Maude-2.6/0000777000147300135640000000000011500304123007416 500000000000000Maude-2.6/aclocal.m40000644000147300135640000007462011500303152011204 00000000000000# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR Maude-2.6/src/0000777000147300135640000000000011500304123010205 500000000000000Maude-2.6/src/Interface/0000777000147300135640000000000011500304117012110 500000000000000Maude-2.6/src/Interface/associativeSymbol.hh0000644000147300135640000000513511350766573016076 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols from permutative theories. // #ifndef _associativeSymbol_hh_ #define _associativeSymbol_hh_ #include "binarySymbol.hh" class AssociativeSymbol : public BinarySymbol { public: enum Structure { UNSTRUCTURED, // no guarantees LIMIT_SORT, // s_1 <= s & s_2 <= s ===> s_f(s_1, s_2) <= s PURE_SORT // replaces ===> with <===>, // taking sort constraints in to account }; AssociativeSymbol(int id, const Vector& strategy, bool memoFlag, Term* identity = 0); const Sort* uniformSort() const; int sortBound(const Sort* sort) const; Structure sortStructure(const Sort* sort) const; bool mightCollapseToOurSymbol(const Term* subterm) const; void finalizeSortInfo(); // virtual in base class SortTable void fillInSortInfo(Term* subject); // virtual in base class SortTable bool isConstructor(DagNode* subject); // virtual in base class Symbol void setFrozen(const NatSet& frozen); // virtual in base class Strategy protected: void processIdentity(); private: struct Inv; void associativeSortCheck(); void associativeSortBoundsAnalysis(); void associativeSortStructureAnalysis(); bool checkUniformity(const Sort* uniformSort, int nrSorts); void insertGreaterOrEqualSorts(const Sort* sort, NatSet& set); const Sort* uniSort; Vector sortBounds; Vector sortStructures; }; inline const Sort* AssociativeSymbol::uniformSort() const { return uniSort; } inline int AssociativeSymbol::sortBound(const Sort* sort) const { return sortBounds[sort->index()]; } inline AssociativeSymbol::Structure AssociativeSymbol::sortStructure(const Sort* sort) const { return sortStructures[sort->index()]; } ostream& operator<<(ostream& s, AssociativeSymbol::Structure structure); #endif Maude-2.6/src/Interface/delayedSubproblem.hh0000644000147300135640000000305311350774215016025 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2008 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Base class for delayed matching subproblems. // The idea is that delayed problems can be batched up. They therefore // need a flag to record if they have aleady been solved as part of // a previous batch. // #ifndef _delayedSubproblem_hh_ #define _delayedSubproblem_hh_ class DelayedSubproblem { public: virtual ~DelayedSubproblem() {} // deep virtual bool delayedSolve(bool findFirst, RewritingContext& solution) { CantHappen("Not implemented"); return false; } bool solved() const; void setSolvedSatus(bool flag); private: bool solvedFlag; }; inline bool DelayedSubproblem::solved() const { return solvedFlag; } inline void DelayedSubproblem::setSolvedSatus(bool flag) { solvedFlag = flag; } #endif Maude-2.6/src/Interface/extensionInfo.hh0000644000147300135640000000403411350774461015216 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2010 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for extension information. // #ifndef _extensionInfo_hh_ #define _extensionInfo_hh_ class ExtensionInfo { public: virtual ~ExtensionInfo() {} bool validAfterMatch() const; void setValidAfterMatch(bool status); bool matchedWhole() const; void setMatchedWhole(bool status); virtual DagNode* buildMatchedPortion() const = 0; virtual ExtensionInfo* makeClone() const = 0; // for saving extension info virtual void copy(ExtensionInfo* extensionInfo) = 0; // for restoring extension info private: // // The match phase records if extension info is valid after // the match phase or do we need to wait until after // the solve phase is successful. // bool validAfterMatchFlag; // // Did we match the whole of the subject theory layer // (extension is empty) or just part. // bool matchedWholeFlag; }; inline bool ExtensionInfo::validAfterMatch() const { return validAfterMatchFlag; } inline void ExtensionInfo::setValidAfterMatch(bool status) { validAfterMatchFlag = status; } inline bool ExtensionInfo::matchedWhole() const { return matchedWholeFlag; } inline void ExtensionInfo::setMatchedWhole(bool status) { matchedWholeFlag = status; } #endif Maude-2.6/src/Interface/lhsAutomaton.hh0000644000147300135640000000242507666302431015045 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for left hand side automata. // #ifndef _lhsAutomaton_hh_ #define _lhsAutomaton_hh_ class LhsAutomaton { public: virtual ~LhsAutomaton() {} virtual bool match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo = 0) = 0; #ifdef DUMP virtual void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel = 0) = 0; #endif }; #endif Maude-2.6/src/Interface/symbol.hh0000644000147300135640000001401611457436202013670 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for function/variable symbol definitions. // #ifndef _symbol_hh_ #define _symbol_hh_ #include "fullCompiler.hh" #include "namedEntity.hh" #include "lineNumber.hh" #include "moduleItem.hh" #include "sort.hh" #include "connectedComponent.hh" #include "sortTable.hh" #include "sortConstraintTable.hh" #include "equationTable.hh" #include "ruleTable.hh" #include "strategy.hh" #include "memoTable.hh" class Symbol : public RuleTable, public NamedEntity, public LineNumber, public SortTable, public SortConstraintTable, public EquationTable, public Strategy, public MemoTable { NO_COPYING(Symbol); static const Vector noArgs; public: Symbol(int id, int arity, bool memoFlag = false); virtual ~Symbol(); unsigned int getHashValue(); int compare(const Symbol* other) const; bool mightMatchPattern(Term* pattern); void fastComputeTrueSort(DagNode* subject, RewritingContext& context); // maybe should be const? int getUniqueSortIndex(); // // Functions needed for sophisticated sort analysis. // virtual bool rangeSortNeverLeqThan(Sort* sort); virtual bool rangeSortAlwaysLeqThan(Sort* sort); virtual bool domainSortAlwaysLeqThan(Sort* sort, int argNr); void computePossibleDomainSorts(const NatSet& rangeSorts, Vector& domainSorts); // // These functions must be defined for each derived class. // virtual bool eqRewrite(DagNode* subject, RewritingContext& context) = 0; virtual void computeBaseSort(DagNode* subject) = 0; virtual void normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context) = 0; virtual Term* makeTerm(const Vector& args) = 0; virtual DagNode* makeDagNode(const Vector& args = noArgs) = 0; virtual void stackArguments(DagNode* subject, Vector& stack, int parentIndex) = 0; // // These functions may be redefined for each derived class. // // interSymbolPass() is called on each symbol in turn until all // return false. It is use for resolving interdependencies. // // postInterSymbolPass() is called on each symbol after the above // completes. // // postOpDeclarationPass() is called on each symbol after its sort // table has been calculated. // virtual bool interSymbolPass(); virtual void postInterSymbolPass(); virtual void postOpDeclarationPass(); // // Clear state information such as caches that affects performance but not result. // virtual void reset(); void finalizeSortInfo(); // virtual in base class SortTable void fillInSortInfo(Term* subject); // virtual in base class SortTable // // These functions may be redefined to attach data/symbols/terms to // support "special" operators. // virtual bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); virtual bool attachSymbol(const char* purpose, Symbol* symbol); virtual bool attachTerm(const char* purpose, Term* term); virtual void copyAttachments(Symbol* original, SymbolMap* map); virtual void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); virtual void getSymbolAttachments(Vector& purposes, Vector& symbols); virtual void getTermAttachments(Vector& purposes, Vector& terms); // // This function might be redefined to provide better performance // or special constructor semantics. // virtual bool isConstructor(DagNode* subject); // // Interface for unification. // virtual UnificationSubproblem* makeUnificationSubproblem(); virtual int unificationPriority() const; // // Symbols that can disappear under substitution must rdefine this to return false. // virtual bool isStable() const = 0; // // Symbols that can resolved theory clashes (typically by collapsing) should // redefined this to return true and be ready to handle alien right hand sides // by restricted unification in unification problem passed to their unification // subproblems. // virtual bool canResolveTheoryClash(); // // Interface for hash consing. // virtual DagNode* makeCanonical(DagNode* original, HashConsSet* hcs) = 0; // // Same as above but copying is forced - original can never be the canonical dagnode. // virtual DagNode* makeCanonicalCopy(DagNode* original, HashConsSet* hcs) = 0; #ifdef COMPILER void fullCompile(CompilationContext& context, bool inLine) const; virtual void generateCode(CompilationContext& context) const; #endif #ifdef DUMP virtual void dump(ostream& s, int indentLevel = 0); #endif protected: bool acceptSortConstraint(SortConstraint* sortConstraint); bool acceptEquation(Equation* equation); bool acceptRule(Rule* rule); private: bool mightMatchSymbol(Symbol* symbol); void slowComputeTrueSort(DagNode* subject, RewritingContext& context); static int symbolCount; const int orderInt; int uniqueSortIndex; }; inline unsigned int Symbol::getHashValue() { return orderInt; } inline int Symbol::compare(const Symbol* other) const { return orderInt - other->orderInt; } inline int Symbol::getUniqueSortIndex() { return uniqueSortIndex; } #endif Maude-2.6/src/Interface/Makefile.in0000644000147300135640000005650111500303155014101 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/Interface DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libinterface_a_AR = $(AR) $(ARFLAGS) libinterface_a_LIBADD = am_libinterface_a_OBJECTS = libinterface_a-symbol.$(OBJEXT) \ libinterface_a-binarySymbol.$(OBJEXT) \ libinterface_a-associativeSymbol.$(OBJEXT) \ libinterface_a-term.$(OBJEXT) libinterface_a-dagNode.$(OBJEXT) libinterface_a_OBJECTS = $(am_libinterface_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libinterface_a_SOURCES) DIST_SOURCES = $(libinterface_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libinterface.a libinterface_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libinterface_a_SOURCES = \ symbol.cc \ binarySymbol.cc \ associativeSymbol.cc \ term.cc \ dagNode.cc noinst_HEADERS = \ associativeSymbol.hh \ binarySymbol.hh \ dagNode.hh \ extensionInfo.hh \ interface.hh \ lhsAutomaton.hh \ rawArgumentIterator.hh \ rawDagArgumentIterator.hh \ rhsAutomaton.hh \ subproblem.hh \ unificationSubproblem.hh \ subproblem.hh \ symbol.hh \ symbol2.hh \ term.hh \ delayedSubproblem.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Interface/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Interface/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libinterface.a: $(libinterface_a_OBJECTS) $(libinterface_a_DEPENDENCIES) -rm -f libinterface.a $(libinterface_a_AR) libinterface.a $(libinterface_a_OBJECTS) $(libinterface_a_LIBADD) $(RANLIB) libinterface.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinterface_a-associativeSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinterface_a-binarySymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinterface_a-dagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinterface_a-symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinterface_a-term.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libinterface_a-symbol.o: symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-symbol.o -MD -MP -MF "$(DEPDIR)/libinterface_a-symbol.Tpo" -c -o libinterface_a-symbol.o `test -f 'symbol.cc' || echo '$(srcdir)/'`symbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-symbol.Tpo" "$(DEPDIR)/libinterface_a-symbol.Po"; else rm -f "$(DEPDIR)/libinterface_a-symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='symbol.cc' object='libinterface_a-symbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-symbol.o `test -f 'symbol.cc' || echo '$(srcdir)/'`symbol.cc libinterface_a-symbol.obj: symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-symbol.obj -MD -MP -MF "$(DEPDIR)/libinterface_a-symbol.Tpo" -c -o libinterface_a-symbol.obj `if test -f 'symbol.cc'; then $(CYGPATH_W) 'symbol.cc'; else $(CYGPATH_W) '$(srcdir)/symbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-symbol.Tpo" "$(DEPDIR)/libinterface_a-symbol.Po"; else rm -f "$(DEPDIR)/libinterface_a-symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='symbol.cc' object='libinterface_a-symbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-symbol.obj `if test -f 'symbol.cc'; then $(CYGPATH_W) 'symbol.cc'; else $(CYGPATH_W) '$(srcdir)/symbol.cc'; fi` libinterface_a-binarySymbol.o: binarySymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-binarySymbol.o -MD -MP -MF "$(DEPDIR)/libinterface_a-binarySymbol.Tpo" -c -o libinterface_a-binarySymbol.o `test -f 'binarySymbol.cc' || echo '$(srcdir)/'`binarySymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-binarySymbol.Tpo" "$(DEPDIR)/libinterface_a-binarySymbol.Po"; else rm -f "$(DEPDIR)/libinterface_a-binarySymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='binarySymbol.cc' object='libinterface_a-binarySymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-binarySymbol.o `test -f 'binarySymbol.cc' || echo '$(srcdir)/'`binarySymbol.cc libinterface_a-binarySymbol.obj: binarySymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-binarySymbol.obj -MD -MP -MF "$(DEPDIR)/libinterface_a-binarySymbol.Tpo" -c -o libinterface_a-binarySymbol.obj `if test -f 'binarySymbol.cc'; then $(CYGPATH_W) 'binarySymbol.cc'; else $(CYGPATH_W) '$(srcdir)/binarySymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-binarySymbol.Tpo" "$(DEPDIR)/libinterface_a-binarySymbol.Po"; else rm -f "$(DEPDIR)/libinterface_a-binarySymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='binarySymbol.cc' object='libinterface_a-binarySymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-binarySymbol.obj `if test -f 'binarySymbol.cc'; then $(CYGPATH_W) 'binarySymbol.cc'; else $(CYGPATH_W) '$(srcdir)/binarySymbol.cc'; fi` libinterface_a-associativeSymbol.o: associativeSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-associativeSymbol.o -MD -MP -MF "$(DEPDIR)/libinterface_a-associativeSymbol.Tpo" -c -o libinterface_a-associativeSymbol.o `test -f 'associativeSymbol.cc' || echo '$(srcdir)/'`associativeSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-associativeSymbol.Tpo" "$(DEPDIR)/libinterface_a-associativeSymbol.Po"; else rm -f "$(DEPDIR)/libinterface_a-associativeSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='associativeSymbol.cc' object='libinterface_a-associativeSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-associativeSymbol.o `test -f 'associativeSymbol.cc' || echo '$(srcdir)/'`associativeSymbol.cc libinterface_a-associativeSymbol.obj: associativeSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-associativeSymbol.obj -MD -MP -MF "$(DEPDIR)/libinterface_a-associativeSymbol.Tpo" -c -o libinterface_a-associativeSymbol.obj `if test -f 'associativeSymbol.cc'; then $(CYGPATH_W) 'associativeSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/associativeSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-associativeSymbol.Tpo" "$(DEPDIR)/libinterface_a-associativeSymbol.Po"; else rm -f "$(DEPDIR)/libinterface_a-associativeSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='associativeSymbol.cc' object='libinterface_a-associativeSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-associativeSymbol.obj `if test -f 'associativeSymbol.cc'; then $(CYGPATH_W) 'associativeSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/associativeSymbol.cc'; fi` libinterface_a-term.o: term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-term.o -MD -MP -MF "$(DEPDIR)/libinterface_a-term.Tpo" -c -o libinterface_a-term.o `test -f 'term.cc' || echo '$(srcdir)/'`term.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-term.Tpo" "$(DEPDIR)/libinterface_a-term.Po"; else rm -f "$(DEPDIR)/libinterface_a-term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='term.cc' object='libinterface_a-term.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-term.o `test -f 'term.cc' || echo '$(srcdir)/'`term.cc libinterface_a-term.obj: term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-term.obj -MD -MP -MF "$(DEPDIR)/libinterface_a-term.Tpo" -c -o libinterface_a-term.obj `if test -f 'term.cc'; then $(CYGPATH_W) 'term.cc'; else $(CYGPATH_W) '$(srcdir)/term.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-term.Tpo" "$(DEPDIR)/libinterface_a-term.Po"; else rm -f "$(DEPDIR)/libinterface_a-term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='term.cc' object='libinterface_a-term.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-term.obj `if test -f 'term.cc'; then $(CYGPATH_W) 'term.cc'; else $(CYGPATH_W) '$(srcdir)/term.cc'; fi` libinterface_a-dagNode.o: dagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-dagNode.o -MD -MP -MF "$(DEPDIR)/libinterface_a-dagNode.Tpo" -c -o libinterface_a-dagNode.o `test -f 'dagNode.cc' || echo '$(srcdir)/'`dagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-dagNode.Tpo" "$(DEPDIR)/libinterface_a-dagNode.Po"; else rm -f "$(DEPDIR)/libinterface_a-dagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dagNode.cc' object='libinterface_a-dagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-dagNode.o `test -f 'dagNode.cc' || echo '$(srcdir)/'`dagNode.cc libinterface_a-dagNode.obj: dagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libinterface_a-dagNode.obj -MD -MP -MF "$(DEPDIR)/libinterface_a-dagNode.Tpo" -c -o libinterface_a-dagNode.obj `if test -f 'dagNode.cc'; then $(CYGPATH_W) 'dagNode.cc'; else $(CYGPATH_W) '$(srcdir)/dagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libinterface_a-dagNode.Tpo" "$(DEPDIR)/libinterface_a-dagNode.Po"; else rm -f "$(DEPDIR)/libinterface_a-dagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dagNode.cc' object='libinterface_a-dagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libinterface_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libinterface_a-dagNode.obj `if test -f 'dagNode.cc'; then $(CYGPATH_W) 'dagNode.cc'; else $(CYGPATH_W) '$(srcdir)/dagNode.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/Interface/term.cc0000644000147300135640000004635711346306303013330 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for base class Term. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "fullCompiler.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "bindingLhsAutomaton.hh" #include "termBag.hh" #include "rhsBuilder.hh" #include "trivialRhsAutomaton.hh" #include "copyRhsAutomaton.hh" #include "symbolMap.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" #include "variableInfo.hh" // full compiler class definitions #include "compilationContext.hh" #include "variableName.hh" Vector Term::subDags; TermSet Term::converted; bool Term::setSortInfoFlag; bool Term::discard; DagNode* Term::term2Dag(bool setSortInfo) { setSortInfoFlag = setSortInfo; subDags.clear(); converted.makeEmpty(); return dagify(); } int Term::compileRhs(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext) { if (Term* t = availableTerms.findTerm(this, eagerContext)) { // // We have seen this term before either in a lhs or // in a rhs (perhaps of a condition fragment) and we // can reuse it. // if (t->saveIndex == NONE) // must be lhs term/variable { if (VariableTerm* vt = dynamic_cast(this)) return vt->getIndex(); // lhs varible t->saveIndex = variableInfo.makeProtectedVariable(); // left->right sharing } return t->saveIndex; } if (VariableTerm* vt = dynamic_cast(this)) { // // Variable must be either unbound (because we didn't see it during matching) OR // we're in eager context and variable was only matched in a lazy context. // int varIndex = vt->getIndex(); if (eagerContext) { // // Since we're using an unbound or lazy variable in // an eager context we must arrange to copy its binding. // DebugAdvisory("made CopyRhsAutomaton for " << this); int index = variableInfo.makeConstructionIndex(); rhsBuilder.addRhsAutomaton(new CopyRhsAutomaton(varIndex, index)); saveIndex = index; availableTerms.insertBuiltTerm(this, true); return index; } return varIndex; // unbound variable in lazy context } // // Previously unseen non-variable term - let its theory compile it. // int index = compileRhs2(rhsBuilder, variableInfo, availableTerms, eagerContext); // // Save the term and the index it was placed at so we can share its // instantiation if we encounter an equal term later on. // saveIndex = index; availableTerms.insertBuiltTerm(this, eagerContext); return index; } void Term::compileTopRhs(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms) { int index = compileRhs(rhsBuilder, variableInfo, availableTerms, true); variableInfo.useIndex(index); // // If we don't have any automata we must create one, if only to do the // replacement. // if (rhsBuilder.empty()) rhsBuilder.addRhsAutomaton(new TrivialRhsAutomaton(index)); } void Term::indexVariables(VariableInfo& indicies) { if (VariableTerm* vt = dynamic_cast(this)) { int index = indicies.variable2Index(vt); vt->setIndex(index); occursSet.insert(index); } else { for (ArgumentIterator a(*this); a.valid(); a.next()) { Term* t = a.argument(); t->indexVariables(indicies); occursSet.insert(t->occursSet); } } } int Term::computeSize() { if (cachedSize == UNDEFINED) { int size = 1; for (ArgumentIterator a(*this); a.valid(); a.next()) size += a.argument()->computeSize(); cachedSize = size; } return cachedSize; } void Term::determineContextVariables() { for (ArgumentIterator a(*this); a.valid(); a.next()) { Term* t = a.argument(); t->contextSet.insert(contextSet); // insert parents context set for (ArgumentIterator b(*this); b.valid(); b.next()) { Term* u = b.argument(); if (u != t) t->contextSet.insert(u->occursSet); // insert siblings occurs set } t->determineContextVariables(); } } void Term::analyseCollapses() { analyseCollapses2(); if (dynamic_cast(topSymbol) == 0 && collapseSet.empty()) flags |= STABLE; } void Term::analyseCollapses2() { for (ArgumentIterator a(*this); a.valid(); a.next()) a.argument()->analyseCollapses(); } void Term::insertAbstractionVariables(VariableInfo& variableInfo) { setHonorsGroundOutMatch(true); for (ArgumentIterator a(*this); a.valid(); a.next()) { Term* t = a.argument(); t->insertAbstractionVariables(variableInfo); if (!(t->honorsGroundOutMatch())) setHonorsGroundOutMatch(false); } } LhsAutomaton* Term::compileLhs(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely) { LhsAutomaton* a = compileLhs2(matchAtTop, variableInfo, boundUniquely, subproblemLikely); if (saveIndex != NONE) a = new BindingLhsAutomaton(saveIndex, a); return a; } bool Term::earlyMatchFailOnInstanceOf(const Term* other) const { if (stable() && other->stable() && topSymbol != other->topSymbol) return true; return false; } bool Term::subsumes(const Term* other, bool sameVariableSet) const { return false; } int Term::partialCompareUnstable(const Substitution& /* partialSubstitution */, DagNode* /* other */) const { return UNDECIDED; } int Term::partialCompareArguments(const Substitution& /* partialSubstitution */, DagNode* /* other */) const { return UNDECIDED; } void Term::commonSymbols(Vector& patterns, PointerSet& common) { // // Generate set of symbols that could be at the top of subject which matches // all patterns. Patterns are assumed to have had their collapse analysis done // and we assume they are in the same connected component. // We make no assumption about where sort constraints have been indexed. // If there in any doubt about some symbol we add it anyway. // Variables are handled in a special way: a variable v which is in one patterns // collapse set (or which is that pattern) is added if for each other pattern // p_i there is some variable v_i which is p_i of is in p_i's collapse set // with sort greater, equal or incomparable to v's sort. // Assert(common.empty(), "common not empty to start with"); int nrPatterns = patterns.length(); for (int i = 0; i < nrPatterns; i++) { Term* p = patterns[i]; PointerSet cs(p->collapseSet); (void) cs.insert(p->topSymbol); int nrSymbols = cs.cardinality(); for (int j = 0; j < nrSymbols; j++) { Symbol* s = static_cast(cs.index2Pointer(j)); if (commonWithOtherPatterns(patterns, i, s)) (void) common.insert(s); } } } bool Term::commonWithOtherPatterns(Vector& patterns, int excluded, Symbol* symbol) { int nrPatterns = patterns.length(); VariableSymbol* v = dynamic_cast(symbol); if (v == 0) { for (int i = 0; i < nrPatterns; i++) { if (i != excluded && !(symbol->mightMatchPattern(patterns[i]))) return false; } } else { for (int i = 0; i < nrPatterns; i++) { if (i != excluded && !hasGeqOrIncomparableVariable(patterns[i], v)) return false; } } return true; } bool Term::hasGeqOrIncomparableVariable(Term* pattern, VariableSymbol* v) { const Sort*s = v->getSort(); VariableSymbol* v2 = dynamic_cast(pattern->topSymbol); if (v2 != 0) { const Sort* s2 = v2->getSort(); return s2 == s || !::leq(s2, s); } const PointerSet& cs = pattern->collapseSet; int cardinality = cs.cardinality(); for (int i = 0; i < cardinality; i++) { Symbol* s2 = static_cast(cs.index2Pointer(i)); v2 = dynamic_cast(s2); if (v2 != 0) { const Sort* s2 = v2->getSort(); if (s2 == s || !::leq(s2, s)) return true; } } return false; } bool Term::greedySafe(const VariableInfo& variableInfo, const NatSet& boundUniquely) const { NatSet badVariables(variableInfo.getConditionVariables()); badVariables.insert(contextSet); badVariables.intersect(occursSet); return boundUniquely.contains(badVariables); } Term* Term::instantiate2(const Vector& varBindings, SymbolMap* translator) { // // Naive implementation. Doesn't work for variables or any subclass // with hidden data. Possibly inefficient in other cases. // Vector args; for (ArgumentIterator a(*this); a.valid(); a.next()) args.append(a.argument()->instantiate2(varBindings, translator)); return translator->findTargetVersionOfSymbol(topSymbol)->makeTerm(args); } #ifdef COMPILER int Term::gatherPartialResults(int nrVariables, TermSet& compiled, Vector& symbols, Vector >& argLists) { VariableTerm* v = dynamic_cast(this); if (v != 0) return v->getIndex(); int source = compiled.term2Index(this); if (source >= 0) return source + nrVariables; // // Need to generate new partial result // Symbol* s = symbol(); Vector args; for (ArgumentIterator a(*this); a.valid(); a.next()) { int source = a.argument()-> gatherPartialResults(nrVariables, compiled, symbols, argLists); args.append(source); } int index = symbols.length(); compiled.insert(this); symbols.append(s); argLists.append(args); return index + nrVariables; } void Term::generateRhs(CompilationContext& context, int indentLevel, const Vector& varNames, Symbol* lhsSymbol) { // // First we generate the a convenient DAG representation of the term. // TermSet compiled; Vector symbols; Vector > argLists; int nrVariables = varNames.length(); int index = gatherPartialResults(nrVariables, compiled, symbols, argLists); int nrPartialResults = symbols.length(); if (nrPartialResults == 0) { // // Handle bare variable case. // context.generateIncrement(indentLevel); context.body() << Indent(indentLevel) << "return " << varNames[index] << ";\n"; return; } // // Now find out which partial result is the last user of each // variable and partial result. // int nrItems = nrVariables + nrPartialResults - 1; // final partial result not used Vector lastUse(nrItems); for (int i = 0; i < nrItems; i++) lastUse[i] = UNUSED; for (int i = 0; i < nrPartialResults; i++) { Vector args = argLists[i]; int nrArgs = args.length(); for (int j = 0; j < nrArgs; j++) lastUse[args[j]] = i; } // // Then we decide what pointers will need to be placed in safe slots // across each function call. // Vector > safeSlots(nrPartialResults - 1); if (nrPartialResults > 1) { Vector& safe = safeSlots[0]; for (int i = 0; i < nrVariables; i++) { if (lastUse[i] > 0) safe.append(i); } } for (int i = 1; i < nrPartialResults - 1; i++) { int prevResult = i - 1 + nrVariables; bool needToSavePrevResult = lastUse[prevResult] > i; Vector& prevSaved = safeSlots[i - 1]; Vector& save = safeSlots[i]; int nrPrevSaved = prevSaved.length(); for (int j = 0; j < nrPrevSaved; j++) { int ps = prevSaved[j]; if (ps == UNUSED) save.append(UNUSED); else { if (lastUse[ps] > i) save.append(ps); else { if (needToSavePrevResult) { save.append(prevResult); needToSavePrevResult = false; } else save.append(UNUSED); } } } if (needToSavePrevResult) { for (int j = 0; j < nrPrevSaved; j++) { if (save[j] == UNUSED) { save[j] = prevResult; needToSavePrevResult = false; break; } } } if (needToSavePrevResult) save.append(prevResult); // need extra slot } // // Now we can generate code. // //context.body() << Indent(indentLevel) << "{\n"; // // Declare partial result variables. // for (int i = 0; i < nrPartialResults - 1; i++) context.body() << Indent(indentLevel + 1) << "Node* p" << i << ";\n"; // // Set up safe slots. // context.generateIncrement(indentLevel + 1); int nrSafeSlots = nrPartialResults >= 2 ? safeSlots[nrPartialResults - 2].length() : 0; context.setNrSafeSlots(nrSafeSlots); if (nrSafeSlots > 0) { context.body() << Indent(indentLevel + 1) << "safe[0].l = g.safePtr;\n"; context.body() << Indent(indentLevel + 1) << "g.safePtr = safe;\n"; context.body() << Indent(indentLevel + 1) << "safe[1].i = " << nrSafeSlots << ";\n"; Vector& firstSlots = safeSlots[0]; int nrFirstSlots = firstSlots.length(); for (int i = 0; i < nrSafeSlots; i++) { context.body() << Indent(indentLevel + 1) << "safe[" << i + 2 << "].n = "; if (i < nrFirstSlots) context.body() << varNames[firstSlots[i]]; else context.body() << '0'; context.body() << ";\n"; } } // // Generate first partial result. // { Symbol* symbol = symbols[0]; int nrArgs = symbol->arity(); Vector& argList = argLists[0]; context.body() << Indent(indentLevel + 1) << "{\n"; if (nrPartialResults == 1 && symbol == lhsSymbol) { // // Tail recursion case. // for (int i = 0; i < nrArgs; i++) { context.body() << Indent(indentLevel + 2) << 'a' << i << " = " << varNames[argList[i]] << ";\n"; } context.body() << Indent(indentLevel + 2) << "goto start;\n"; context.setTailRecursive(); } else { if (nrPartialResults > 1) context.body() << Indent(indentLevel + 2) << "p0 ="; else context.body() << Indent(indentLevel + 2) << "return"; context.body() << " f" << symbol->getIndexWithinModule() << '('; for (int i = 0; i < nrArgs; i++) { context.body() << varNames[argList[i]]; if (i + 1 < nrArgs) context.body() << ", "; } context.body() << ");\n"; } context.body() << Indent(indentLevel + 1) << "}\n"; } // // Generate remaining partial results. // for (int i = 1; i < nrPartialResults; i++) { Symbol* symbol = symbols[i]; int nrArgs = symbol->arity(); Vector& argList = argLists[i]; Vector& prevSaved = safeSlots[i - 1]; int nrSlots = prevSaved.length(); context.body() << Indent(indentLevel + 1) << "{\n"; // // Copy saved values needed for args into local 'b' variables. // int bCount = 1; for (int j = 0; j < nrSlots; j++) { int contents = prevSaved[j]; if (contents != UNUSED) { int localCopy = NONE; for (int k = 0; k < nrArgs; k++) { if (argList[k] == contents) { if (localCopy == NONE) { localCopy = bCount++; context.body() << Indent(indentLevel + 2) << "Node* b" << localCopy << " = safe[" << j + 2 << "].n;\n"; } argList[k] = -localCopy; } } } } if (i < nrPartialResults - 1) { // // Clear saves values no longer needed, and save previous // partial result if need after our function call. // Vector& toSave = safeSlots[i]; for (int j = 0; j < nrSlots; j++) { int ps = prevSaved[j]; int ts = toSave[j]; if (ps != ts) { if (ts == UNUSED) context.body() << Indent(indentLevel + 2) << "safe[" << j + 2 << "].n = 0;\n"; else { context.body() << Indent(indentLevel + 2) << "safe[" << j + 2 << "].n = p" << i - 1 << ";\n"; } } } if (toSave.length() > nrSlots) { context.body() << Indent(indentLevel + 2) << "safe[" << nrSlots + 2 << "].n = p" << i - 1 << ";\n"; } context.body() << Indent(indentLevel + 2) << 'p' << i << " ="; } else { if (nrSafeSlots > 0) context.body() << Indent(indentLevel + 2) << "g.safePtr = safe[0].l;\n"; if (symbol == lhsSymbol) { // // Tail recursion case. // for (int j = 0; j < nrArgs; j++) { context.body() << Indent(indentLevel + 2) << 'a' << j << " = "; int a = argList[j]; if (a < 0) context.body() << 'b' << -a; else context.body() << 'p' << i - 1; context.body() << ";\n"; } context.body() << Indent(indentLevel + 2) << "goto start;\n"; context.body() << Indent(indentLevel + 1) << "}\n"; context.setTailRecursive(); break; } context.body() << Indent(indentLevel + 2) << "return"; } context.body() << " f" << symbol->getIndexWithinModule() << '('; for (int j = 0; j < nrArgs; j++) { int a = argList[j]; if (a < 0) context.body() << 'b' << -a; else context.body() << 'p' << i - 1; if (j + 1 < nrArgs) context.body() << ", "; } context.body() << ");\n"; context.body() << Indent(indentLevel + 1) << "}\n"; } // context.body() << Indent(indentLevel) << "}\n"; return; } #endif #ifdef DUMP void Term::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{Term}\n"; ++indentLevel; dumpCommon(s, variableInfo, indentLevel); s << Indent(indentLevel) << "arguments:\n"; ++indentLevel; for (ArgumentIterator a(*this); a.valid(); a.next()) a.argument()->dump(s, variableInfo, indentLevel); s << Indent(indentLevel - 2) << "End{Term}\n"; } void Term::dumpCommon(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "topSymbol = " << topSymbol << "\thonorsGroundOutMatch = " << honorsGroundOutMatch() << "\teagerContext = " << hasEagerContext() << '\n'; if (sortIndex == Sort::SORT_UNKNOWN) s << Indent(indentLevel) << "sort information not valid\n"; else s << Indent(indentLevel) << "sortIndex = " << sortIndex << '\n'; s << Indent(indentLevel) << "occursSet = "; dumpVariableSet(s, occursSet, variableInfo); s << Indent(indentLevel) << "contextSet = "; dumpVariableSet(s, contextSet, variableInfo); s << Indent(indentLevel) << "collapseSet = "; dumpSymbolSet(s, collapseSet); } void Term::dumpVariableSet(ostream& s, const NatSet& variableSet, const VariableInfo& variableInfo) { int m = variableSet.max(); for (int i = 0; i <= m; i++) { if (variableSet.contains(i)) s << ' ' << variableInfo.index2Variable(i); } s << '\n'; } void Term::dumpSymbolSet(ostream& s, const PointerSet& symbolSet) { int c = symbolSet.cardinality(); for (int i = 0; i < c; i++) s << ' ' << static_cast(symbolSet.index2Pointer(i)); s << '\n'; } #endif Maude-2.6/src/Interface/rhsAutomaton.hh0000644000147300135640000000246607666302431015060 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for right hand side automata. // #ifndef _rhsAutomaton_hh_ #define _rhsAutomaton_hh_ class RhsAutomaton { public: virtual ~RhsAutomaton() {} virtual void remapIndices(VariableInfo& variableInfo) = 0; virtual DagNode* construct(Substitution& matcher) = 0; virtual void replace(DagNode* old, Substitution& matcher) = 0; #ifdef DUMP virtual void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel = 0) = 0; #endif }; #endif Maude-2.6/src/Interface/dagNode.cc0000644000147300135640000002130411433103621013676 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for base class DagNode // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" // interface class definitions #include "symbol.hh" #include "binarySymbol.hh" #include "dagNode.hh" #include "subproblem.hh" // core class definitions #include "substitution.hh" #include "rewritingContext.hh" #include "sortCheckSubproblem.hh" #include "dagArgumentIterator.hh" #include "module.hh" #include "rootContainer.hh" #include "sortBdds.hh" #include "unificationContext.hh" // variable class definitions #include "variableDagNode.hh" #if 0 // // Outlined hash code for easy experimentation without changing header. // #include size_t DagNode::hash(size_t v1, size_t v2) { size_t sq = v1 * v1; // size_t result = 3 * v1 + v2; //size_t result = v1 ^ (v1 >> 16) ^ v2; //size_t result = sq ^ (v1 >> 16) ^ v2; size_t result = sq ^ (sq >> 16) ^ (v1 >> 16) ^ v2; /* DebugAdvisory("hash v1 = " << mpz_get_str(0, 2, mpz_class(v1).get_mpz_t()) << " : v2 " << mpz_get_str(0, 2, mpz_class(v2).get_mpz_t()) << " : sq " << mpz_get_str(0, 2, mpz_class(sq).get_mpz_t()) << " : result " << mpz_get_str(0, 2, mpz_class(result).get_mpz_t())); */ return result; //return (v1 * v2 + ((v1 >> 16))) ^ (v2 >> 16); //return (v1 >> 3) ^ (v1 << 29) ^ v2; //return 3 * v1 + v2; // bad hash function! //return (v1 >> 1) + (v2 << 1); } #endif bool DagNode::checkSort(const Sort* boundSort, Subproblem*& returnedSubproblem) { returnedSubproblem = 0; if (getSortIndex() != Sort::SORT_UNKNOWN) return leq(boundSort); topSymbol->computeBaseSort(this); if (leq(boundSort)) { if (!(topSymbol->sortConstraintFree())) setSortIndex(Sort::SORT_UNKNOWN); } else { if (topSymbol->sortConstraintFree()) return false; setSortIndex(Sort::SORT_UNKNOWN); returnedSubproblem = new SortCheckSubproblem(this, boundSort); } return true; } bool DagNode::checkSort(const Sort* boundSort, RewritingContext& context) { if (getSortIndex() == Sort::SORT_UNKNOWN) { topSymbol->computeBaseSort(this); if (leq(boundSort)) { if (!(topSymbol->sortConstraintFree())) setSortIndex(Sort::SORT_UNKNOWN); return true; } else { if (topSymbol->sortConstraintFree()) return false; RewritingContext* local = context.makeSubcontext(this, RewritingContext::SORT_EVAL); topSymbol->constrainToSmallerSort(this, *local); context.addInCount(*local); delete local; } } return leq(boundSort); } bool DagNode::matchVariable(int index, const Sort* sort, bool copyToAvoidOverwriting, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { if (extensionInfo != 0) return matchVariableWithExtension(index, sort, solution, returnedSubproblem, extensionInfo); DagNode* d = solution.value(index); if (d == 0) { if (checkSort(sort, returnedSubproblem)) { solution.bind(index, copyToAvoidOverwriting ? makeClone() : this); return true; } } else { if (compare(d) == 0) { returnedSubproblem = 0; return true; } } return false; } ExtensionInfo* DagNode::makeExtensionInfo() { return 0; } // // Dummy functions to allow linking of theories which don't use extension. // bool DagNode::matchVariableWithExtension(int /* index */, const Sort* /* sort */, Substitution& /* solution */, Subproblem*& /* returnedSubproblem */, ExtensionInfo* /* extensionInfo */) { CantHappen("Called on subject " << this); return false; } void DagNode::partialReplace(DagNode* /* replacement */, ExtensionInfo* /* extensionInfo */) { CantHappen("Called on subject " << this); } DagNode* DagNode::partialConstruct(DagNode* /* replacement */, ExtensionInfo* /* extensionInfo */) { CantHappen("Called on subject " << this); return 0; } // // Unification code. // DagNode::ReturnResult DagNode::computeBaseSortForGroundSubterms() { // // This is the backstop version for an unimplemented theory. If // all our subterms are ground we compute our sort and return GROUND // other we return UNIMPLEMENTED. // for (DagArgumentIterator a(*this); a.valid(); a.next()) { switch (a.argument()->computeBaseSortForGroundSubterms()) { case NONGROUND: IssueWarning("Term " << QUOTE(this) << " is non-ground and unification for its top symbol is not currently supported."); // fall thru case UNIMPLEMENTED: return UNIMPLEMENTED; default: ; // to avoid compiler warning } } topSymbol->computeBaseSort(this); setGround(); return GROUND; } bool DagNode::computeSolvedForm(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending) { DebugAdvisory("computeSolvedForm() lhs = " << this << " rhs = " << rhs); // // If we are nonground we dispatch the theory specific algorithm. // if (!isGround()) return computeSolvedForm2(rhs, solution, pending); // // Ground. If the other unificand is nonground, call its algorithm. // if (!(rhs->isGround())) return rhs->computeSolvedForm2(this, solution, pending); // // // We have two ground terms so we can just compare them without the // need for an unification algorithm. // return equal(rhs); } bool DagNode::computeSolvedForm2(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending) { DebugAdvisory("DagNode::computeSolvedForm2() " << this << " vs " << rhs); if (isGround()) { // // We handle the case // =? X // for unimplmented theories now that variable code no longer binds variables to nonvariables. // if (VariableDagNode* v = dynamic_cast(rhs)) { VariableDagNode* repVar = v->lastVariableInChain(solution); if (DagNode* value = solution.value(repVar->getIndex())) return computeSolvedForm(value, solution, pending); else { solution.unificationBind(repVar, this); // bind variable to unpurified ground term return true; } } } IssueWarning("Unification modulo the theory of operator " << QUOTE(this->topSymbol) << " is not currently supported."); return false; } void DagNode::computeGeneralizedSort(const SortBdds& sortBdds, const Vector& realToBdd, Vector& generalizedSort) { if (isGround()) { // // We assume that any code setting the ground flag will also ensure a sort index is set. // FIXME: this may not be true if the node is unreduced. // Assert(getSortIndex() != Sort::SORT_UNKNOWN, "unknown sort in node flagged as ground"); int nrBdds = sortBdds.getNrVariables(symbol()->rangeComponent()->getIndexWithinModule()); sortBdds.makeIndexVector(nrBdds, getSortIndex(), generalizedSort); } else symbol()->computeGeneralizedSort(sortBdds, realToBdd, this, generalizedSort); } // // Narrowing code. // bool DagNode::indexVariables2(NarrowingVariableInfo& indices, int baseIndex) { // // This is the backstop version for an unimplemented theory. It does the right // thing but is rather inefficient for runtime code. // bool ground = true; for (DagArgumentIterator a(*this); a.valid(); a.next()) { if (!(a.argument()->indexVariables(indices, baseIndex))) ground = false; } return ground; } #ifdef DUMP void DagNode::dump(ostream& s, int indentLevel) { s << Indent(indentLevel) << "Begin{DagNode}\n"; ++indentLevel; dumpCommon(s, indentLevel); s << Indent(indentLevel) << "arguments:\n"; ++indentLevel; for (DagArgumentIterator a(*this); a.valid(); a.next()) a.argument()->dump(s, indentLevel); s << Indent(indentLevel - 2) << "End{DagNode}\n"; } void DagNode::dumpCommon(ostream& s, int indentLevel) { s << Indent(indentLevel) << "topSymbol = " << topSymbol << '\n'; } #endif Maude-2.6/src/Interface/interface.hh0000644000147300135640000000336211123047056014320 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2007 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for equational theory interface classes. // #ifndef _interface_hh_ #define _interface_hh_ // // These classes must be derived from for all equational theories. // class Symbol; // or class BinarySymbol; // or class AssociativeSymbol; class Term; class RawArgumentIterator; class DagNode; class RawDagArgumentIterator; class LhsAutomaton; class RhsAutomaton; // // These classes must be derived from for equational theories that // need to generate matching or unification subproblems or // pass back extension information respectively. // class Subproblem; class ExtensionInfo; // // This class must be derived from for equational theories that generate // unification subproblems. // class UnificationSubproblem; // // This class can be derived from for equational theories that want to // delay and batch subproblems in the hope of reducing the search space. // class DelayedSubproblem; #endif Maude-2.6/src/Interface/term.hh0000644000147300135640000003411411305607375013336 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for terms. // #ifndef _term_hh_ #define _term_hh_ #include "lineNumber.hh" #include "sort.hh" #include "symbol.hh" #include "dagNode.hh" #include "natSet.hh" #include "pointerSet.hh" #include "termSet.hh" #include "variableSymbol.hh" class Term : public LineNumber { NO_COPYING(Term); static bool discard; public: enum ReturnValues { GREATER = 1, LESS = -2, EQUAL = 0, UNKNOWN = -1 }; Term(Symbol* symbol); virtual ~Term() {} // // These member functions should not be overridden // Symbol* symbol() const; bool ground() const; bool stable() const; const NatSet& occursBelow() const; const NatSet& occursInContext() const; const PointerSet& collapseSymbols() const; unsigned int getHashValue() const; int computeSize(); Term* deepCopy(SymbolMap* translation = 0) const; Term* instantiate(const Vector& varBindings, SymbolMap* translation); int compare(const Term* other) const; int compare(const DagNode* other) const; bool equal(const Term* other) const; bool equal(const DagNode* other) const; bool leq(const Sort* sort) const; DagNode* term2Dag(bool setSortInfo = false); DagNode* dagify(); void indexVariables(VariableInfo& indicies); void determineContextVariables(); void markEager(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables); ConnectedComponent* getComponent() const; int getSortIndex() const; Sort* getSort() const; void setSortInfo(ConnectedComponent* component, int index); int getSaveIndex() const; bool matchIndependent(const Term* other) const; bool honorsGroundOutMatch() const; void setHonorsGroundOutMatch(bool flag); bool willGroundOutMatch(const NatSet& boundUniquely) const; void analyseCollapses(); bool hasEagerContext() const; bool greedySafe(const VariableInfo& variableInfo, const NatSet& boundUniquely) const; LhsAutomaton* compileLhs(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely); int compileRhs(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext); void compileTopRhs(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms); // // These member functions must be defined for each derived class // virtual RawArgumentIterator* arguments() = 0; virtual void deepSelfDestruct() = 0; virtual Term* deepCopy2(SymbolMap* translator) const = 0; virtual Term* normalize(bool full, bool& changed = discard) = 0; virtual int compareArguments(const Term* other) const = 0; virtual int compareArguments(const DagNode* other) const = 0; virtual void findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop = false) = 0; virtual void findEagerVariables(bool atTop, NatSet& eagerVariables) const = 0; virtual void analyseConstraintPropagation(NatSet& boundUniquely) const = 0; virtual LhsAutomaton* compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely) = 0; virtual void markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables) = 0; virtual int compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext) = 0; virtual DagNode* dagify2() = 0; // // The following function returns true if the lhs automaton for "this" // is guarenteed to return "false" on any instance of "other" when running // without extension and an empty substitution. It is used to optimize the // compilation of patterns and can be defined conservatively --- returning // false is always OK. // virtual bool earlyMatchFailOnInstanceOf(const Term* other) const; // // These member functions compute approximate relations between terms; // i.e. they can return UNDECIDED whenever the true relation is too // expensive to evaluate (or even undecidable). The default versions // return UNDECIDED most of the time. Theory specific versions may be able // to do better but must be prepared to handle UNDECIDED results from // alien subterms. These functions are intended for use in optimizing // lhs and rhs automata; if a result is UNDECIDED the optimization is quietly // forgotten. // // The following function returns true if any subject that matches "other" // is guarenteed to match "this" taking into account nonlinear variables // in the context. It can be defined conservatively --- returning // false is always OK. The sameVariableSet flag indicates whether // variables in this are the same as (and thus trivially subsume) variables // with the same name in "other". When both subterms are from the same // pattern it should be set to true; when they are from different patterns // it should be set to false since f(X, Y) does not subsume f(a, Y) if // Y is already bound in the context of f(X, Y). // virtual bool subsumes(const Term* other, bool sameVariableSet) const; // // This pair of functions does the preprocessing needed to handle collapse // theories correctly. analyseCollapses2() computes the set of symbols that // could be the top symbol of the term following collapses caused by bindings // to its variables. The default version will work for symbols with // collapse-free theories. insertAbstractionVariables() inserts abstraction // variables where needed to help out the matching algorithm by replacing // tricky subpatterns with variables, whose binding will be matched against // the subpattern at solve time. The default version will work for symbols // whose matching algorithm does not need abstraction variables. // virtual void analyseCollapses2(); virtual void insertAbstractionVariables(VariableInfo& variableInfo); // // Runtime heuristic partial camparison between a term with variables // and a dag, with a substitution that may bind some of the variables. // int partialCompare(const Substitution& partialSubstitution, DagNode* other) const; virtual int partialCompareUnstable(const Substitution& partialSubstitution, DagNode* other) const; virtual int partialCompareArguments(const Substitution& partialSubstitution, DagNode* other) const; // // The following function should be redefined for any subclass that needs a // non-naive treatment of it's arguments or has hidden data. // virtual Term* instantiate2(const Vector& varBindings, SymbolMap* translator); #ifdef COMPILER void generateRhs(CompilationContext& context, int indentLevel, const Vector& varNames, Symbol* lhsSymbol); int gatherPartialResults(int nrVariables, TermSet& compiled, Vector& symbols, Vector >& argLists); #endif #ifdef DUMP // // dump() routine is optional; Default will dump common stuff togther with args // in naive way. Replacement routine should call dumpCommon() to dump stuff in // base class. // virtual void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel = 0); void dumpCommon(ostream& s, const VariableInfo& variableInfo, int indentLevel); private: static void dumpVariableSet(ostream& s, const NatSet& variableSet, const VariableInfo& variableInfo); static void dumpSymbolSet(ostream& s, const PointerSet& symbolSet); #endif protected: static unsigned int hash(unsigned int v1, unsigned int v2); static unsigned int hash(unsigned int v1, unsigned int v2, unsigned int v3); static void commonSymbols(Vector& terms, PointerSet& common); void addCollapseSymbol(Symbol* symbol); void addCollapseSymbols(const PointerSet& symbols); void setHashValue(unsigned int value); void setSaveIndex(int index); private: enum Flags { // // A subterm is stable if its top symbol cannot change under instantiation. // STABLE = 1, // // A subterm is in an eager context if the path to its root contains only // eagerly evaluated positions. // EAGER_CONTEXT = 2, // // A subterm "honors ground out match" if its matching algorithm guarantees // never to to return a matching subproblem when all the terms variables // are already bound. // HONORS_GROUND_OUT_MATCH = 4 }; static bool commonWithOtherPatterns(Vector& patterns, int excluded, Symbol* symbol); static bool hasGeqOrIncomparableVariable(Term* pattern, VariableSymbol* v); static Vector subDags; static TermSet converted; static bool setSortInfoFlag; Symbol* topSymbol; NatSet occursSet; NatSet contextSet; PointerSet collapseSet; Ubyte flags; short sortIndex; ConnectedComponent* connectedComponent; int saveIndex; unsigned int hashValue; int cachedSize; }; inline Term::Term(Symbol* symbol) { topSymbol = symbol; flags = 0; sortIndex = Sort::SORT_UNKNOWN; saveIndex = NONE; cachedSize = UNDEFINED; } inline Symbol* Term::symbol() const { return topSymbol; } inline bool Term::ground() const { return occursSet.empty(); } inline bool Term::stable() const { return flags & STABLE; } inline const NatSet& Term::occursBelow() const { return occursSet; } inline const NatSet& Term::occursInContext() const { return contextSet; } inline const PointerSet& Term::collapseSymbols() const { return collapseSet; } inline Term* Term::deepCopy(SymbolMap* translator) const { Term* t = deepCopy2(translator); t->setLineNumber(getLineNumber()); return t; } inline Term* Term::instantiate(const Vector& varBindings, SymbolMap* translator) { Term* t = instantiate2(varBindings, translator); t->setLineNumber(getLineNumber()); return t; } inline int Term::compare(const Term* other) const { Symbol* s = other->topSymbol; return (topSymbol == s) ? compareArguments(other) : topSymbol->compare(s); } inline int Term::compare(const DagNode* other) const { Symbol* s = other->symbol(); return (topSymbol == s) ? compareArguments(other) : topSymbol->compare(s); } inline int // inline this because it is heavily used at runtime Term::partialCompare(const Substitution& partialSubstitution, DagNode* other) const { if (!stable()) return partialCompareUnstable(partialSubstitution, other); Symbol* s = other->symbol(); if (topSymbol == s) return partialCompareArguments(partialSubstitution, other); return (topSymbol->compare(s) < 0) ? LESS : GREATER; } inline bool Term::equal(const Term* other) const { return topSymbol == other->topSymbol && compareArguments(other) == 0; } inline bool Term::equal(const DagNode* other) const { return topSymbol == other->symbol() && compareArguments(other) == 0; } inline DagNode* Term::dagify() { Assert(subDags.length() == converted.cardinality(), "length/cardinality mismatch"); int e = converted.term2Index(this); if (e >= 0) return subDags[e]; DagNode* d = dagify2(); if (setSortInfoFlag) { Assert(sortIndex != Sort::SORT_UNKNOWN, "missing sort info"); d->setSortIndex(sortIndex); d->setReduced(); } converted.insert(this); subDags.append(d); return d; } inline void Term::markEager(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables) { flags |= EAGER_CONTEXT; markEagerArguments(nrVariables, eagerVariables, problemVariables); } inline ConnectedComponent* Term::getComponent() const { return connectedComponent; } inline int Term::getSortIndex() const { return sortIndex; } inline Sort* Term::getSort() const { return (sortIndex == Sort::SORT_UNKNOWN) ? 0 : connectedComponent->sort(sortIndex); } inline int Term::getSaveIndex() const { return saveIndex; } inline void Term::setSaveIndex(int index) { saveIndex = index; } inline void Term::setSortInfo(ConnectedComponent* component, int index) { connectedComponent = component; sortIndex = index; } inline bool Term::matchIndependent(const Term* other) const { return earlyMatchFailOnInstanceOf(other) && other->earlyMatchFailOnInstanceOf(this); } inline void Term::addCollapseSymbol(Symbol* symbol) { (void) collapseSet.insert(symbol); } inline void Term::addCollapseSymbols(const PointerSet& symbols) { collapseSet.insert(symbols); } inline unsigned int Term::getHashValue() const { return hashValue; } inline unsigned int Term::hash(unsigned int v1, unsigned int v2) { return (v1 * v1) ^ (v1 >> 16) ^ v2; // symmetry with DagNode version } inline unsigned int Term::hash(unsigned int v1, unsigned int v2, unsigned int v3) { return (v1 * v1) ^ (v1 >> 16) ^ (v2 * v3); // symmetry with DagNode version } inline void Term::setHashValue(unsigned int value) { hashValue = value; } inline bool Term::honorsGroundOutMatch() const { return flags & HONORS_GROUND_OUT_MATCH; } inline void Term::setHonorsGroundOutMatch(bool flag) { if (flag) // HACK should probably start clear and set as needed flags |= HONORS_GROUND_OUT_MATCH; else flags &= ~HONORS_GROUND_OUT_MATCH; } inline bool Term::willGroundOutMatch(const NatSet& boundUniquely) const { return honorsGroundOutMatch() && boundUniquely.contains(occursSet); } inline bool Term::hasEagerContext() const { return flags & EAGER_CONTEXT; } inline bool Term::leq(const Sort* sort) const { return ::leq(sortIndex, sort); } // // Output function for Term must be defined by library user // ostream& operator<<(ostream& s, const Term* term); #endif Maude-2.6/src/Interface/rawArgumentIterator.hh0000644000147300135640000000220507666302431016371 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for raw argument iterators. // #ifndef _rawArgumentIterator_hh_ #define _rawArgumentIterator_hh_ class RawArgumentIterator { public: virtual ~RawArgumentIterator() {} virtual bool valid() const = 0; virtual Term* argument() const = 0; virtual void next() = 0; }; #endif Maude-2.6/src/Interface/dagNode.hh0000644000147300135640000003535411457651007013736 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2010 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for dag nodes. // #ifndef _dagNode_hh_ #define _dagNode_hh_ //#include "gmpxx.h" #include "symbol.hh" #include "redexPosition.hh" class DagNode { NO_COPYING(DagNode); public: DagNode(Symbol* symbol); virtual ~DagNode() {} void setCallDtor(); // // Nasty cross casting stuff. // MemoryCell* getMemoryCell(); const MemoryCell* getMemoryCell() const; // // Static members (for memory management). // void* operator new(size_t size); void* operator new(size_t size, DagNode* old); // // These member functions should not be overridden. // Symbol* symbol() const; int compare(const DagNode* other) const; bool equal(const DagNode* other) const; bool leq(const Sort* sort) const; bool isReduced() const; void reduce(RewritingContext& context); void mark(); void setReduced(); void setUnrewritable(); bool isUnrewritable() const; void setUnstackable(); bool isUnstackable() const; void setGround(); bool isGround() const; void copySetRewritingFlags(const DagNode* other); void copySortIndex(const DagNode* other); void upgradeSortIndex(const DagNode* other); Byte getTheoryByte() const; void setTheoryByte(Byte value); DagNode* copyReducible(); DagNode* copyEagerUptoReduced(); void clearCopyPointers(); DagNode* copyAndReduce(RewritingContext& context); void setSortIndex(int index); int getSortIndex() const; Sort* getSort() const; void computeTrueSort(RewritingContext& context); void repudiateSortInfo(); bool checkSort(const Sort* boundSort, Subproblem*& returnedSubproblem); bool checkSort(const Sort* boundSort, RewritingContext& context); bool inErrorSort(); bool matchVariable(int index, const Sort* sort, bool copyToAvoidOverwriting, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); // // Currently only used as an efficiency measure in changing the sorts // of fresh variables introduced by unification. // void replaceSymbol(Symbol* newSymbol); // // These member functions must be defined for each derived class. // virtual RawDagArgumentIterator* arguments() = 0; virtual size_t getHashValue() = 0; virtual int compareArguments(const DagNode* other) const = 0; virtual void overwriteWithClone(DagNode* old) = 0; virtual DagNode* makeClone() = 0; virtual DagNode* copyWithReplacement(int argIndex, DagNode* replacement) = 0; virtual DagNode* copyWithReplacement(Vector& redexStack, int first, int last) = 0; virtual void stackArguments(Vector& redexStack, int parentIndex, bool respectFrozen) = 0; // // Interface for unification. // enum ReturnResult { GROUND, NONGROUND, UNIMPLEMENTED }; virtual ReturnResult computeBaseSortForGroundSubterms( ); bool computeSolvedForm(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending); virtual bool computeSolvedForm2(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending); void insertVariables(NatSet& occurs); virtual void insertVariables2(NatSet& occurs) {} // // instantiate() returns 0 if instantiation does not change term. // DagNode* instantiate(const Substitution& substitution); virtual DagNode* instantiate2(const Substitution& substitution) { CantHappen("Not implemented"); return 0; } void computeGeneralizedSort(const SortBdds& sortBdds, const Vector& realToBdd, // first BDD variable for each free real variable Vector& generalizedSort); // // Interface for narrowing. // bool indexVariables(NarrowingVariableInfo& indices, int baseIndex); virtual bool indexVariables2(NarrowingVariableInfo& indices, int baseIndex); virtual DagNode* instantiateWithReplacement(const Substitution& substitution, int argIndex, DagNode* newDag) { CantHappen("Not implemented"); return 0; } // // These member functions must be defined for each derived class in theories // that need extension. // virtual bool matchVariableWithExtension(int index, const Sort* sort, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); virtual void partialReplace(DagNode* replacement, ExtensionInfo* extensionInfo); virtual DagNode* partialConstruct(DagNode* replacement, ExtensionInfo* extensionInfo); virtual ExtensionInfo* makeExtensionInfo(); #ifdef DUMP // // dump() routine is optional; Default will dump common stuff togther with args // in naive way. Replacement routine should call dumpCommon() to dump stuff in // base class. // virtual void dump(ostream& s, int indentLevel = 0); void dumpCommon(ostream& s, int indentLevel); #endif protected: enum Sizes { // // We use 2 of the available words in a memory cell; one for our // symbol/copy pointer and one for our virtual function table pointer. // It would be nice to do this in a cleaner way, rather than assume // the existence/size of our virtual function table pointer. // nrWords = 3 // HACK }; static size_t hash(size_t v1, size_t v2); static size_t hash(size_t v1, size_t v2, size_t v3); // // Functions to set and test the status of the hash valid flag. // void setHashValid(); bool isHashValid() const; // // These member functions must be defined for each derived class. // virtual DagNode* markArguments() = 0; virtual DagNode* copyEagerUptoReduced2() = 0; virtual void clearCopyPointers2() = 0; private: enum Flags { REDUCED = 1, // reduced up to strategy by equations COPIED = 2, // copied in current copy operation; copyPointer valid UNREWRITABLE = 4, // reduced and not rewritable by rules UNSTACKABLE = 8, // unrewritable and all subterms unstackable or frozen //CACHED = 16, // node exists as part of a cache GROUND_FLAG = 16, // no variables occur below this node HASH_VALID = 32 // node has a valid hash value (storage is theory dependent) }; bool isCopied() const; void setCopied(); void clearCopied(); union { // // Since copy pointers are needed infrequently we will use the top symbol slot // and restore the top symbol from the copy of the dag node when the entire // copy operation in finished; this is slightly hairy but dag nodes are the // fundemental runtime data structure and need to be highly optimized. // Symbol* topSymbol; DagNode* copyPointer; }; }; // // Output function for DagNode must be defined by library user. // ostream& operator<<(ostream& s, DagNode* dagNode); #include "memoryCell.hh" inline MemoryCell* DagNode::getMemoryCell() { return static_cast(static_cast(this)); } inline const MemoryCell* DagNode::getMemoryCell() const { return static_cast(static_cast(this)); } inline void DagNode::copySetRewritingFlags(const DagNode* other) { getMemoryCell()->copySetFlags(REDUCED | UNREWRITABLE | UNSTACKABLE | GROUND_FLAG, other->getMemoryCell()); } inline void DagNode::copySortIndex(const DagNode* other) { getMemoryCell()->setHalfWord(other->getMemoryCell()->getHalfWord()); } inline void DagNode::upgradeSortIndex(const DagNode* other) { // // We set the sort to best of original and other sorts; that is: // SORT_UNKNOWN, SORT_UNKNOWN -> SORT_UNKNOWN // SORT_UNKNOWN, valid-sort -> valid-sort // valid-sort, SORT_UNKNOWN -> valid-sort // valid-sort, valid-sort -> valid-sort // // We can do it with a bitwise AND trick because valid sorts should // always be in agreement and SORT_UNKNOWN is represented by -1, i.e. // all 1 bits. // getMemoryCell()->setHalfWord(getMemoryCell()->getHalfWord() & other->getMemoryCell()->getHalfWord()); } inline void DagNode::setCallDtor() { getMemoryCell()->setCallDtor(); } inline int DagNode::getSortIndex() const { return getMemoryCell()->getHalfWord(); } inline void DagNode::setSortIndex(int index) { getMemoryCell()->setHalfWord(index); } inline void DagNode::replaceSymbol(Symbol* newSymbol) { topSymbol = newSymbol; } inline void DagNode::repudiateSortInfo() { setSortIndex(Sort::SORT_UNKNOWN); } //#include "memoryCellNew.hh" inline void* DagNode::operator new(size_t size) { // // We rely on MemoryCell::allocateMemoryCell() setting the half word to // Sort::SORT_UNKNOWN. // Assert(size <= sizeof(MemoryCell), "dag node too big"); return MemoryCell::allocateMemoryCell(); } inline void* DagNode::operator new(size_t /* size */, DagNode* old) { if (old->getMemoryCell()->needToCallDtor()) old->~DagNode(); // explicitly call virtual destructor old->getMemoryCell()->clearAllExceptMarked(); old->repudiateSortInfo(); //DebugAdvisory("in place new called, old = " << (void*)(old)); Assert(old->getSortIndex() == Sort::SORT_UNKNOWN, "bad sort init"); return static_cast(old); } inline DagNode::DagNode(Symbol* symbol) { topSymbol = symbol; //DebugAdvisory("created dag node for " << symbol << " at " << (void*)(this)); //DebugAdvisoryCheck(getSortIndex() == Sort::SORT_UNKNOWN, // "bad sort in dagnode"); } inline Symbol* DagNode::symbol() const { return topSymbol; } inline int DagNode::compare(const DagNode* other) const { if (this == other) return 0; // pointers to same shared node Symbol* s = other->topSymbol; return (topSymbol == s) ? compareArguments(other) : topSymbol->compare(s); } inline bool DagNode::equal(const DagNode* other) const { return this == other || (topSymbol == other->topSymbol && compareArguments(other) == 0); } inline bool DagNode::isReduced() const { return getMemoryCell()->getFlag(REDUCED); } inline void DagNode::setReduced() { getMemoryCell()->setFlag(REDUCED); } inline bool DagNode::isCopied() const { return getMemoryCell()->getFlag(COPIED); } inline void DagNode::setCopied() { getMemoryCell()->setFlag(COPIED); } inline void DagNode::clearCopied() { getMemoryCell()->clearFlag(COPIED); } inline void DagNode::setUnrewritable() { getMemoryCell()->setFlag(UNREWRITABLE); } inline bool DagNode::isUnrewritable() const { return getMemoryCell()->getFlag(UNREWRITABLE); } inline void DagNode::setUnstackable() { getMemoryCell()->setFlag(UNSTACKABLE); } inline bool DagNode::isUnstackable() const { return getMemoryCell()->getFlag(UNSTACKABLE); } inline void DagNode::setGround() { getMemoryCell()->setFlag(GROUND_FLAG); } inline bool DagNode::isGround() const { return getMemoryCell()->getFlag(GROUND_FLAG); } inline void DagNode::setHashValid() { getMemoryCell()->setFlag(HASH_VALID); } inline bool DagNode::isHashValid() const { return getMemoryCell()->getFlag(HASH_VALID); } inline Byte DagNode::getTheoryByte() const { return getMemoryCell()->getByte(); } inline void DagNode::setTheoryByte(Byte value) { getMemoryCell()->setByte(value); } // // We use Symbol::fastComputeTrueSort() inline function which in turn uses // our setSortIndex() inline function. // #include "symbol2.hh" inline void DagNode::reduce(RewritingContext& context) { while (!isReduced()) { if (!(topSymbol->eqRewrite(this, context))) { setReduced(); topSymbol->fastComputeTrueSort(this, context); break; } } } inline void DagNode::mark() { Assert(this != 0, "bad dag node"); Assert(topSymbol->arity() >= 0 && topSymbol->arity() <= 30, // arbitrary - but helps catch bugs "bad symbol at " << static_cast(topSymbol)); DagNode* d = this; while (!(d->getMemoryCell()->isMarked())) { d->getMemoryCell()->setMarked(); // // markArguments() returns a pointer our the last argument // rather than calling mark() on it. This allows us to // do tail recursion elimination on the last argument // which is important for cons style lists. // d = d->markArguments(); if (d == 0) break; // leaf } } inline bool DagNode::inErrorSort() { int t = getSortIndex(); if (t == Sort::SORT_UNKNOWN) { topSymbol->computeBaseSort(this); t = getSortIndex(); if (!(topSymbol->sortConstraintFree())) setSortIndex(Sort::SORT_UNKNOWN); } return t == Sort::ERROR_SORT; } inline Sort* DagNode::getSort() const { return (getSortIndex() == Sort::SORT_UNKNOWN) ? 0 : topSymbol->rangeComponent()->sort(getSortIndex()); } inline void DagNode::computeTrueSort(RewritingContext& context) { if (getSortIndex() == Sort::SORT_UNKNOWN) topSymbol->normalizeAndComputeTrueSort(this, context); } inline DagNode* DagNode::copyEagerUptoReduced() { if (isReduced()) return this; if (!isCopied()) { copyPointer = copyEagerUptoReduced2(); // this destroys our top symbol setCopied(); } return copyPointer; } inline void DagNode::clearCopyPointers() { if (isCopied()) { clearCopied(); topSymbol = copyPointer->topSymbol; // restore our top symbol from copy clearCopyPointers2(); // can't safely call this until top symbol restored } } inline DagNode* DagNode::copyReducible() { DagNode* d = copyEagerUptoReduced(); clearCopyPointers(); return d; } inline DagNode* DagNode::copyAndReduce(RewritingContext& context) { DagNode* d = copyReducible(); d->reduce(context); return d; } inline DagNode* DagNode::instantiate(const Substitution& substitution) { return isGround() ? 0 : instantiate2(substitution); } inline void DagNode::insertVariables(NatSet& occurs) { if (!isGround()) insertVariables2(occurs); } inline bool DagNode::indexVariables(NarrowingVariableInfo& indices, int baseIndex) { if (isGround()) return true; // no variables below us to index bool ground = indexVariables2(indices, baseIndex); if (ground) setGround(); return ground; } inline bool DagNode::leq(const Sort* sort) const { return ::leq(getSortIndex(), sort); } inline size_t DagNode::hash(size_t v1, size_t v2) { return (v1 * v1) ^ (v1 >> 16) ^ v2; // best function to date on empirical measurement } inline size_t DagNode::hash(size_t v1, size_t v2, size_t v3) { return (v1 * v1) ^ (v1 >> 16) ^ (v2 * v3); } #endif Maude-2.6/src/Interface/symbol.cc0000644000147300135640000003264311412510005013645 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for base class Symbol. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "fullCompiler.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "dagArgumentIterator.hh" #include "equation.hh" #include "rule.hh" #include "sortConstraint.hh" // variable class definitions #include "variableSymbol.hh" // full compiler class definitions #include "compilationContext.hh" int Symbol::symbolCount = 0; const Vector Symbol::noArgs; // constant empty vector Symbol::Symbol(int id, int arity, bool memoFlag) : NamedEntity(id), SortTable(arity), MemoTable(memoFlag), orderInt(symbolCount++ | (arity << 24)) { uniqueSortIndex = 0; } Symbol::~Symbol() { } void Symbol::slowComputeTrueSort(DagNode* subject, RewritingContext& context) { if (subject->getSortIndex() == Sort::SORT_UNKNOWN) { computeBaseSort(subject); constrainToSmallerSort(subject, context); } } bool Symbol::mightMatchPattern(Term* pattern) { if (mightMatchSymbol(pattern->symbol())) return true; const PointerSet& cs = pattern->collapseSymbols(); int cardinality = cs.cardinality(); for (int i = 0; i < cardinality; i++) { if (mightMatchSymbol(static_cast(cs.index2Pointer(i)))) return true; } return false; } bool Symbol::mightMatchSymbol(Symbol* symbol) { if (symbol == this) return true; if (VariableSymbol* vs = dynamic_cast(symbol)) { Sort* s = vs->getSort(); if (rangeComponent() == s->component()) { if (specialSortHandling()) return true; // can't tell anything about a symbol with special sort handling if (!safeToInspectSortConstraints()) return true; // uninspected sort constraint may lower our symbols lowest sort const Vector& opDeclarations = getOpDeclarations(); int nrDeclarations = opDeclarations.length(); int nrArgs = arity(); for (int i = 0; i < nrDeclarations; i++) { if (leq(opDeclarations[i].getDomainAndRange()[nrArgs], s)) return true; } const Vector& sortConstraints = getSortConstraints(); int nrSortConstraints = sortConstraints.length(); for (int i = 0; i < nrSortConstraints; i++) { if (leq(sortConstraints[i]->getSort(), s)) return true; } } } return false; } bool Symbol::acceptSortConstraint(SortConstraint* sortConstraint) { return mightMatchPattern(sortConstraint->getLhs()); } bool Symbol::acceptEquation(Equation* equation) { return mightMatchPattern(equation->getLhs()); } bool Symbol::acceptRule(Rule* rule) { return mightMatchPattern(rule->getLhs()); } void Symbol::fillInSortInfo(Term* subject) { Assert(this == subject->symbol(), "Bad Symbol"); ConnectedComponent* component = rangeComponent(); // should be const Assert(component != 0, "couldn't get component"); int nrArgs = arity(); if (nrArgs == 0) { subject->setSortInfo(component, traverse(0, 0)); // HACK return; } int step = 0; #ifndef NO_ASSERT int nrArgsSeen = 0; #endif for (ArgumentIterator a(*subject); a.valid(); a.next()) { Term* t = a.argument(); t->symbol()->fillInSortInfo(t); Assert(t->getComponent() == domainComponent(nrArgsSeen), "component error on arg " << nrArgsSeen << " while computing sort of " << subject); step = traverse(step, t->getSortIndex()); #ifndef NO_ASSERT ++nrArgsSeen; #endif } Assert(nrArgsSeen == nrArgs, "bad # of args for op"); subject->setSortInfo(component, step); } bool Symbol::interSymbolPass() { return false; } void Symbol::postInterSymbolPass() { } void Symbol::postOpDeclarationPass() { } void Symbol::finalizeSortInfo() { if (sortConstraintFree()) { Sort* s = getSingleNonErrorSort(); uniqueSortIndex = (s != 0 && !(canProduceErrorSort())) ? s->index() : -1; } } void Symbol::reset() { resetEachRule(); } bool Symbol::rangeSortNeverLeqThan(Sort* sort) { // // Check to see that our range sort will never be less than or equal to // given sort; Equivalently a variable with given sort can never take a // term headed by us. // int nrArgs = arity(); const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { if (leq(opDecls[i].getDomainAndRange()[nrArgs], sort)) return false; } const Vector& sortConstraints = getSortConstraints(); int nrSortConstraints = sortConstraints.length(); for (int i = 0; i < nrSortConstraints; i++) { if (leq(sortConstraints[i]->getSort(), sort)) return false; } return true; } bool Symbol::rangeSortAlwaysLeqThan(Sort* sort) { // // Check to see that our range sort will always be less than or equal to // given sort (except if it is in the error sort); Equivalently a variable // with given sort can always take a term headed by us unless it is in the // error sort. // int nrArgs = arity(); const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { if (!leq(opDecls[i].getDomainAndRange()[nrArgs], sort)) return false; } return true; } bool Symbol::domainSortAlwaysLeqThan(Sort* sort, int argNr) { // // Check that any sort we could take in our argNr position and not end up // in the error sort is less or equal to the given sort. // The current definition will be seriously incorrect if sort constraints // are allowed to terms out of the error sort in the future. // const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { if (!leq(opDecls[i].getDomainAndRange()[argNr], sort)) return false; } return true; } void Symbol::computePossibleDomainSorts(const NatSet& rangeSorts, Vector& domainSorts) { Assert(!(rangeSorts.empty()), "shouldn't be empty"); // // We compute the set of sorts that the specified argument can possibly have // given that the range sort must be <= one of the specified range sorts. // We are conservative in that we may generate a larger set of domain sorts // than strictly necessary. // int nrArgs = arity(); domainSorts.resize(nrArgs); if (specialSortHandling() || !safeToInspectSortConstraints() || rangeSorts.contains(Sort::KIND)) { // // We can't safely compute anything in these cases so // return the complete set of domain sorts. // for (int i = 0; i < nrArgs; i++) domainSorts[i] = domainComponent(i)->sort(Sort::KIND)->getLeqSorts(); return; } NatSet allPossibleRangeSorts; { // // First throw in all sorts that are less or equal to given range sorts. // const ConnectedComponent* rc = rangeComponent(); const NatSet::const_iterator e = rangeSorts.end(); for (NatSet::const_iterator i = rangeSorts.begin(); i != e; ++i) allPossibleRangeSorts.insert(rc->sort(*i)->getLeqSorts()); } { // // Now do a fixed point computation to see if we can get down from // other sorts to or below our given range sorts via a sort constraint. // const Vector& sortConstraints = getSortConstraints(); int nrSortConstraints = sortConstraints.length(); bool changed; do { changed = false; for (int i = 0; i < nrSortConstraints; i++) { SortConstraint* sc = sortConstraints[i]; if (allPossibleRangeSorts.contains(sc->getSort()->index())) { const NatSet& fromSorts = sc->getLhs()->getSort()->getLeqSorts(); if (fromSorts.contains(Sort::KIND)) { // // A sort constraint can pull us out of the kind! // for (int i = 0; i < nrArgs; i++) domainSorts[i] = domainComponent(i)->sort(Sort::KIND)->getLeqSorts(); return; } if (!(allPossibleRangeSorts.contains(fromSorts))) { allPossibleRangeSorts.insert(fromSorts); changed = true; } } } } while (changed); } Assert(!(allPossibleRangeSorts.contains(Sort::KIND)), "shouldn't contain kind"); { // // Now examine our declarations to see what domain sorts are possible // in each argument position. // for (int i = 0; i < nrArgs; i++) domainSorts[i].clear(); const Vector& opDeclarations = getOpDeclarations(); int nrDeclarations = opDeclarations.length(); for (int i = 0; i < nrDeclarations; i++) { const Vector& domainAndRange = opDeclarations[i].getDomainAndRange(); if (allPossibleRangeSorts.contains(domainAndRange[nrArgs]->index())) { for (int j = 0; j < nrArgs; j++) domainSorts[j].insert(domainAndRange[j]->getLeqSorts()); } } } } bool Symbol::attachData(const Vector& /* opDeclaration */, const char* purpose, const Vector& /* data */) { IssueWarning(*this <<": failed to attach id-hook " << QUOTE(purpose) << " to " << QUOTE(this) << '.'); return false; } bool Symbol::attachSymbol(const char* purpose, Symbol* symbol) { IssueWarning(*this <<": failed to attach op-hook " << QUOTE(purpose) << ' ' << QUOTE(symbol) << " to " << QUOTE(this) << '.'); return false; } bool Symbol::attachTerm(const char* purpose, Term* term) { IssueWarning(*this <<": failed to attach term-hook " << QUOTE(purpose) << ' ' << QUOTE(term) << " to " << QUOTE(this) << '.'); term->deepSelfDestruct(); return false; } void Symbol::copyAttachments(Symbol* /* original */, SymbolMap* /* map */) { } void Symbol::getDataAttachments(const Vector& /* opDeclaration */, Vector& /* purposes */, Vector >& /* data */) { } void Symbol::getSymbolAttachments(Vector& /* purposes */, Vector& /* symbols */) { } void Symbol::getTermAttachments(Vector& /* purposes */, Vector& /* terms */) { } bool Symbol::isConstructor(DagNode* subject) { if (specialSortHandling()) return false; // HACK switch (getCtorStatus()) { case SortTable::IS_CTOR: return true; case SortTable::IS_COMPLEX: { if (arity() == 0) return ctorTraverse(0, 0); // HACK int state = 0; for (DagArgumentIterator a(*subject); a.valid(); a.next()) { int t = a.argument()->getSortIndex(); Assert(t != Sort::SORT_UNKNOWN, "Unknown sort"); state = ctorTraverse(state, t); } return state; } default: break; } return false; } // // Putting this stuff here rather than the header file avoids gcc creating separate instances // for derived classes tht don't define their own versions. // bool Symbol::canResolveTheoryClash() { // // The default is that we can't resolve theory clashes. // return false; } UnificationSubproblem* Symbol::makeUnificationSubproblem() { CantHappen("Not implemented"); return 0; } int Symbol::unificationPriority() const { return 100; } #ifdef COMPILER void Symbol::fullCompile(CompilationContext& context, bool inLine) const { context.beginNewFunction(); #ifdef ANNOTATE context.body() << "// " << this << '\n'; #endif int nrArgs = arity(); int index = getIndexWithinModule(); // // Generate forward decl for C++ function. // context.head() << "Node* f" << index << '('; for (int i = 0; i < nrArgs; i++) { if (i != 0) context.head() << ", "; context.head() << "Node*"; } context.head() << ");\n"; // // Generate C++ function. // if (inLine) context.body() << "inline "; context.body() << "Node*\nf" << index << '('; for (int i = 0; i < nrArgs; i++) { if (i != 0) context.body() << ", "; context.body() << "Node* a" << i; } context.body() << ")\n{\n F" << index << ";\n"; generateCode(context); context.body() << "}\n\n"; // // Generate #define for start label and/or safe slots if needed. // context.head() << "#define F" << getIndexWithinModule(); if (context.isTailRecursive()) context.head() << "\tstart:"; int maxSafe = context.getNrSafeSlots(); if (maxSafe > 0) context.head() << "\tLink safe[" << maxSafe + 2 << ']'; context.head() << '\n'; } void Symbol::generateCode(CompilationContext& context) const { context.body() << " // not implemented\n return 0;\n"; } #endif #ifdef DUMP void Symbol::dump(ostream& s, int indentLevel) { s << Indent(indentLevel) << "Dumping Symbol: \"" << this << "\"\n"; dumpSortDiagram(s, indentLevel); dumpEquationTable(s, indentLevel); } #endif Maude-2.6/src/Interface/binarySymbol.hh0000644000147300135640000001162611442316123015032 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for binary symbols with attributes. // This class adds extra functionality needed by: // (1) commutative function symbols; // (2) idempotent function symbols; and // (3) function symbols with an identity. // #ifndef _binarySymbol_hh_ #define _binarySymbol_hh_ #include "symbol.hh" #include "term.hh" #include "cachedDag.hh" class BinarySymbol : public Symbol { public: // // Distinguishing arguments for permutative function symbols is not possible // so only three strategies make sense. // enum PermuteStrategy { EAGER, // [strat (1 2 0)] SEMI_EAGER, // [strat (0 1 2 0)] LAZY // [strat (0)] }; BinarySymbol(int id, bool memoFlag, Term* identity = 0); void setPermuteStrategy(const Vector& userStrategy); PermuteStrategy getPermuteStrategy() const; void setPermuteFrozen(const NatSet& frozen); void setIdentity(Term* id); Term* getIdentity() const; bool hasIdentity() const; bool hasUnequalLeftIdentityCollapse() const; bool hasUnequalRightIdentityCollapse() const; bool hasCyclicIdentity() const; DagNode* getIdentityDag(); bool mightMatchOurIdentity(const Term* subterm) const; bool takeIdentity(const Sort* sort); bool interSymbolPass(); void reset(); int computeSortIndex(int index1, int index2); int computeMultSortIndex(int index1, int index2, int multiplicity); // // Default definition returns true iff we don't have an identity. This must // be overridden for any symbol with other behavior. // bool isStable() const; protected: void commutativeSortCompletion(); void idempotentSortCheck(); void processIdentity(); void leftIdentitySortCheck(); void rightIdentitySortCheck(); private: enum IdentityStatus { NOT_NORMALIZED, IN_PROCESS, NORMALIZED }; bool lookForCycle(Term* term, NatSet& examinedIds) const; PermuteStrategy permuteStrategy; CachedDag identityTerm; // // These flags record if we detected a collapse from one sort to another. // Collapsing to a lower sort is legal but complicates unification. // bool unequalLeftIdCollapse; bool unequalRightIdCollapse; // // This flag records if we can reach find a cycle of symbols by examining identities of symbols. // We need this information for breaking non-disjoint cycles during unification. // Because it is potentially expensive to compute we only compute it if needed and therefore // store it as an int so we can have an undecided state. // mutable int cyclicIdentity; }; inline BinarySymbol::PermuteStrategy BinarySymbol::getPermuteStrategy() const { return permuteStrategy; } inline void BinarySymbol::setIdentity(Term* id) { Assert(identityTerm.getTerm() == 0, "overwriting identity for " << this); identityTerm.setTerm(id); cyclicIdentity = UNDECIDED; } inline Term* BinarySymbol::getIdentity() const { return identityTerm.getTerm(); } inline bool BinarySymbol::hasIdentity() const { return identityTerm.getTerm() != 0; } inline bool BinarySymbol::hasCyclicIdentity() const { if (cyclicIdentity == UNDECIDED) { NatSet examinedIds; cyclicIdentity = lookForCycle(getIdentity(), examinedIds); } return cyclicIdentity; } inline bool BinarySymbol::hasUnequalLeftIdentityCollapse() const { return unequalLeftIdCollapse; } inline bool BinarySymbol::hasUnequalRightIdentityCollapse() const { return unequalRightIdCollapse; } inline bool BinarySymbol::takeIdentity(const Sort* sort) { Term* id = identityTerm.getTerm(); return id != 0 && id->leq(sort); } inline DagNode* BinarySymbol::getIdentityDag() { Assert(identityTerm.getTerm() != 0, "null identity for symbol " << this); return identityTerm.getDag(); } inline int BinarySymbol::computeSortIndex(int index1, int index2) { return traverse(traverse(0, index1), index2); } inline int BinarySymbol::computeMultSortIndex(int index1, int index2, int multiplicity) { while (multiplicity > 0) { if (multiplicity & 1) index1 = computeSortIndex(index1, index2); multiplicity >>= 1; index2 = computeSortIndex(index2, index2); } return index1; } #endif Maude-2.6/src/Interface/unificationSubproblem.hh0000644000147300135640000000304411430647204016722 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2008 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for the accumulation and simultaneous solution of subproblems during unification. // #ifndef _unificationSubproblem_hh_ #define _unificationSubproblem_hh_ class UnificationSubproblem { public: virtual ~UnificationSubproblem() {} // deep virtual void addUnification(DagNode* lhs, DagNode* rhs, bool marked, UnificationContext& solution) { CantHappen("Not implemented " << lhs << " vs " << rhs); } virtual bool solve(bool findFirst, UnificationContext& solution, PendingUnificationStack& pending) { CantHappen("Not implemented"); return false; } #ifdef DUMP virtual void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel = 0) {} // HACK #endif }; #endif Maude-2.6/src/Interface/ChangeLog0000644000147300135640000040362411457650525013631 000000000000002010-10-20 Steven Eker * dagNode.hh (DagNode::upgradeSortIndex): added (DagNode::copySortIndex): added 2010-10-19 Steven Eker * symbol.hh (class Symbol): makeCanonicalCopyEagerUptoReduced() -> makeCanonicalCopy() ===================================Maude95a========================================== 2010-09-30 Steven Eker * symbol.hh (class Symbol): removed derivation from ModuleItem now that MemoTable is derived from this 2010-09-28 Steven Eker * symbol.hh (class Symbol): added decl for makeCanonicalCopyEagerUptoReduced() 2010-09-09 Steven Eker * binarySymbol.hh (BinarySymbol::hasUnequalLeftIdentityCollapse): added (BinarySymbol::hasUnequaRightIdentityCollapse): added (class BinarySymbol): added data members unequalLeftIdCollapse and unequalRightIdCollapse * binarySymbol.cc (BinarySymbol::leftIdentitySortCheck): set unequalLeftIdCollapse (BinarySymbol::rightIdentitySortCheck): set unequalRightIdCollapse 2010-08-18 Steven Eker * dagNode.cc (DagNode::nonVariableSize): deleted * dagNode.hh (class DagNode): deleted decl for nonVariableSize() ===================================Maude95========================================== 2010-08-11 Steven Eker * binarySymbol.hh (BinarySymbol::setIdentity): set cyclicIdentity = UNDECIDED * binarySymbol.cc (BinarySymbol::BinarySymbol): initialize cyclicIdentity * binarySymbol.hh (class BinarySymbol): added data member cyclicIdentity; added decl for lookForCycle() * binarySymbol.cc (BinarySymbol::lookForCycle): added * binarySymbol.hh (BinarySymbol::hasCyclicIdentity): added 2010-08-04 Steven Eker * dagNode.cc (DagNode::computeSolvedForm2): handle the ground term vs variable case 2010-08-03 Steven Eker * unificationSubproblem.hh (class UnificationSubproblem): updated decl for addUnification() 2010-07-29 Steven Eker * unificationSubproblem.hh (class UnificationSubproblem): updated decl for addUnification 2010-07-08 Steven Eker * binarySymbol.hh (BinarySymbol::hasIdentity): added ===================================Maude94a========================================== 2010-06-29 Steven Eker * symbol.cc (Symbol::canResolveTheoryClash): added * symbol.hh (class Symbol): added decl for canResolveTheoryClash() 2010-06-23 Steven Eker * binarySymbol.cc (BinarySymbol::isStable): fix bug where we didn't have a return statement 2010-06-04 Steven Eker * binarySymbol.cc (BinarySymbol::isStable): added * binarySymbol.hh (class BinarySymbol): added decl for isStable() * symbol.hh (class Symbol): added decl for isStable() ===================================Maude94========================================== 2010-03-19 Steven Eker * subproblem.hh (class Subproblem): delete unificationSolve() * extensionInfo.hh (class ExtensionInfo): Bool -> bool * dagNode.hh (DagNode::reduce): remove code to save a copy of topSymbol since the register load we save is paid for with register shuffling needed to preserve the value across a function call 2010-03-11 Steven Eker * term.cc (Term::compileRhs): code cleaning and comments ===================================Maude93========================================== 2010-01-28 Steven Eker * dagNode.hh (reduce): try storing topSymbol in a local variable to avoid reloading it * symbol.hh (class Symbol): makeCanonical() becomes null * symbol.cc (makeUnificationSubproblem): moved here to avoid gcc making copies for derived classes that don't define their own 2009-12-02 Steven Eker * term.hh (hash): updated both versions to be symmetrical with DagNode versions * dagNode.hh (hash): modified both versions; ifdef'd simple version * dagNode.cc (hash): version added here for experiments 2009-11-24 Steven Eker * symbol.hh (class Symbol): added decl for makeCanonical() ===================================Maude92b========================================== 2009-01-22 Steven Eker * dagNode.hh (reduce): new version that checks reduced flag after each successful rewrite; this cost an extra flag test per successful rewrite but avoids an eqRewrite() call and a sort calculation if a collapse equation executes and the flag is set by virtue of rewriting to an already reduced subterm ===================================Maude92========================================== 2008-12-19 Steven Eker * interface.hh: added class DelayedSubproblem * delayedSubproblem.hh: created ===================================Maude92========================================== 2008-09-11 Steven Eker * dagNode.cc (computeBaseSortForGroundSubterms): added default case to avoid compiler warning ===================================Maude91a========================================== 2008-04-18 Steven Eker * symbol.cc (unificationPriority): added * symbol.hh (class Symbol): added decl for unificationPriority() ===================================Maude91========================================== 2008-03-23 Steven Eker * dagNode.hh (class DagNode): deleted decls for old versions of computeSolvedForm() and computeSolvedForm2() 2008-03-12 Steven Eker * term.cc (computeSize): added * term.hh (class Term): added data member cachedSize (Term): initialize cachedSize (class Term): added decl for computeSize() ===================================Maude90a========================================== 2008-02-08 Steven Eker * dagNode.cc (computeSolvedForm, computeSolvedForm2): use UnificationContext in place of Substitution * dagNode.hh (class DagNode): updated decls for computeSolvedForm() and computeSolvedForm2() 2008-02-05 Steven Eker * dagNode.cc (computeSolvedForm2): rewritten (computeSolvedForm): rewritten * dagNode.hh (class DagNode): updated decls for computeSolvedForm() and computeSolvedForm2() 2008-01-31 Steven Eker * unificationSubproblem.hh: created * interface.hh: added class UnificationSubproblem * symbol.hh (class Symbol): added decl for makeUnificationSubproblem() 2008-01-15 Steven Eker * term.cc (compileRhs): removed commented out calls to useIndex() ===================================Maude90========================================== 2007-11-12 Steven Eker * dagNode.hh (copySetRewritingFlags): add GROUND_FLAG to flags that are copied 2007-11-01 Steven Eker * dagNode.cc (indexVariables2): added (indexVariables2): don't call setGround() here since it is called by indexVariables() * dagNode.hh (class DagNode): updated decls for instantiate(), instantiate2(), instantiateWithReplacement() (instantiate): updated 2007-10-26 Steven Eker * dagNode.hh (class DagNode): added decl for indexVariables2(); indexVariables() becomes nonvirtual (indexVariables): added 2007-10-25 Steven Eker * dagNode.cc (computeBaseSortForGroundSubterms): use setGround(); (computeSolvedForm): use isGround() rather than checking sort indices (nonVariableSize): use isGround() in Assert() (computeGeneralizedSort): rewritten using isGround() * dagNode.hh (class DagNode): added GROUND_FLAG to Flags (setGround, isGround): added (instantiate, insertVariables): use isGround() 2007-10-15 Steven Eker * dagNode.hh (class DagNode): added decl for indexVariables() 2007-09-24 Steven Eker * symbol.cc (reset): call resetEachRule() ===================================Maude89h========================================== 2007-08-24 Steven Eker * dagNode.cc (computeSolvedForm): use equal() rather than compare() * dagNode.hh (class DagNode): added enum ReturnResult; updated decl for computeBaseSortForGroundSubterms() * dagNode.cc (computeBaseSortForGroundSubterms): added 2007-08-23 Steven Eker * dagNode.cc (nonVariableSize): added * dagNode.hh (class DagNode): de-virtualized computeSolvedForm(); added computeSolvedForm2() * dagNode.cc (computeSolvedForm): added (computeSolvedForm2): added ===================================Maude89g========================================== 2007-06-28 Steven Eker * dagNode.hh (class DagNode): added extensionInfo arg to decl for computeSolvedForm() ===================================Maude89c========================================== 2007-03-16 Steven Eker * dagNode.hh (class DagNode): deleted decls for unify(), occurs(), occurs2() (occurs): deleted 2007-03-15 Steven Eker * dagNode.cc (computeGeneralizedSort): pass realToBdd by reference * dagNode.hh (class DagNode): pass realToBdd by reference rather than by value in computeGeneralizedSort() ===================================Maude89a========================================== 2007-03-09 Steven Eker * subproblem.hh (class Subproblem): added decl for unificationSolve() (class Subproblem): solve() gets a default implementation 2007-03-05 Steven Eker * dagNode.hh (class DagNode): nonVariableSize() must return mpz_class for correctness wrt S_Theory 2007-02-27 Steven Eker * dagNode.hh (insertVariables): added (class DagNode): added decl for insertVariables2() 2007-02-26 Steven Eker * dagNode.hh (class DagNode): added decl for nonVariableSize() 2007-02-22 Steven Eker * dagNode.hh (class DagNode): added decl for computeSolvedForm() ===================================Maude89========================================== 2007-01-30 Steven Eker * dagNode.cc (computeGeneralizedSort): added * dagNode.hh (class DagNode): added decl for computeBaseSortForGroundSubterms() (instantiate): added (class DagNode): added decl for instantiate2() (class DagNode): added decl for occurs2() (class DagNode): added decl for computeGeneralizedSort() ===================================Maude88e========================================== 2007-01-18 Steven Eker * dagNode.hh (class DagNode): add returns to unification interface functions in order to fail gracefully 2007-01-12 Steven Eker * dagNode.hh (replaceSymbol): added 2006-12-11 Steven Eker * dagNode.hh (class DagNode): added decl for instantiate() (class DagNode): added decl for occurs 2006-12-08 Steven Eker * dagNode.hh (class DagNode): added decl for unify() * term.cc (term2Dag): use clear() ===================================Maude88d========================================== 2005-06-24 Steven Eker * term.hh (instantiate): new calling convention (class Term): updated decls for instantiate() and instantiate2() (deepCopy): new arg name (class Term): updated decls for deepCopy() and deepCopy2() * term.cc (instantiate2): use findTargetVersionOfSymbol(); new calling convention 2005-06-22 Steven Eker * term.cc (instantiate2): added * term.hh (class Term): added decls for instantiate(), instantiate2() (instantiate): added ===================================Maude86b========================================== 2004-10-07 Steven Eker * dagNode.hh: added #include "symbol.hh" to appease g++ 2.4.2 2004-02-05 Steven Eker * dagNode.hh (copyEagerUptoReduced): set the copy flag after rather than before calling copyEagerUptoReduced2(); this fixes a subtle but nasty bug where copyEagerUptoReduced2() does an in place transformation on the dag node (say ACU tree -> array rep) that loses the copy pointer an prevents us from replacing the symbol ===================================Maude83a========================================== 2003-11-03 Steven Eker * symbol.cc (getDataAttachments): added (getSymbolAttachments): added (getTermAttachments): added * symbol.hh (class Symbol): added declatations for getDataAttachments(), getSymbolAttachments(), getTermAttachments() 2003-10-23 Steven Eker * symbol.cc (attachTerm): added error message (attachSymbol): added error message (attachData): added error message ===================================Maude83=========================================== 2003-05-30 Steven Eker * associativeSymbol.hh (class AssociativeSymbol): deleted decl for kindLevelDeclarationsOnly() * associativeSymbol.cc (kindLevelDeclarationsOnly): deleted * symbol.hh (class Symbol): virtualized rangeSortNeverLeqThan(), rangeSortAlwaysLeqThan(), domainSortAlwaysLeqThan() 2003-05-29 Steven Eker * binarySymbol.cc (rightIdentitySortCheck): updated comment * associativeSymbol.cc (associativeSortCheck): use QUOTE() 2003-05-28 Steven Eker * associativeSymbol.hh (class AssociativeSymbol): added decl for kindLevelDeclarationsOnly() * associativeSymbol.cc (kindLevelDeclarationsOnly): added (associativeSortCheck): use kindLevelDeclarationsOnly(); warn if there are memberships together with declarations that are not at the kind level * dagNode.hh (okToCollectGarbage): deleted ===================================Maude80b=========================================== 2003-05-22 Steven Eker * dagNode.hh (mark): tighten Assert() 2003-05-13 Steven Eker * term.cc (compileRhs): added DebugAdvisory() got CopyRhsAutomaton use 2003-05-06 Steven Eker * term.hh (class Term): added UNKNOWN to enum ReturnValues (partialCompare): simplified 2003-05-05 Steven Eker * binarySymbol.hh (computeSortIndex): added (computeMultSortIndex): added ===================================Maude80a=========================================== 2003-05-01 Steven Eker * dagNode.hh (copySetRewritingFlags): added ===================================Maude80=========================================== 2003-03-24 Steven Eker * symbol.hh (getUniqueSortIndex): added 2003-03-04 Steven Eker * interface.hh: removed class HeuristicLhsAutomaton * heuristicLhsAutomaton.cc: deleted * heuristicLhsAutomaton.hh: deleted 2003-02-24 Steven Eker * term.cc: removed #pragmas (commonSymbols): updated Assert() * term.hh: removed #pragmas (dagify): updated Assert()s * symbol.cc: removed #pragmas (fillInSortInfo): updated Assert()s (computePossibleDomainSorts): updated Assert()s (isConstructor): updated Assert() * symbol2.hh: removed #pragma * symbol.hh: removed #pragma * rhsAutomaton.hh: removed #pragma * rawArgumentIterator.hh: removed #pragma * rawDagArgumentIterator.hh: removed #pragma * lhsAutomaton.hh: removed #pragma * interface.cc: deleted * subproblem.hh (class Subproblem): added empty implementation for dump() removed #pragma * heuristicLhsAutomaton.cc: removed #pragma * heuristicLhsAutomaton.hh: removed #pragma * extensionInfo.hh: removed #pragma * dagNode.cc: removed #pragma * dagNode.hh: removed #pragma (new): updated Assert() (both versions) (mark): updated Assert()s * binarySymbol.cc: removed #pragma (commutativeSortCompletion): updated Assert() (processIdentity): updated Assert() (leftIdentitySortCheck): updated Assert()s (rightIdentitySortCheck): updated Assert()s (idempotentSortCheck): updated Assert() * binarySymbol.hh: removed #pragma (setIdentity): updated Assert() (getIdentityDag): updated Assert() * associativeSymbol.cc: removed #pragma (associativeSortCheck): updated Assert() (fillInSortInfo): updated Assert()s * associativeSymbol.hh: removed #pragma ===================================Maude79=========================================== 2003-01-31 Steven Eker * term.hh (stable): use flags data member * term.cc (dumpCommon): use honorsGroundOutMatch() and hasEagerContext() (insertAbstractionVariables): use honorsGroundOutMatch() (analyseCollapses): added * term.hh (class Term): added decl for analyseCollapses() (class Term): added enum Flags (class Term): added flags data member; removed honorsGroundOutMatchFlag and eagerContext flags (honorsGroundOutMatch): use flags data member (setHonorsGroundOutMatch): use flags data member (willGroundOutMatch): use honorsGroundOutMatch() (Term): clear flags rather than eagerContext (markEager): use flags data member * term.cc (analyseCollapses): becomes analyseCollapses2() * term.hh (class Term): analyseCollapses() -> analyseCollapses2() 2003-01-24 Steven Eker * extensionInfo.hh (class ExtensionInfo): added comments to explain data members ===================================Maude78=========================================== 2003-01-07 Steven Eker * term.hh (partialCompare): fixed bug in that we are supposed to return LESS, GREATER, EQUAL or UNDECIDED rather than an arbitrary int * term.cc (partialCompareUnstable): added * term.hh (class Term): added decl for partialCompareUnstable() * term.cc (partialCompareArguments): added * term.hh (class Term): added enum ReturnValues (partialCompare): added (class Term): added decls for partialCompareArguments() and partialCompare() 2002-11-26 Steven Eker * dagNode.hh: major rewrite, using new MemoryCell semantics ===================================Maude77================================================== 2002-11-14 Steven Eker * associativeSymbol.cc (processIdentity): use new style WarningCheck()s (associativeSortCheck): use new style WarningCheck()s * binarySymbol.cc (processIdentity): use new style WarningCheck()s (leftIdentitySortCheck): use new style WarningCheck()s (rightIdentitySortCheck): use new style WarningCheck()s (idempotentSortCheck): use new style WarningCheck()s; fix bug where the check was the wrong way around 2002-11-05 Steven Eker * interface.hh: class MemoryCell no longer declared here 2002-10-22 Steven Eker * memoryCell.cc (slowNew): use callDtor() and initialize() * memoryCell.hh (class MemoryCell): added decls for callDtor() and initialize() * memoryCellNew.hh (new): use callDtor(), initialize(), getFlag() and clearFlag() (callDtor): added * dagNode.hh (new): (reuse version) use clearAllExceptMarked(); use repudiateSortInfo() (DagNode): don't use setSortIndex(); we will rely on the new functions to do this * memoryCell.hh (class MemoryCell): made collectGarbage() private (clearAllExceptMarked): added * dagNode.hh (class DagNode): use NR_EXTRA_WORDS * memoryCell.hh (class MemoryCell): added enum SpecialValues 2002-10-21 Steven Eker * argVec.hh: use MemoryCell::allocateStorage() throughout * dagNode.cc (checkSort): (both versions) don't access sortIndex directly * dagNode.hh: almost complete rewrite; now derived from MemoryCell * memoryCellNew.hh (_memoryCellNew_hh_): created 2002-10-18 Steven Eker * memoryCell.hh: created * memoryCell.cc: created 2002-10-16 Steven Eker * symbol.cc (postOpDeclarationPass): added * symbol.hh (class Symbol): added declaration for postOpDeclarationPass(); the idea is that this function will be called after the sort table has been calculated. interSymbolPass() and postInterSymbolPass() are now done before the sort table is calculated 2002-10-10 Steven Eker * associativeSymbol.hh (class AssociativeSymbol): added fwd decl for struct Inv * associativeSymbol.cc (associativeSortCheck): implemented faster check based on inverting the first step of sort diagram traversal; we also test on kinds now that the user can add declarations at the kind level. 2002-10-08 Steven Eker * dagNode.hh (class DagNode): updated comment for UNSTACKABLE flag to take frozen arg into account (class DagNode): updated decl for complex copyWithReplacement() * binarySymbol.hh (class BinarySymbol): added decl for setPermuteFrozen() * binarySymbol.cc (setPermuteFrozen): added * associativeSymbol.cc (setFrozen): added * associativeSymbol.hh (class AssociativeSymbol): added decl for setFrozen() 2002-10-03 Steven Eker * dagNode.hh (class DagNode): added respectFrozen argument to stackArguments() decl ===================================Maude76================================================== 2002-09-08 Steven Eker * associativeSymbol.cc (isConstructor): use getCtorStatus() * symbol.cc (isConstructor): rewritten using getCtorStatus() 2002-08-28 Steven Eker * associativeSymbol.cc (isConstructor): added * associativeSymbol.hh (class AssociativeSymbol): added decl for isConstructor() * associativeSymbol.cc (isConstructor): added * symbol.cc (fillInSortInfo): added #ifdefs to avoid unneeded computation in nondebug case (isConstructor): added * symbol.hh (class Symbol): added decl for isConstructor() 2002-08-26 Steven Eker * symbol.cc (mightMatchSymbol): use class OpDeclaration (rangeSortNeverLeqThan): use class OpDeclaration (rangeSortAlwaysLeqThan): use class OpDeclaration (domainSortAlwaysLeqThan): use class OpDeclaration (computePossibleDomainSorts): use class OpDeclaration * binarySymbol.cc (commutativeSortCompletion): rewritten to use class OpDeclaration and to do constructor completion as well as sort completion; newDecl is no longer static 2002-08-23 Steven Eker * term.cc (compileRhs): don't call useIndex() at all - it is now the callers responsibility, since the actually last use of the index may be later than now (compileTopRhs): call useIndex() ===================================Maude75================================================== 2002-08-02 Steven Eker * term.cc (compileRhs): call useIndex() after we call makeConstructionIndex() or compileRhs2() to insure the use of the return index is recorded for coloring purposes 2002-08-01 Steven Eker * dagNode.cc (matchVariableWithExtension): replaced Assert(false,...) with CantHappen() (partialReplace): replaced Assert(false,...) with CantHappen() (partialConstruct): replaced Assert(false,...) with CantHappen() 2002-07-24 Steven Eker * term.hh (class Term): subsumes() now takes sameVariableSet arg to indicate whether X in "this" term is the same variable as X in "other" term. Also we now return a bool; false is used to cover the UNDECIDED case. * term.cc (subsumes): take sameVariableSet arg; always return false ===================================Maude74================================================== 2002-05-08 Steven Eker * symbol.hh/symbol2.hh/symbol.cc.dagNode.hh: reverted; the scheme for eliminating symbol2.hh has a flaw in that as the definitation of Symbol::fastComputeTrueSort() is not available when DagNode::reduce() is defined, it does not get inlined, even though it is always defined before DagNode::reduce() is called * symbol2.hh: deleted * dagNode.hh: don't include symbol2.hh * symbol.cc: no longer provide implementation for symbol2.hh * symbol.hh (fastComputeTrueSort): moved here from symbol2.hh; include dagNode.hh just before ===================================Maude72================================================== 2002-04-03 Steven Eker * term.hh (class Term): added static data member discard; use discard as default 2nd arg to normalize * symbol.hh (class Symbol): added static const data member noArgs ===================================Maude71a================================================== 2002-03-15 Steven Eker * symbol.hh (class Symbol): updated decl for computePossibleDomainSorts() * symbol.cc (computePossibleDomainSorts): now handle all args at once for efficiency * symbol.hh (class Symbol): addedd decl for computePossibleDomainSorts() * symbol.cc (computePossibleDomainSorts): added 2002-03-11 Steven Eker * associativeSymbol.cc: deleted explicit template instantiation * interface.cc: deleted explicit template instantiations ===================================Maude71================================================== 2001-12-10 Steven Eker * dagNode.hh (class DagNode): made dagNodeSize a static member rather than a static non-member so initialization can take the size of private data structures. ===================================Maude69================================================== 2001-04-03 Steven Eker * dagNode.hh (class DagNode): added decl for Vector version of copyWithReplacement() ===================================Engine66================================================== 2001-03-16 Steven Eker * dagNode.cc (checkSort): use addInCount() rather than incrementCount() and count() 2001-03-07 Steven Eker * symbol.hh (class Symbol): added decl for stackArguments() ===================================Engine65================================================== 2001-01-26 Steven Eker * dagNode.hh (class DagNode): changed decl for markArguments() so that it now returns a DagNode* (mark): rewritten using new markArguments() semantics (markIfNotMarkedAlready): deleted (class DagNode): deleted decl for markIfNotMarkedAlready() (class DagNode): make markArguments() protected 2001-01-19 Steven Eker * symbol.cc (attachTerm): self destruct term 2001-01-10 Steven Eker * symbol.cc (attachData): added purpose argument * symbol.hh (class Symbol): added purpose argument to attachData() decl 2001-01-09 Steven Eker * symbol.cc (attachTerm): now return false (attachSymbol): now return false (attachData): now return false 2001-01-08 Steven Eker * symbol.hh (class Symbol): added decls for attachData(), attachSymbol(), attachTerm(), copyAttachments() * symbol.cc (attachData): added (attachSymbol): added (attachTerm): added (copyAttachments): added ===================================Engine64================================================== 2000-12-18 Steven Eker * binarySymbol.cc (processIdentity): deleted commented out ErrorCheck about id having own function symbols on top since this is only relavent to AssocitaiveSymbols and is checked for there (leftIdentitySortCheck): no longer check for collapsing from the error sort to an output sort. I can't remember why I only worried about collapsing to output sorts and not any non-error sort but its clear that any any supersort to the coutput component would otherwise cause problems for operators with identities. Now that we allow rewrites to take place at the error sort level there doesn't seem to be anything to worry about. The code code for computing the set of output sorts was buggy in the case the two argument components were different. (rightIdentitySortCheck): changes symmetric with above 2000-11-28 Steven Eker * term.cc (compileRhs): rewritten to fix 2 potetial problems. Most obviously we were treating unbound variables as eager whereas we need to treat them as lazy. Also when we create a CopyRhsAutomaton to use an lazy variable in an eager position we were storing in the index of the copy in the saveIndex of the lazy lhs occurence rather than the eager rhs occurence that was inserted into availableTerms ===================================Engine63================================================== 2000-08-30 Steven Eker * binarySymbol.cc (leftIdentitySortCheck): don't use ComplexSort() (4 places) (rightIdentitySortCheck): ditto * term.hh (class Term): added decl for getSort() (getSort): added * dagNode.hh (getSort): added (class DagNode): added decl for getSort() ===================================Engine62================================================== 2000-08-04 Steven Eker * associativeSymbol.cc (fillInSortInfo): don't deal with union sorts * binarySymbol.cc (processIdentity): don't check for union sorts * symbol.cc (fillInSortInfo): don't handle union sorts 2000-07-26 Steven Eker * rhsAutomaton.hh (class RhsAutomaton): added decl for remapIndices() * term.hh (class Term): make saveIndex an int rather than a short * term.cc (compileRhs): use makeProtectedVariable() instead of allocateIndex() for use in left->right sharing (compileRhs): use makeConstructionIndex() instead of allocateIndex() when we're make an eager copy of a variable that only occurs in a lazy context 2000-07-25 Steven Eker * interface.cc: now generates implementation for rhsAutomaton.hh * rhsAutomaton.cc: deleted * rhsAutomaton.hh (class RhsAutomaton): deleted data member aliens and decls for addAlien() and buildAliens() (addAlien): deleted (buildAliens): deleted * term.hh (class Term): deleted decl for old compileRhs() ===================================Engine60================================================== 2000-07-19 Steven Eker * term.hh: made 2nd argument of operator<<() const 2000-07-18 Steven Eker * term.cc (compileRhs): set our save index; not t->saveIndex 2000-07-12 Steven Eker * term.cc (greedySafe): conditionVariables() -> getConditionVariables() * associativeSymbol.cc (associativeSortBoundsAnalysis): sort() -> getSort() (2 places) * symbol.cc (acceptSortConstraint): lhs() -> getLhs() (acceptEquation): lhs() -> getLhs() (acceptRule): lhs() -> getLhs() (rangeSortNeverLeqThan): sort() -> getSort() (mightMatchSymbol): sort() -> getSort() 2000-07-11 Steven Eker * term.hh (class Term): added atTop arg to findAvailableTerms() (setSaveIndex): added (class Term): added decl for setSaveIndex() 2000-07-10 Steven Eker * term.hh (class Term): added decls for compileRhs2(), compileTopRhs() and new version of compileRhs() (class Term): added decl for findAvailableTerms() * term.cc (compileRhs): added new version (compileTopRhs): added ===================================Engine59================================================== 2000-07-05 Steven Eker * term.hh (class Term): added decl for getSaveIndex(); (getSaveIndex): added * term.cc (compileLhs): added * term.hh (class Term): added data member saveIndex (class Term): compileLhs() becomes non-virtual; replaced by compileLhs2() (Term): initialize saveIndex = NONE 2000-06-23 Steven Eker * symbol.cc (mightMatchSymbol): code cleaning * term.cc (indexVariables): use VariableTerm* rather than VariableSymbol* (gatherPartialResults): index() -> getIndex() ===================================Engine58================================================== 2000-03-17 Steven Eker * interface.cc (dump): ifdef'd * heuristicLhsAutomaton.cc (dump): ifdef'd * heuristicLhsAutomaton.hh (class HeuristicLhsAutomaton): ifdef'd dump() decl * subproblem.hh (class Subproblem): ifdef'd dump() decl * dagNode.hh (class DagNode): use NO_COPYING() macro * rhsAutomaton.cc (dump): ifdef'd * rhsAutomaton.hh (class RhsAutomaton): ifdef'd dump() decl * lhsAutomaton.hh (class LhsAutomaton): ifdef'd dump() decl * memoryManager.cc (stompArenas): ifdef'd (checkArenas): ifdef'd (checkInvariant): ifdef'd (dumpMemoryVariables): ifdef'd * dagNode.cc (dump): ifdef'd (dumpCommon): ifdef'd * dagNode.hh (class DagNode): ifdef'd dump routine decls * term.cc (dump): ifdef'd (dumpCommon): ifdef'd (dumpVariableSet): ifdef'd (dumpSymbolSet): ifdef'd * symbol.hh (class Symbol): use NO_COPYING() macro * term.hh (class Term): ifdef'd dump routine decls (class Term): use NO_COPYING() macro * symbol.hh (class Symbol): ifdef'd dump() decl * symbol.cc (dump): ifdef'd * binarySymbol.cc (leftIdentitySortCheck): standardized WarningCheck()s (rightIdentitySortCheck): standardized WarningCheck()s (idempotentSortCheck): standardized WarningCheck() * associativeSymbol.cc (processIdentity): standardized WarningCheck() (associativeSortCheck): standardized WarningCheck()s 2000-03-16 Steven Eker * binarySymbol.cc (processIdentity): commented out ErrorCheck for identity element having its owner as top symbol; this is already checked for in AssociativeSymbol and shouldn't be a problem in non-assoc case (processIdentity): downgraded variable in identity elt to a WarningCheck() (processIdentity): downgraded union and error sorts in identity elt to WarningCheck()s (processIdentity): added Assert() for our sort index (leftIdentitySortCheck): left id vs left arg component ErrorCheck() becomes and Assert() (rightIdentitySortCheck): right id vs left arg component ErrorCheck() becomes and Assert() 2000-03-03 Steven Eker * binarySymbol.cc (commutativeSortCompletion): ErrorCheck() -> Assert() (leftIdentitySortCheck): ErrorCheck() -> Assert() for domain/range component mismatch (rightIdentitySortCheck): ErrorCheck() -> Assert() for domain/range component mismatch (idempotentSortCheck): ErrorCheck() -> Assert() * associativeSymbol.cc (associativeSortCheck): ErrorCheck() -> Assert() 2000-02-25 Steven Eker * term.hh (class Term): updated decls for commonSymbols() and commonWithOtherPatterns() * term.cc (commonSymbols): fixed bug where we weren't passing Vector arg by ref (commonWithOtherPatterns): fixed bug where we weren't passing Vector arg by ref ===================================Engine56================================================== 2000-02-15 Steven Eker * memoryManager.cc (collectGarbage): don't call Module::notifyOfGC() 2000-02-14 Steven Eker * symbol.cc (Symbol): don't pass type arg to NamedEntity 2000-02-08 Steven Eker * symbol.cc (fillInSortInfo): message in component error Assert() made more detailed ===================================Engine55================================================== 1999-12-17 Steven Eker * term.cc (generateRhs): new convention for calling setTailRecursive() and context.setNrSafeSlots() * symbol.cc (fullCompile): call beginNewFuction() (generateCode): don't call setTailRecursive() or setNrSafeSlots() * term.hh (class Term): updated decl for generateRhs() * term.cc (generateRhs): rewritten to new convention * symbol.cc (generateCode): don't take tailRecursive arg or return a value; call setTailRecursive() and setNrSafeSlots() (fullCompile): use isTailRecursive(), getNrSafeSlots() and new generateCode() calling convention * symbol.hh (class Symbol): removed tailRecursive arg from generateCode() decl ===================================Engine54================================================== 1999-11-11 Steven Eker * symbol.cc (rangeSortNeverLeqThan): added (rangeSortAlwaysLeqThan): added (domainSortAlwaysLeqThan): added * symbol.hh (class Symbol): added decls for rangeSortNeverLeqThan(), rangeSortAlwaysLeqThan(), domainSortAlwaysLeqThan() 1999-11-09 Steven Eker * term.cc (generateRhs): updated * term.hh (class Term): updated decl for generateRhs() 1999-11-08 Steven Eker * symbol.cc (generateBody): deleted (generateCode): deleted (generateCode): added new version (fullCompile): call generateCode() * symbol.hh (class Symbol): added decl for fullCompile() (class Symbol): added decl for new generateCode() * symbol.cc (fullCompile): added 1999-10-31 Steven Eker * memoryManager.cc (Arena): unioned nextArena with an Int64 inside struct DagNode::Arena to force DagNodes to be aligned on 8 byte boundries for machine where this is critical (eg SPARC) 1999-10-29 Steven Eker * standardSymbol.hh (class StandardSymbol): deleted * interface.hh: class StandardSymbol deleted * binarySymbol.cc (BinarySymbol): init Symbol * binarySymbol.hh (class BinarySymbol): revert to base Symbol * symbol.cc (Symbol): init MemoTable * symbol.hh (class Symbol): restored MemoTable and Strategy bases - it's just simpler to have it all in Symbol whether its needed or not; things like clearMemo() need to be called safely on all symbols * binarySymbol.cc (BinarySymbol): init StandardSymbol rather than Symbol (setPermuteStrategy): reverted to previous version (setPermuteStrategy): pass memoFlag to both calls to setStrategy() * binarySymbol.hh (class BinarySymbol): derive from StandardSymbol rather than Symbol * symbol.cc (Symbol): don't take memoFlag argument or call MemoTable initializer * symbol.hh (class Symbol): no longer have MemoTable as a base; no longer take memoFlag * standardSymbol.hh: created * symbol.hh (class Symbol): made RuleTable first base class to avoid dynamic_cast problem if first base in non-polymorphic 1999-10-27 Steven Eker * associativeSymbol.cc (AssociativeSymbol): don't take or pass theory arg; take and pass memoFlag arg * associativeSymbol.hh (class AssociativeSymbol): delete theory arg and added memoflag arg to ctor decl * binarySymbol.cc (BinarySymbol): take and pass memoFlag argument; don't take or pass theory argument (setPermuteStrategy): don't call setStrategy() * binarySymbol.hh (class BinarySymbol): don't take theory arg (class BinarySymbol): take memoFlag argument * symbol.cc (Symbol): take memoFlag arg, don't take theory arg or init theoryName * symbol.hh (class Symbol): no longer take theory arg; no longer derived from Strategy, take memoFlag arg; data member theoryName deleted; decl for theory() deleted (theory): deleted ===================================Engine53================================================== 1999-10-26 Steven Eker * term.hh (stable): use test on dynamic_cast(topSymbol) to avoid constness problem * symbol.cc (mightMatchSymbol): VariableSymbol::dynamicCast() -> dynamic_cast() * associativeSymbol.cc (mightCollapseToOurSymbol): VariableSymbol::dynamicCast() -> dynamic_cast() * binarySymbol.cc (mightMatchOurIdentity): VariableSymbol::dynamicCast() -> dynamic_cast() (*2) * term.cc (indexVariables): VariableSymbol::dynamicCast() -> dynamic_cast() (commonWithOtherPatterns): VariableSymbol::dynamicCast() -> dynamic_cast() (hasGeqOrIncomparableVariable): VariableSymbol::dynamicCast() -> dynamic_cast() (*2) (gatherPartialResults): VariableTerm::dynamicCast() -> dynamic_cast() * term.hh (stable): test on VariableSymbol::dynamicCast(topSymbol) replaced by one on dynamic_cast(this) 1999-10-22 Steven Eker * symbol.hh (class Symbol): add MemoTable to base classes 1999-10-21 Steven Eker * memoryManager.cc (collectGarbage): call RootContainer::markPhase(), don't call RewritingContext::markReachableNodes(), LocalBinding::markReachableNodes(), DagRoot::markReachableNodes() 1999-10-19 Steven Eker * dagNode.hh (class DagNode): added decl for getHashValue() (hash): added (2 and 3 arg versions) (class DagNode): added decl for hash() (2 and 3 arg versions) 1999-10-18 Steven Eker * dagNode.hh (class DagNode): union Word moved from private to protected (class DagNode): HASHED flag becomes HASH_VALID flag (class DagNode): added decls for setHashValid() and isHashValid() (setHashValid): added (isHashValid): added ===================================Engine52================================================== 1999-08-03 Steven Eker * memoryManager.cc (collectGarbage): call stompArenas() to try and force fast fail * dagNode.hh (class DagNode): added decl for stompArenas(); * memoryManager.cc (slowAllocateStorage): added static_cast(t) to allow ANSI legal ptr arith (3 places) (collectGarbage): use b + 1 rather than static_cast(b) + sizeof(Bucket) to keep ANSI happy (slowAllocateStorage): rewrote bucket creation code to simplify casting (stompArenas): added 1999-07-30 Steven Eker * dagNode.hh (allocateStorage): static_cast before adding bytesNeeded 1999-07-22 Steven Eker * term.cc (generateRhs): generate code to increment rewrite counter in the case where we have a collapse equation 1999-06-29 Steven Eker * symbol.hh (class Symbol): updated decls for generateCode() and generateBody() * symbol.cc (generateCode): pass hfile to generateBody() * term.cc (generateRhs): handle tail recursion in sinngle function call case 1999-06-25 Steven Eker * term.hh (class Term): updated decl of generateRhs() * term.cc (generateRhs): now take lhs symbol arg (generateRhs): added code for tail recursion elimination * symbol.cc (generateCode): output start label * term.cc (generateRhs): generate code to increment g.count; use g.safePtr (generateRhs): use correct union members for safe[] in genertaed code 1999-06-24 Steven Eker * term.cc (generateRhs): need to handle the bare variable case 1999-06-23 Steven Eker * term.hh (class Term): added decls for generateRhs() and gatherPartialResults() * term.cc (generateRhs): added (gatherPartialResults): added 1999-06-10 Steven Eker * symbol.cc (generateCode): added (generateBody): added * symbol.hh (class Symbol): added decls for generateCode() and generateBody() ===================================Engine50================================================== 1999-06-01 Steven Eker * argVec.hh: added ARG_VEC_HACK and CONST_ARG_VEC_HACK macros 1999-05-12 Steven Eker * dagNode.hh (computeTrueSort): computeTrueSort() -> normalizeAndComputeTrueSort() * symbol.hh (class Symbol): deleted decl for finalizeSymbol() (class Symbol): added decl for normalizeAndComputeTrueSort() * symbol.cc (finalizeSymbol): deleted 1999-05-10 Steven Eker * dagNode.hh (reduce): added sortIndex == Sort::SORT_UNKNOWN check back for the moment (reduce): commented test out again 1999-05-07 Steven Eker * symbol.hh (class Symbol): added decl for slowComputeTrueSort() * symbol.cc (slowComputeTrueSort): added * symbol2.hh (fastComputeTrueSort): use slowComputeTrueSort() * dagNode.hh (reduce): don't bother checking sortIndex to see if its unknown; just assume it is; branch that does sortConstraints will do the check to make sure we don't repeat work in that case; We guess that the repeated work in all othercases isn't worth the cost of the test 1999-05-05 Steven Eker * symbol.hh (class Symbol): moved decls for eqRewrite() and computeBaseSort() here to optimize dispatch * symbol2.hh (fastComputeTrueSort): split into 3 cases * symbol.cc (finalizeSortInfo): created to do unique sort index computation (postInterSymbolPass): no longer do unique sort index computation here (Symbol): initialize uniqueSortIndex = 0 (finalizeSortInfo): check sortConstraintFree() before setting uniqueSortIndex * symbol.hh (class Symbol): added decl for finalizeSortInfo() * associativeSymbol.cc (finalizeSortInfo): call BinarySymbol::finalizeSortInfo() before doing our stuff * symbol2.hh (fastComputeTrueSort): moved here to resolve interdepency with dagNode.hh * dagNode.hh (reduce): use fastComputeTrueSort() * symbol.cc (postInterSymbolPass): compute unique sort index * symbol.hh (fastComputeTrueSort): added (class Symbol): added decl for fastComputeTrueSort() and data member uniqueSortIndex 1999-05-04 Steven Eker * associativeSymbol.hh (class AssociativeSymbol): updated decl for checkUniformity() * associativeSymbol.cc (associativeSortCheck): use getSingleNonErrorSort() in uniform sort determination (associativeSortCheck): No longer assert that we must have at least one none error output sort; this is because we may allow ops to be defined only at the kind level at some point in the future (checkUniformity): take nrSorts rather than component 1999-04-27 Steven Eker * dagNode.hh (markIfNotMarkedAlready): added so that we can try tail recursion elimination in mark phase ===================================Engine49================================================== 1999-04-22 Steven Eker * binarySymbol.cc (idempotentSortCheck): use traverse() rather than lookupSort() (leftIdentitySortCheck): use traverse() rather than lookupSort() (rightIdentitySortCheck): not quite symmetric changes * symbol.cc (mightMatchSymbol): use specialSortHandling() to fix bug that was created when rangeComponent stopped returning 0 to indicate special sort handling * associativeSymbol.hh (class AssociativeSymbol): updated checkUniformity() decl * associativeSymbol.cc (checkUniformity): first arg make const * binarySymbol.cc (commutativeSortCompletion): use rangeComponent() and domainComponent(); removed unnecessary Assert() (leftIdentitySortCheck): use rangeComponent() and domainComponent(); removed unnecessary Assert() (rightIdentitySortCheck): symmetric changes (idempotentSortCheck): use rangeComponent() and domainComponent(); simplified ErrorCheck; removed unnecessary Assert() * associativeSymbol.cc (associativeSortBoundsAnalysis): use rangeComponent(); removed unnecessary Assert() (associativeSortStructureAnalysis): use rangeComponent(); removed unnecessary Assert() (associativeSortCheck): use rangeComponent() and domainComponent(); simplified ErrorCheck - plan to make this an assert eventually; removed unnecessary Assert() 1999-04-20 Steven Eker * term.cc (specialPrint): deleted * term.hh (class Term): deleted decl for specialPrint() * dagNode.cc (specialPrint): deleted * dagNode.hh (getTheoryBit): deleted (setTheoryBit): deleted (class DagNode): THEORY_BIT changed to HASHED (clearTheoryBit): deleted (class DagNode): deleted decls for getTheoryBit(), setTheoryBit(), clearTheoryBit() (class DagNode): deleted decl for specialPrint() ===================================Engine48================================================== ===================================Maude 1.0.2 released======================================= ===================================Maude 1.0.1 released======================================= 1999-02-18 Steven Eker * rhsAutomaton.hh (buildAliens): rewritten using isNull() ===================================VectorExperiment========================================== 1999-02-04 Steven Eker * associativeSymbol.cc (fillInSortInfo): fixed bug where we were not advancing arg iterator (associativeSortStructureAnalysis): total rewrite to check limit property before checking for purity; error sorts are always considered to be pure and are not checked; error sorts can not break main purity property and are not tested against; leq sorts have larger indices and this can be use to optimized limit sort check loops 1999-02-03 Steven Eker * binarySymbol.cc (processIdentity): use fillInSortInfo() in place of parse * symbol.cc (fillInSortInfo): added * symbol.hh (class Symbol): added decl for fillInSortInfo(); deleted decl for parse() * associativeSymbol.hh (class AssociativeSymbol): added decl for fillInSortInfo(); deleted decl for parse() * associativeSymbol.cc (associativeSortBoundsAnalysis): use traverse() rather than lookupSort() (associativeSortBoundsAnalysis): don't call insertGreaterOrEqualSorts() if tooBig already contains our sort - since tooBig is always closed upward calling insertGreaterOrEqualSorts() would be a waste of time (associativeSortBoundsAnalysis): make NatSet tooBig static and reset it with an assignment each time (associativeSortBoundsAnalysis): make NatSet unbounded static and reset it with makeEmpty() (associativeSortBoundsAnalysis): don't call insertGreaterOrEqualSorts() if our sort is the error sort (parse): made Vector sortIndices static; although we are recursive we never call ourself or anything that could call us from the block in which sortIndices is used (parse): rewritten to use traverse() rather than lookupSortIndex() where possible (fillInSortInfo): added; this is basically a 1-pass verion of parse() that deals with component errors by Assert()s rather than passing back error flags. Component errors shouldn't happen! 1999-02-02 Steven Eker * associativeSymbol.cc (checkUniformity): rewritten to use traverse() rather than lookupSort() (associativeSortCheck): completely revised uniform sort calculation loop, using traverse() rather than lookupSort() (associativeSortCheck): main sort check rewritten using traverse() rather than lookupSort(); 3 static vectors deleted (associativeSortCheck): deleted static vector v1 * binarySymbol.cc (leftIdentitySortCheck): replace lookupSort() by traverse() in one place; it doesn't seem worth the hassle to do it in the other place (rightIdentitySortCheck): symmetric change * associativeSymbol.cc (associativeSortStructureAnalysis): use traverse() rather than lookupSort() for efficiency (associativeSortStructureAnalysis): deleted indicies static vector ===================================Engine47================================================== ===================================Maude 1.00 released======================================= 1999-01-21 Steven Eker * memoryManager.cc (collectGarbage): call Module::notifyOfGC() 1999-01-16 Steven Eker * term.hh (class Term): make sortIndex a short and changed its position to save a word ===================================Engine46================================================== 1998-12-23 Steven Eker * dagNode.hh (class DagNode): set nrWords = 3, ARENA_SIZE = 5460 (class DagNode): delete data member dummyWord ===================================Engine45================================================== Tue Nov 10 16:32:10 1998 Steven Eker * memoryManager.cc (collectGarbage): become a no-op if no arenas have yet been allocated; We could get called when deleted a module even though no dag nodes have been allocated! Fri Nov 6 15:17:07 1998 Steven Eker * term.hh (class Term): deepCopy() -> deepCopy2(); added non-virtual decl for deepCopy() (deepCopy): added; we call deepCopy2() and then copy the line number Tue Nov 3 19:20:17 1998 Steven Eker * term.hh (class Term): derive from LineNumber * symbol.hh (class Symbol): derive from LineNumber ===================================Engine43================================================== Thu Oct 29 12:10:02 1998 Steven Eker * associativeSymbol.cc (associativeSortCheck): Give single detailed warning rather that huge list of warning for an associative operator with non-associative sort declarations Fri Oct 16 09:56:41 1998 Steven Eker * memoryManager.cc (checkArenas): added, to search for bugs in GC (checkInvariant): added (collectGarbage): fix nasty bug by calculating endPointer _after_ we have created any extra arenas (slowNew): assert that d->flags == 0 rather than clear d->flags in the allocate new arena case ifdef GC_DEBUG used throughout file to control inclusion of self test and dump code Thu Oct 15 14:47:46 1998 Steven Eker * binarySymbol.cc (getIdentityDag): moved to .hh file and made inline (interSymbolPass): simplified using CachedDag::normalize() (processIdentity): simplified using CachedDag::prepare() Wed Oct 14 10:14:00 1998 Steven Eker * binarySymbol.hh (class BinarySymbol): deleted dtor decl * binarySymbol.cc (BinarySymbol): use CachedDag ctor (~BinarySymbol): deleted (interSymbolPass): use CachedDag::setTerm() and getTerm() (reset): use CachedDag::reset() (processIdentity): use CachedDag::getTerm() (getIdentityDag): simplified using CachedDag::getDag() (leftIdentitySortCheck): use CachedDag::getTerm() (rightIdentitySortCheck): use CachedDag::getTerm() * binarySymbol.hh (class BinarySymbol): use CachedDag rather than Term* and DagRoot (setIdentity): use CachedDag::setTerm() and getTerm() (takeIdentity): use CachedDag::getTerm() (getIdentity): use CachedDag::getTerm() * dagNode.hh (class DagNode): doubled RESERVE_SIZE to 256 since we seem to be allocated lots of extra arenas on big_sieve example. (class DagNode): reduced ARENA_SIZE to 4 * 1024 - 1 to see what effect that has ===================================Engine42================================================== Thu Oct 8 11:54:12 1998 Steven Eker * dagNode.hh (DagNode): deleted default ctor * memoryManager.cc (allocateNewArena): removed static_cast (slowNew): removed static_cast (4 places) (tidyArenas): removed static_cast (2 places) (collectGarbage): removed static_cast (firstNode): added to Arena (allocateNewArena): use firstNode() (slowNew): use firstNode() (4 places) (tidyArenas): use firstNode() (2 places) (collectGarbage): use firstNode() * dagNode.hh (DagNode): added default ctor; for use by DummyDagNode ctor only Tue Sep 29 11:47:25 1998 Steven Eker * memoryManager.cc (slowNew): clear flags before returning pointer to dagnode in all except new arrena case (since new areanas always have their flags zeroed * dagNode.hh (DagNode): don't clear flags because we can't afford to lose mark flag during in place replacement (new): (normal version) clear flags before returning pointer to dagnode (new): (overwrite version) clear all flags _except_ MARKED before returning pointer to dagnode * memoryManager.cc (collectGarbage): major bug! we weren't setting endPointer after gc (slowNew): fixed subtle bug; when new() calls us it has not updated nextNode so if we try to use reserve we end up overwriting nodes which are actually in use (but have just had their marked flags reset buy this lazy sweep. Of couse we could update nextNode in new() but since it is a macro we chose to update nextNode here; there is an invariant that the correct value of nextNode when we are called is actually endPointer and so we can use this in the reserve case; in all other cases we change arena and reset nextNode as a matter of course (tidyArenas): inefficient hack to avoid relying on lastActiveArena and lastActiveNode in order to locate a bug * dagNode.hh (class DagNode): added decl for dumpMemoryVariables() * memoryManager.cc (dumpMemoryVariables): added Mon Sep 28 11:22:30 1998 Steven Eker * dagNode.hh (class DagNode): added static data member currentArenaPastActiveArena * memoryManager.cc (slowNew): handle initial case (currentArena == 0) (allocateNewArena): return pointer to new arena (tidyArenas): handle currentArenaPastActiveArena flag * dagNode.hh (class DagNode): added decls for tidyArenas() and slowNew() (okToCollectGarbage): test needToCollectGarbage (class DagNode): deleted static data members arenaList, freeList and nrFree (class DagNode): updated decl for allocateNewArena() * memoryManager.cc (tidyArenas): added * dagNode.hh (class DagNode): added static data member nrArenas (mark): increment nrNodesInUse * memoryManager.cc (allocateNewArena): reimplemented (collectGarbage): rewritten * dagNode.hh (class DagNode): added static data members nrNodesInUse and needToCollectGarbage Fri Sep 25 17:51:37 1998 Steven Eker * dagNode.hh (new): reimplemented using lazy sweep idea (DummyDagNode): moved definition here (class DagNode): added static data members nextNode, endPointer, currentArena, lastActiveArena, lastActiveNode ===================================Engine41================================================== Mon Sep 21 11:20:34 1998 Steven Eker * symbol.cc (parse): lookupSortIndex() doesm't work in the nrArgs == 0 case so use traverse(0, 0) instead Sat Sep 19 16:34:08 1998 Steven Eker * symbol.cc (parse): need to initialize sortIndices with a size! Thu Sep 17 13:22:55 1998 Steven Eker * associativeSymbol.cc (parse): rewritten using lookupSortIndex() * symbol.cc (parse): use lookupSortIndex() (2 places) * associativeSymbol.cc (checkUniformity): use leq(int, Sort*) (2 places) (insertGreaterOrEqualSorts): use leq(Sort*, int) (associativeSortStructureAnalysis): use leq(Sort*, Sort*) (2 places) (associativeSortStructureAnalysis): use leq(int, Sort*) (2 places) * term.cc (hasGeqOrIncomparableVariable): use leq(Sort*, Sort*) (2 places) * symbol.cc: (mightMatchSymbol): use leq(Sort*, Sort*) (2 places) * dagNode.cc (checkSort): (Subproblem*& version) use leq() (2 places) (checkSort): (RewritingContext& version) use leq() (2 places) * binarySymbol.cc (mightMatchOurIdentity): use Term::leq() (2 places) (leftIdentitySortCheck): use leq(int, Sort*) (will probably chnage in future) (rightIdentitySortCheck): use leq(int, Sort*) (idempotentSortCheck): use leq(Sort*, int) * binarySymbol.hh (takeIdentity): use Term::leq() * term.hh (leq): added (operator<=): deleted (class Term): added decl for leq() * dagNode.hh (leq): added (operator<=): deleted (class DagNode): added decl for leq() * term.cc (dumpCommon): don't dump sortCode * term.hh (class Term): deleted decl for getSortCode(); updated decl for setSortInfo() (class Term): deleted data member sortCode (dagify): use DagNode::setSortIndex() (getSortCode): deleted (setSortInfo): no longer set sortCode * dagNode.hh (class DagNode): decl for setSortInfo() becomes setSortIndex(); decl for getSortCode() deleted (class DagNode): deleted data member sortCode; added data member dummyWord to take its place (setSortInfo): becomes setSortIndex() (getSortCode): deleted Fri Sep 11 10:07:33 1998 Steven Eker * dagNode.cc (checkSort): use Sort* rather than SortCode& throughout (both versions); need to optimize these sometime (matchVariable): use new checkSort() convention * dagNode.hh (class DagNode): updated both checkSort() decls * binarySymbol.cc (mightMatchOurIdentity): use <=(Term*, Sort&) instead of code() * binarySymbol.hh (takeIdentity): use <=(Term*, Sort&) instead of code() * term.hh (operator<=): (Term*, Sort&) added * associativeSymbol.cc (checkUniformity): switched <=(int, Sort&) for >=(Sort&, int) (associativeSortStructureAnalysis): switched <=(int, Sort&) for >=(Sort&, int) * term.cc (hasGeqOrIncomparableVariable): use <= on Sorts instead of code() * symbol.cc (mightMatchSymbol): use <= on Sorts instead of code() * binarySymbol.cc (leftIdentitySortCheck): use <= on Sorts instead of code() (rightIdentitySortCheck): symmetric change (idempotentSortCheck): use <= on Sorts instead of code() * associativeSymbol.cc (associativeSortStructureAnalysis): use <= on Sorts and (Sort, int) pairs instead of code() Thu Sep 10 15:55:51 1998 Steven Eker * associativeSymbol.cc (checkUniformity): use <= on Sorts instead of code() (insertGreaterOrEqualSorts): use <= on Sorts instead of code() (checkUniformity): use >= on (Sort, int) pair instead of <= on Sorts * symbol.cc (dump): dumpSortTable() -> dumpSortDiagram() Wed Sep 9 11:45:44 1998 Steven Eker * binarySymbol.cc (commutativeSortCompletion): rewritten; now works by using addOpDeclaration() rather than adjustSort() because commutative sort completion can potential eliminate a pre-regularity problem and anyway it will be hard to implement adjustSort() when we upgrade from sort tables to sort decision diagrams. ===================================Engine40================================================== Mon Jul 20 19:14:44 1998 Steven Eker * term.hh (class Term): added decl for deepCopy() ===================================Engine39================================================== Thu Jun 11 17:42:03 1998 Steven Eker * term.cc (commonSymbols): cast PointerSet::insert() return value to void (*2) * term.hh (addCollapseSymbol): cast PointerSet::insert() return value to void Wed Jun 10 17:02:36 1998 Steven Eker * binarySymbol.cc (interSymbolPass): added * binarySymbol.hh (normalizeIdentity): deleted (class BinarySymbol): deleted normalizeIdentity() decl; added interSymbolPass() decl * binarySymbol.cc (BinarySymbol): don't initialize identity status * symbol.cc (interSymbolPass): added (postInterSymbolPass): added * symbol.hh (class Symbol): added decls for interSymbolPass() and postInterSymbolPass() * binarySymbol.cc (processIdentity): removed normalization code * binarySymbol.hh (class BinarySymbol): deleted enum IdentityStatus, and data member identityStatus (class BinarySymbol): added decl for normalizeIdentity() (normalizeIdentity): added * binarySymbol.cc (earlyGetIdentity): deleted * binarySymbol.hh (class BinarySymbol): deleetd decl for earlyGetIdentity() * term.hh (class Term): added changed flag to decl for normalize() Tue Jun 9 18:01:41 1998 Steven Eker * associativeSymbol.hh: IntSet -> NatSet * term.cc: IntSet -> NatSet * binarySymbol.cc: IntSet -> NatSet * associativeSymbol.cc: IntSet -> NatSet * term.hh: IntSet -> NatSet ===================================Engine38================================================== Thu Jun 4 10:57:22 1998 Steven Eker * binarySymbol.cc (BinarySymbol): need to initialize identityStatus (leftIdentitySortCheck): make sure identity is in correct component (rightIdentitySortCheck): make sure identity is in correct component * binarySymbol.hh (setIdentity): fixed buggy Assert Wed Jun 3 15:28:50 1998 Steven Eker * associativeSymbol.cc (processIdentity): added * associativeSymbol.hh (class AssociativeSymbol): added decl for processIdentity() * binarySymbol.hh (setIdentity): added; we now allow identity to be set after the the symbol is created as long as the identity was originally 0 * binarySymbol.cc (earlyGetIdentity): added (processIdentity): normalize identity and mark it as such. (BinarySymbol): don't normalize identity (~BinarySymbol): destruct identity if it exists; we assume identities are not shared bewteen symbols. * binarySymbol.hh (class BinarySymbol): added enum IdentityStatus; decl for earlyGetIdentity() Mon Apr 13 10:38:26 1998 Steven Eker * symbol.hh (class Symbol): inherit from ModuleItem ===================================Engine37================================================== Thu Feb 26 12:11:11 1998 Steven Eker * dagNode.hh (operator<=): for (const DagNode* dagNode, const Sort& sort); put here rather than in sort.hh because of inclusion order conflict Tue Feb 24 11:07:20 1998 Steven Eker * interface.cc (dump): added as temporary hack * dagNode.cc (dump): added (dumpCommon): added * dagNode.hh (class DagNode): added decls for dump() and dumpCommon() * subproblem.hh (class Subproblem): added virtual function dump Fri Feb 20 15:42:07 1998 Steven Eker * dagNode.hh (class DagNode): added decls for setUnrewritable() and isUnrewritable() (isUnrewritable): added (setUnrewritable): added (class DagNode): added decls for setUnstackable() and isUnstackable() (setUnstackable): addded (isUnstackable): added Thu Feb 19 17:22:43 1998 Steven Eker * symbol.cc (parse): simplified; no longer need to handle the flattened assoc case * associativeSymbol.cc (parse): added * associativeSymbol.hh (class AssociativeSymbol): added decl for parse() ===================================Engine36================================================== Fri Feb 13 13:47:51 1998 Steven Eker * binarySymbol.cc (~BinarySymbol): commented out identity destruct code because of serious bug if identity shared Wed Feb 11 15:38:44 1998 Steven Eker * binarySymbol.cc (mightMatchOurIdentity): compare() replaced by equal() * dagNode.hh (equal): added (class DagNode): added decl for equal() * term.hh (class Term): for added decls for equal() (Term* and dagNode* versions) (equal): added (Term* version) (equal): added (DagNode* version) * subproblem.hh (class Subproblem): abstract function deepSelfDestruct() deleted; standard destructor will now be deep ===================================Engine35================================================== Thu Jan 8 15:42:40 1998 Steven Eker * binarySymbol.cc (mightMatchOurIdentity): commented out assertion that subterm is not our identity since this can happen if we only have a left or right identity (mightMatchOurIdentity): must return true if subterm is our identity - even though it is ground Tue Dec 23 12:34:21 1997 Steven Eker * term.hh (class Term): added greedySafe() decl * term.cc (greedySafe): added Thu Dec 18 17:53:51 1997 Steven Eker * binarySymbol.hh (takeIdentity): added (class BinarySymbol): added takeIdentity() decl Tue Dec 16 16:47:01 1997 Steven Eker * interface.hh: added forward decl for class HeuristicLhsAutomaton * heuristicLhsAutomaton.cc: created * heuristicLhsAutomaton.hh: created ===================================Engine34================================================== Fri Dec 5 11:20:28 1997 Steven Eker * associativeSymbol.hh (class AssociativeSymbol): added decl for finalizeSortInfo(); made associativeSortCheck(), associativeSortBoundsAnalysis() and associativeSortStructureAnalysis() private * associativeSymbol.cc (finalizeSortInfo): added Thu Dec 4 12:43:10 1997 Steven Eker * symbol.hh: commented out all inert stuff; I don't think we need it now that we don't try and build stuff already reduced * associativeSymbol.cc (AssociativeSymbol): deleted inert arg * associativeSymbol.hh (class AssociativeSymbol): deleted inert arg from ctor decl * binarySymbol.cc (BinarySymbol): deleted inert arg * binarySymbol.hh (class BinarySymbol): deleted inert arg from ctor decl * symbol.cc (Symbol): deleted inert arg; set inertFlag = true * symbol.hh (class Symbol): added decl for noteSpecialSemantics() (class Symbol): deleted inert arg from ctor decl (noteSpecialSemantics): added Tue Dec 2 16:15:51 1997 Steven Eker * dagNode.hh (class DagNode): added decl for copyAndReduce() (copyAndReduce): added Mon Dec 1 10:29:28 1997 Steven Eker * binarySymbol.hh (getPermuteStrategy): made const * associativeSymbol.cc: created from old permuteSymbol.cc (AssociativeSymbol): greatly simplified; use setPermuteStrategy() (commutativeSortCompletion): deleted * associativeSymbol.hh (class AssociativeSymbol): created from old PermuteSymbol class (class AssociativeSymbol): enum Strategy deleted (class AssociativeSymbol): decls for strategy() and commutativeSortCompletion() deleted (class AssociativeSymbol): strat data member deleted (strategy): deleted * binarySymbol.cc (commutativeSortCompletion): copied from PermuteSymbol * binarySymbol.hh (class BinarySymbol): added decl forcommutativeSortCompletion() * binarySymbol.cc (setPermuteStrategy): added * binarySymbol.hh (class BinarySymbol): added decl for setPermuteStrategy() (class BinarySymbol): added enum PermuteStrategy (class BinarySymbol): added decl for getPermuteStrategy() (getPermuteStrategy): added Wed Nov 26 17:53:58 1997 Steven Eker * symbol.hh (class Symbol): derive from Strategy Mon Nov 24 19:36:19 1997 Steven Eker * interface.cc: no longer provide implemetation for rhsAutomaton.hh * rhsAutomaton.cc (dump): added (~RhsAutomaton): added * rhsAutomaton.hh (class RhsAutomaton): added decl for buildAliens() and data member aliens (buildAliens): added (class RhsAutomaton): added decl for addAlien() Sun Nov 23 16:06:27 1997 Steven Eker * rhsAutomaton.hh (class RhsAutomaton): added variableInfo arg to dump() * lhsAutomaton.hh (class LhsAutomaton): rearranged dump(); indentLevel is now last and variableInfo is a reference ===================================Engine33================================================== Fri Nov 21 14:35:51 1997 Steven Eker * dagNode.hh (class DagNode): unusedByte changed to theoryByte (getTheoryByte): added (setTheoryByte): Tue Nov 18 18:07:20 1997 Steven Eker * term.cc (dumpCommon): added (dump): rewritten (dumpArguments): deleted * term.hh (class Term): replace dumpArguments() decl with dumpCommon(); virtualized dump() * term.cc (dump): switch order of variableInfo and indentLevel (dumpVariableSet): pass variableInfo by ref (dump): removed const (dumpArguments): removed const * term.hh (class Term): put variableInfo before indentLevel and pass it by reference Mon Nov 17 10:28:42 1997 Steven Eker * dagNode.hh (class DagNode): added decls for getTheoryBit(), setTheoryBit(), clearTheoryBit() (getTheoryBit): added (setTheoryBit): added (clearTheoryBit): added ===================================Engine32================================================== Wed Nov 5 10:43:36 1997 Steven Eker * binarySymbol.cc (getIdentityDag): moved here from binarySymbol.hh * memoryManager.cc (collectGarbage): removed call to BinarySymbol::invalidateIdentityDags() * binarySymbol.cc (reset): added deleted listHead * binarySymbol.hh (class BinarySymbol): deleted decls for invalidateIdentityDags() and makeIdentityDag() (class BinarySymbol): deleted secl for listHead * binarySymbol.cc (makeIdentityDag): deleted * binarySymbol.hh (getIdentityDag): actually make the identity dag if it does not exist * binarySymbol.cc (BinarySymbol): simplified (BinarySymbol): greatly simplified (invalidateIdentityDags): deleted * binarySymbol.hh (class BinarySymbol): added decl for reset() (class BinarySymbol): change identityDag from a DagNode* to a DagRoot; delete nextActive and prevActive (getIdentityDag): use DagRoot::getNode() * symbol.cc (reset): added * symbol.hh (class Symbol): made mightMatchPattern() public (class Symbol): deleted decls for scMightMatchSymbol() and retainSortConstraint() (class Symbol): added decl for virtual function reset() * symbol.cc (mightMatchSymbol): use safeToInspectSortConstraints() (retainSortConstraint): deleted (acceptSortConstraint): simplified to old retainSortConstraint() def (scMightMatchSymbol): deleted * term.hh (class Term): added decl for commonWithOtherPatterns() and hasGeqOrIncomparableVariable() * term.cc (commonSymbols): added (commonWithOtherPatterns): added (hasGeqOrIncomparableVariable): added * term.hh (class Term): added decl for commonSymbols() =============================Engine31======================================================== Wed Oct 29 10:20:23 1997 Steven Eker * extensionInfo.hh (valid): changed to validAfterMatch() (clear): changed to setValidAfterMatch() (setWholeFlag): changed to setMatchedWhole() (setMatchedWhole): no longer mess with valid flag (matchedWhole): no longer make assertion about valid flag (class ExtensionInfo): changed all decls to agree with preceedng changes Tue Oct 28 09:14:40 1997 Steven Eker * extensionInfo.hh (ExtensionInfo): added (valid): added (reset): added (matchedWhole): Assert that validFlag is true (setWholeFlag): set valid flag to true (class ExtensionInfo): added decls for ExtensionInfo(), valid() and reset(); Added data member validFlag; changed fro bool to Bool (reset): renamed to clear() (ExtensionInfo): deleted Mon Oct 27 10:57:55 1997 Steven Eker * extensionInfo.hh (class ExtensionInfo): added two new virtual function decls makeClone() and copy() to overcome the following problem: Suppose in a multiway collapse at tome with extension, one or more of the alternatives fills out the extensionInfo structure. Then when we form a subproblemDisjunction this information is lost (since there is only one extensionInfo structure provided by the match() caller). With these functions SubproblemDisjuction can make local copies of extension info for each branch. We will now have an invariant on match algorithms: if you return a subproblem then you may not fill out the extensionInfo structure at match time. Fri Oct 24 13:26:16 1997 Steven Eker * memoryManager.cc (collectGarbage): call DagRoot::markReachableNodes() * extensionInfo.hh (class ExtensionInfo): subject and getSubject decl deleted; subject arg to ctor deleted; this stuff is better of in the derived classes (ExtensionInfo): deleted (getSubject): deleted Thu Oct 23 18:11:15 1997 Steven Eker * extensionInfo.hh (class ExtensionInfo): major reorganization with new data member subject and new function members (ExtensionInfo): added explicitly; now takes argument (getSubject): added Tue Oct 21 11:31:02 1997 Steven Eker * term.cc (dagify): renamed to term2Dag() * term.hh (class Term): protected dagify() make public and public dagify() renamed to term2Dag() * binarySymbol.cc (makeIdentityDag): use new dagify with setSortInfo = true. This fixes a long standing bug in ACU where we were matching abstracted patterns against indentity dags that might have uninitialized sort info below the top symbol. VariableAbstractionSubproblem::solve() had a small hack to fix the problem in the case where it was used to resolve abstracted patterns but in other cases where abstracted patterns were resolved directly in the ACU matcher the problem remained. * term.hh (dagify): enter sort info into dag and set reduced flag if we are in setSortInfo mode * term.cc (dagify): added public version of dagify() that sets up global data and then calls protected version of dagify() * term.hh (class Term): added subDags and converted as static data members (class Term): add protected no arguments version of dagify() (class Term): make public version of dagify just take setSortInfo arg (class Term): removed args from dagify2() Thu Oct 16 14:25:02 1997 Steven Eker * binarySymbol.cc (mightMatchOurIdentity): added Assert to check for null identity (mightMatchOurIdentity): return false if null identity because that is what caller expects; this bug mut have been around since the analyseCollapses()/insertAbstractionVariables() split Tue Oct 14 10:42:37 1997 Steven Eker * permuteSymbol.cc (PermuteSymbol): changed args (mightCollapseToOurSymbol): added * permuteSymbol.hh (class PermuteSymbol): added decl for mightCollapseToOurSymbol() (class PermuteSymbol): rearranged args for ctor * memoryManager.cc (collectGarbage): call BinarySymbol::invalidateIdentityDags() * binarySymbol.cc (mightMatchOurIdentity): added (processIdentity): added (invalidateIdentityDags): added (makeIdentityDag): link symbol onto active identity list (~BinarySymbol): link symbol from active identity list * binarySymbol.hh (class BinarySymbol): deleted identityAutomaton and identitySubstitution * binarySymbol.cc (rightIdentitySortCheck): deleted arg (leftIdentitySortCheck): deleted arg * binarySymbol.hh (getIdentity): added (getIdentityDag): added * binarySymbol.cc (BinarySymbol): rewritten * binarySymbol.hh (class BinarySymbol): deleted constructor arg and added identity arg to ctor; added decls for getIdentity(), getIdentityDag(), processIdentity(), makeIdentityDag() (class BinarySymbol): added data members identity, identityDag, identityAutomaton, identitySubstitution (class BinarySymbol): deleted arg from leftIdentitySortCheck() and rightIdentitySortCheck() (class BinarySymbol): added decl for mightMatchOurIdentity() * dagNode.hh (new): replaced old style cast with static_cast (both new functions) * term.cc (indexVariables): use VariableSymbol::dynamicCast() * term.hh (stable): use VariableSymbol::dynamicCast() * symbol.cc (Symbol): rewritten to reflect new design (scMightMatchSymbol): use VariableSymbol::dynamicCast() (mightMatchSymbol): use VariableSymbol::dynamicCast() and getSort() * symbol.hh (class Symbol): deleted enum Theory; deleted constructor flag from ctor; theory arg in now a const string. (constructor): deleted (theory): now return const char* Mon Oct 13 12:41:28 1997 Steven Eker * term.cc (analyseCollapses): added (determineCollapseSymbols): added (determineCollapseSymbols): deleted * term.hh (class Term): added decls for analyseCollapses() and insertAbstractionVariables(); deleted decl for determineCollapseSymbols() Fri Oct 10 16:54:44 1997 Steven Eker * term.cc (indexVariables): VariableIndex -> VariableInfo (indexVariables): symbol2Index() -> variable2Index() (determineCollapseSymbols): VariableIndex -> VariableInfo (dump): VariableIndex -> VariableInfo (dumpArguments): VariableIndex -> VariableInfo (dumpVariableSet): VariableIndex -> VariableInfo (dumpVariableSet): index2Symbol() -> * lhsAutomaton.hh (class LhsAutomaton): VariableIndex -> VariableInfo * term.hh (class Term): VariableIndex -> VariableInfo =================================Engine30================================================== Thu Oct 9 10:27:10 1997 Steven Eker * dagNode.hh (new): only call dtor iff CALL_DTOR * memoryManager.cc (collectGarbage): only call virtual destructor for garbage collected dag nodes that have their CALL_DTOR flag set. * dagNode.hh (needToCallDtor): added (setCallDtor): added * argVec.hh (class ArgVec): ctor deleted; initialize() added; we should now be able to use ArgVec in unions (class ArgVec): change unmade since we can't use ArgVec in FreeDagNode union after all :-( (See FreeTheory for reason.) * dagNode.hh (class DagNode): added UNREWRITABLE, UNSTACKABLE, CALL_DTOR and THEORY_BIT to flags (class DagNode): flags type changed to Ubyte Wed Oct 8 11:35:05 1997 Steven Eker * dagNode.hh (mark): undid small optimization as it made 0 difference (compiler must do this optimization itself) (copyEagerUptoReduced): setMarked() right after isMarked() to allow compiler to optimize memory ref (clearCopyPointers): clearMarked() right after isMarked() to allow compiler to optimize memory ref (clearCopied): added (setCopied): added (isCopied): added (copyEagerUptoReduced): use isCopied() and setCopied() (clearCopyPointers): use isCopied() and clearCopied() * memoryManager.cc (collectGarbage): undid small optimization as it made 0 difference (compiler must do this optimization itself) * dagNode.hh (mark): make small optimization to testing and setting marked flag * memoryManager.cc (collectGarbage): use isMarked() and clearMarked (collectGarbage): replaced old style casts with static_cast<>s; Made small optimization to testing and clearing marked flag. * dagNode.hh (isMarked): added (clearMarked): added (setMarked): added (setReduced): changed to use flags (isReduced): changed to use flags (class DagNode): added enum Flags; added flags and unusedByte data members; deleted reduced and marked data members (DagNode): clear flags rather than reduced and marked (mark): use isMarked() and setMarked() (copyEagerUptoReduced): use isMarked() and setMarked() Tue Oct 7 15:17:40 1997 Steven Eker * symbol.hh: added decl for pure virtual makeDagNode() Fri Oct 3 18:49:11 1997 Steven Eker * term.cc (hash): deleted (isEqual): deleted * term.hh (class Term): no longer derived from DataSet::Data (class Term): TermSet replaces DataSet throughout (dagify): use term2Index() rather than data2Index() =================================Engine29================================================== Thu Oct 2 16:52:58 1997 Steven Eker * term.hh (term): DataSet::Data inheritance changed to protected so that derived classes can down cast and up cast to and from Data* (term): now changed to public because protected didn't work * term.cc (findEqual): deleted * term.hh (term): deleted decl for findEqual() (term): changed compileRhs() compiled decl from Vector to DataSet& Tue Sep 30 10:49:14 1997 Steven Eker * term.hh (Term): converted is now a DataSet ref (dagify): added (Term): derivation is now private, dagify2() decl added * term.cc (isEqual): added (hash): added * term.hh (hash): added 2 and 3 arg versions (class Term): derive from DataSet::Data * symbol.hh (getHashValue): added * term.hh (setHashValue): added (getHashValue): added (class Term): added data member hashValue Thu Sep 25 15:29:18 1997 Steven Eker * permuteSymbol.cc (commutativeSortCompletion): use getOpDeclarations() (associativeSortCheck): use getOpDeclarations() (associativeSortBoundsAnalysis): use getOpDeclarations() (associativeSortStructureAnalysis): use getOpDeclarations() (associativeSortCheck): use getSortConstraints() (associativeSortBoundsAnalysis): use getSortConstraints() (associativeSortStructureAnalysis): use getSortConstraints() * binarySymbol.cc (leftIdentitySortCheck): use getOpDeclarations() (rightIdentitySortCheck): use getOpDeclarations() (idempotentSortCheck): use getOpDeclarations() * symbol.hh (class Symbol): added decl for finalizeSymbol() * symbol.cc (mightMatchSymbol): rewritten to use new rangeComponent() (scMightMatchSymbol): rewritten to use new rangeComponent() (parse): rewritten to use new rangeComponent() and domainComponent() (finalizeSymbol): added Wed Sep 24 11:52:47 1997 Steven Eker * symbol.cc (retainSortConstraint): added * symbol.hh (class Symbol): heavily rewritten; now derived from SortTable, SortConstraintTable, EquationTable and RuleTable =================================Engine28================================================== Sat Aug 30 12:52:24 1997 Steven Eker * sortHandling.cc (parse): in the 0 arg case if there is only one op dec, don't use sort table since it may not exist * symbol.hh (class Symbol): made Vector > version of lookupUnionSort() private. * sortHandling.cc (parse): rewritten to use Vector version of lookupUnionSort() (lookupUnionSort): if there is a single op decl don't bother finding maximal sorts or looking for the sort table * symbol.hh (lookupSort): now handle the case where there the sort table is not built. (class Symbol): added decl for buildSortTable() * sortHandling.cc (buildSortTable): added (compileOpDeclarations): rewritten using buildSortTable() (adjustSort): call buildSortTable() if sort table is not Fri Aug 29 13:31:55 1997 Steven Eker * ruleHandling.cc (applyRules): ignore rules that are not variable safe. =================================Engine27================================================== Mon Aug 25 12:18:01 1997 Steven Eker * dagNode.hh (reduce): fixed a bug where no rewrite took place but top symbol changed due to collapse. We now reload top symbol before calling computeBaseSort() and constrainToSmallerSort() (reduce): loop simplified because we don't try and save the top symbol for the sort calculation Tue Aug 5 16:49:59 1997 Steven Eker * sortHandling.cc (findMinResultSort): fixed very long standing bug. When infSoFar == resultCode we must still see if result is applicable since it may be the least sort; infSoFar is found by the meets of several sorts so it may have the code of the least sort without having considered the least sort. The bug leads to warnings about "failed pre-regularity check" and incorrect sort tables for certain complicated pre-regular signatures. Wed Jul 30 18:31:07 1997 Steven Eker * dagNode.hh (class DagNode): added decl for virtual specialPrint() * dagNode.cc (specialPrint): added * term.hh (class Term): added decl for virtual specialPrint() * term.cc (specialPrint): added Tue Jul 29 16:47:11 1997 Steven Eker * symbol.hh (class Symbol): added NA_THEORY to enum Theory * sortHandling.cc (compileOpDeclarations): added symbol printout to Assert for no operator declarations Wed Jul 23 11:25:10 1997 Steven Eker * term.hh (class Term): added full arg to normalize =====================================Engine26b====================================== Fri Jul 18 15:50:17 1997 Steven Eker * dagNode.hh (class DagNode): added decls for normalizeEagerUpToReduced2() and normalizeEagerUpToReduced() (normalizeEagerUpToReduced): added (normalizeEagerUptoReduced): (26b) deleted (class DagNode): (26b) stripped all normalizeEagerUpToReduced() stuff Thu Jul 17 11:23:41 1997 Steven Eker * term.hh (hasEagerContext): added Tue Jul 15 15:12:06 1997 Steven Eker * permuteSymbol.hh (class PermuteSymbol): added inert arg to ctor * binarySymbol.cc (BinarySymbol): added inert arg * binarySymbol.hh (class BinarySymbol): added inert arg to ctor * symbol.cc (Symbol): initialize symbolInert * symbol.hh (equationFree): made from old inert() (offerSortConstraint): clear symbolInert flag (offerEquation): clear symbolInert flag (inert): added (class Symbol): added symboInert data member =======================================Engine26================================================= Wed Jul 9 18:15:55 1997 Steven Eker * symbol.hh (class Symbol): made inert() public Tue Jul 1 10:33:55 1997 Steven Eker * symbol.hh (compare): no longer reverse order; symbols with big arity are considered bigger than those with small arity; amongst symbols with same arity newer symbols are bigger than older symbols. Fri Jun 27 15:40:04 1997 Steven Eker * dagNode.hh (class DagNode): copyEagerUptoReduced(), clearCopyPointers(), copyEagerUptoReduced2(), clearCopyPointers2() made protected (copyReducible): added; this will be used in preference to copyUptoReduced() since with the latter we often forget to call clearCopyPointers(), introducing a subtle bug into the code. (class DagNode): copyEagerUptoReduced(), clearCopyPointers() since for some reason we can't call them from ACU_DagNode!! (is this a g++ bug?) (class DagNode): nrWords changed to 4; (class DagNode): topSymbol and copyPointer made into an anonymous union (copyEagerUptoReduced): use new marked protocol (clearCopyPointers): use new marked protocol and restore topSymbol (DagNode): don't clear copy pointer since in now shares the top symbol slot. This has the advantage of speeding up dagNode initialization by 1 write (clearCopyPointers): fix bug where we were calling clearCopyPointers2() before restoring top symbol; this is fatal because some derived classes (eg FreeDagNode) will inspect top symbol in clearCopyPointers2() Wed Jun 25 12:02:15 1997 Steven Eker * dagNode.cc (checkSort): pass purpose arg to makeSubcontext() Tue Jun 24 14:49:23 1997 Steven Eker * permuteSymbol.cc: added #include "variable.hh" * binarySymbol.cc: added #include "variable.hh" * symbol.cc: added #include "variable.hh * term.cc: added #include "variableTerm.hh" Tue Jun 17 11:15:27 1997 Steven Eker * interface.cc: deleted template class Vector * sortConstraintHandling.cc (acceptSortConstraint): added (scMightMatchSymbol): added (compileSortConstraints): greatly simplified (orderSortConstraints): added (constrainToSmallerSort2): greatly simplified; native and foreign sort constraints are now all handle by the same loop (addForeignSortConstraint): deleted (offerForeignSortConstraint): deleted Mon Jun 16 12:10:32 1997 Steven Eker * symbol.cc (mightMatchSymbol): adapted from mightHaveSort() (mightMatchPattern): added * ruleHandling.cc (compileRules): greatly simplified (acceptRule): added (applyRules): simplified; no longer have to deal with foreign rules (applySpecificRule): simplified; no longer have to deal with foreign rules (offerForeignRule): deleted * equationHandling.cc (acceptEquation): added (compileEquations): greatly simplified (applyReplace): no longer bother with foreignApplyReplace() (foreignApplyReplace2): deleted (offerForeignEquation): deleted * sortConstraintHandling.cc: created * symbol.cc: most functionality moved out into sortHandling.cc, sortConstraintHandling.cc, equationHandling.cc, ruleHandling.cc * equationHandling.cc: created * ruleHandling.cc: created * sortHandling.cc: created (finalizeSortInfo): added * symbol.hh (class Symbol): added decls for orderSortConstraints(), acceptSortConstraint(), acceptEquation(), acceptRule() (offerSortConstraint): added (offerEquation): added (offerRule): added Fri Jun 13 18:55:51 1997 Steven Eker * symbol.hh: total rewrite to remove foreign stuff Wed Jun 11 10:28:15 1997 Steven Eker * term.cc (findBestSequence): delete both * term.hh (willGroundOutMatch): added (class Term): delete findBestSequence() decls Fri Jun 6 11:52:15 1997 Steven Eker * dagNode.cc (partialReplace): better error reporting (partialConstruct): better error reporting (matchVariable): use DagNode::matchVariableWithExtension() * symbol.cc (matchVariableWithExtension): deleted * dagNode.cc (matchVariableWithExtension): added * dagNode.hh (class DagNode): decl for matchVariableWithExtension() added * symbol.hh (class Symbol): decl for matchVariableWithExtension() deleted Thu Jun 5 11:12:46 1997 Steven Eker * dagNode.hh (copyEagerUptoReduced): added (clearCopyPointers): added (getCopyPointer): deleted (setCopyPointer): deleted (class DagNode): decls for copyEagerUptoReduced() and clearCopyPointers() made non-virtual; (class DagNode): decls for virtual functions copyEagerUptoReduced2() and clearCopyPointers2() added (class DagNode): decls for setCopyPointer() and getCopyPointer() deleted * dagNode.cc (checkSort): added RewritingContext& version (computeTrueSortWhilePreservingContext): deleted memory management code split off into memoryManager.cc * dagNode.hh (class DagNode): added decl for checkSort(const SortCode& boundCode, RewritingContext& context) deleted decl for computeTrueSortWhilePreservingContext() * binarySymbol.cc (BinarySymbol): removed stable arg * permuteSymbol.cc (PermuteSymbol): removed stable arg * symbol.cc (Symbol): removed stable arg * symbol.hh (stable): deleted (class Symbol): delete symbolStable ==============================Engine24==================================== Thu May 29 16:29:44 1997 Steven Eker * term.cc (determineCollapseSymbols): set honorsGroundOutMatchFlag true unless we have a subterm for which its flag false. (dump): print honorsGroundOutMatchFlag * term.hh (class Term): added honorsGroundOutMatchFlag. We set this flag to indicate that matching with this term as pattern will not return a subproblem if all the variables below are already bound. We used to assume that this always held, but it is actually quite a strong requirement on the matching algorithms; one that can be hard to satisfy in the presence of abstraction variables. Thus when we see that the "groundOutMatch" property cannot be guarenteed (during collpase preprocessing say) we set this flag to false and thus disable matching optimizations above us that depend on the property for their correctness. (honorsGroundOutMatch): added (setHonorsGroundOutMatch): added Tue May 27 10:47:24 1997 Steven Eker * dagNode.cc (matchVariable): added * dagNode.hh (class DagNode): added decl for matchVariable() Fri May 16 10:54:38 1997 Steven Eker * term.cc (earlyMatchFailOnInstanceOf): use Term::stable() (subsumes): use Term::stable() * term.hh (stable): added; this seems to be a more important notion than symbol stability and may replace it everywhere in the future Thu May 15 10:46:30 1997 Steven Eker * term.hh (Term): initialize sortIndex to SORT_UNKNOWN * term.cc (dumpSymbolSet): added (dumpVariableSet): added (dumpArguments): added (dump): added (earlyMatchFailOnInstanceOf): use collapseSet rather than stable() (subsumes): use collapseSet rather than stable(); return false in more situations since if we are not a variable and can't collapse we can never subsume any term with a different top symbol * term.hh (class Term): added dump() and dumpArguments() decls Wed May 14 14:39:34 1997 Steven Eker * term.cc (analyseCollapses): deleted * term.hh (class Term): deleted analyseCollapses() decl * term.cc (determineCollapseSymbols): added * term.hh (class Term): added decl for determineCollapseSymbols() (class Term): added decl for collapseSymbols() (class Term): added decls for addCollapseSymbol() and addCollapseSymbols() (collapseSymbols): added (addCollapseSymbol): added (addCollapseSymbols): added * dagNode.hh (inErrorSort): only invalid computed base sort if there are sort constraints for the top symbol * symbol.cc (foreignApplyReplace2): no longer compute true sort of subject up front; this will be done by VariableLhsAutomaton::match() if needed. If foreign equations lhs's don't collapse to variables then this computation will not be needed Tue May 13 10:06:11 1997 Steven Eker * dagNode.cc (checkSort): use existing sort if it exists (checkSort): make first arg const Mon May 12 11:26:02 1997 Steven Eker * dagNode.hh (class DagNode): added decl for checkSort() * dagNode.cc (checkSort): added Thu May 8 17:09:47 1997 Steven Eker * symbol.cc (offerForeignEquation): now return flag to say whether we accepted equation (offerForeignRule): now return flag to say whether we accepted rule (offerForeignSortConstraint): now return flag to say whether we accepted sort constraint * symbol.hh (class Symbol): offerForeignEquation() no longer virtual and now return bool to indicate whether equation was accepted. addForeignEquation() no longer protected. (class Symbol): offerForeignRule() no longer virtual and now return bool to indicate whether rule was accepted. addForeignRule() no longer protected. (class Symbol): offerForeignSortConstraint() no longer virtual and now return bool to indicate whether sort constraint was accepted. addForeignSortConstraint() no longer protected Wed May 7 15:39:17 1997 Steven Eker * term.cc (analyseCollapses): added * term.hh (class Term): added analyseCollapses() decl Mon Apr 21 14:35:36 1997 Steven Eker * symbol.cc (Symbol): use symbolCount in place of id when forming orderInt added Symbol::symbolCount * symbol.hh (class Symbol): added static int symbolCount Mon Apr 7 19:28:58 1997 Steven Eker * symbol.cc (constrainToSmallerSort2): calls to checkCondition() now take subject (foreignApplyReplace2): call to checkCondition() now takes subject (applyRules): call to checkCondition() now takes subject (applySpecificRule): calls to checkCondition() now take subject (applyReplace): call to checkCondition() now takes subject Fri Apr 4 16:51:58 1997 Steven Eker * symbol.cc (constrainToSmallerSort2): use tracePreScApplication() * dagNode.cc (computeTrueSortWhilePreservingContext): use makeSubcontext() * symbol.cc (applyRules): use tracePreRuleRewrite() (applyReplace): use tracePreEqRewrite() and tracePostEqRewrite() (foreignApplyReplace2): use tracePreEqRewrite() and tracePostEqRewrite() Fri Mar 28 14:53:19 1997 Steven Eker * dagNode.hh (class DagNode): decl for makeExtensionInfo() added * dagNode.cc (makeExtensionInfo): added * symbol.cc (makeExtensionInfo): added (makeExtensionInfo): deleted * symbol.hh (totalNrRules): added (getRule): added Tue Feb 18 11:55:57 1997 Steven Eker * binarySymbol.cc (rightIdentitySortCheck): made symmetric with leftIdentitySortCheck() (rightIdentitySortCheck): allow collapse from error sorts to non-output non-error sorts without generating a warning (leftIdentitySortCheck): same change Thu Feb 13 12:21:43 1997 Steven Eker * permuteSymbol.cc (commutativeSortCompletion): added more detail to warning message (associativeSortCheck): added more detail to warning message * binarySymbol.cc (leftIdentitySortCheck): more explicit warning messages (leftIdentitySortCheck): use ComplexSort to get error sorts to print correctly Wed Feb 12 19:16:44 1997 Steven Eker * symbol.cc (dump): deal with null lhsAutomaton (as happens in free theory) Fri Feb 7 16:22:29 1997 Steven Eker * binarySymbol.cc (leftIdentitySortCheck): issue a warning whenever a reverse collapse moves from a non-error sort to the error sort. (rightIdentitySortCheck): same change Wed Jan 8 14:45:43 1997 Steven Eker * symbol.hh (class Symbol): ACU_THEORY constant added * binarySymbol.cc (leftIdentitySortCheck): added (rightIdentitySortCheck): added * binarySymbol.hh (class BinarySymbol): added decls for leftIdentitySortCheck() and rightIdentitySortCheck() Tue Jan 7 10:37:05 1997 Steven Eker * symbol.cc (applyReplace): use inErrorSort rather than computeBaseSort() * dagNode.hh (inErrorSort): added Tue Dec 24 11:03:26 1996 Steven Eker * symbol.cc (applyReplace): call to computeSort() replaced by cal to computeBaseSort() (foreignApplyReplace2): call to computeSort() replaced by call to computeTrueSort() * symbol.hh (class Symbol): rewrite() -> eqRewrite() (class Symbol): sortConstraintFree() made public * dagNode.hh (reduce): removed context arg from call to computeBaseSort() (reduce): rewrite() -> eqRewrite() * symbol.hh (class Symbol): removed context arg from computeBaseSort() * dagNode.cc (computeTrueSortWhilePreservingContext): adapted from computeSortWhilePreservingContext(); now check to see if there are sortConstraints before creating a new rewriting context. * dagNode.hh (class DagNode): computeSortWhilePreservingContext() changed to computeTrueSortWhilePreservingContext() Mon Dec 23 16:35:10 1996 Steven Eker * dagNode.hh (computeTrueSort): adapted from computeSort() (reduce): rewritten to use computeBaseSort() and local variable in the hope of gaining more speed * symbol.hh (class Symbol): computeSort() replaced by computeBaseSort() and computeTrueSort() (class Symbol): constrainToSmallerSort() made public Thu Dec 12 15:33:43 1996 Steven Eker * symbol.cc (mightHaveSort): updated to take foreign sort constraints into consideration Tue Dec 10 11:01:32 1996 Steven Eker * symbol.cc (applyRules): considerable simplification of sort handling. we assume that true sort of subject is known. If there is no extension info we immediatly check for error sort and give up if so. Otherwise we don't further consider subjects sort: if it is in the error sort it is the job of the code that handle the extension to check the the matched portion is not in the error sort. (applySpecificRule): similar chenges with same justification * dagNode.hh (reduce): set reduced flag before computing sort since compuation of sort may involve foreign sort constraints that need to put temp sort in node. If reduced flag is not set these nodes may be copied, leaving temp sort info behind and causing infinite loop since full calculation of sort will fire the same foreign sort constraint. test for sort already computed removed; can't remember why we put it here in the first place (maybe to avoid recomputation of sort needed for eager error pattern?) but it seems inefficient in general case. * symbol.cc (addForeignSortConstraint): fix bug where we were added foreign equations rather than sort constraints Mon Dec 9 12:30:18 1996 Steven Eker * symbol.cc (constrainToSmallerSort2): changed to new calling convention (constrainToSmallerSort2): now support foreign sort constraints (offerForeignSortConstraint): lose sortcode argument * symbol.hh (constrainToSmallerSort): changed to new calling convention * symbol.cc (addForeignSortConstraint): added (offerForeignSortConstraint): added * symbol.hh (sortConstraintFree): added (class Symbol): Vector foreignSortConstraints added Fri Dec 6 15:49:44 1996 Steven Eker * symbol.cc (compileSortConstraints): scLhs replaced by PreEquation::setLhsAutomaton() and applicationOrder; comparePairs() replaced by compareSortConstraints() (constrainToSmallerSort2): use applicationOrder and PreEquation::setLhsAutomaton() instead of scLhs * symbol.hh (class Symbol): applicationOrder changed to Vector * symbol.cc (compareSortConstraints): replaces comparePairs() * interface.cc: template class Vector deleted * symbol.cc (compileEquations): use PreEquation::setLhsAutomaton() in place of eqLhs (applyReplace): use PreEquation::lhsAutomaton() in place of eqLhs (dump): use PreEquation::lhsAutomaton() in place of eqLhs (foreignApplyReplace2): use PreEquation::lhsAutomaton() in place of eqLhs (compileRules): use PreEquation::setLhsAutomaton() in place of ruleLhs (applyRules): use PreEquation::lhsAutomaton() in place of ruleLhs (applySpecificRule): use PreEquation::lhsAutomaton() in place of ruleLhs * symbol.hh (class Symbol): Vector eqLhs deleted, Vector ruleLhs deleted, Vector scLhs replace by Vector applicationOrder struct Pair deleted (constrainToSmallerSort): use applicationOrder.length() instead of scLhs.length() Wed Dec 4 13:55:32 1996 Steven Eker * symbol.cc (applyRules): fix bug where we were not taking foreign rules into account when wrppaing around rule number (Symbol): fixed long standing initialization bug for nextRule (applyRules): force computation of sort if we are trying to apply a foreign rule and there is no extension info (applySpecificRule): now support foreign rules Tue Dec 3 17:40:35 1996 Steven Eker * symbol.cc (applyRules): now take foreign rules into account Mon Dec 2 16:21:19 1996 Steven Eker * symbol.cc (couldHaveSort): added (mightHaveSort): renamed from couldHaveSort() to reflect that we return true if we are uncertain (offerForeignRule): added (offerForeignEquation): use mightHaveSort() (mightHaveSort): take sort constraints into account (we still have to worry about default sort constraints) * symbol.hh (class Symbol): added Vector foreignRules, offerForeignRule(), addForeignRule() declarations (addForeignRule): added Mon Nov 25 16:57:14 1996 Steven Eker * permuteSymbol.cc (PermuteSymbol): added constructor arg * binarySymbol.cc (BinarySymbol): added constructor arg * symbol.cc (Symbol): take constructor argument * symbol.hh (constructor): added Wed Nov 20 15:52:22 1996 Steven Eker * symbol.cc (foreignApplyReplace2): take in to account that if the subject is in the error sort we cannot be certain that part of it will not rewrite via a foreign equation if extension is used * symbol.hh (inert): added; might be worthwhile storing a flag rather than computing this each time. Fri Nov 15 15:50:17 1996 Steven Eker * symbol.cc (matchVariableWithExtension): added (matchVariableWithExtension): changed args to take index and sortCode rather than variable Thu Nov 14 17:44:57 1996 Steven Eker * dagNode.hh (class DagNode): added declaration of makeClone() Wed Nov 13 11:53:07 1996 Steven Eker * symbol.cc (foreignApplyReplace2): now take extension info, do almost all the work of applying equations (offerForeignEquation): for symbols with standard op decl procesing; check sort component and sort code before accepting foreign equation * symbol.hh (foreignApplyReplace): now take extension info Thu Oct 31 17:06:10 1996 Steven Eker * symbol.cc (offerForeignEquation): added Wed Oct 30 11:44:15 1996 Steven Eker * symbol.hh (constrainToSmallerSort): rewritten * symbol.cc (constrainToSmallerSort2): renamed from checkSortConstraints() for consistancy Tue Oct 29 17:40:24 1996 Steven Eker * symbol.hh (foreignApplyReplace): guts moved to foreignApplyReplace2() * symbol.cc (applyRules): 0 -> Sort::ERROR_SORT, break rather than continuing if error sort found (applySpecificRule): 0 -> Sort::ERROR_SORT, break rather than continuing if error sort found (applyReplace): 0 -> Sort::ERROR_SORT, return false rather than continuing if error sort found (foreignApplyReplace2): added since we can't call DagNode::computeSort() from inline because symbol.hh is always included before dagNode.hh * symbol.hh (foreignApplyReplace): compute the sort of the subject up front to make life simpler, at the cost of some efficiency in rare cases Thu Oct 24 17:00:01 1996 Steven Eker * interface.cc: template class Vector added * symbol.cc (applyReplace): call foreignApplyReplace() instead of returning false * symbol.hh (foreignApplyReplace): added * symbol.cc (applyForeignEquation): added * symbol.hh (class Symbol): extra declarations for foreign equation handling added (addForeignEquation): added Thu Oct 17 16:16:46 1996 Steven Eker * term.hh (Term): untilityFlag = false deleted (setUtilityFlag): deleted (getUtilityFlag): deleted Wed Oct 16 14:38:47 1996 Steven Eker * symbol.cc (dumpSortTable): hacked to handle indent (dump): hacked to handle indent Tue Oct 15 16:48:54 1996 Steven Eker * rhsAutomaton.hh (class RhsAutomaton): indentLevel and added to dump * lhsAutomaton.hh (class LhsAutomaton): indentLevel arg added to dump Fri Oct 11 16:22:09 1996 Steven Eker * symbol.cc (applyRules): use new partialConstruct() (applySpecificRule): use new partialConstruct() (applyReplace): use new partialReplace() * dagNode.cc (partialReplace): added (partialConstruct): added * symbol.cc (partialReplace): deleted (partialConstruct): deleted Tue Oct 8 17:44:06 1996 Steven Eker * permuteSymbol.cc (commutativeSortCompletion): use new opDeclarations() def (associativeSortCheck): use new opDeclarations() def (associativeSortBoundsAnalysis): use new opDeclarations() def (associativeSortStructureAnalysis): use new opDeclarations() def * binarySymbol.cc (idempotentSortCheck): use new opDeclarations() def * symbol.cc (findMinResultSort): revised using new symbolOpDeclarations def (compileOpDeclarations): revised using new symbolOpDeclarations def * symbol.hh (addOpDeclaration): made inline * symbol.cc (~Symbol): body deleted (addOpDeclaration): considerably simplified * symbol.hh (class Symbol): symbolOpDeclarations changed from Vector*> to Vector> (opDeclarations): changed return type Wed Oct 2 17:33:51 1996 Steven Eker * dagNode.cc (dump): deleted (slowAllocateStorage): update nrBuckets and bucketStorage (copyWithReplacement): deleted (stackArguments): deleted * dagNode.hh (setShowGC): added (class DagNode): major reorganization Tue Oct 1 14:55:16 1996 Steven Eker * dagNode.cc (collectGarbage): don't let target ever decrease; the idea is that when we have allocated lots of storage, we should make maximal use of it before doing a GC. This could hurt us in some cases where the already allocated store is huge and causes cache or page thrashing but should win on smallish examples where a reasonable amount of store has already been allocated * dagNode.hh (trackStorage): deleted (allocateStorage): move here and inlined * interface.cc: template class ArgVec instantiation added Mon Sep 30 10:52:42 1996 Steven Eker * dagNode.cc (collectGarbage): modified to use unusedList algorithm (slowAllocateStorage): modified to use unusedList algorithm (dump): modified to use unusedList algorithm Fri Sep 27 15:40:41 1996 Steven Eker * dagNode.cc (collectGarbage): switch bucket and comdemed lists for crude copying collect (collectGarbage): remember for reset all buckets on condemed list after mark phase (dump): added (allocateStorage): increment storageInUse (collectGarbage): update target (collectGarbage): remember to reset storageInUse (slowAllocateStorage): add new bucket to end rather than begining of list * argVec.hh (expandBy): fixed bug where we were shadowing "vector" * dagNode.cc (allocateStorage): added (slowAllocateStorage): added * argVec.hh: heavily rewritten Sun Aug 25 16:07:00 1996 Steven Eker * symbol.cc (applySpecificRule): fixed bug in null subproblem + condition logic Thu Aug 22 14:16:14 1996 Steven Eker * symbol.cc (applySpecificRule): use new Label class; idea: may be rules should be named entities rather then labels? or is it reasonable to have multiple labels per rule at some future time (applyRules): added label printing for tracing Fri Aug 16 14:51:02 1996 Steven Eker * permuteSymbol.cc (associativeSortStructureAnalysis): changed sc[i]->sort()->code() <= code to sc[j]->sort()->code() <= code Thu Aug 15 19:37:21 1996 Steven Eker * symbol.cc (applySpecificRule): added (specificRewrite): added * symbol.hh (class Symbol): added applySpecificRule() Fri Aug 9 15:46:03 1996 Steven Eker * symbol.hh (class Symbol): added partialConstruct() * symbol.cc (ruleRewrite): added (applyRules): now deal with extension (partialConstruct): added * symbol.hh (class Symbol): ruleRewrite() interface changed * dagNode.hh (class DagNode): copyWithReplacement() and stackArguments() added Thu Aug 8 12:01:11 1996 Steven Eker * symbol.cc (applyRules): added (applyRules): use n intead of i in all places (horrible bug when n != i of rule and rule lhs getting out of sync) * symbol.hh (addRule): added (rules): added * symbol.cc (compileRules): added Tue Aug 6 14:42:33 1996 Steven Eker * symbol.cc (compileEquations): removed boundAbove from call to compileLhs() (compileSortConstraints): removed boundAbove from call to compileLhs() * term.cc (findBestSequence): removed matchAtTop argument from call to analyseConstraintPropagation() * term.hh (class Term): boundAbove arg removed from compileLhs(); matchAtTop arg removed from analyseConstraintPropagation() Wed Jul 31 17:10:22 1996 Steven Eker * symbol.hh (class Symbol): pure abstract makeTerm() added Tue Jul 9 16:59:40 1996 Steven Eker * permuteSymbol.hh (uniformSort): added * permuteSymbol.cc (associativeSortCheck): now check for uniform sorts and enforce restrictions on sort constraints (checkUniformity): added Sat Jul 6 17:29:38 1996 Steven Eker * dagNode.hh (class DagNode): trackStorage() made public Wed Jun 26 10:12:50 1996 Steven Eker * permuteSymbol.cc (associativeSortCheck): fixed bug; should do check even when there is only one op decl (commutativeSortCompletion): fixed bug; should do completion even when there is only one op decl (associativeSortBoundsAnalysis): added Assert (associativeSortStructureAnalysis): added Assert (associativeSortCheck): made vectors static for efficiency (commutativeSortCompletion): made vectors static for efficiency (associativeSortBoundsAnalysis): made vector static for efficiency (associativeSortStructureAnalysis): made vector static for efficiency Tue Jun 25 15:59:51 1996 Steven Eker * symbol.cc (lookupUnionSort): added * symbol.hh (class Symbol): added new lookupUnionSort() Fri Jun 21 15:30:37 1996 Steven Eker * symbol.cc (compileEquations): use new compileLhs() (compileSortConstraints): use new compileLhs() * term.hh (class Term): changed arg list of compileLhs() * binarySymbol.cc: most functionality moved to permuteSymbol.cc * binarySymbol.hh (class BinarySymbol): most functionality moved to permuteSymbol * permuteSymbol.hh: created * permuteSymbol.cc: created Wed Jun 19 12:15:37 1996 Steven Eker * dagNode.cc (collectGarbage): update maxExtra if needed * dagNode.hh (trackStorage): added (class DagNode): added EXTRA_BOUND and EXTRA_FACTOR constants (class DagNode): extraStorage and maxExtra data members added (okToCollectGarbage): now take extra storage into account when deciding when to do GC Thu Jun 13 16:28:04 1996 Steven Eker * lhsAutomaton.hh (class LhsAutomaton): have extensionInfo = 0 default Wed Jun 12 10:41:10 1996 Steven Eker * symbol.cc (compileEquations): pass # of variable to compileLhs() (compileSortConstraints): pass # of variable to compileLhs() * term.hh (class Term): compileLhs() now takes int nrVariables Tue Jun 11 16:04:17 1996 Steven Eker * term.cc (determineContextVariables): added * term.hh (occursInContext): added (class Term): added contextSet data member Sat Jun 8 16:26:07 1996 Steven Eker * term.hh (matchIndependent): added Fri Jun 7 15:09:24 1996 Steven Eker * interface.cc: Sequences abolished throughout module * symbol.cc (lookupUnionSort): switched over to Vector > (parse): switched over to Vector > Thu Jun 6 10:12:03 1996 Steven Eker * term.hh (compare): both versions: optimization reversed for symmetry * dagNode.hh (compare): optimization reversed: it appears that constants are almost always the same shared node anyway so optimization makes things slightly slower * term.hh (compare): DagNode version: optimized for 0 args case (compare): Term version: optimized for 0 args case * dagNode.hh (compare): optimized for 0 args case Mon Jun 3 10:27:51 1996 Steven Eker * term.cc (matchIndependent): replaces quasiUnifiable() (earlyMatchFailOnInstanceOf): replaces matchIndependent() because matchers for different theories may differ in their power to detect early failure Fri May 31 17:24:48 1996 Steven Eker * term.cc (quasiUnifiable): added; replaces potentially unifiable * binarySymbol.cc (associativeSortStructureAnalysis): the purity of the error sort or of a maximal sort cannot be destroyed by a sort constraint. A sort constraint can never pull a term into a maximal sort from "outside" since "outside" could only be the error sort or an another (incomparable) maximal sort Thu May 30 12:20:54 1996 Steven Eker * binarySymbol.cc (associativeSortBoundsAnalysis): renamed (used to be associativeSortAnalysis()) (operator<<): added (associativeSortStructureAnalysis): fixed bug: result tests were the wrong way around (associativeSortStructureAnalysis): fixed bug: updating lessOrEqual in third nested loop invalidates it for future iterations; now have bothLessOrEqual which is computed inside third loop * binarySymbol.hh (class BinarySymbol): added enum Structure * binarySymbol.cc (associativeSortStructureAnalysis): added Tue May 28 16:40:31 1996 Steven Eker * term.cc (findBestSequence): added (public version) (findBestSequence): added (private recursive version) Thu May 23 10:15:43 1996 Steven Eker * symbol.cc (dumpSortTable): added (dump): now dump LHS automata * lhsAutomaton.hh (class LhsAutomaton): now take variableIndex arg Tue May 21 09:52:25 1996 Steven Eker * dagNode.cc (collectGarbage): no longer trace DagRoots * term.cc (potentiallyUnifiable): added Sun May 19 17:57:14 1996 Steven Eker * dagNode.cc (collectGarbage): call RewritingContext::markReachableNodes() and LocalBinding::markReachableNodes() * symbol.cc (applyReplace): call DagNode::okToCollectGarbage() even if we fail to match because matching process may create many new DAG nodes (eg by matching under assoc symbol) (applyReplace): call finished() when finished with context to allow substitution nodes to be garbage collected (checkSortConstraints): same changes as above for same reasons Sat May 18 14:59:44 1996 Steven Eker * binarySymbol.cc (Symbol): rewritten to compute strategies correctly Fri May 17 11:29:42 1996 Steven Eker * lhsAutomaton.hh (class LhsAutomaton): dump() now takes stream arg * symbol.cc (dumpSortAndTab): added (dump): rewritten to use streams rather than DumpContext Wed May 15 15:07:21 1996 Steven Eker * dagNode.hh (class DagNode): added enum Sizes * binarySymbol.cc (commutativeSortCompletion): use ErrorCheck() and WarningCheck() (associativeSortCheck): use ErrorCheck() and WarningCheck() * symbol.cc (compileOpDeclarations): replaced Validate() with ErrorCheck() (findMinResultSort): replaced Validate with WarningCheck Sat May 11 16:19:18 1996 Steven Eker * binarySymbol.cc (Symbol): added stable arg * binarySymbol.hh (class BinarySymbol): added stable arg * symbol.cc (Symbol): added stable argument * symbol.hh (class Symbol): bool sharable() deleted, bool stable() added, Fri May 3 11:44:32 1996 Steven Eker * dagNode.hh (compare): optimized for symbols equal case * symbol.cc (compileSortConstraints): compile sort contraints with at top flag = false to prevent extension Thu May 2 11:59:46 1996 Steven Eker * dagNode.cc (computeSortWhilePreservingContext): added; note that this is needed to ensure that (1) solution in original context in not corrupted during execution of sort contraints; (2) the node itself (which may have been constructed on-the-fly) does not get garbage collected during the execution of sort contraints. * binarySymbol.cc (associativeSortAnalysis): bug fixed; when we insert a sort into "tooBig", all larger sorts (except error sort) must also be inserted. Otherwise sorts that don't appear in the table but that are greater than some sort that does will get an incorrect upper bound of 1. (insertGreaterOrEqualSorts): added (associativeSortAnalysis): ensure that sorts constrained to by sort constraints and any larger sorts are always unbounded Fri Apr 26 19:20:36 1996 Steven Eker * binarySymbol.cc (associativeSortAnalysis): fixed trivial for condition bug Wed Apr 24 17:54:48 1996 Steven Eker * symbol.cc (applyReplace): only check for loose patterns if there is no extension info structure; this places responsibility for ensure that garbage is not matched with those theories that require extension info. The reason for this is that the subject could be in the error sort, but with extension, the part of the subject actually matched could be in a user sort. Tue Apr 23 11:01:33 1996 Steven Eker * subproblem.hh (class Subproblem): solve() now takes RewritingContext& Thu Apr 18 17:13:09 1996 Steven Eker * extensionInfo.hh (matchedWhole): made a const member function Wed Apr 17 17:00:03 1996 Steven Eker * interface.cc: now implements "extensionInfo.hh" * extensionInfo.hh (setWholeFlag): added (matchedWhole): added * symbol.cc (applyConstruct): added (applyConstruct): deleted (applyReplace): augemnted to handle extension info * symbol.hh (class Symbol): applyConstruct() added Tue Apr 16 10:45:03 1996 Steven Eker * binarySymbol.cc (associativeSortAnalysis): added * binarySymbol.hh (class BinarySymbol): associativeSortCheck() and associativeSortAnalysis() added * binarySymbol.cc (associativeSortCheck): added * binarySymbol.hh (class BinarySymbol): commutativeSortCompletion() added * binarySymbol.cc (commutativeSortCompletion): added * symbol.cc (adjustSort): added * symbol.hh (class Symbol): adjustSort() added Fri Apr 12 17:15:05 1996 Steven Eker * term.hh: matchAtTop added to analyseConstraintPropagation() Wed Apr 10 16:20:22 1996 Steven Eker * dagNode.hh (mark): added Asserts that we are going to remove from *::markArguments() * interface.hh: BinarySymbol added Tue Apr 9 18:12:55 1996 Steven Eker * binarySymbol.cc: created * binarySymbol.hh: created Mon Mar 25 10:56:33 1996 Steven Eker * term.hh (setUtilityFlag): added (getUtilityFlag): added Thu Mar 21 14:44:44 1996 Steven Eker * symbol.cc (compileOpDeclarations): added code to set uniformSort (containsErrorSort): added (compileSortConstraints): zero out uniform sort if there are sort constraints Fancy uniform sort code stripped as it appears to offer no performance advantage * symbol.hh (singleSort): added Wed Mar 20 16:57:41 1996 Steven Eker * symbol.hh (constrainToSmallerSort): now a inline test and wrap for checkSortConstraints() * symbol.cc (checkSortConstraints): renamed from constrainToLowerSort() Thu Mar 14 14:41:18 1996 Steven Eker * symbol.hh: dump() virtualized Sun Mar 10 15:44:22 1996 Steven Eker * symbol.cc (applyReplace): build() -> match() (constrainToSmallerSort): build() -> match() Sat Mar 9 16:18:52 1996 Steven Eker * symbol.cc (compileSortConstraints): simple arg removed from call to compileLhs() (compileEquations): simple arg removed from call to compileLhs() * term.hh: simple argument removed from compileLhs() Fri Mar 8 11:32:44 1996 Steven Eker * interface.cc: added instantiation for Vector; Wed Mar 6 17:04:03 1996 Steven Eker * symbol.cc (compileSortConstraints): expand() -> expandTo() Mon Mar 4 16:13:00 1996 Steven Eker * symbol.cc (constrainToSmallerSort): don't break from loop if s->code() imcomparable with currentCode Tue Feb 27 13:51:59 1996 Steven Eker * dagNode.hh: unnecessary #include removed Tue Feb 20 11:37:29 1996 Steven Eker * symbol.hh: fixed comments Wed Feb 14 11:46:21 1996 Steven Eker * symbol.cc (applyReplace): check for loose patterns and check sort of subject before using them * dagNode.hh (repudiateSortInfo): added Thu Feb 8 15:44:11 1996 Steven Eker * symbol.cc (findMinResultSort): fixed bad Validate fn name * dagNode.hh (computeSort): added (reduce): check that sort is not set before calling Symbol::computeSort() Tue Feb 6 11:20:57 1996 Steven Eker * symbol.cc (compileSortConstraints): implemented properly (comparePairs): added (constrainToSmallerSort): added (compileSortConstraints): must compile sort constraint as well as its left hand side * interface.cc: template class Vector added * symbol.hh (addSortConstraint): added (sortConstraints): added Fri Feb 2 15:27:37 1996 Steven Eker * term.hh: sort info and functions added * symbol.hh: parse parameters changed * symbol.cc (parse): rewritten Thu Feb 1 14:08:17 1996 Steven Eker * symbol.hh: parse() added (fixedDomainComponent): added (fixedRangeComponent): added deleted fixedDomainComponent(), fixedRangeComponent() parse() no longer pure virtual Wed Jan 31 11:10:30 1996 Steven Eker * symbol.cc (rangeComponent): Assert added (compileOpDeclarations): now expand dimensionVector and componentVector when needed rather than starting with them at full size. This way we can tell if they have been initialized in Asserts (compileOpDeclarations): check that symbolArity > 0 before expanding dimensionVector (compileEquations): rewritten (applyReplace): added (applyReplace): remember to self destruct subproblems * symbol.hh (lookupSort): Assert added * symbol.cc (lookupUnionSort): Asserts added Tue Jan 30 14:24:15 1996 Steven Eker * symbol.cc (lookupUnionSort): various renaming * symbol.hh: restored previous version. void generateSortTable() -> virtual void compileOpDeclarations() virtual void compileSortConstraints() added const Sequence*>& opDeclarations() added lookupSort() & lookupUnionSort() now protected * symbolWithOD.hh: created using sort computation code from old symbol.hh * symbolWithOD.cc : created using sort computation code from old symbol.cc * symbol.cc: Stripped operator declaration and and sort stuff * symbol.hh: All stuff to do with sorts and operator declarations stripped out except for modified addOpDeclaration() and new opDeclarations() Thu Jan 11 18:01:15 1996 Steven Eker * dagNode.hh (DagNode): moved SORT_UNKNOWN into class Sort Wed Jan 10 11:27:16 1996 Steven Eker * symbol.hh (lookupSort): make Vector parameter const * symbol.cc (generateSortTable): now use Vectors (incrementSortVector): now use Vectors (findMinResultSort): now use Vectors (also renamed from private computeSort()) (addOpDeclaration): now use Vectors (NamedEntity): now use Vectors; sharable parameter dropped (Symbol): now delete opDeclarations vectors (lookupUnionSort): now use Vectors (lookupUnionSort): make Vector parameter const * symbol.hh (lookupSort): changed to use Vector template class Tue Dec 19 16:52:25 1995 Steven Eker * symbol.hh: made orderInt symbolTheory and symbolArity into constants. resultComponent() deleted * dagNode.hh: made topSymbol a constant Fri Dec 15 12:56:59 1995 Steven Eker * symbol.hh: added lookupUnionSort() * symbol.cc (generateSortTable): added code to call compile() on each equation (compileEquations): previous code moved here so that equation compilation can be done after _all_ sort computations have been done Thu Dec 14 14:46:34 1995 Steven Eker * symbol.cc (rangeComponent): added * symbol.hh (resultComponent): commented out; replaced by virtual function rangeComponent() that takes the acual instance as a parameter to deal with polymorphic symbols Wed Dec 13 15:25:09 1995 Steven Eker * symbol.cc (dump): use dumpSortTab() * symbol.hh (resultComponent): added Tue Dec 12 10:22:27 1995 Steven Eker * symbol.hh (lookupSort): added * dagNode.hh (setSortInfo): added added getSortIndex() and getSortCode() (reduce): now compute sort for term once it has been reduced * symbol.hh: added public computeSort() for DagNodes Fri Dec 8 18:03:52 1995 Steven Eker * dagNode.hh: normalize() and rewrite() deleted Thu Dec 7 10:38:32 1995 Steven Eker * dagNode.hh: commented out virtual DagNode* normalize() and virtual bool rewrite() (reduce): now use Symbol::rewrite() * symbol.hh: added virtual bool rewrite(); * symbol.cc (computeSort): wholesale renaming of identifiers * symbol.hh: sortInfo -> opDeclarations * dagNode.hh: reduced nrWords to 3, added sortCode, changed minSort to sortIndex Wed Dec 6 17:09:44 1995 Steven Eker * symbol.hh: now derived from NamedEntity * symbol.cc (Symbol, ~Symbol): no longer inline Fri Dec 1 11:12:59 1995 Steven Eker * symbol.cc (dump): added Thu Nov 30 18:17:25 1995 Steven Eker * symbol.cc: much hacking for sort table computation Tue Nov 28 17:40:25 1995 Steven Eker * symbol.hh: added addSortInfo() and symbolSortInfo Tue Nov 21 17:26:13 1995 Steven Eker * interface.cc: added Sequence Template instantiation Wed Oct 25 17:22:54 1995 Steven Eker * dagNode.hh (new): removed DagNode::replenish(), and replaced call to it with call to DagNode::allocateNewArena() * dagNode.cc: removed DagNode::replenish(); corrected comment on DagNode::allocateNewArena() Mon Oct 23 18:04:49 1995 Steven Eker * symbol.hh: removed symbol2String() declaration Tue Oct 17 14:04:25 1995 Steven Eker * rhsAutomaton.hh: updated to use dump context * lhsAutomaton.hh: updated to use dump context * term.cc (indexVariables): added analyseVariables() code; removed actual analyseVariables() * term.hh: removed analyseVariables() * dagNode.hh (reduce): added reduce() inline member function Fri Oct 13 17:55:50 1995 Steven Eker * term.cc: removed findIdentical() removed getVariable() * term.hh: removed findIdentical() removed getVariable() Maude-2.6/src/Interface/subproblem.hh0000644000147300135640000000273511351002230014521 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for subproblems during matching. // #ifndef _subproblem_hh_ #define _subproblem_hh_ class Subproblem { public: #if 0 Subproblem() { cout << "BaseSubproblem " << ((void*) this) << " created" << endl; } virtual ~Subproblem() { cout << "BaseSubproblem " << ((void*) this) << " destroyed" << endl; } #else virtual ~Subproblem() {} // deep #endif virtual bool solve(bool findFirst, RewritingContext& solution) { CantHappen("Not implemented"); return false; } #ifdef DUMP virtual void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel = 0) {} // HACK #endif }; #endif Maude-2.6/src/Interface/symbol2.hh0000644000147300135640000000236207666302431013756 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Fast inlined sort computation function. // #ifndef _symbol2_hh_ #define _symbol2_hh_ inline void Symbol::fastComputeTrueSort(DagNode* subject, RewritingContext& context) { int t = uniqueSortIndex; if (t < 0) computeBaseSort(subject); // usual case else if (t > 0) subject->setSortIndex(t); // unique sort case else slowComputeTrueSort(subject, context); // most general case } #endif Maude-2.6/src/Interface/associativeSymbol.cc0000644000147300135640000002557007666302431016063 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AssociativeSymbol. // #include // utility stuff #include "macros.hh" #include "vector.hh" #include "pointerSet.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" // interface class definitions #include "associativeSymbol.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "sortConstraint.hh" struct AssociativeSymbol::Inv { int sortIndex; int count; }; AssociativeSymbol::AssociativeSymbol(int id, const Vector& strategy, bool memoFlag, Term* identity) : BinarySymbol(id, memoFlag, identity) { setPermuteStrategy(strategy); } void AssociativeSymbol::finalizeSortInfo() { BinarySymbol::finalizeSortInfo(); // do parent classes stuff // // These things are dependent on sort constraints and hence can't be done // correctly until all sort constraints that could apply to our symbol // have been determined. // associativeSortCheck(); associativeSortBoundsAnalysis(); associativeSortStructureAnalysis(); } void AssociativeSymbol::processIdentity() { BinarySymbol::processIdentity(); Term* identity = getIdentity(); WarningCheck(identity == 0 || identity->symbol() != this, *identity << ": associative operator " << QUOTE(this) << " occurs on top of its own identity."); } bool AssociativeSymbol::mightCollapseToOurSymbol(const Term* subterm) const { const PointerSet& cs = subterm->collapseSymbols(); int nrSymbols = cs.cardinality(); for (int i = 0; i < nrSymbols; i++) { Symbol* s = static_cast(cs.index2Pointer(i)); if (static_cast(s) == this) return true; VariableSymbol* vs = dynamic_cast(s); if (vs != 0 && sortBound(vs->getSort()) > 1) return true; } return false; } bool AssociativeSymbol::checkUniformity(const Sort* uniformSort, int nrSorts) { int uniformIndex = uniformSort->index(); for (int i = 1; i < nrSorts; i++) { bool good = leq(i, uniformSort); int step = traverse(0, i); for (int j = 1; j < nrSorts; j++) { int resultIndex = traverse(step, j); if (good && leq(j, uniformSort)) { if (resultIndex != uniformIndex) return false; } else { if (resultIndex != Sort::ERROR_SORT) return false; } } } return true; } void AssociativeSymbol::associativeSortCheck() { const ConnectedComponent* component = rangeComponent(); Assert(domainComponent(0) == component && domainComponent(1) == component, "Associative operator " << this << " has a domain sort in a different connected component from its range sort"); uniSort = 0; if (kindLevelDeclarationsOnly()) return; WarningCheck(getSortConstraints().empty(), "membership axioms are not guaranteed to work correctly for associative symbol " << QUOTE(this) << " as it has declarations that are not at the kind level."); int nrSorts = component->nrSorts(); // // Check to see if symbol has a uniform sort table. // (in which case it is automatically associative). // We do this by taking the singleNonErrorSort if it has one // and checking it for uniformity. // Sort* candidate = getSingleNonErrorSort(); if (candidate != 0 && checkUniformity(candidate, nrSorts)) { uniSort = candidate; return; } // // Sort table is not uniform so check all triples to see if it is associative. // int nrBadTriples = 0; int bad1 = 0; int bad2 = 0; int bad3 = 0; { // // The naive O(n^3) algorithm can be slow when the number of user sorts // n is large. This more complicated approach is O(k.n^2) where k is the // width of the sort diagram - often a lot less than n. // typedef map InvMap; InvMap invMap; // // First invert the first step of the sort diagram. // for (int i = 0; i < nrSorts; i++) { int step = traverse(0, i); pair p = invMap.insert(InvMap::value_type(step, Inv())); if (p.second) { p.first->second.sortIndex = i; p.first->second.count = 1; } else ++(p.first->second.count); } // // Now for each possible first step, we check the n^2 possible triples. // const InvMap::const_iterator e = invMap.end(); for (InvMap::const_iterator i = invMap.begin(); i != e; ++i) { int step_i = i->first; for (int j = 0; j < nrSorts; j++) { int step_j = traverse(0, j); int step_ij = traverse(0, traverse(step_i, j)); for (int k = 1; k < nrSorts; k++) { if (traverse(step_ij, k) != traverse(step_i, traverse(step_j, k))) { if (nrBadTriples == 0) { bad1 = i->second.sortIndex; bad2 = j; bad3 = k; } nrBadTriples += i->second.count; } } } } } WarningCheck(nrBadTriples == 0, "sort declarations for associative operator " << QUOTE(this) << " are non-associative on " << nrBadTriples << " out of " << nrSorts * nrSorts * nrSorts << " sort triples. First such triple is (" << QUOTE(component->sort(bad1)) << ", " << QUOTE(component->sort(bad2)) << ", " << QUOTE(component->sort(bad3)) << ")."); } void AssociativeSymbol::insertGreaterOrEqualSorts(const Sort* sort, NatSet& set) { int index = sort->index(); for (int i = 1; i <= index; i++) { if (leq(sort, i)) set.insert(i); } } void AssociativeSymbol::associativeSortBoundsAnalysis() { // // If there is a sort constraint to some sort s then s and all larger sorts // must always be unbounded // const Vector& sc = getSortConstraints(); int nrSortConstraints = sc.length(); static NatSet unbounded; unbounded.makeEmpty(); for (int i = 0; i < nrSortConstraints; i++) insertGreaterOrEqualSorts(sc[i]->getSort(), unbounded); // // Start off with all sorts unbounded // const ConnectedComponent* component = rangeComponent(); int nrSorts = component->nrSorts(); sortBounds.expandTo(nrSorts); for (int i = 0; i < nrSorts; i++) sortBounds[i] = UNBOUNDED; // // Now for each possible bound; 1, 2, 3, ... we check to see which sorts are // too big because of their occurrence in the regularity table. When a sort // is too big, all bigger sorts are also too big // int largestBound = 1; for (int i = 1; i <= largestBound; i++) { static NatSet tooBig; tooBig = unbounded; for (int j = 1; j < nrSorts; j++) { int step = traverse(0, j); int jBound = sortBounds[j]; for (int k = 1; k < nrSorts; k++) { int kBound = sortBounds[k]; if (jBound == UNBOUNDED || kBound == UNBOUNDED || jBound + kBound > i) { int resultIndex = traverse(step, k); if (resultIndex != Sort::ERROR_SORT && !(tooBig.contains(resultIndex))) insertGreaterOrEqualSorts(component->sort(resultIndex), tooBig); } } } for (int j = 1; j < nrSorts; j++) { if (!(tooBig.contains(j)) && sortBounds[j] == UNBOUNDED) { sortBounds[j] = i; largestBound = 2 * i; } } } } void AssociativeSymbol::associativeSortStructureAnalysis() { const Vector& sc = getSortConstraints(); int nrSortConstraints = sc.length(); const ConnectedComponent* component = rangeComponent(); int nrSorts = component->nrSorts(); int nrMaxSorts = component->nrMaximalSorts(); sortStructures.expandTo(nrSorts); sortStructures[0] = PURE_SORT; // error sorts are always pure // // We examine each non-error sort s in turn // for (int i = 1; i < nrSorts; i++) { const Sort* sort = component->sort(i); // // First check where it has the limit property: // s1, s2 <= s ===> s_f(s1, s2) <= s // for (int j = i; j < nrSorts; j++) { if (leq(j, sort)) { int step = traverse(0, j); for (int k = i; k < nrSorts; k++) { if (leq(k, sort) && !(leq(traverse(step, k), sort))) { sortStructures[i] = UNSTRUCTURED; goto nextSort; } } } } // // First check to see if a sort constraint destroys the purity // of a non-maximal, non-error sort. // if (i > nrMaxSorts) // maximal sorts are 1...nrMaxSorts { for (int j = 0; j < nrSortConstraints; j++) { if (leq(sc[j]->getSort(), sort)) { sortStructures[i] = LIMIT_SORT; goto nextSort; } } } // // Now check main part of purity property: // s_f(s1, s2) <= s ===> s1, s2 <= s // for (int j = 1; j < nrSorts; j++) { bool j_leq = leq(j, sort); int step = traverse(0, j); for (int k = 1; k < nrSorts; k++) { if ((!j_leq || !(leq(k, sort))) && leq(traverse(step, k), sort)) { sortStructures[i] = LIMIT_SORT; goto nextSort; } } } sortStructures[i] = PURE_SORT; nextSort: ; } } void AssociativeSymbol::fillInSortInfo(Term* subject) { Assert(this == subject->symbol(), "bad Symbol"); ConnectedComponent* component = rangeComponent(); // should be const Assert(component != 0, "couldn't get component"); ArgumentIterator a(*subject); Term* t = a.argument(); t->symbol()->fillInSortInfo(t); Assert(t->getComponent() == component, "assoc component error"); int si = t->getSortIndex(); #ifndef NO_ASSERT int nrArgsSeen = 1; #endif for (a.next(); a.valid(); a.next()) { Term* t = a.argument(); t->symbol()->fillInSortInfo(t); Assert(t->getComponent() == component, "assoc component error"); si = traverse(traverse(0, si), t->getSortIndex()); #ifndef NO_ASSERT ++nrArgsSeen; #endif } Assert(nrArgsSeen >= 2, "bad # of args for assoc op"); subject->setSortInfo(component, si); } bool AssociativeSymbol::isConstructor(DagNode* subject) { return getCtorStatus() == SortTable::IS_CTOR; // HACK } void AssociativeSymbol::setFrozen(const NatSet& frozen) { setPermuteFrozen(frozen); } ostream& operator<<(ostream& s, AssociativeSymbol::Structure structure) { static const char* const names[] = {"UNSTRUCTURED", "LIMIT_SORT", "PURE_SORT"}; s << names[structure]; return s; } Maude-2.6/src/Interface/rawDagArgumentIterator.hh0000644000147300135640000000223507666302431017010 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for raw DAG argument iterators. // #ifndef _rawDagArgumentIterator_hh_ #define _rawDagArgumentIterator_hh_ class RawDagArgumentIterator { public: virtual ~RawDagArgumentIterator() {} virtual bool valid() const = 0; virtual DagNode* argument() const = 0; virtual void next() = 0; }; #endif Maude-2.6/src/Interface/binarySymbol.cc0000644000147300135640000002233411442314027015017 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class BinarySymbol. // // utility stuff #include "macros.hh" #include "vector.hh" #include "pointerSet.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" // interface class definitions #include "binarySymbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "sortConstraint.hh" #include "argumentIterator.hh" // variable class definitions #include "variableSymbol.hh" BinarySymbol::BinarySymbol(int id, bool memoFlag, Term* identity) : Symbol(id, 2, memoFlag), identityTerm(identity) { cyclicIdentity = (identity == 0) ? 0 : UNDECIDED; } bool BinarySymbol::interSymbolPass() { return identityTerm.getTerm() == 0 ? false : identityTerm.normalize(); } void BinarySymbol::reset() { identityTerm.reset(); // so identity dag can be garbage collected Symbol::reset(); // default reset() tasks } void BinarySymbol::setPermuteStrategy(const Vector& userStrategy) { int stratLen = userStrategy.length(); if (stratLen == 0) { permuteStrategy = EAGER; setStrategy(userStrategy, 2, isMemoized()); return; } permuteStrategy = LAZY; Vector modifiedStrategy; bool seenZero = false; for (int i = 0; i < stratLen; i++) { int a = userStrategy[i]; if (a == 0) seenZero = true; else { if (seenZero) { permuteStrategy = SEMI_EAGER; modifiedStrategy.append(0); } else permuteStrategy = EAGER; modifiedStrategy.append(1); modifiedStrategy.append(2); break; } } modifiedStrategy.append(0); setStrategy(modifiedStrategy, 2, isMemoized()); } void BinarySymbol::setPermuteFrozen(const NatSet& frozen) { // // Must freeze both arguments or neither for permutative operator. // if (frozen.contains(0) == frozen.contains(1)) Symbol::setFrozen(frozen); else { NatSet newFrozen; newFrozen.insert(0); newFrozen.insert(1); Symbol::setFrozen(newFrozen); } } bool BinarySymbol::isStable() const { return identityTerm.getTerm() == 0; } void BinarySymbol::commutativeSortCompletion() { Assert(domainComponent(0) == domainComponent(1), "Commutative operator " << this << " has its arguments in different sort components"); Vector newDecl(3); const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { const Vector& iDecl = opDecls[i].getDomainAndRange(); bool iCtor = opDecls[i].isConstructor(); for (int j = opDecls.length() - 1; j >= 0; j--) { const Vector& jDecl = opDecls[j].getDomainAndRange(); if (iDecl[0] == jDecl[1] && iDecl[1] == jDecl[0] && iDecl[2] == jDecl[2] && (!iCtor || opDecls[j].isConstructor())) goto nextOpDecl; } newDecl[0] = iDecl[1]; newDecl[1] = iDecl[0]; newDecl[2] = iDecl[2]; addOpDeclaration(newDecl, iCtor); nextOpDecl: ; } } void BinarySymbol::processIdentity() { Term* id = identityTerm.getTerm(); if (id == 0) return; VariableInfo vi; id->indexVariables(vi); WarningCheck(id->occursBelow().empty(), *id << ": identity element " << QUOTE(id) << " for operator " << QUOTE(this) << " contains variables."); id->symbol()->fillInSortInfo(id); int index = id->getSortIndex(); // is this valid? Assert(index != Sort::SORT_UNKNOWN, "unknown sort for identity element"); WarningCheck(index != Sort::ERROR_SORT, *id << ": identity element " << QUOTE(id) << " for operator " << QUOTE(this) << " has error sort."); identityTerm.prepare(); } bool BinarySymbol::mightMatchOurIdentity(const Term* subterm) const { Term* id = identityTerm.getTerm(); if (id == 0) return false; if (id->equal(subterm)) return true; // this can happen if we only have left (right) identity Symbol* idTopSymbol = id->symbol(); // // First examine subterm. // Symbol* s = subterm->symbol(); if (s == idTopSymbol && !(subterm->ground())) return true; VariableSymbol* vs = dynamic_cast(s); if (vs != 0 && id->leq(vs->getSort())) return true; // // Second examine what it might collapse to. // const PointerSet& cs = subterm->collapseSymbols(); int nrSymbols = cs.cardinality(); for (int i = 0; i < nrSymbols; i++) { Symbol* s2 = static_cast(cs.index2Pointer(i)); if (s2 == idTopSymbol) return true; VariableSymbol* vs2 = dynamic_cast(s2); if (vs2 != 0 && id->leq(vs2->getSort())) return true; } return false; } void BinarySymbol::leftIdentitySortCheck() { Term* id = identityTerm.getTerm(); const ConnectedComponent* component = rangeComponent(); Assert(component == domainComponent(1), "operator with left identity " << this << " has right argument and range in different sort components"); Assert(id->getComponent() == domainComponent(0), "operator " << this << " has left identity and left argument is different sort components"); int nrSorts = component->nrSorts(); // // Check that all collapses are to less or equal sorts. // int step = traverse(0, id->getSortIndex()); for (int i = 1; i < nrSorts; i++) { const Sort* resultSort = component->sort(traverse(step, i)); unequalLeftIdCollapse = (resultSort->index() != i); WarningCheck(leq(i, resultSort), "sort declarations for operator " << QUOTE(this) << " with left identity " << QUOTE(id) << " can cause collapse from sort " << QUOTE(resultSort) << " to " << QUOTE(component->sort(i)) << " (collapsing to a larger or incomparable sort is illegal)."); } } void BinarySymbol::rightIdentitySortCheck() { Term* id = identityTerm.getTerm(); const ConnectedComponent* component = rangeComponent(); Assert(component == domainComponent(0), "operator with right identity " << this << " has left argument and range in different sort components"); Assert(id->getComponent() == domainComponent(1), "operator " << this << " has right identity and right argument is different sort components"); int nrSorts = component->nrSorts(); // // Check all collapses are to less or equal sorts. // int idIndex = id->getSortIndex(); for (int i = 1; i < nrSorts; i++) { const Sort* resultSort = component->sort(traverse(traverse(0, i), idIndex)); unequalRightIdCollapse = (resultSort->index() != i); WarningCheck(leq(i, resultSort), "sort declarations for operator " << QUOTE(this) << " with right identity " << QUOTE(id) << " can cause collapse from sort " << QUOTE(resultSort) << " to sort " << QUOTE(component->sort(i)) << " (collapsing to a larger or incomparable sort is illegal)."); } } void BinarySymbol::idempotentSortCheck() { const ConnectedComponent* component = rangeComponent(); Assert(domainComponent(0) == component && domainComponent(1) == component, "Idempotent operator " << this << " has a domain sort in a different connected component from its range sort"); int nrSorts = component->nrSorts(); for (int i = 1; i < nrSorts; i++) { const Sort* resultSort = component->sort(traverse(traverse(0, i), i)); WarningCheck(leq(i, resultSort), "sort declarations for idempotent operator " << QUOTE(this) << " can cause collapse from sort " << QUOTE(resultSort) << " to sort " << QUOTE(component->sort(i)) << " (collapsing to a larger or incomparable sort is illegal)."); } } bool BinarySymbol::lookForCycle(Term* term, NatSet& examinedIds) const { DebugAdvisory("BinarySymbol::lookForCycle() looking at " << term); // // Check if we've cycled back. // Symbol* s = term->symbol(); if (s == this) return true; // // If we've reached symbol which has an identity we haven't explored, see // if we can reach a cycle through it. // if (BinarySymbol* bs = dynamic_cast(s)) { if (Term* id = bs->getIdentity()) { int index = bs->getIndexWithinModule(); if (!examinedIds.contains(index)) { examinedIds.insert(index); if (lookForCycle(id, examinedIds)) return true; } } } // // Finally explore the arguments. // for (ArgumentIterator a(*term); a.valid(); a.next()) { if (lookForCycle(a.argument(), examinedIds)) return true; } return false; } Maude-2.6/src/Interface/Makefile.am0000644000147300135640000000115711244667552014110 00000000000000noinst_LIBRARIES = libinterface.a libinterface_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libinterface_a_SOURCES = \ symbol.cc \ binarySymbol.cc \ associativeSymbol.cc \ term.cc \ dagNode.cc noinst_HEADERS = \ associativeSymbol.hh \ binarySymbol.hh \ dagNode.hh \ extensionInfo.hh \ interface.hh \ lhsAutomaton.hh \ rawArgumentIterator.hh \ rawDagArgumentIterator.hh \ rhsAutomaton.hh \ subproblem.hh \ unificationSubproblem.hh \ subproblem.hh \ symbol.hh \ symbol2.hh \ term.hh \ delayedSubproblem.hh Maude-2.6/src/Variable/0000777000147300135640000000000011500304120011727 500000000000000Maude-2.6/src/Variable/variableLhsAutomaton.hh0000644000147300135640000000300407666301420016327 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for left hand side automata when lhs is a bare variable. // #ifndef _variableLhsAutomaton_hh_ #define _variableLhsAutomaton_hh_ #include "lhsAutomaton.hh" class VariableLhsAutomaton : public LhsAutomaton { NO_COPYING(VariableLhsAutomaton); public: VariableLhsAutomaton(int index, const Sort* sort, bool copyToAvoidOverwriting); bool match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: const int index; const Sort* const sort; const bool copyToAvoidOverwriting; }; #endif Maude-2.6/src/Variable/variableDagNode.hh0000644000147300135640000000516711433103665015224 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for DAG nodes that are variables. // #ifndef _variableDagNode_hh_ #define _variableDagNode_hh_ #include "dagNode.hh" #include "namedEntity.hh" class VariableDagNode : public DagNode, public NamedEntity { NO_COPYING(VariableDagNode); public: VariableDagNode(Symbol* symbol, int name, int index); RawDagArgumentIterator* arguments(); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); DagNode* copyWithReplacement(int argIndex, DagNode* replacement); DagNode* copyWithReplacement(Vector& redexStack, int first, int last); void stackArguments(Vector& stack, int parentIndex, bool respectFrozen); // // Unification member functions. // ReturnResult computeBaseSortForGroundSubterms(); /* bool computeSolvedForm2(DagNode* rhs, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); */ bool computeSolvedForm2(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending); void insertVariables2(NatSet& occurs); DagNode* instantiate2(const Substitution& substitution); // // Narrowing member functions. // bool indexVariables2(NarrowingVariableInfo& indicies, int baseIndex); // // Functions specific to VariableDagNode. // int getIndex() const; VariableDagNode* lastVariableInChain(Substitution& solution); private: DagNode* markArguments(); DagNode* copyEagerUptoReduced2(); void clearCopyPointers2(); int index; }; inline VariableDagNode::VariableDagNode(Symbol* symbol, int name, int index) : DagNode(symbol), NamedEntity(name), index(index) { } inline int VariableDagNode::getIndex() const { return index; } #endif Maude-2.6/src/Variable/variableTerm.cc0000644000147300135640000001073210536154710014612 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class VariableTerm. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" #include "lhsAutomaton.hh" #include "rhsAutomaton.hh" // core class definitions #include "variableInfo.hh" #include "symbolMap.hh" #include "termBag.hh" #include "substitution.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" #include "variableDagNode.hh" #include "variableLhsAutomaton.hh" VariableTerm::VariableTerm(VariableSymbol* symbol, int name) : Term(symbol), NamedEntity(name) { index = UNDEFINED; } RawArgumentIterator* VariableTerm::arguments() { return 0; } void VariableTerm::deepSelfDestruct() { delete this; } Term* VariableTerm::deepCopy2(SymbolMap* translator) const { VariableSymbol* vs = safeCast(VariableSymbol*, (translator == 0 ? symbol() : translator->translate(symbol()))); return new VariableTerm(vs, id()); } Term* VariableTerm::instantiate2(const Vector& varBindings, SymbolMap* translator) { return varBindings[index]->deepCopy(translator); } Term* VariableTerm::normalize(bool /* full */, bool& changed) { changed = false; setHashValue(hash(symbol()->getHashValue(), id())); return this; } int VariableTerm::compareArguments(const Term* other) const { return id() - safeCast(const VariableTerm*, other)->id(); } int VariableTerm::compareArguments(const DagNode* other) const { return id() - safeCast(const VariableDagNode*, other)->id(); } void VariableTerm::findEagerVariables(bool /* atTop */, NatSet& eagerVariables) const { eagerVariables.insert(index); } void VariableTerm::analyseConstraintPropagation(NatSet& boundUniquely) const { boundUniquely.insert(index); } LhsAutomaton* VariableTerm::compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely) { boundUniquely.insert(index); subproblemLikely = false; bool copyToAvoidOverwriting = matchAtTop /* && variableInfo.rhsVariables().contains(index) */; return new VariableLhsAutomaton(index, getSort(), copyToAvoidOverwriting); } void VariableTerm::markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables) { } DagNode* VariableTerm::dagify2() { return new VariableDagNode(symbol(), id(), index); } bool VariableTerm::subsumes(const Term* other, bool sameVariableSet) const { // // If "this" and "other" are using the same set of variables // then a variable can subsume itself. // if (sameVariableSet && symbol() == other->symbol() && id() == safeCast(const VariableTerm*, other)->id()) return true; // // Otherwise a variable must be linear and have large enough // sort. // return !(occursInContext().contains(index)) && getComponent()->leq(other->getSortIndex(), getSortIndex()); } int VariableTerm::partialCompareUnstable(const Substitution& partialSubstitution, DagNode* other) const { DagNode* d = partialSubstitution.value(index); if (d == 0) return Term::UNKNOWN; int r = d->compare(other); if (r < 0) return LESS; if (r > 0) return GREATER; return EQUAL; } void VariableTerm::findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop) { if (!atTop) availableTerms.insertMatchedTerm(this, eagerContext); } int VariableTerm::compileRhs2(RhsBuilder& /* rhsBuilder */, VariableInfo& /* variableInfo */, TermBag& /* availableTerms */, bool /* eagerContext */) { CantHappen("should never be called"); return 0; } Maude-2.6/src/Variable/Makefile.in0000644000147300135640000005324311500303156013727 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/Variable DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libvariable_a_AR = $(AR) $(ARFLAGS) libvariable_a_LIBADD = am_libvariable_a_OBJECTS = libvariable_a-variableSymbol.$(OBJEXT) \ libvariable_a-variableTerm.$(OBJEXT) \ libvariable_a-variableDagNode.$(OBJEXT) \ libvariable_a-variableLhsAutomaton.$(OBJEXT) libvariable_a_OBJECTS = $(am_libvariable_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libvariable_a_SOURCES) DIST_SOURCES = $(libvariable_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libvariable.a libvariable_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/FullCompiler libvariable_a_SOURCES = \ variableSymbol.cc \ variableTerm.cc \ variableDagNode.cc \ variableLhsAutomaton.cc noinst_HEADERS = \ variable.hh \ variableDagNode.hh \ variableLhsAutomaton.hh \ variableSymbol.hh \ variableTerm.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Variable/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Variable/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libvariable.a: $(libvariable_a_OBJECTS) $(libvariable_a_DEPENDENCIES) -rm -f libvariable.a $(libvariable_a_AR) libvariable.a $(libvariable_a_OBJECTS) $(libvariable_a_LIBADD) $(RANLIB) libvariable.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvariable_a-variableDagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvariable_a-variableLhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvariable_a-variableSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvariable_a-variableTerm.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libvariable_a-variableSymbol.o: variableSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableSymbol.o -MD -MP -MF "$(DEPDIR)/libvariable_a-variableSymbol.Tpo" -c -o libvariable_a-variableSymbol.o `test -f 'variableSymbol.cc' || echo '$(srcdir)/'`variableSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableSymbol.Tpo" "$(DEPDIR)/libvariable_a-variableSymbol.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableSymbol.cc' object='libvariable_a-variableSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableSymbol.o `test -f 'variableSymbol.cc' || echo '$(srcdir)/'`variableSymbol.cc libvariable_a-variableSymbol.obj: variableSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableSymbol.obj -MD -MP -MF "$(DEPDIR)/libvariable_a-variableSymbol.Tpo" -c -o libvariable_a-variableSymbol.obj `if test -f 'variableSymbol.cc'; then $(CYGPATH_W) 'variableSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/variableSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableSymbol.Tpo" "$(DEPDIR)/libvariable_a-variableSymbol.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableSymbol.cc' object='libvariable_a-variableSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableSymbol.obj `if test -f 'variableSymbol.cc'; then $(CYGPATH_W) 'variableSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/variableSymbol.cc'; fi` libvariable_a-variableTerm.o: variableTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableTerm.o -MD -MP -MF "$(DEPDIR)/libvariable_a-variableTerm.Tpo" -c -o libvariable_a-variableTerm.o `test -f 'variableTerm.cc' || echo '$(srcdir)/'`variableTerm.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableTerm.Tpo" "$(DEPDIR)/libvariable_a-variableTerm.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableTerm.cc' object='libvariable_a-variableTerm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableTerm.o `test -f 'variableTerm.cc' || echo '$(srcdir)/'`variableTerm.cc libvariable_a-variableTerm.obj: variableTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableTerm.obj -MD -MP -MF "$(DEPDIR)/libvariable_a-variableTerm.Tpo" -c -o libvariable_a-variableTerm.obj `if test -f 'variableTerm.cc'; then $(CYGPATH_W) 'variableTerm.cc'; else $(CYGPATH_W) '$(srcdir)/variableTerm.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableTerm.Tpo" "$(DEPDIR)/libvariable_a-variableTerm.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableTerm.cc' object='libvariable_a-variableTerm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableTerm.obj `if test -f 'variableTerm.cc'; then $(CYGPATH_W) 'variableTerm.cc'; else $(CYGPATH_W) '$(srcdir)/variableTerm.cc'; fi` libvariable_a-variableDagNode.o: variableDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableDagNode.o -MD -MP -MF "$(DEPDIR)/libvariable_a-variableDagNode.Tpo" -c -o libvariable_a-variableDagNode.o `test -f 'variableDagNode.cc' || echo '$(srcdir)/'`variableDagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableDagNode.Tpo" "$(DEPDIR)/libvariable_a-variableDagNode.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableDagNode.cc' object='libvariable_a-variableDagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableDagNode.o `test -f 'variableDagNode.cc' || echo '$(srcdir)/'`variableDagNode.cc libvariable_a-variableDagNode.obj: variableDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableDagNode.obj -MD -MP -MF "$(DEPDIR)/libvariable_a-variableDagNode.Tpo" -c -o libvariable_a-variableDagNode.obj `if test -f 'variableDagNode.cc'; then $(CYGPATH_W) 'variableDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/variableDagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableDagNode.Tpo" "$(DEPDIR)/libvariable_a-variableDagNode.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableDagNode.cc' object='libvariable_a-variableDagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableDagNode.obj `if test -f 'variableDagNode.cc'; then $(CYGPATH_W) 'variableDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/variableDagNode.cc'; fi` libvariable_a-variableLhsAutomaton.o: variableLhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableLhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Tpo" -c -o libvariable_a-variableLhsAutomaton.o `test -f 'variableLhsAutomaton.cc' || echo '$(srcdir)/'`variableLhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Tpo" "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableLhsAutomaton.cc' object='libvariable_a-variableLhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableLhsAutomaton.o `test -f 'variableLhsAutomaton.cc' || echo '$(srcdir)/'`variableLhsAutomaton.cc libvariable_a-variableLhsAutomaton.obj: variableLhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libvariable_a-variableLhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Tpo" -c -o libvariable_a-variableLhsAutomaton.obj `if test -f 'variableLhsAutomaton.cc'; then $(CYGPATH_W) 'variableLhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/variableLhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Tpo" "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Po"; else rm -f "$(DEPDIR)/libvariable_a-variableLhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='variableLhsAutomaton.cc' object='libvariable_a-variableLhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libvariable_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libvariable_a-variableLhsAutomaton.obj `if test -f 'variableLhsAutomaton.cc'; then $(CYGPATH_W) 'variableLhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/variableLhsAutomaton.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/Variable/variableDagNode.cc0000644000147300135640000001233711433103752015204 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class VariableDagNode // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // core class definitions #include "substitution.hh" #include "narrowingVariableInfo.hh" #include "unificationContext.hh" // variable class definitions #include "variableSymbol.hh" #include "variableDagNode.hh" RawDagArgumentIterator* VariableDagNode::arguments() { return 0; } size_t VariableDagNode::getHashValue() { return hash(symbol()->getHashValue(), id()); } int VariableDagNode::compareArguments(const DagNode* other) const { return id() - safeCast(const VariableDagNode*, other)->id(); } DagNode* VariableDagNode::markArguments() { return 0; } DagNode* VariableDagNode::copyEagerUptoReduced2() { return new VariableDagNode(symbol(), id(), index); } void VariableDagNode::clearCopyPointers2() { } void VariableDagNode::overwriteWithClone(DagNode* old) { VariableDagNode* d = new(old) VariableDagNode(symbol(), id(), index); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); } DagNode* VariableDagNode::makeClone() { VariableDagNode* d = new VariableDagNode(symbol(), id(), index); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); return d; } DagNode* VariableDagNode::copyWithReplacement(int /* argIndex */, DagNode* /* replacement */) { CantHappen("should never be called"); return 0; } DagNode* VariableDagNode::copyWithReplacement(Vector& /* redexStack */, int /* first */, int /* last */) { CantHappen("should never be called"); return 0; } void VariableDagNode::stackArguments(Vector& /* stack */, int /* parentIndex */, bool /* respectFrozen */) { } // // Unification code. // DagNode::ReturnResult VariableDagNode::computeBaseSortForGroundSubterms() { return NONGROUND; } bool VariableDagNode::computeSolvedForm2(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending) { // // In this version we only handle variable vs variable unfication and // punt on everything else. // if (VariableDagNode* v = dynamic_cast(rhs)) { VariableDagNode* lv = lastVariableInChain(solution); VariableDagNode* rv = v->lastVariableInChain(solution); if (lv->equal(rv)) return true; // // Not clear if it safe to leave existing bindings in place or should we unsolve // and re-solve them to take care of any occurs check issues. // // Also we might want to make sure we don't map an original variable to a fresh variable. // DagNode* lt = solution.value(lv->index); if (lt == 0) { solution.unificationBind(lv, rv); return true; } DagNode* rt = solution.value(rv->index); if (rt == 0) { solution.unificationBind(rv, lv); return true; } solution.unificationBind(lv, rv); // // Need to call computeSolvedForm() since lt and rt could be ground. // Safe to call computeSolvedForm() since neither lt nor rt are // variables so the problem can't be kicked back to us. // return lt->computeSolvedForm(rt, solution, pending); } // // Calling computeSolvedForm() would just kick the problem back to us if // rhs is ground, since this is a variable, and cause an infinite recursion. // return rhs->computeSolvedForm2(this, solution, pending); } void VariableDagNode::insertVariables2(NatSet& occurs) { occurs.insert(index); } DagNode* VariableDagNode::instantiate2(const Substitution& substitution) { return substitution.value(index); } VariableDagNode* VariableDagNode::lastVariableInChain(Substitution& solution) { // // If a variable has been bound to anther variable, it is notionally // replaced by that variable thoughout the problem, and in particular // we need chase the replacement chain and find out what variable is // notionally in its place. // VariableDagNode* v = this; for (;;) { DagNode* d = solution.value(v->index); if (d == 0) break; VariableDagNode* n = dynamic_cast(d); if (n == 0) break; v = n; } return v; } bool VariableDagNode::indexVariables2(NarrowingVariableInfo& indices, int baseIndex) { index = baseIndex + indices.variable2Index(this); return false; } Maude-2.6/src/Variable/variableSymbol.hh0000644000147300135640000000432511457443262015171 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for variable symbols. // #ifndef _variableSymbol_hh_ #define _variableSymbol_hh_ #include "symbol.hh" class VariableSymbol : public Symbol { NO_COPYING(VariableSymbol); public: VariableSymbol(int id); Term* makeTerm(const Vector& args); DagNode* makeDagNode(const Vector& args); bool eqRewrite(DagNode* subject, RewritingContext& context); void computeBaseSort(DagNode* subject); void normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context); void stackArguments(DagNode* subject, Vector& stack, int parentIndex); // // Unification stuff. // void computeGeneralizedSort(const SortBdds& sortBdds, const Vector& realToBdd, DagNode* subject, Vector& generalizedSort); bool isStable() const; // // Hash cons stuff. // DagNode* makeCanonical(DagNode* original, HashConsSet* /* hcs */); DagNode* makeCanonicalCopy(DagNode* original, HashConsSet* /* hcs */); // // VariableSymbol specific functions. // Sort* getSort(); }; inline Sort* VariableSymbol::getSort() { // // Temporary hack until sorts mechanism revised. // const Vector& s = getOpDeclarations(); Assert(s.length() == 1, "s.length() != 1"); const Vector& v = s[0].getDomainAndRange(); Assert(v.length() == 1, "v.length() != 1"); return v[0]; } #endif Maude-2.6/src/Variable/variable.hh0000644000147300135640000000202407666301420013771 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for core classes // #ifndef _variable_hh_ #define _variable_hh_ class VariableSymbol; class VariableTerm; class VariableDagNode; class VariableLhsAutomaton; #endif Maude-2.6/src/Variable/variableTerm.hh0000644000147300135640000000542610257133054014626 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for variable terms. // #ifndef _variableTerm_hh_ #define _variableTerm_hh_ #include "term.hh" #include "namedEntity.hh" #include "variableSymbol.hh" class VariableTerm : public Term, public NamedEntity { NO_COPYING(VariableTerm); public: VariableTerm(VariableSymbol* symbol, int name); RawArgumentIterator* arguments(); void deepSelfDestruct(); Term* deepCopy2(SymbolMap* translator) const; Term* normalize(bool full, bool& changed); int compareArguments(const Term* other) const; int compareArguments(const DagNode* other) const; void findEagerVariables(bool atTop, NatSet& eagerVariables) const; void analyseConstraintPropagation(NatSet& boundUniquely) const; LhsAutomaton* compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely); void markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables); DagNode* dagify2(); void findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop); int compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext); // // Optional stuff that is easy to define for variable terms. // bool subsumes(const Term* other, bool sameVariableSet) const; int partialCompareUnstable(const Substitution& partialSubstitution, DagNode* other) const; // // Needed because we actually do the instantiation of variables. // Term* instantiate2(const Vector& varBindings, SymbolMap* translator); // // Functions particular to variable terms. // Sort* getSort() const; int getIndex() const; void setIndex(int indx); private: int index; }; inline Sort* VariableTerm::getSort() const { return safeCast(VariableSymbol*, symbol())->getSort(); } inline int VariableTerm::getIndex() const { return index; } inline void VariableTerm::setIndex(int indx) { index = indx; } #endif Maude-2.6/src/Variable/ChangeLog0000644000147300135640000006003111457443365013447 000000000000002010-10-19 Steven Eker * variableSymbol.cc (VariableSymbol::makeCanonicalCopyEagerUptoReduced): becomes makeCanonicalCopy() - no change in semantics needed * variableSymbol.hh (class VariableSymbol): makeCanonicalCopyEagerUptoReduced() -> makeCanonicalCopy() ===================================Maude95a=========================================== 2010-09-29 Steven Eker * variableSymbol.hh (class VariableSymbol): added decl for makeCanonicalCopyEagerUptoReduced() * variableSymbol.cc (Variable_Symbol::makeCanonicalCopyEagerUptoReduced): added 2010-08-18 Steven Eker * variableDagNode.cc (VariableDagNode::computeSolvedForm2): deleted (VariableDagNode::computeSolvedForm2): deleted commented out old version * variableDagNode.hh (class VariableDagNode): deleted decl for nonVariableSize() ===================================Maude95=========================================== 2010-08-11 Steven Eker * variableDagNode.cc (VariableDagNode::computeSolvedForm2): need to check for unifying a variable against itself 2010-08-04 Steven Eker * variableDagNode.cc (VariableDagNode::computeSolvedForm2): use computeSolvedForm() rather than computeSolvedForm2() in two places since the nonvariable object might be ground (VariableDagNode::computeSolvedForm2): reverted since we get infinite loop - no one wants to handle variable vs ground term (VariableDagNode::computeSolvedForm2): the two bound variables case needs to use computeSolvedForm() since the bindings could be ground and are guarenteed not to be variables 2010-08-03 Steven Eker * variableDagNode.cc (VariableDagNode::computeSolvedForm2): rewritten; we now only handle the variable vs variable case and punt the other cases to the nonvariable terms theory ===================================Maude94a=========================================== 2010-06-04 Steven Eker * variableSymbol.hh (class VariableSymbol): added decl for isStable() * variableSymbol.cc (VariableSymbol::isStable): added ===================================Maude94=========================================== 2009-12-03 Steven Eker * variableSymbol.hh (class VariableSymbol): added decl for makeCanonical() * variableSymbol.cc (makeCanonical): added ===================================Maude92b=========================================== 2008-02-08 Steven Eker * variableDagNode.cc (computeSolvedForm2): use unificationBind() (5 places) (computeSolvedForm2): missed one! * variableDagNode.hh (class VariableDagNode): updated decl for computeSolvedForm2() 2008-02-05 Steven Eker * variableDagNode.cc (computeSolvedForm2): rewritten * variableDagNode.hh (class VariableDagNode): updated decl for computeSolvedForm2() ===================================Maude90=========================================== 2007-11-01 Steven Eker * variableDagNode.cc (instantiate2): updated * variableDagNode.hh (class VariableDagNode): updated decl for instantiate2() 2007-10-26 Steven Eker * variableDagNode.hh (class VariableDagNode): decl for indexVariables() becomes indexVariables2() * variableDagNode.cc (indexVariables): becomes indexVariables2(); return bool 2007-10-15 Steven Eker * variableDagNode.hh (class VariableDagNode): adde decl for indexVariables() * variableDagNode.cc (indexVariables): added ===================================Maude89h=========================================== 2007-08-24 Steven Eker * variableDagNode.cc (computeBaseSortForGroundSubterms): updated * variableDagNode.hh (class VariableDagNode): updated decl for computeBaseSortForGroundSubterms() 2007-08-23 Steven Eker * variableDagNode.cc (computeSolvedForm): becomes computeSolvedForm2() * variableDagNode.hh (class VariableDagNode): added decl for nonVariableSize() (class VariableDagNode): computeSolvedForm() -> computeSolvedForm2() * variableDagNode.cc (nonVariableSize): added, now that default returns 1 ===================================Maude89g=========================================== 2007-07-09 Steven Eker * variableDagNode.cc (computeSolvedForm): detect and warn about unimplemented bare variable case 2007-06-28 Steven Eker * variableDagNode.cc (computeSolvedForm): added extensionInfo arg * variableDagNode.hh (class VariableDagNode): updated decl for computeSolvedForm() ===================================Maude89c=========================================== 2007-03-16 Steven Eker * variableDagNode.cc (occurs2, unify): deleted * variableDagNode.hh (class VariableDagNode): deleted decls for unify(), occurs2() 2007-03-15 Steven Eker * variableSymbol.cc (computeGeneralizedSort): pass realToBdd by ref * variableSymbol.hh (class VariableSymbol): fix decl for computeGeneralizedSort() ===================================Maude89a=========================================== 2007-02-27 Steven Eker * variableDagNode.cc (insertVariables2): added * variableDagNode.hh (class VariableDagNode): added decl for insertVariables2() 2007-02-26 Steven Eker * variableDagNode.cc (computeSolvedForm): fix sortIndex != bug * variableDagNode.hh (class VariableDagNode): added decl for lastVariableInChain() * variableDagNode.cc (lastVariableInChain): added (computeSolvedForm): added * variableDagNode.hh (class VariableDagNode): added decl for computeSolvedForm() ===================================Maude89=========================================== 2007-02-02 Steven Eker * variableDagNode.cc: use unificationBind(); this fixes the bug where we bind a variable X to a variable Y that is already bound to X and fail the occurs check 2007-01-31 Steven Eker * variableDagNode.cc (unify): clear returnedSubproblem; pass 0 extensionInfo on recursive call 2007-01-30 Steven Eker * variableDagNode.cc (unify): do sort check when getting bound to ground variable * variableDagNode.hh (class VariableDagNode): occurs() -> occurs2() * variableDagNode.cc (instantiate): becomes instantiate2() (occurs): becomes occurs2() * variableDagNode.hh (class VariableDagNode): instantiate() -> instantiate2() * variableDagNode.cc (computeBaseSortForGroundSubterms): added * variableDagNode.hh (class VariableDagNode): added decl for computeBaseSortForGroundSubterms() ===================================Maude88e=========================================== 2007-01-16 Steven Eker * variableDagNode.cc (unify): handle the case where we unify an unbound variable against itself 2007-01-04 Steven Eker * variableSymbol.cc (computeGeneralizedSort): added * variableSymbol.hh (class VariableSymbol): added decl for computeGeneralizedSort() 2006-12-11 Steven Eker * variableDagNode.cc (occurs): added (unify): do occurs check * variableDagNode.hh (class VariableDagNode): added decls for occurs() and instantiate() * variableDagNode.cc (instantiate): added (unify): use instantiate() (unify): use update() 2006-12-08 Steven Eker * variableDagNode.cc (unify): added 2006-12-07 Steven Eker * variableDagNode.cc (makeClone, overwriteWithClone) (copyEagerUptoReduced2): pass index to VariableDagNode() * variableTerm.cc (dagify2): pass index to VariableDagNode() * variableDagNode.hh (class VariableDagNode): added data member index (getIndex): added (VariableDagNode): handle index ===================================Maude88d=========================================== 2005-06-24 Steven Eker * variableTerm.hh (class VariableTerm): updated decl for deepCopy2() * variableTerm.cc (deepCopy2): changed arg name * variableTerm.hh (class VariableTerm): updated decl for instantiate2() * variableTerm.cc (instantiate2): new calling convention 2005-06-22 Steven Eker * variableTerm.cc (instantiate2): added * variableTerm.hh (class VariableTerm): added decl for instantiate2() ===================================Maude86b=========================================== 2003-05-06 Steven Eker * variableTerm.cc (partialCompareUnstable): use Term::UNKNOWN 2003-05-01 Steven Eker * variableDagNode.cc (overwriteWithClone): use copySetRewritingFlags() (makeClone): use copySetRewritingFlags() ===================================Maude80=========================================== 2003-02-24 Steven Eker * variableSymbol.cc (makeTerm): updated Assert() (makeDagNode): updated Assert() * variableSymbol.hh (getSort): updated Assert()s * variableTerm.cc: removed #pragma * variableTerm.hh: removed #pragma * variableSymbol.cc: removed #pragma * variableSymbol.hh: removed #pragma * variableLhsAutomaton.cc: removed #pragma * variableLhsAutomaton.hh: removed #pragma * variableDagNode.cc: removed #pragma * variableDagNode.hh: removed #pragma ===================================Maude79=========================================== 2003-01-07 Steven Eker * variableTerm.cc (partialCompareUnstable): added * variableTerm.hh (class VariableTerm): added decl for partialCompareUnstable() ===================================Engine78=========================================== 2002-10-08 Steven Eker * variableDagNode.cc (copyWithReplacement): (both versions) use CantHappen() macro 2002-10-04 Steven Eker * variableDagNode.cc (copyWithReplacement): complex version: changed last (unused) arg * variableDagNode.hh (class VariableDagNode): updated decl for complex version of copyWithReplacement() 2002-10-03 Steven Eker * variableDagNode.hh (class VariableDagNode): updated decl for stackArguments() * variableDagNode.cc (stackArguments): take respectFrozen flag ===================================Engine76================================================== 2002-08-26 Steven Eker * variableSymbol.hh (getSort): updated "temporary hack" to use class OpDeclaration 2002-08-23 Steven Eker * variableTerm.hh (class VariableTerm): deleted superfluous decl for compileRhs() 2002-08-21 Steven Eker * variableTerm.cc (compileRhs2): CantHappen() replaces Assert() ===================================Engine75================================================== 2002-07-24 Steven Eker * variableTerm.cc (subsumes): rewritten to handle sameVariableSet arg * variableTerm.hh (class VariableTerm): updated decl for subsumes() ===================================Engine74================================================== 2001-04-03 Steven Eker * variableDagNode.hh (class VariableDagNode): added decl for Vector version of copyWithReplacement() * variableDagNode.cc (copyWithReplacement): added (Vector version) ===================================Engine66================================================== 2001-03-07 Steven Eker * variableSymbol.hh (class VariableSymbol): added decl for stackArguments() * variableSymbol.cc (stackArguments): added ===================================Engine65================================================== 2001-01-26 Steven Eker * variableDagNode.hh (class VariableDagNode): updated markArguments() decl and made it private * variableDagNode.cc (markArguments): return 0 ===================================Engine64================================================== 2000-07-25 Steven Eker * variableTerm.cc (VariableTerm): don't set modifiedIndex (markEagerArguments): becomes the empty function * variable.hh: deleted forward decl for class VariableRhsAutomaton * variableTerm.hh (class VariableTerm): deleted decl for compileRhs() (class VariableTerm): deleted data member modifiedIndex; index becomes an int (setIndex): don't set modifiedIndex (getModifiedIndex): deleted (class VariableTerm): deleted decl for getModifiedIndex() * variableTerm.cc (compileRhs): deleted * variableRhsAutomaton.cc: deleted * variableRhsAutomaton.hh: deleted ===================================Engine60================================================== 2000-07-18 Steven Eker * variableRhsAutomaton.cc (dump): varIndex -> index * variableTerm.cc (compileLhs2): commented out use of variableInfo.rhsVariables() since we no longer have this 2000-07-12 Steven Eker * variableTerm.hh (class VariableTerm): added decls for findAvailableTerms() and compileRhs2() * variableTerm.cc (findAvailableTerms): added (compileRhs2): added ===================================Engine59================================================== 2000-07-05 Steven Eker * variableTerm.hh (class VariableTerm): compileLhs() -> compileLhs2() * variableTerm.cc (compileLhs): becomes compileLhs2() 2000-06-23 Steven Eker * variableTerm.hh (getSort): made const * variableRhsAutomaton.hh (class VariableRhsAutomaton): made index const * variableRhsAutomaton.cc (VariableRhsAutomaton): use index (construct): use index (replace): use index (dump): use index * variableRhsAutomaton.hh (class VariableRhsAutomaton): varIndex -> index * variableDagNode.hh (class VariableDagNode): use NO_COPYING() macro * variableTerm.cc (compareArguments): use safeCast() (both versions) (dagify2): pass id() * variableDagNode.cc (getHashValue): use id() in hash computation (compareArguments): compare ids() (copyEagerUptoReduced2): copy id() (overwriteWithClone): copy id() (makeClone): copy id() * variableDagNode.hh (class VariableDagNode): derive from class NamedEntity; ctor takes name arg (VariableDagNode): pass name to NamedEntity * variableTerm.hh (getSort): use safeCast() macro * variableTerm.cc (deepCopy2): use safeCast() macro * variableTerm.hh (class VariableTerm): added decl for getSort() (getSort): added * variableTerm.cc (VariableTerm): deal with anme arg; use index and modifiedIndex (deepCopy2): pass id() to new VariableTerm() (normalize): include id() in hash calculation (compareArguments): compare id()s (both versions) (findEagerVariables): use index (analyseConstraintPropagation): use index (compileLhs): use index and getSort() (markEagerArguments): use index and modifiedIndex (compileRhs): use modifiedIndex (subsumes): compare id()s and use index (lookupSort): deleted * variableTerm.hh (downCast): deleted (index): becomes getIndex() (modifiedIndex): becomes getModifiedIndex() (class VariableTerm): data members varIndex and modifiedVarIndex become index and modifiedIndex (setIndex): set index and modifiedIndex (class VariableTerm): ctor takes name arg 2000-06-21 Steven Eker * variableTerm.hh (class VariableTerm): derive from NamedEntity, use NO_COPYING() macro (class VariableTerm): deleted decls for downCast() and lookupSort() * variableSymbol.hh (class VariableSymbol): use NO_COPYING() macro * variableSymbol.cc (makeTerm): now a dummy function (makeDagNode): now a dummy function ===================================Engine58================================================== 2000-03-17 Steven Eker * variableRhsAutomaton.cc (dump): ifdef'd * variableRhsAutomaton.hh (class VariableRhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decls * variableLhsAutomaton.cc (dump): ifdef'd * variableLhsAutomaton.hh (class VariableLhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decls 1999-10-29 Steven Eker * variableSymbol.cc: deleted variableString (VariableSymbol): call Symbol with new conventions (VariableSymbol): don't pass memoFlag arg to Symbol * variableSymbol.hh: deleted static data member variableString ===================================Engine53================================================== 1999-10-26 Steven Eker * variableSymbol.hh (dynamicCast): deleted (class VariableSymbol): deleted decl for dynamicCast() * variableTerm.hh (downCast): rewritten using dynamic_cast() (dynamicCast): deleted (class VariableTerm): deleted decl for dynamicCast() 1999-10-19 Steven Eker * variableDagNode.cc (getHashValue): added * variableDagNode.hh (class VariableDagNode): added decl for getHashValue() ===================================Engine52================================================== 1999-05-12 Steven Eker * variableSymbol.hh (class VariableSymbol): computeTrueSort() -> normalizeAndComputeTrueSort() * variableSymbol.cc (computeTrueSort): become normalizeAndComputeTrueSort() (normalizeAndComputeTrueSort): use fastComputeTrueSort() ===================================Engine49================================================== 1999-01-16 Steven Eker * variableTerm.hh (class VariableTerm): made varIndex and modifiedVarIndex shorts to save memory ===================================Engine46================================================== Fri Nov 6 16:26:56 1998 Steven Eker * variableTerm.cc (deepCopy): -> deepCopy2() * variableTerm.hh (class VariableTerm): deepCopy() -> deepCopy2() ===================================Engine43================================================== Thu Sep 17 17:27:06 1998 Steven Eker * variableSymbol.cc (computeBaseSort): setSortInfo() -> setSortIndex() * variableTerm.cc (subsumes): use ConnectedComponent::leq() * variableDagNode.cc (overwriteWithClone): setSortInfo() -> setSortIndex() (makeClone): setSortInfo() -> setSortIndex() ===================================Engine40================================================== Tue Jul 21 10:42:34 1998 Steven Eker * variableTerm.hh (class VariableTerm): aded decl for deepCopy() * variableTerm.cc (deepCopy): added ===================================Engine39================================================== Wed Jun 10 18:21:38 1998 Steven Eker * variableTerm.hh (class VariableTerm): updated normalize() decl * variableTerm.cc (normalize): clear changed flag Tue Jun 9 18:13:41 1998 Steven Eker * variableTerm.cc: IntSet -> NatSet * variableTerm.hh: IntSet -> NatSet ===================================Engine38================================================== Thu Dec 4 13:13:01 1997 Steven Eker * variableSymbol.cc (VariableSymbol): don't pass inert arg to Symbol() Sun Nov 23 16:15:06 1997 Steven Eker * variableLhsAutomaton.cc (dump): rewritten * variableRhsAutomaton.cc (dump): rewritten * variableRhsAutomaton.hh (class VariableRhsAutomaton): added variableInfo arg * variableLhsAutomaton.hh (class VariableLhsAutomaton): rearranged dump() args ===================================Engine33================================================== Tue Oct 21 11:48:48 1997 Steven Eker * variableTerm.cc (dagify2): switch to new convention * variableTerm.hh (class VariableTerm): switch dagify2() decl to new convention Thu Oct 16 12:16:26 1997 Steven Eker * variableSymbol.cc: variableString changed from array to pointer to get around some slippery C++ semantics * variableSymbol.hh (class VariableSymbol): variableString changed from array to pointer to get around some slippery C++ semantics Wed Oct 15 12:11:49 1997 Steven Eker * variableTerm.hh (class VariableTerm): added decl for dynamicCast() (dynamicCast): added Tue Oct 14 11:15:46 1997 Steven Eker * variableTerm.hh (downCast): use VariableSymbol::dynamicCast() * variableSymbol.cc (makeTerm): ErrorCheck() changed to Assert() * variableSymbol.hh (getSort): added * variableSymbol.cc (computeBaseSort): use getSort(); * variableSymbol.hh (class VariableSymbol): added decls for getSort() and dynamicCast() (class VariableSymbol): added variableString static data member (dynamicCast): added Fri Oct 10 17:52:59 1997 Steven Eker * variableLhsAutomaton.cc (dump): VariableIndex -> VariableInfo, index2Symbol() -> index2Variable() * variableLhsAutomaton.hh (class VariableLhsAutomaton): VariableIndex -> VariableInfo ===================================Engine30================================================== Tue Oct 7 15:47:52 1997 Steven Eker * variableSymbol.cc (makeDagNode): added * variableSymbol.hh (class VariableSymbol): added decl for makeDagNode() Fri Oct 3 18:58:01 1997 Steven Eker * variableTerm.cc (compileRhs): DataSet -> TermSet (dagify2): DataSet -> TermSet * variableTerm.hh (class VariableTerm): DataSet -> TermSet ===================================Engine29================================================== Thu Oct 2 18:31:02 1997 Steven Eker * variableTerm.hh (class VariableTerm): updated compileRhs() decl * variableTerm.cc (compileRhs): adapted to DataSet& compiled Tue Sep 30 12:42:45 1997 Steven Eker * variableTerm.hh (class VariableTerm): dagify() decl becomes dagify2() * variableTerm.cc (normalize): set hash value (dagify2): adapted from dagify() Thu Sep 25 16:32:49 1997 Steven Eker * variableTerm.cc (lookupSort): use getOpDeclarations() * variableSymbol.cc (computeBaseSort): use getOpDeclarations() ===================================Engine28================================================== Wed Jul 23 11:36:19 1997 Steven Eker * variableTerm.cc (normalize): added full flag * variableTerm.hh (class VariableTerm): added full flag to normalize() Mon Jul 21 19:17:26 1997 Steven Eker * variableDagNode.cc (normalizeEagerUptoReduced2): deleted * variableDagNode.hh (class VariableDagNode): deleted normalizeEagerUptoReduced2() decl ===================================Engine26b================================================== Fri Jul 18 15:55:29 1997 Steven Eker * variableDagNode.cc (normalizeEagerUpToReduced2): added * variableDagNode.hh (class VariableDagNode): added decl for normalizeEagerUpToReduced2() Tue Jul 15 15:26:54 1997 Steven Eker * variableSymbol.cc (VariableSymbol): pass inert = true to Symbol() ===================================Engine26================================================== Mon Jun 30 11:09:58 1997 Steven Eker * variableTerm.cc (markEagerArguments): handle case where varIndex is UNDEFINED (VariableTerm): initialize varIndex = modifiedVarIndex = UNDEFINED Fri Jun 27 16:24:21 1997 Steven Eker * variableDagNode.hh (class VariableDagNode): copyEagerUptoReduced2() and clearCopyPointers2() made private Wed Jun 25 14:32:29 1997 Steven Eker * variableSymbol.cc (acceptSortConstraint): deleted (acceptEquation): deleted (acceptRule): deleted * variableSymbol.hh (class VariableSymbol): deleted acceptSortConstraint(), acceptEquation() and acceptRule() decls Tue Jun 24 11:04:05 1997 Steven Eker * variableSymbol.cc (eqRewrite): now do right thing (computeTrueSort): now do right thing (computeBaseSort): now do right thing * variableTerm.cc (dagify): now make VaraibleDagNode s * variableDagNode.cc: created * variableDagNode.hh: created * variableSymbol.cc (makeTerm): use VariableTerm rather than Variable * variableTerm.cc: created from old variable.cc * variableTerm.hh: created from old variable.hh * variable.hh: created to provide forward decls for variable classes Maude-2.6/src/Variable/variableLhsAutomaton.cc0000644000147300135640000000435307666301420016325 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for VariableLhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "lhsAutomaton.hh" // core class definitions #include "variableSymbol.hh" #include "variableInfo.hh" #include "substitution.hh" #include "variableLhsAutomaton.hh" VariableLhsAutomaton::VariableLhsAutomaton(int index, const Sort* sort, bool copyToAvoidOverwriting) : index(index), sort(sort), copyToAvoidOverwriting(copyToAvoidOverwriting) { } bool VariableLhsAutomaton::match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { return subject->matchVariable(index, sort, copyToAvoidOverwriting, solution, returnedSubproblem, extensionInfo); } #ifdef DUMP void VariableLhsAutomaton::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{VariableLhsAutomaton}\n"; s << Indent(indentLevel + 1) << "index = " << index << " \"" << variableInfo.index2Variable(index) << "\"\tsort = " << sort << "\tcopyToAvoidOverwriting = " << copyToAvoidOverwriting << '\n'; s << Indent(indentLevel) << "End{VariableLhsAutomaton}\n"; } #endif Maude-2.6/src/Variable/Makefile.am0000644000147300135640000000064707676173252013743 00000000000000noinst_LIBRARIES = libvariable.a libvariable_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/FullCompiler libvariable_a_SOURCES = \ variableSymbol.cc \ variableTerm.cc \ variableDagNode.cc \ variableLhsAutomaton.cc noinst_HEADERS = \ variable.hh \ variableDagNode.hh \ variableLhsAutomaton.hh \ variableSymbol.hh \ variableTerm.hh Maude-2.6/src/Variable/variableSymbol.cc0000644000147300135640000000646611457443511015164 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class VariableSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "sortBdds.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" #include "variableDagNode.hh" VariableSymbol::VariableSymbol(int id) : Symbol(id, 0) { } Term* VariableSymbol::makeTerm(const Vector& args) { Assert(false, "makeTerm() not useable on variable symbol " << this); return 0; } DagNode* VariableSymbol::makeDagNode(const Vector& args) { Assert(false, "makeDagNode() not useable on variable symbol " << this); return 0; } bool VariableSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { return applyReplace(subject, context); } void VariableSymbol::computeBaseSort(DagNode* subject) { subject->setSortIndex(getSort()->index()); } void VariableSymbol::normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context) { fastComputeTrueSort(subject, context); } void VariableSymbol::stackArguments(DagNode* /* subject */, Vector& /* stack */, int /* parentIndex */) { } // // Unification code. // void VariableSymbol::computeGeneralizedSort(const SortBdds& sortBdds, const Vector& realToBdd, DagNode* subject, Vector& generalizedSort) { int firstVariable = realToBdd[safeCast(VariableDagNode*, subject)->getIndex()]; int nrVariables = sortBdds.getNrVariables(rangeComponent()->getIndexWithinModule()); sortBdds.makeVariableVector(firstVariable, nrVariables, generalizedSort); } bool VariableSymbol::isStable() const { return false; } // // Hash cons code. // DagNode* VariableSymbol::makeCanonical(DagNode* original, HashConsSet* /* hcs */) { // // No arguments that could be non-canonical so we can make the original // instance into the canonical instance. // return original; } DagNode* VariableSymbol::makeCanonicalCopy(DagNode* original, HashConsSet* /* hcs */) { // // We have a unreduced node - copy forced - in principle variable could rewrite to something else! // VariableDagNode* v = safeCast(VariableDagNode*, original); VariableDagNode* n = new VariableDagNode(this, v->id(), v->getIndex()); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); return n; } Maude-2.6/src/NA_Theory/0000777000147300135640000000000011500304120012032 500000000000000Maude-2.6/src/NA_Theory/NA_LhsAutomaton.cc0000644000147300135640000000343707666302013015301 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NA_LhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // NA theory class definitions #include "NA_Symbol.hh" #include "NA_Term.hh" #include "NA_DagNode.hh" #include "NA_LhsAutomaton.hh" NA_LhsAutomaton::NA_LhsAutomaton(NA_Term* term) : term(term) { } bool NA_LhsAutomaton::match(DagNode* subject, Substitution& /* solution */, Subproblem*& returnedSubproblem, ExtensionInfo* /* extensionInfo */) { returnedSubproblem = 0; return term->equal(subject); } #ifdef DUMP void NA_LhsAutomaton::dump(ostream& s, const VariableInfo& /* variableInfo */, int indentLevel) { s << Indent(indentLevel) << "Begin{NA_LhsAutomaton}\n"; s << Indent(indentLevel + 1) << "term = " << term << '\n'; s << Indent(indentLevel) << "End{NA_LhsAutomaton}\n"; } #endif Maude-2.6/src/NA_Theory/NA_Term.hh0000644000147300135640000000442207666302013013577 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for terms in the NA theory. // #ifndef _NA_Term_hh_ #define _NA_Term_hh_ #include "term.hh" class NA_Term : public Term { public: NA_Term(NA_Symbol* symbol); // // Functions required by theory interface. // // The following functions are left to the derived class to handle: // // int compareArguments(const Term* other) const // int compareArguments(const DagNode* other) const // RawArgumentIterator* arguments(); void deepSelfDestruct(); void findEagerVariables(bool atTop, NatSet& eagerVariables) const; void analyseConstraintPropagation(NatSet& BoundUniquely) const; LhsAutomaton* compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely); void markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables); DagNode* dagify2(); void findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop); int compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext); // // The following pure virtual functions are particular to NA_Term // and must be defined by the derived class. // virtual void overwriteWithDagNode(DagNode* old) const = 0; virtual NA_DagNode* makeDagNode() const = 0; }; #endif Maude-2.6/src/NA_Theory/Makefile.in0000644000147300135640000005677011500303155014041 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/NA_Theory DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libNA_Theory_a_AR = $(AR) $(ARFLAGS) libNA_Theory_a_LIBADD = am_libNA_Theory_a_OBJECTS = libNA_Theory_a-NA_Symbol.$(OBJEXT) \ libNA_Theory_a-NA_Term.$(OBJEXT) \ libNA_Theory_a-NA_DagNode.$(OBJEXT) \ libNA_Theory_a-NA_LhsAutomaton.$(OBJEXT) \ libNA_Theory_a-NA_RhsAutomaton.$(OBJEXT) libNA_Theory_a_OBJECTS = $(am_libNA_Theory_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libNA_Theory_a_SOURCES) DIST_SOURCES = $(libNA_Theory_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libNA_Theory.a libNA_Theory_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libNA_Theory_a_SOURCES = \ NA_Symbol.cc \ NA_Term.cc \ NA_DagNode.cc \ NA_LhsAutomaton.cc \ NA_RhsAutomaton.cc noinst_HEADERS = \ NA_DagNode.hh \ NA_LhsAutomaton.hh \ NA_RhsAutomaton.hh \ NA_Symbol.hh \ NA_Term.hh \ NA_Theory.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/NA_Theory/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/NA_Theory/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libNA_Theory.a: $(libNA_Theory_a_OBJECTS) $(libNA_Theory_a_DEPENDENCIES) -rm -f libNA_Theory.a $(libNA_Theory_a_AR) libNA_Theory.a $(libNA_Theory_a_OBJECTS) $(libNA_Theory_a_LIBADD) $(RANLIB) libNA_Theory.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libNA_Theory_a-NA_DagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libNA_Theory_a-NA_Symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libNA_Theory_a-NA_Term.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libNA_Theory_a-NA_Symbol.o: NA_Symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_Symbol.o -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Tpo" -c -o libNA_Theory_a-NA_Symbol.o `test -f 'NA_Symbol.cc' || echo '$(srcdir)/'`NA_Symbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_Symbol.cc' object='libNA_Theory_a-NA_Symbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_Symbol.o `test -f 'NA_Symbol.cc' || echo '$(srcdir)/'`NA_Symbol.cc libNA_Theory_a-NA_Symbol.obj: NA_Symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_Symbol.obj -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Tpo" -c -o libNA_Theory_a-NA_Symbol.obj `if test -f 'NA_Symbol.cc'; then $(CYGPATH_W) 'NA_Symbol.cc'; else $(CYGPATH_W) '$(srcdir)/NA_Symbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_Symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_Symbol.cc' object='libNA_Theory_a-NA_Symbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_Symbol.obj `if test -f 'NA_Symbol.cc'; then $(CYGPATH_W) 'NA_Symbol.cc'; else $(CYGPATH_W) '$(srcdir)/NA_Symbol.cc'; fi` libNA_Theory_a-NA_Term.o: NA_Term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_Term.o -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_Term.Tpo" -c -o libNA_Theory_a-NA_Term.o `test -f 'NA_Term.cc' || echo '$(srcdir)/'`NA_Term.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_Term.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_Term.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_Term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_Term.cc' object='libNA_Theory_a-NA_Term.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_Term.o `test -f 'NA_Term.cc' || echo '$(srcdir)/'`NA_Term.cc libNA_Theory_a-NA_Term.obj: NA_Term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_Term.obj -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_Term.Tpo" -c -o libNA_Theory_a-NA_Term.obj `if test -f 'NA_Term.cc'; then $(CYGPATH_W) 'NA_Term.cc'; else $(CYGPATH_W) '$(srcdir)/NA_Term.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_Term.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_Term.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_Term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_Term.cc' object='libNA_Theory_a-NA_Term.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_Term.obj `if test -f 'NA_Term.cc'; then $(CYGPATH_W) 'NA_Term.cc'; else $(CYGPATH_W) '$(srcdir)/NA_Term.cc'; fi` libNA_Theory_a-NA_DagNode.o: NA_DagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_DagNode.o -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Tpo" -c -o libNA_Theory_a-NA_DagNode.o `test -f 'NA_DagNode.cc' || echo '$(srcdir)/'`NA_DagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_DagNode.cc' object='libNA_Theory_a-NA_DagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_DagNode.o `test -f 'NA_DagNode.cc' || echo '$(srcdir)/'`NA_DagNode.cc libNA_Theory_a-NA_DagNode.obj: NA_DagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_DagNode.obj -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Tpo" -c -o libNA_Theory_a-NA_DagNode.obj `if test -f 'NA_DagNode.cc'; then $(CYGPATH_W) 'NA_DagNode.cc'; else $(CYGPATH_W) '$(srcdir)/NA_DagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_DagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_DagNode.cc' object='libNA_Theory_a-NA_DagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_DagNode.obj `if test -f 'NA_DagNode.cc'; then $(CYGPATH_W) 'NA_DagNode.cc'; else $(CYGPATH_W) '$(srcdir)/NA_DagNode.cc'; fi` libNA_Theory_a-NA_LhsAutomaton.o: NA_LhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_LhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Tpo" -c -o libNA_Theory_a-NA_LhsAutomaton.o `test -f 'NA_LhsAutomaton.cc' || echo '$(srcdir)/'`NA_LhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_LhsAutomaton.cc' object='libNA_Theory_a-NA_LhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_LhsAutomaton.o `test -f 'NA_LhsAutomaton.cc' || echo '$(srcdir)/'`NA_LhsAutomaton.cc libNA_Theory_a-NA_LhsAutomaton.obj: NA_LhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_LhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Tpo" -c -o libNA_Theory_a-NA_LhsAutomaton.obj `if test -f 'NA_LhsAutomaton.cc'; then $(CYGPATH_W) 'NA_LhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/NA_LhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_LhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_LhsAutomaton.cc' object='libNA_Theory_a-NA_LhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_LhsAutomaton.obj `if test -f 'NA_LhsAutomaton.cc'; then $(CYGPATH_W) 'NA_LhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/NA_LhsAutomaton.cc'; fi` libNA_Theory_a-NA_RhsAutomaton.o: NA_RhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_RhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Tpo" -c -o libNA_Theory_a-NA_RhsAutomaton.o `test -f 'NA_RhsAutomaton.cc' || echo '$(srcdir)/'`NA_RhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_RhsAutomaton.cc' object='libNA_Theory_a-NA_RhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_RhsAutomaton.o `test -f 'NA_RhsAutomaton.cc' || echo '$(srcdir)/'`NA_RhsAutomaton.cc libNA_Theory_a-NA_RhsAutomaton.obj: NA_RhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libNA_Theory_a-NA_RhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Tpo" -c -o libNA_Theory_a-NA_RhsAutomaton.obj `if test -f 'NA_RhsAutomaton.cc'; then $(CYGPATH_W) 'NA_RhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/NA_RhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Tpo" "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Po"; else rm -f "$(DEPDIR)/libNA_Theory_a-NA_RhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NA_RhsAutomaton.cc' object='libNA_Theory_a-NA_RhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libNA_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libNA_Theory_a-NA_RhsAutomaton.obj `if test -f 'NA_RhsAutomaton.cc'; then $(CYGPATH_W) 'NA_RhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/NA_RhsAutomaton.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/NA_Theory/NA_Theory.hh0000644000147300135640000000204407666302013014140 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for NA theory classes // #ifndef _NA_Theory_hh_ #define _NA_Theory_hh_ class NA_Symbol; class NA_Term; class NA_DagNode; class NA_LhsAutomaton; class NA_RhsAutomaton; #endif Maude-2.6/src/NA_Theory/NA_RhsAutomaton.cc0000644000147300135640000000411607666302013015302 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NA_RhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // core class definitions #include "substitution.hh" #include "variableInfo.hh" // NA theory class definitions #include "NA_Symbol.hh" #include "NA_Term.hh" #include "NA_DagNode.hh" #include "NA_RhsAutomaton.hh" NA_RhsAutomaton::NA_RhsAutomaton(NA_Term* term, int destination) : term(term), destination(destination) { } void NA_RhsAutomaton::remapIndices(VariableInfo& variableInfo) { destination = variableInfo.remapIndex(destination); } DagNode* NA_RhsAutomaton::construct(Substitution& matcher) { NA_DagNode* d = term->makeDagNode(); matcher.bind(destination, d); return d; } void NA_RhsAutomaton::replace(DagNode* old, Substitution& /* matcher */) { term->overwriteWithDagNode(old); } #ifdef DUMP void NA_RhsAutomaton::dump(ostream& s, const VariableInfo& /* variableInfo */, int indentLevel) { s << Indent(indentLevel) << "Begin{NA_RhsAutomaton}\n"; s << Indent(indentLevel + 1) << "[" << destination << "] <= " << term << '\n'; s << Indent(indentLevel) << "End{NA_RhsAutomaton}\n"; } #endif Maude-2.6/src/NA_Theory/NA_LhsAutomaton.hh0000644000147300135640000000262007666302013015304 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for left hand side automata in the NA theory. // #ifndef _NA_LhsAutomaton_hh_ #define _NA_LhsAutomaton_hh_ #include "lhsAutomaton.hh" class NA_LhsAutomaton : public LhsAutomaton { NO_COPYING(NA_LhsAutomaton); public: NA_LhsAutomaton(NA_Term* term); bool match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: NA_Term* const term; }; #endif Maude-2.6/src/NA_Theory/NA_DagNode.hh0000644000147300135640000000344610663667632014212 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for dag nodes in the NA theory. // #ifndef _NA_DagNode_hh_ #define _NA_DagNode_hh_ #include "dagNode.hh" class NA_DagNode : public DagNode { public: NA_DagNode(NA_Symbol* symbol); // // Functions required by theory interface. // // The following functions are left to the derived class to handle: // // int compareArguments(const DagNode* other) const // void overwriteWithClone(DagNode* old); // DagNode* makeClone(); // RawDagArgumentIterator* arguments(); DagNode* copyWithReplacement(int argIndex, DagNode* replacement); DagNode* copyWithReplacement(Vector& redexStack, int first, int last); void stackArguments(Vector& stack, int parentIndex, bool respectFrozen); private: DagNode* markArguments(); DagNode* copyEagerUptoReduced2(); void clearCopyPointers2(); }; inline NA_DagNode::NA_DagNode(NA_Symbol* symbol) : DagNode(symbol) { } #endif Maude-2.6/src/NA_Theory/NA_RhsAutomaton.hh0000644000147300135640000000265107666302013015316 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for right hand side automata in the NA theory. // #ifndef _NA_RhsAutomaton_hh_ #define _NA_RhsAutomaton_hh_ #include "rhsAutomaton.hh" class NA_RhsAutomaton : public RhsAutomaton { NO_COPYING(NA_RhsAutomaton); public: NA_RhsAutomaton(NA_Term* term, int destination); void remapIndices(VariableInfo& variableInfo); DagNode* construct(Substitution& matcher); void replace(DagNode* old, Substitution& matcher); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: NA_Term* const term; int destination; }; #endif Maude-2.6/src/NA_Theory/NA_Symbol.cc0000644000147300135640000000465511457445345014144 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NA_Symbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // NA theory class definitions #include "NA_Symbol.hh" NA_Symbol::NA_Symbol(int id) : Symbol(id, 0) { } Term* NA_Symbol::makeTerm(const Vector& /* args */) { CantHappen("makeTerm() not useable on non-algebraic symbol " << this); return 0; } DagNode* NA_Symbol::makeDagNode(const Vector& /* args */) { CantHappen("makeDagNode() not useable on non-algebraic symbol " << this); return 0; } bool NA_Symbol::eqRewrite(DagNode* subject, RewritingContext& context) { return applyReplace(subject, context, 0); } void NA_Symbol::computeBaseSort(DagNode* subject) { subject->setSortIndex(traverse(0, 0)); } void NA_Symbol::normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context) { fastComputeTrueSort(subject, context); } void NA_Symbol::stackArguments(DagNode* /* subject */, Vector& /* stack */, int /* parentIndex */) { } bool NA_Symbol::isStable() const { return true; } // // Hash cons code. // DagNode* NA_Symbol::makeCanonical(DagNode* original, HashConsSet* /* hcs */) { // // No arguments that could be non-canonical so we can make the original // instance into the canonical instance. // return original; } DagNode* NA_Symbol::makeCanonicalCopy(DagNode* original, HashConsSet* /* hcs */) { // // Copy forced. // return original->makeClone(); } Maude-2.6/src/NA_Theory/ChangeLog0000644000147300135640000002432611457445351013556 000000000000002010-10-19 Steven Eker * NA_Symbol.cc (NA_Symbol::makeCanonicalCopy): added * NA_Symbol.hh (class NA_Symbol): added decl for makeCanonicalCopy() ===================================Maude95a=========================================== 2010-06-04 Steven Eker * NA_Symbol.cc (NA_Symbol::isStable): added * NA_Symbol.hh (class NA_Symbol): added decl for isStable() ===================================Maude94=========================================== 2009-12-03 Steven Eker * NA_Symbol.hh (class NA_Symbol): added decl for makeCanonical() * NA_Symbol.cc (makeCanonical): added ===================================Maude92b=========================================== 2007-08-24 Steven Eker * NA_DagNode.cc (computeBaseSortForGroundSubterms) (computeSolvedForm, nonVariableSize): deleted * NA_DagNode.hh (class NA_DagNode): deleted decls for computeBaseSortForGroundSubterms(), computeSolvedForm(), nonVariableSize() 2007-06-28 Steven Eker * NA_DagNode.hh (class NA_DagNode): updated decl for computeSolvedForm() * NA_DagNode.cc (computeSolvedForm): added extensionInfo arg ===================================Maude89c=========================================== 2007-03-16 Steven Eker * NA_DagNode.cc (unify): deleted * NA_DagNode.hh (class NA_DagNode): deleted decl for unify() ===================================Maude89a=========================================== 2007-03-05 Steven Eker * NA_DagNode.cc (nonVariableSize): return mpz_class * NA_DagNode.hh (class NA_DagNode): nonVariableSize() now returns mpz_class 2007-02-28 Steven Eker * NA_DagNode.cc (computeSolvedForm, nonVariableSize): added * NA_DagNode.hh (class NA_DagNode): added decls for computeSolvedForm() and nonVariableSize() ===================================Maude89=========================================== 2007-01-31 Steven Eker * NA_DagNode.cc (computeBaseSortForGroundSubterms): added (unify): added (unify): clear returnedSubproblem; pass 0 extensionInfo on recursive call * NA_DagNode.hh (class NA_DagNode): added declarations for unify() and computeBaseSortForGroundSubterms() ===================================Maude88e=========================================== 2003-02-25 Steven Eker * NA_Term.cc: removed #pragma * NA_Term.hh: removed #pragma * NA_Symbol.cc: removed #pragma (makeTerm): Assert() -> CantHappen() (makeDagNode): Assert() -> CantHappen() * NA_Symbol.hh: removed #pragma * NA_RhsAutomaton.cc: removed #pragma * NA_RhsAutomaton.hh: removed #pragma * NA_LhsAutomaton.cc: removed #pragma * NA_LhsAutomaton.hh: removed #pragma * NA_DagNode.cc: removed #pragma * NA_DagNode.hh: removed #pragma ===================================Maude79=========================================== 2002-10-08 Steven Eker * NA_DagNode.cc (copyWithReplacement): (both versions) use CantHappen() macro 2002-10-04 Steven Eker * NA_DagNode.hh (class NA_DagNode): updated decl for complex version of copyWithReplacement() * NA_DagNode.cc (copyWithReplacement): complex version: changed name of unused last arg 2002-10-03 Steven Eker * NA_DagNode.hh (class NA_DagNode): updated decl for respectFrozen * NA_DagNode.cc (stackArguments): take respectFrozen flag =================================Engine76================================================== 2001-04-03 Steven Eker * NA_DagNode.cc (copyWithReplacement): added (Vector verison) * NA_DagNode.hh (class NA_DagNode): added dec for Vector verison of copyWithReplacement() =================================Engine66================================================== 2001-03-07 Steven Eker * NA_Symbol.cc (stackArguments): added * NA_Symbol.hh (class NA_Symbol): added decl for stackArguments() =================================Engine65================================================== 2001-01-26 Steven Eker * NA_DagNode.hh (class NA_DagNode): updated markArguments() decl * NA_DagNode.cc (markArguments): return 0 =================================Engine64================================================== 2000-07-28 Steven Eker * NA_RhsAutomaton.hh (class NA_RhsAutomaton): added decl for remapIndices() * NA_RhsAutomaton.cc (remapIndices): added 2000-07-26 Steven Eker * NA_Term.cc (compileRhs2): use makeConstructionIndex() instead of allocateIndex() 2000-07-25 Steven Eker * NA_Term.cc (findAvailableTerms): becomes null function; we no longer try to do left->right sharing on ground terms since these typically are matched by direct comparison rather than by an automaton and hence we can't use are trick of interposing a BindingLhsAutomaton before the true LhsAutomaton to get a pointer to the dag node for sharing * NA_Term.hh (class NA_Term): deleted decl for compileRhs() * NA_Term.cc (compileRhs): deleted =================================Engine60================================================== 2000-07-12 Steven Eker * NA_Term.cc (findAvailableTerms): added (compileRhs2): added * NA_Term.hh (class NA_Term): added decls for findAvailableTerms() and compileRhs2() =================================Engine59================================================== 2000-07-05 Steven Eker * NA_Term.cc (compileLhs): becomes compileLhs2() * NA_Term.hh (class NA_Term): compileLhs() -> compileLhs2() =================================Engine58================================================== 2000-03-17 Steven Eker * NA_RhsAutomaton.cc (dump): ifdef'd * NA_RhsAutomaton.hh (class NA_RhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decls * NA_LhsAutomaton.cc (dump): ifdef'd * NA_LhsAutomaton.hh (class NA_LhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decls =================================Engine56================================================== 1999-10-29 Steven Eker * NA_Symbol.cc (NA_Symbol): use new Symbol conventions 1999-05-12 Steven Eker * NA_Symbol.hh (class NA_Symbol): computeTrueSort() -> normalizeAndComputeTrueSort() * NA_Symbol.cc (computeTrueSort): become normalizeAndComputeTrueSort() (normalizeAndComputeTrueSort): use fastComputeTrueSort() =================================Engine49================================================== Fri Sep 18 16:48:44 1998 Steven Eker * NA_Symbol.cc (computeBaseSort): use setSortIndex() and traverse() =================================Engine40================================================== Tue Jul 21 14:02:23 1998 Steven Eker * NA_Symbol.hh (class NA_Symbol): updated ctor decl * NA_Symbol.cc (NA_Symbol): don't take sort arg and don't call addOpDeclaration() =================================Engine39================================================== Wed Jun 10 12:06:24 1998 Steven Eker * NA_Term.cc: IntSet -> NatSet * NA_Term.hh (class NA_Term): IntSet -> NatSet =================================Engine38================================================== Thu Feb 12 14:50:03 1998 Steven Eker * NA_LhsAutomaton.cc (match): compare() == 0 changed to equal() =================================Engine35================================================== Thu Dec 4 13:12:00 1997 Steven Eker * NA_Symbol.cc (NA_Symbol): don't pass inert arg to Symbol() Tue Nov 25 11:38:06 1997 Steven Eker * NA_RhsAutomaton.cc (dump): updated * NA_RhsAutomaton.hh (class NA_RhsAutomaton): updated decl for dump() * NA_LhsAutomaton.cc (dump): updated * NA_LhsAutomaton.hh (class NA_LhsAutomaton): updated decl for dump() =================================Engine33================================================== Tue Oct 21 11:53:13 1997 Steven Eker * NA_Term.cc (dagify2): switch to new convention * NA_Term.hh (class NA_Term): switch dagify2() decl to new convention Tue Oct 14 18:04:35 1997 Steven Eker * NA_Symbol.cc (NA_Symbol): use revised Symbol ctor Fri Oct 10 18:18:43 1997 Steven Eker * NA_LhsAutomaton.cc (dump): VariableIndex -> VariableInfo * NA_LhsAutomaton.hh (class NA_LhsAutomaton): VariableIndex -> VariableInfo =================================Engine30================================================== Tue Oct 7 15:44:35 1997 Steven Eker * NA_Symbol.cc (makeDagNode): added * NA_Symbol.hh (class NA_Symbol): added decl for makeDagNode() Fri Oct 3 19:06:36 1997 Steven Eker * NA_Term.cc (dagify2): DataSet -> TermSet (compileRhs): DataSet -> TermSet * NA_Term.hh (class NA_Term): DataSet -> TermSet =================================Engine29================================================== Thu Oct 2 18:11:14 1997 Steven Eker * NA_Term.hh (class NA_Term): updated compileRhs() decl * NA_Term.cc (compileRhs): adapted to DataSet& compiled Tue Sep 30 14:35:30 1997 Steven Eker * NA_Term.hh (class NA_Term): dagify() decl becomes dagify2() * NA_Term.cc (normalize): deleted; now must be supplied by derived class as it does hash calculation (dagify2): adapted from dagify() * NA_Term.hh (class NA_Term): deleted normalize() decl =================================Engine28================================================== Wed Jul 30 10:56:52 1997 Steven Eker * NA_LhsAutomaton.cc: created * NA_RhsAutomaton.hh (class NA_RhsAutomaton): created * NA_LhsAutomaton.hh (class NA_LhsAutomaton): created * NA_Term.cc: created * NA_DagNode.hh (class NA_DagNode): created * NA_Theory.hh: created * NA_DagNode.cc: created * NA_Term.hh (class NA_Term): created Tue Jul 29 17:37:41 1997 Steven Eker * NA_Symbol.cc: created * NA_Symbol.hh (class NA_Symbol): created Maude-2.6/src/NA_Theory/NA_Term.cc0000644000147300135640000000517707666302013013575 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NA_Term. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" #include "lhsAutomaton.hh" #include "rhsAutomaton.hh" // core class definitions #include "variableInfo.hh" #include "termBag.hh" #include "rhsBuilder.hh" // NA theory class definitions #include "NA_Symbol.hh" #include "NA_DagNode.hh" #include "NA_Term.hh" #include "NA_LhsAutomaton.hh" #include "NA_RhsAutomaton.hh" NA_Term::NA_Term(NA_Symbol* symbol) : Term(symbol) { } RawArgumentIterator* NA_Term::arguments() { return 0; } void NA_Term::deepSelfDestruct() { delete this; } void NA_Term::findEagerVariables(bool /* atTop */, NatSet& /* eagerVariables */) const { } void NA_Term::markEagerArguments(int /* nrVariables */, const NatSet& /* eagerVariables */, Vector& /* problemVariables */) { } void NA_Term::analyseConstraintPropagation(NatSet& /* BoundUniquely */) const { } LhsAutomaton* NA_Term::compileLhs2(bool /* matchAtTop */, const VariableInfo& /* variableInfo */, NatSet& /* boundUniquely */, bool& subproblemLikely) { subproblemLikely = false; return new NA_LhsAutomaton(this); } DagNode* NA_Term::dagify2() { return makeDagNode(); } void NA_Term::findAvailableTerms(TermBag& /* availableTerm */s, bool /* eagerContext */, bool /* atTop */) { } int NA_Term::compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& /* availableTerms */, bool /* eagerContext */) { int index = variableInfo.makeConstructionIndex(); rhsBuilder.addRhsAutomaton(new NA_RhsAutomaton(this, index)); return index; } Maude-2.6/src/NA_Theory/NA_DagNode.cc0000644000147300135640000000361610663667540014175 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NA_DagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "NA_Theory.hh" // variable class definitions #include "variableDagNode.hh" // NA theory class definitions #include "NA_Symbol.hh" #include "NA_DagNode.hh" RawDagArgumentIterator* NA_DagNode::arguments() { return 0; } DagNode* NA_DagNode::markArguments() { return 0; } DagNode* NA_DagNode::copyEagerUptoReduced2() { return makeClone(); } void NA_DagNode::clearCopyPointers2() { } DagNode* NA_DagNode::copyWithReplacement(int /* argIndex */, DagNode* /* replacement */) { CantHappen("should never be called"); return 0; } DagNode* NA_DagNode::copyWithReplacement(Vector& /* redexStack */, int /* first */, int /* last */) { CantHappen("should never be called"); return 0; } void NA_DagNode::stackArguments(Vector& /* stack */, int /* parentIndex */, bool /* respectFrozen */) { } Maude-2.6/src/NA_Theory/NA_Symbol.hh0000644000147300135640000000315711457445157014153 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Base class for non-algebraic built-in constant symbols. // #ifndef _NA_Symbol_hh_ #define _NA_Symbol_hh_ #include "symbol.hh" class NA_Symbol : public Symbol { public: NA_Symbol(int id); Term* makeTerm(const Vector& args); DagNode* makeDagNode(const Vector& args); bool eqRewrite(DagNode* subject, RewritingContext& context); void computeBaseSort(DagNode* subject); void normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context); void stackArguments(DagNode* subject, Vector& stack, int parentIndex); bool isStable() const; // // Hash cons stuff. // DagNode* makeCanonical(DagNode* original, HashConsSet* /* hcs */); DagNode* makeCanonicalCopy(DagNode* original, HashConsSet* /* hcs */); }; #endif Maude-2.6/src/NA_Theory/Makefile.am0000644000147300135640000000071707676173072014044 00000000000000noinst_LIBRARIES = libNA_Theory.a libNA_Theory_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libNA_Theory_a_SOURCES = \ NA_Symbol.cc \ NA_Term.cc \ NA_DagNode.cc \ NA_LhsAutomaton.cc \ NA_RhsAutomaton.cc noinst_HEADERS = \ NA_DagNode.hh \ NA_LhsAutomaton.hh \ NA_RhsAutomaton.hh \ NA_Symbol.hh \ NA_Term.hh \ NA_Theory.hh Maude-2.6/src/MSCP10/0000777000147300135640000000000011500304122011107 500000000000000Maude-2.6/src/MSCP10/scp_memory.cc0000644000147300135640000000611607666302265013543 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /************************************************ ** SCP Parsing Algorithm ** ** Maude Implementation ** ** Jose F. Quesada ** ** CSL - SRI Int. 1998 ** ************************************************/ /******* ******* scp_memory.cc *******/ #include "scp_parser.hh" ScpParser::ScpParser() { compiled = 0; lenprodtn = MEMPRODTN; memprodtn = new ScpProdtn[lenprodtn]; curprodtn = 0; ldgrprodtn = 0; lenrhs = MEMRHS; memrhs = new int[lenrhs]; currhs = 0; lenbasent = MEMBASENT; membasent = new ScpBaseNT[lenbasent]; memset(membasent,-1,lenbasent*sizeof(ScpBaseNT)); maxbasent = 0; lenabslnt = MEMABSLNT; memabslnt = new ScpAbslNT[lenabslnt]; memset(memabslnt,0,lenabslnt*sizeof(ScpAbslNT)); maxabslnt = 0; lenbubble = MEMBUBBLE; membubble = new ScpBubble[lenbubble]; curbubble = 0; lenexcept = MEMEXCEPT; memexcept = new int[lenexcept]; curexcept = 0; maxtermn = -1; addrtermn = 0; covtbl = 0; adjtb = 0; bubexcept = 0; memcov = 0; bubcov = 0; maxlenterm = MEMLENTERM; nodeterm = new int[maxlenterm*5]; eventterm = nodeterm+maxlenterm; inputterm = eventterm+maxlenterm; errorlist = inputterm+maxlenterm; errorlevel = errorlist+maxlenterm; lenevent = MEMEVENT; memevent = new ScpEvent[lenevent]; lennode = MEMNODE; memnode = new ScpNode[lennode]; memambnode = new int[lennode]; prevambnode = 1; /* because memambnode hasn't been initialized */ lenanal = MEMANAL; memanal = new ScpAnal[lenanal]; lendetect = MEMDETECT; memdetect = new int[lendetect]; typedetect = new int[lendetect]; memalter = 0; lenalter = 0; memprodruntoken = 0; // includes memprodrunnode } ScpParser::~ScpParser() { delete [] memprodtn; delete [] ldgrprodtn; delete [] memrhs; delete [] membasent; delete [] memabslnt; delete [] membubble; delete [] memexcept; delete [] addrtermn; delete [] covtbl; delete [] adjtb; delete [] bubexcept; delete [] memcov; delete [] bubcov; delete [] nodeterm; delete [] memevent; delete [] memnode; delete [] memambnode; delete [] memanal; delete [] memprodruntoken; delete [] memdetect; delete [] typedetect; delete [] memalter; } Maude-2.6/src/MSCP10/scp_parser.cc0000644000147300135640000012634507666302265013536 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /************************************************ ** SCP Parsing Algorithm ** ** Maude Implementation ** ** Jose F. Quesada ** ** CSL - SRI Int. 1998 ** ************************************************/ /******* ******* scp_parser.cc *******/ #include "scp_parser.hh" int ScpParser::parseSentence(Vector& term,int root,int errorRecover) { // Control: compile grammar if (!compiled) compileParser(); // Init EventTerm lengthterm = term.length()+1; if (lengthterm > maxlenterm) { maxlenterm = lengthterm + ADDLENTERM; delete [] nodeterm; nodeterm = new int[maxlenterm*5]; eventterm = nodeterm+maxlenterm; inputterm = eventterm+maxlenterm; errorlist = inputterm+maxlenterm; errorlevel = errorlist+maxlenterm; } memset(eventterm,0,(lengthterm+1)*sizeof(int)); memset(nodeterm,0,(lengthterm+1)*sizeof(int)); // ErrorRecover parseErrorRecover = errorRecover; if (errorRecover) { curdetect = 0; lasttokendetect = 0; prevlasttokendetect = -1; } // Init Counters and Flags rootterm = membasent[-root].lastAbs; register int tk; // Copy term(Vector) to inputterm(int*) for (tk = 0; tk < lengthterm-1; tk++) inputterm[tk] = term[tk]; // End Token inputterm[tk] = maxtermn + 10; // Prod 0 memprodtn[0].lhs = rootterm; memrhs[memprodtn[0].rhs] = rootterm; // Initial Flags curevent = 0; /* event 0 is not used */ curnode = 0; /* node 0 is not used */ curanal = 0; /* anal 0 is not used */ rootnode = 0; ambnodes = 0; prevnextanal = 0; #ifdef SCPTRACE cout << "==============================================" << endl; cout << "parse: "; for (tk = 0; tk < lengthterm-1; tk++) cout << inputterm[tk] << " " ; cout << endl; #endif tryEvent(0,0,0,0,0,0); if (curbubble) { for (tk = 0; tk < lengthterm; tk++) if (eventterm[tk]) runTokenBubble(tk); } else { for (tk = 0; tk < lengthterm-1; tk++) if ((inputterm[tk] < maxtermn) && (eventterm[tk])) runToken(tk); } #ifdef SCPTRACE cout << "parse: "; for (tk = 0; tk < lengthterm-1; tk++) cout << inputterm[tk] << " " ; cout << endl; cout << "Length: " << lengthterm-1 << " RootNode: " << rootnode << endl; cout << " Nodes: " << curnode << " Events: " << curevent << " Anals: " << curanal << endl; #endif if (!errorRecover) curerrorlist = 0; if (!rootnode) { if (errorRecover) { errorRecovery(); } else { memset(errorlist,0,(lengthterm+1)*sizeof(int)); memset(errorlevel,0,(lengthterm+1)*sizeof(int)); parseSentence(term,root,1); } return 0; } else if (rootnode && !ambnodes) return 1; else { if (prevambnode) memset(memambnode,0,(curnode+1)*sizeof(int)); prevambnode = 1; return setAmbNode(rootnode); } } void ScpParser::tryEvent(int prod,int idot,int fpos,int lpos, int prevnode = 0,int prevevent = 0) { #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent (" << " prod:" << prod-1 << " symbol:" << printSymbol(memprodtn[prod].lhs) << " idot:" << idot << " fpos:" << fpos << " lpos:" << lpos << " )" << endl; #endif int pos = lpos; int dot = idot; int rhs = memprodtn[prod].rhs+dot; while ((dot < memprodtn[prod].lrhs) && (memrhs[rhs] >= 0) && (pos < lengthterm)) { if (memrhs[rhs] == inputterm[pos]) { #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:skipTerm (" << " pos:" << pos << " token:" << inputterm[pos] << " )" << endl; #endif rhs ++; pos ++; dot ++; } else { #ifdef SCPTRACE cout << "SCPtrace$$ FAIL:tryEvent:skipTerm (" << " pos:" << pos << " inputToken:" << inputterm[pos] << " neededToken:" << memrhs[rhs] << " )" << endl; #endif if (parseErrorRecover) { if (pos >= lasttokendetect) { errorDetect(pos,memrhs[rhs]); curevent ++; if (curevent >= lenevent) { ScpEvent* xmemevent = new ScpEvent[lenevent+ADDEVENT]; memcpy(xmemevent,memevent,lenevent*sizeof(ScpEvent)); lenevent += ADDEVENT; delete [] memevent; memevent = xmemevent; } ScpEvent* event = &memevent[curevent]; event->prodtn = prod; event->dot = dot; event->fpos = fpos; event->nextsymbol = memrhs[rhs]; if (event->nextsymbol >= 0) { if (event->nextsymbol < maxtermn) event->addrnextsymbol = addrtermn[event->nextsymbol]; else event->addrnextsymbol = 0; } else event->addrnextsymbol = addrnontm[-event->nextsymbol]; event->subsumed = 1; event->prevnode = prevnode; event->prevevent = prevevent; #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:newEvent[" << curevent << "] ( " << " prod:" << prod-1 << " symbol:" << printSymbol(memprodtn[prod].lhs) << " dot:" << dot << " nextsymbol: " << memrhs[rhs] << " fpos:" << fpos << " lpos:" << pos << endl; cout << "SCPtrace$$ tryEvent:addEvent[" << pos << "] ADD " << curevent << endl; #endif if (!eventterm[pos]) { event->nextevent = 0; eventterm[pos] = curevent; } else { if (curbubble && (lpos == fpos)) { int xevents = eventterm[pos]; while (memevent[xevents].nextevent) xevents = memevent[xevents].nextevent; memevent[xevents].nextevent = curevent; event->nextevent = 0; } else { event->nextevent = eventterm[pos]; eventterm[pos] = curevent; } } } } return; } } if (dot < memprodtn[prod].lrhs) { if ((memabslnt[-memrhs[rhs]].bubblecov) || ((inputterm[pos] < maxtermn) && (ldertmtb[addrtermn[inputterm[pos]]-memrhs[rhs]]))) { #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:LDerControl (" << " symbol:" << printSymbol(memrhs[rhs]) << " token:" << inputterm[pos] << " ) => 1" << endl; #endif curevent ++; if (curevent >= lenevent) { ScpEvent* xmemevent = new ScpEvent[lenevent+ADDEVENT]; memcpy(xmemevent,memevent,lenevent*sizeof(ScpEvent)); lenevent += ADDEVENT; delete [] memevent; memevent = xmemevent; } ScpEvent* event = &memevent[curevent]; event->prodtn = prod; event->dot = dot; event->fpos = fpos; event->nextsymbol = memrhs[rhs]; event->addrnextsymbol = addrnontm[-event->nextsymbol]; event->subsumed = 0; event->prevnode = prevnode; event->prevevent = prevevent; #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:newEvent[" << curevent << "] ( " << " prod:" << prod-1 << " symbol:" << printSymbol(memprodtn[prod].lhs) << " dot:" << dot << " nextsymbol: " << printSymbol(memrhs[rhs]) << " fpos:" << fpos << " lpos:" << pos << endl; // << "SCPtrace$$ " // << " prevnode:" << prevnode // << " prevevent:" << prevevent // << " )" << endl; cout << "SCPtrace$$ tryEvent:addEvent[" << pos << "] ADD " << curevent << endl; #endif if (!eventterm[pos]) { event->nextevent = 0; eventterm[pos] = curevent; } else { int xevents = eventterm[pos]; int sub = 0; while (!sub && xevents) { if (memevent[xevents].nextsymbol < 0) { if (ldernttb[event->addrnextsymbol - memevent[xevents].nextsymbol]) { #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:subsume event " << xevents << " to " << curevent << endl; #endif event->subsumed = 1; sub = 1; } else if (ldernttb[memevent[xevents].addrnextsymbol - event->nextsymbol]){ #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:subsume event " << curevent << " to " << xevents << endl; #endif memevent[xevents].subsumed = 1; } } xevents = memevent[xevents].nextevent; } if (curbubble && (lpos == fpos)) { xevents = eventterm[pos]; while (memevent[xevents].nextevent) xevents = memevent[xevents].nextevent; memevent[xevents].nextevent = curevent; event->nextevent = 0; } else { event->nextevent = eventterm[pos]; eventterm[pos] = curevent; } } } else { #ifdef SCPTRACE cout << "SCPtrace$$ FAIL:tryEvent:LDerControl (" << " symbol:" << printSymbol(memrhs[rhs]) << " token:" << inputterm[pos] << " ) => 0" << endl; #endif if (parseErrorRecover) { if (pos >= lasttokendetect) { errorDetect(pos,memrhs[rhs]); if ((inputterm[pos] < maxtermn) && (!ldertmtb[addrtermn[inputterm[pos]]-memrhs[rhs]])) { #ifdef SCPTRACE cout << "SCPtrace$$ ErrorRecoveryPhase: cancelling FAIL" << endl; #endif curevent ++; if (curevent >= lenevent) { ScpEvent* xmemevent = new ScpEvent[lenevent+ADDEVENT]; memcpy(xmemevent,memevent,lenevent*sizeof(ScpEvent)); lenevent += ADDEVENT; delete [] memevent; memevent = xmemevent; } ScpEvent* event = &memevent[curevent]; event->prodtn = prod; event->dot = dot; event->fpos = fpos; event->nextsymbol = memrhs[rhs]; event->addrnextsymbol = addrnontm[-event->nextsymbol]; event->subsumed = 1; event->prevnode = prevnode; event->prevevent = prevevent; #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:newEvent[" << curevent << "] ( " << " prod:" << prod-1 << " symbol:" << printSymbol(memprodtn[prod].lhs) << " dot:" << dot << " nextsymbol: " << printSymbol(memrhs[rhs]) << " fpos:" << fpos << " lpos:" << pos << endl; cout << "SCPtrace$$ tryEvent:addEvent[" << pos << "] ADD " << curevent << endl; #endif if (!eventterm[pos]) { event->nextevent = 0; eventterm[pos] = curevent; } else { int xevents = eventterm[pos]; int sub = 0; while (!sub && xevents) { if (memevent[xevents].nextsymbol < 0) { if (ldernttb[event->addrnextsymbol - memevent[xevents].nextsymbol]) { #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:subsume event " << xevents << " to " << curevent << endl; #endif event->subsumed = 1; sub = 1; } else if (ldernttb[memevent[xevents].addrnextsymbol - event->nextsymbol]){ #ifdef SCPTRACE cout << "SCPtrace$$ tryEvent:subsume event " << curevent << " to " << xevents << endl; #endif memevent[xevents].subsumed = 1; } } xevents = memevent[xevents].nextevent; } if (curbubble && (lpos == fpos)) { xevents = eventterm[pos]; while (memevent[xevents].nextevent) xevents = memevent[xevents].nextevent; memevent[xevents].nextevent = curevent; event->nextevent = 0; } else { event->nextevent = eventterm[pos]; eventterm[pos] = curevent; } } } } } } } else { if (pos == lengthterm) { #ifdef SCPTRACE cout << "SCPtrace$$ AssigningRootNode: " << prevnode << endl; #endif rootnode = prevnode; } else tryNode(prod,fpos,pos,prevnode,prevevent); } } void ScpParser::runToken(int token) { #ifdef SCPTRACE cout << "SCPtrace$$ runToken (" << " token:" << inputterm[token] << " post:" << token << " )" << endl; #endif int prememprodruntoken; int curmemprodruntoken = 0; int event = eventterm[token]; int addrtoken = addrtermn[inputterm[token]]; while (event) { if (!memevent[event].subsumed) { int cov = covtmtb[addrtoken-memevent[event].nextsymbol]; prememprodruntoken = curmemprodruntoken-1; while (cov) { int pro = memcov[cov].prodtn; int run = 0; for (int rt = prememprodruntoken; (!run) && (rt >= 0); rt--) if (memprodruntoken[rt] == pro) run = 1; if (run) { #ifdef SCPTRACE cout << "SCPtrace$$ runToken:triggerCoverage-Run:" << memcov[cov].prodtn - 1 << " runToken (" << " token:" << inputterm[token] << " post:" << token << " )" << endl; #endif } else { #ifdef SCPTRACE cout << "SCPtrace$$ runToken:triggerCoverage:" << memcov[cov].prodtn -1 << " runToken (" << " token:" << inputterm[token] << " post:" << token << " )" << endl; #endif memprodruntoken[curmemprodruntoken++] = pro; tryEvent(pro,0,token,token,0,0); } cov = memcov[cov].next; } } event = memevent[event].nextevent; } } void ScpParser::runTokenBubble(int token) { #ifdef SCPTRACE cout << "SCPtrace$$ runToken (" << " token:" << inputterm[token] << " post:" << token << " )" << endl; #endif int prememprodruntoken; int curmemprodruntoken = 0; int event = eventterm[token]; int addrtoken; if (inputterm[token] < maxtermn) addrtoken = addrtermn[inputterm[token]]; int bcov; int ecov; while (event) { if ((inputterm[token] < maxtermn) && (!memevent[event].subsumed)) { int cov = covtmtb[addrtoken-memevent[event].nextsymbol]; prememprodruntoken = curmemprodruntoken-1; while (cov) { int pro = memcov[cov].prodtn; int run = 0; for (int rt = prememprodruntoken; (!run) && (rt >= 0); rt--) if (memprodruntoken[rt] == pro) run = 1; if (run) { #ifdef SCPTRACE cout << "SCPtrace$$ runToken:triggerCoverage-Run:" << memcov[cov].prodtn -1 << " runToken (" << " token:" << inputterm[token] << " post:" << token << " )" << endl; #endif } else { #ifdef SCPTRACE cout << "SCPtrace$$ runToken:triggerCoverage:" << memcov[cov].prodtn -1 << " runToken (" << " token:" << inputterm[token] << " post:" << token << " )" << endl; #endif memprodruntoken[curmemprodruntoken++] = pro; tryEvent(pro,0,token,token,0,0); } cov = memcov[cov].next; } } if (!memevent[event].subsumed) { if (ecov = memabslnt[-memevent[event].nextsymbol].bubbleev) { while (ecov) { if (bcov = memabslnt[-memrhs[memprodtn[bubcov[ecov].prodtn].rhs]].bubblecov) { while (bcov) { runBubble(bubcov[ecov].prodtn,0, token,memcov[bcov].prodtn,token,0); bcov = memcov[bcov].next; } } ecov = bubcov[ecov].next; } } } if (memevent[event].nextsymbol < 0) { if (memabslnt[-memevent[event].nextsymbol].bubbletermn) { if (bcov = memabslnt[-memevent[event].nextsymbol].bubblecov) { while (bcov) { runBubble(memevent[event].prodtn,memevent[event].dot, memevent[event].fpos,memcov[bcov].prodtn,token,event); bcov = memcov[bcov].next; } } } } event = memevent[event].nextevent; } } void ScpParser::tryNode(int prod,int fpos,int lpos,int prevnode,int prevevent) { #ifdef SCPTRACE cout << "SCPtrace$$ tryNode (" << " prod:" << prod -1; if (memprodtn[prod].bubble) cout << " symbol:" << printSymbol(membubble[memprodtn[prod].bubble].abslnt); else cout << " symbol:" << printSymbol(memprodtn[prod].lhs); cout << " fpos:" << fpos << " lpos:" << lpos << " )" << endl; #endif if (lpos >= lengthterm) return; // Adjacency Control int nextterm = inputterm[lpos]; int lhs; if (memprodtn[prod].bubble) lhs = membubble[memprodtn[prod].bubble].abslnt; else lhs = memprodtn[prod].lhs; if (lpos < (lengthterm-1)) { if (nextterm >= maxtermn) { ; } else if (adjtb[addrtermn[nextterm]-lhs]) { #ifdef SCPTRACE cout << "SCPtrace$$ tryNode:AdjControl (" << " symbol:" << printSymbol(lhs) << " token:" << nextterm << " ) => 1" << endl; #endif } else if (memabslnt[-lhs].adjbubble) { #ifdef SCPTRACE cout << "SCPtrace$$ tryNode:AdjControl (" << " symbol:" << printSymbol(lhs) << " ) => (adjBubble) 1" << endl; #endif } else { #ifdef SCPTRACE cout << "SCPtrace$$ FAIL:tryNode:AdjControl (" << " symbol:" << printSymbol(lhs) << " token:" << nextterm << " ) => 0" << endl; #endif if (!parseErrorRecover) return; else { #ifdef SCPTRACE cout << "SCPtrace$$ ErrorRecoveryPhase: cancelling FAIL" << endl; #endif } } } else { if (rdernttb[addrnontm[-lhs]-rootterm]) { #ifdef SCPTRACE cout << "SCPtrace$$ tryNode:AdjControl:RMS (" << " symbol:" << printSymbol(lhs) << " ) => 1" << endl; #endif } else if (memabslnt[-lhs].adjbubble) { #ifdef SCPTRACE cout << "SCPtrace$$ tryNode:AdjControl:RMS (" << " symbol:" << printSymbol(lhs) << " ) => (adjBubble) 1" << endl; #endif } else { #ifdef SCPTRACE cout << "SCPtrace$$ FAIL:tryNode:AdjControl:RMS (" << " symbol:" << printSymbol(lhs) << " ) => 0" << endl; #endif if (!parseErrorRecover) return; else { #ifdef SCPTRACE cout << "SCPtrace$$ ErrorRecoveryPhase: cancelling FAIL" << endl; #endif } } } int symbol = lhs; // Local Ambiguity control int xnode = nodeterm[fpos]; while (xnode) { if ((memnode[xnode].lpos == lpos) && (memnode[xnode].symbol == symbol)) { if (memprodtn[prod].bubble || parseErrorRecover) return; curanal++; if (curanal >= lenanal) { ScpAnal* xmemanal = new ScpAnal[lenanal+ADDANAL]; memcpy(xmemanal,memanal,lenanal*sizeof(ScpAnal)); lenanal += ADDANAL; delete [] memanal; memanal = xmemanal; } ScpAnal* anal = &memanal[curanal]; anal->prodtn = prod; anal->prevnode = prevnode; anal->prevevent = prevevent; anal->nextanal = memnode[xnode].initanal; memnode[xnode].initanal = curanal; ambnodes = 1; #ifdef SCPTRACE cout << "SCPtrace$$ tryNode:LocalAmbiguity with node " << xnode << endl; cout << "SCPtrace$$ tryNode:newAnal[" << curanal << "] (" << " prod:" << prod -1 << " prevnode:" << prevnode << " prevevent:" << prevevent << " nextanal:" << anal->nextanal << ")" << endl; #endif return; } xnode = memnode[xnode].nextnode; } // Node Creation curnode ++; if (curnode >= lennode) { ScpNode* xmemnode = new ScpNode[lennode+ADDNODE]; memcpy(xmemnode,memnode,lennode*sizeof(ScpNode)); int* xmemambnode = new int[lennode+ADDNODE]; lennode += ADDNODE; delete [] memnode; memnode = xmemnode; delete [] memambnode; memambnode = xmemambnode; prevambnode = 1; } curanal++; if (curanal >= lenanal) { ScpAnal* xmemanal = new ScpAnal[lenanal+ADDANAL]; memcpy(xmemanal,memanal,lenanal*sizeof(ScpAnal)); lenanal += ADDANAL; delete [] memanal; memanal = xmemanal; } ScpNode* node = &memnode[curnode]; ScpAnal* anal = &memanal[curanal]; node->fpos = fpos; node->lpos = lpos; node->symbol = symbol; node->nextnode = nodeterm[fpos]; nodeterm[fpos] = curnode; node->initanal = curanal; anal->prodtn = prod; anal->prevnode = prevnode; anal->prevevent = prevevent; anal->nextanal = 0; #ifdef SCPTRACE cout << "SCPtrace$$ tryNode:newNode[" << curnode << "] (" << " symbol:" << printSymbol(node->symbol) << " fpos:" << fpos << " lpos:" << lpos << " initanal: " << curanal << ")" << endl; cout << "SCPtrace$$ tryNode:newAnal[" << curanal << "] (" << " prod:" << prod-1 << " prevnode:" << prevnode << " prevevent:" << prevevent << " nextanal:" << 0 << ")" << endl; #endif // Run Node int event; int inode = curnode; ScpEvent* pevent; int prememprodrunnode; int curmemprodrunnode = 0; while (symbol) { int addrlhs = addrnontm[-symbol]; event = eventterm[fpos]; while (event) { if (!memevent[event].subsumed) { int cov = covnttb[addrlhs-memevent[event].nextsymbol]; prememprodrunnode = curmemprodrunnode-1; while (cov) { int pro = memcov[cov].prodtn; int run = 0; for (int rt = prememprodrunnode; (!run) && (rt >= 0); rt--) if (memprodrunnode[rt] == pro) run = 1; if (run) { #ifdef SCPTRACE cout << "SCPtrace$$ runNode:triggerCoverage-Run:" << memcov[cov].prodtn -1 << " runNode (" << " node:" << inode << " as symbol:" << printSymbol(symbol) << " )" << endl; #endif } else { #ifdef SCPTRACE cout << "SCPtrace$$ runNode:triggerCoverage:" << memcov[cov].prodtn -1 << " runNode (" << " node:" << inode << " as symbol:" << printSymbol(symbol) << " )" << endl; #endif tryEvent(memcov[cov].prodtn,1,fpos,lpos,inode); memprodrunnode[curmemprodrunnode++] = pro; } cov = memcov[cov].next; } } event = memevent[event].nextevent; } event = eventterm[fpos]; while (event) { pevent = &memevent[event]; if (pevent->nextsymbol == symbol) { #ifdef SCPTRACE cout << "SCPtrace$$ runNode:linkEvent:" << event << " runNode (" << " node:" << inode << " as symbol:" << printSymbol(symbol) << " )" << endl; #endif tryEvent(pevent->prodtn,pevent->dot+1,pevent->fpos,lpos,inode,event); } event = memevent[event].nextevent; } symbol = memabslnt[-symbol].nextNT; } } void ScpParser::runBubble(int evprod,int dot,int evfpos, int bprod,int fpos,int event) { #ifdef SCPTRACE cout << "SCPtrace$$ runBubble(" << " evprodtn:" << evprod-1 << " evdot:" << dot << " evfpos:" << evfpos << " bprod:" << bprod-1 << " lpos:" << fpos << " event:" << event << " )" << endl; #endif ScpBubble* bubble = &membubble[memprodtn[bprod].bubble]; int lpos = fpos; int lbnd = bubble->lbound; int ubnd = bubble->ubound; int lpar = bubble->lparen; int rpar = bubble->rparen; int pars = 0; // LBound Tokens #ifdef SCPTRACE cout << "SCPtrace$$ lbound:" << bubble->lbound << endl; cout << "SCPtrace$$ ubound:" << bubble->ubound << endl; cout << "SCPtrace$$ lparen:" << bubble->lparen << endl; cout << "SCPtrace$$ rparen:" << bubble->rparen << endl; #endif while ((lbnd>0 || pars) && ubnd && (lpos < lengthterm-1)) { #ifdef SCPTRACE cout << "SCPtrace$$ skipLBound: " << inputterm[lpos] << endl; #endif if ((inputterm[lpos] < maxtermn) && (bubexcept[bubble->addrbubexcept + inputterm[lpos]])) { #ifdef SCPTRACE cout << "SCPtrace$$ exceptionError: " << inputterm[lpos] << endl; #endif if (parseErrorRecover && (lpos > lasttokendetect)) { errorDetect(lpos,inputterm[lpos],EXCEPTION_ERROR,bubble->abslnt); errorRecovery(1); } else return; } else if (inputterm[lpos] == rpar) { #ifdef SCPTRACE cout << "SCPtrace$$ closeParenthesis: pars=" << pars-1 << endl; #endif if (pars <= 0) { #ifdef SCPTRACE cout << "SCPtrace$$ ERROR-No Open Parenthesis" << endl; #endif if (parseErrorRecover && (lpos > lasttokendetect)) { errorDetect(lpos,inputterm[lpos],CLOSEPAR_ERROR,bubble->abslnt); errorRecovery(1); pars++; } else return; /* Error: over-closed parenthesis */ } pars--; } else if (inputterm[lpos] == lpar) { pars++; #ifdef SCPTRACE cout << "SCPtrace$$ openParenthesis: pars=" << pars << endl; #endif } lbnd --; ubnd --; lpos ++; } if (lbnd > 0) return; dot ++; int lrhs = memprodtn[evprod].lrhs; int rhs = memprodtn[evprod].rhs; int bubbleend; int bubbletermn; int bubblenexttermn; int bubblenexttermnlen; int bubblenext; if (dot < lrhs) { bubbleend = 0; if (memrhs[rhs+dot] >= 0) { bubbletermn = 1; bubblenexttermn = memrhs[rhs+dot]; bubblenexttermnlen = 1; int xdot = dot + 1; bubblenext = 0; while (!bubblenext && (xdot < lrhs)) { if (memrhs[rhs+xdot] < 0) { bubblenext = memrhs[rhs+xdot]; } else { xdot++; bubblenexttermnlen ++; } } if (!bubblenext) { bubbleend = 1; bubblenext = memprodtn[evprod].lhs; } } else { bubbletermn = 0; bubblenext = memrhs[memprodtn[evprod].rhs+dot]; } } else { bubbletermn = 0; bubbleend = 1; bubblenext = memprodtn[evprod].lhs; } #ifdef SCPTRACE cout << "SCPtrace$$ bubbleend :" << bubbleend << endl; cout << "SCPtrace$$ bubbletermn:" << bubbletermn << endl; cout << "SCPtrace$$ bubblenext :" << printSymbol(bubblenext) << endl; if (bubbletermn) cout << "SCPtrace$$ bubblenextt:" << bubblenexttermn << endl; #endif int termerror; int xlpos = lpos; int poslpos; if (!pars) poslpos = lpos; else poslpos = 0; int found = 0; while (!found && (lpos <= lengthterm-1)) { #ifdef SCPTRACE cout << "SCPtrace$$ seekFirstCandidate: " << " lpos=" << lpos << " token=" << inputterm[lpos] << endl; #endif xlpos = lpos; termerror = 0; if (bubbletermn && !pars) { int xdot = dot; int blen = 1; for (blen = 1; !termerror && (blen <= bubblenexttermnlen); blen++) { #ifdef SCPTRACE cout << "SCPtrace$$ skipNextTerminal: " << " xlpos=" << xlpos << " xdot=" << xdot << " rhs=" << memrhs[rhs+xdot] << " token=" << inputterm[xlpos] << endl; #endif if (xlpos > lengthterm -1) termerror = 1; else if (inputterm[xlpos] != memrhs[rhs+xdot]) termerror = 1; else { xlpos++; xdot++; } } if (blen < bubblenexttermnlen) termerror = 1; } if (!pars && !termerror) { if (xlpos <= lengthterm) { if (!pars) poslpos = xlpos; if (xlpos == lengthterm) { if (rdernttb[addrnontm[-bubble->abslnt]-rootterm]) found = 1; } else if (xlpos == lengthterm-1) { if (bubbleend) found = 1; else if (!bubbleend && memabslnt[-bubblenext].bubblecov) found = 1; } else if (inputterm[xlpos] >= maxtermn) { if (bubbleend) { if (memabslnt[-bubblenext].adjbubble) found = 1; else if (memabslnt[-bubble->abslnt].adjbubble) found = 1; } else { if (memabslnt[-bubblenext].bubblecov) found = 1; } } else if (bubbleend) { if (adjtb[addrtermn[inputterm[xlpos]]-bubblenext]) found = 1; else if (adjtb[addrtermn[inputterm[xlpos]]-bubble->abslnt]) found = 1; /* Incorporated 2/13/99 to solve p13 problem */ else if (memabslnt[-bubblenext].bubblecov) found = 1; } else { if (memabslnt[-bubblenext].bubblecov) found = 1; else if (covtmtb[addrtermn[inputterm[xlpos]]-bubblenext]) found = 1; } } } else { if (parseErrorRecover) { if (!pars) poslpos = xlpos; } } if (!found && (ubnd == 0)) break; else if (!found) { if ((inputterm[lpos] < maxtermn) && (bubexcept[bubble->addrbubexcept + inputterm[lpos]])) { #ifdef SCPTRACE cout << "SCPtrace$$ exceptionError: " << inputterm[lpos] << endl; #endif if (parseErrorRecover && (lpos >= lasttokendetect)) { #ifdef SCPTRACE cout << "SCPtrace$$ ErrorRecoveryPhase: cancelling FAIL" << endl; #endif // errorDetect(lpos,inputterm[lpos],EXCEPTION_ERROR,bubble->abslnt); break; } else return; } else if (inputterm[lpos] == rpar) { #ifdef SCPTRACE cout << "SCPtrace$$ closeParenthesis: pars=" << pars-1 << endl; #endif if (pars <= 0) { #ifdef SCPTRACE cout << "SCPtrace$$ ERROR-No Open Parenthesis" << endl; #endif if (parseErrorRecover && (lpos >= lasttokendetect)) { #ifdef SCPTRACE cout << "SCPtrace$$ ErrorRecoveryPhase: cancelling FAIL" << endl; #endif break; // errorDetect(lpos,inputterm[lpos],CLOSEPAR_ERROR,bubble->abslnt); } else return; } pars--; } else if (inputterm[lpos] == lpar) { pars++; #ifdef SCPTRACE cout << "SCPtrace$$ openParenthesis: pars=" << pars << endl; #endif } lpos++; ubnd--; } } if (found) tryNode(bprod,fpos,lpos,0,0); else if (parseErrorRecover && poslpos && (poslpos >= lasttokendetect)) tryNode(bprod,fpos,poslpos,0,0); } void ScpParser::errorDetect(int pos,int symbol,int type,int bubbleabslnt) { if (pos > lasttokendetect) { if (!lendetect) { lendetect = MEMDETECT; memdetect = new int[lendetect]; typedetect = new int[lendetect]; } #ifdef SCPTRACE cout << "SCPtrace$$ ErrorDetect: " << " position: " << pos << " type: " << type << " #detect: " << 0 << " symbolNeeded: " << symbol; if (type == EXCEPTION_ERROR) cout << " type: ExceptionError, bubble: " << bubbleabslnt; else if (type == CLOSEPAR_ERROR) cout << " type: CloseParenthesisError, bubble: " << bubbleabslnt; cout << endl; #endif if (type == STANDARD_ERROR) memdetect[0] = symbol; else memdetect[0] = bubbleabslnt; typedetect[0] = type; curdetect = 1; lasttokendetect = pos; } else if (pos == lasttokendetect) { if (curdetect >= lendetect) { int* xmemdetect = new int[lendetect+ADDDETECT]; memcpy(xmemdetect,memdetect,lendetect*sizeof(int)); int* xtypedetect = new int[lendetect+ADDDETECT]; memcpy(xtypedetect,typedetect,lendetect*sizeof(int)); lendetect += ADDDETECT; delete [] memdetect; memdetect = xmemdetect; delete [] typedetect; typedetect = xtypedetect; } #ifdef SCPTRACE cout << "SCPtrace$$ ErrorDetect: " << " position: " << pos << " type: " << type << " #detect: " << curdetect << " symbolNeeded: " << symbol; if (type == EXCEPTION_ERROR) cout << " type: ExceptionError"; else if (type == CLOSEPAR_ERROR) cout << " type: CloseParenthesisError"; cout << endl; #endif if (type == STANDARD_ERROR) memdetect[curdetect] = symbol; else memdetect[curdetect] = bubbleabslnt; typedetect[curdetect] = type; curdetect ++; } } void ScpParser::errorRecovery(int bubblerecovery) { int erlevel; if (lasttokendetect > prevlasttokendetect) { prevlasttokendetect = lasttokendetect; curerrorlist++; if (curerrorlist > lenalter) { char* xmemalter = new char[(maxtermn+(maxnontm*2))*(lenalter+ADDALTER)]; memcpy(xmemalter,memalter,(maxtermn+(maxnontm*2))*lenalter*sizeof(char)); lenalter += ADDALTER; delete [] memalter; memalter = xmemalter; } int lasttokenerror = lasttokendetect; int addralter = (curerrorlist-1)*(maxtermn+(maxnontm*2)); memset(memalter+addralter,0,maxtermn+(maxnontm*2)); errorlist[curerrorlist] = lasttokenerror+1; errorlevel[curerrorlist] = 1; erlevel = 2; for (int i=0; i= 0) { if (memdetect[i] < maxtermn) memalter[addralter+memdetect[i]] = 1; } else { for (int tm = 0; tm < maxtermn; tm++) if (covtmtb[addrtermn[tm]-memdetect[i]]) memalter[addralter+tm] = 1; } } else if (typedetect[i] == EXCEPTION_ERROR) memalter[addralter+maxtermn-memdetect[i]] = 1; else if (typedetect[i] == CLOSEPAR_ERROR) memalter[addralter+maxtermn+maxnontm-memdetect[i]] = 1;; } } else { errorlevel[curerrorlist] = errorlevel[curerrorlist]+1; erlevel = errorlevel[curerrorlist]; } if (erlevel > MAXERRORLEVEL) return; if (bubblerecovery) return; #ifdef SCPTRACE cout << "SCPtrace$$ ErroRecoveryStrategy" << endl; #endif int success = 0; // InputSkip Strategy #ifdef SCPTRACE cout << "SCPtrace$$ InputSkipStrategy" << endl; #endif int lasttokenerror = lasttokendetect; int event = eventterm[lasttokenerror]; while (event) { #ifdef SCPTRACE cout << "SCPtrace$$ InputSkipEvent: " << event << " nextsymbol: " << memevent[event].nextsymbol << endl; #endif int foundskip = 0; int pos = lasttokenerror; int nextsymbol = memevent[event].nextsymbol; if (nextsymbol >= 0) { int xerlevel = 0; while (!foundskip && (xerlevel++ <= erlevel) && (pos < lengthterm-1)) { if (inputterm[pos] == nextsymbol) foundskip = 1; else pos ++; } } else { int xerlevel = 1; while (!foundskip && (pos < lengthterm-1)) { if ((inputterm[pos] < maxtermn) && (ldertmtb[addrtermn[inputterm[pos]]-nextsymbol])) foundskip = 1; else pos ++; } } if (foundskip) { success = 1; tryEvent(memevent[event].prodtn,memevent[event].dot, memevent[event].fpos,pos, memevent[event].prevnode,memevent[event].prevevent); } event = memevent[event].nextevent; } // RuleSkip Strategy #ifdef SCPTRACE cout << "SCPtrace$$ RuleSkipStrategy" << endl; #endif event = eventterm[lasttokenerror]; while (event) { #ifdef SCPTRACE cout << "SCPtrace$$ RuleSkipEvent: " << event << " nextsymbol: " << memevent[event].nextsymbol << endl; #endif int foundskip = 0; int dot = memevent[event].dot; int pro = memevent[event].prodtn; int lrhs = memprodtn[pro].lrhs; int xerlevel = 1; while (!foundskip && (xerlevel++ <= erlevel) && (dot < lrhs)) { int nextsymbol = memrhs[memprodtn[pro].rhs+dot]; if (nextsymbol >= 0) { if (inputterm[lasttokenerror] == nextsymbol) foundskip = 1; else dot ++; } else { if ((inputterm[lasttokenerror] < maxtermn) && (ldertmtb[addrtermn[inputterm[lasttokenerror]]-nextsymbol])) foundskip = 1; else dot ++; } } if (dot == lrhs) foundskip = 1; if (foundskip) { success = 1; tryEvent(memevent[event].prodtn,dot, memevent[event].fpos,lasttokenerror, memevent[event].prevnode,memevent[event].prevevent); } event = memevent[event].nextevent; } // InputRuleSkip Strategy #ifdef SCPTRACE cout << "SCPtrace$$ InputRuleSkipStrategy" << endl; #endif event = eventterm[lasttokenerror]; while (event) { #ifdef SCPTRACE cout << "SCPtrace$$ InputRuleSkipEvent: " << event << " nextsymbol: " << memevent[event].nextsymbol << endl; #endif int foundskip = 0; int dot = memevent[event].dot; int pos = lasttokenerror; int pro = memevent[event].prodtn; int lrhs = memprodtn[pro].lrhs; int xerlevel = 1; while (!foundskip && (xerlevel++ <= erlevel) && (dot < lrhs) && (pos < lengthterm-1)) { int nextsymbol = memrhs[memprodtn[pro].rhs+dot]; if (nextsymbol >= 0) { if (inputterm[pos] == nextsymbol) foundskip = 1; else { dot ++; pos ++; } } else { if ((inputterm[pos] < maxtermn) && (ldertmtb[addrtermn[inputterm[pos]]-nextsymbol])) foundskip = 1; else { dot ++; pos ++; } } } if (dot == lrhs) foundskip = 1; if (foundskip) { success = 1; tryEvent(memevent[event].prodtn,dot, memevent[event].fpos,pos, memevent[event].prevnode,memevent[event].prevevent); } event = memevent[event].nextevent; } if (!success) { errorRecovery(bubblerecovery); return; } // Parsing Continuation int tk; if (curbubble) { for (tk = lasttokenerror; tk < lengthterm; tk++) if (eventterm[tk]) runTokenBubble(tk); } else { for (tk = lasttokenerror; tk < lengthterm-1; tk++) if ((inputterm[tk] < maxtermn) && (eventterm[tk])) runToken(tk); } if (!rootnode) errorRecovery(bubblerecovery); } int ScpParser::getRootNode() { return rootnode; } int ScpParser::getProductionNumber(int node) { if (node > 0) return memanal[memnode[node].initanal].prodtn-1; else return -1; } int ScpParser::getFirstPosition(int node) { if (node > 0) return memnode[node].fpos; else return -1; } int ScpParser::getLastPosition(int node) { if (node > 0) return memnode[node].lpos; else return -1; } int ScpParser::getNumberOfChildren(int node) { if (node > 0) return memprodtn[memanal[memnode[node].initanal].prodtn].lgather; else return -1; } int ScpParser::getChild(int node,int number) { int nchildren; if ((node > 0) && ((nchildren = getNumberOfChildren(node)) > number)) { int position = nchildren - number - 1; if (!position) return memanal[memnode[node].initanal].prevnode; else { int prevevent = memanal[memnode[node].initanal].prevevent; while (prevevent && (--position)) prevevent = memevent[prevevent].prevevent; if (prevevent) return memevent[prevevent].prevnode; } } return -1; } int ScpParser::getLHSProduction(int prod) { if (prod < curprodtn) { if (memprodtn[prod+1].bubble) return memabslnt[-membubble[memprodtn[prod+1].bubble].abslnt].baseNT; else return memabslnt[-memprodtn[prod+1].lhs].baseNT; } else return 0; } int ScpParser::getNumberOfErrors() { return curerrorlist; } int ScpParser::getErrorPosition(int errornumber) { if ((errornumber > 0) && (errornumber <= curerrorlist)) return errorlist[errornumber]-1; else return -1; } Vector ScpParser::getAlternativesStandardError(int errornumber) { Vector alter (0); if ((errornumber > 0) && (errornumber <= curerrorlist)) { int addralter = (errornumber-1)*(maxtermn+(maxnontm*2)); int index = 0; for (int tm=0; tm < maxtermn; tm++) { if (memalter[addralter+tm]) { alter.expandBy(1); alter[index++] = tm; } } } return alter; } Vector ScpParser::getBubblesExceptionError(int errornumber) { Vector bexcep (0); if ((errornumber > 0) && (errornumber <= curerrorlist)) { int addrbexcep = ((errornumber-1)*(maxtermn+(maxnontm*2)))+maxtermn; int index = 0; for (int nt=1; nt ScpParser::getBubblesCloseParenthesisError(int errornumber) { Vector cparen (0); if ((errornumber > 0) && (errornumber <= curerrorlist)) { int addrcparen = ((errornumber-1)*(maxtermn+(maxnontm*2)))+maxtermn+maxnontm; int index = 0; for (int nt=1; nt",absl,getBaseNT(absl),getPrecNT(absl)); return strdup(p); } void ScpParser::printErrorDetect() { cout << " *** MSCP: printErrorDetection *** " << endl; for (int er=1; er <= curerrorlist; er++) { cout << "#############################" << endl; cout << "# ErrorNumber: " << er << endl; cout << "# Position: " << errorlist[er]-1 << endl; cout << "# Alternatives: "; int linalt = 0; int addralter = (er-1)*maxtermn; for (int tm=0; tm < maxtermn; tm++) { if (memalter[addralter+tm]) { if (linalt > 8) { cout << endl << "# "; linalt++; } printf("%4d ",tm); linalt++; } } cout << endl; } } Maude-2.6/src/MSCP10/Makefile.in0000644000147300135640000004476611500303155013116 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/MSCP10 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libmscp10_a_AR = $(AR) $(ARFLAGS) libmscp10_a_LIBADD = am_libmscp10_a_OBJECTS = libmscp10_a-scp_parser.$(OBJEXT) \ libmscp10_a-scp_compiler.$(OBJEXT) \ libmscp10_a-scp_memory.$(OBJEXT) libmscp10_a_OBJECTS = $(am_libmscp10_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libmscp10_a_SOURCES) DIST_SOURCES = $(libmscp10_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libmscp10.a libmscp10_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility libmscp10_a_SOURCES = \ scp_parser.cc \ scp_compiler.cc \ scp_memory.cc noinst_HEADERS = \ scp_kernel.hh \ scp_parser.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/MSCP10/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/MSCP10/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmscp10.a: $(libmscp10_a_OBJECTS) $(libmscp10_a_DEPENDENCIES) -rm -f libmscp10.a $(libmscp10_a_AR) libmscp10.a $(libmscp10_a_OBJECTS) $(libmscp10_a_LIBADD) $(RANLIB) libmscp10.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmscp10_a-scp_compiler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmscp10_a-scp_memory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmscp10_a-scp_parser.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libmscp10_a-scp_parser.o: scp_parser.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmscp10_a-scp_parser.o -MD -MP -MF "$(DEPDIR)/libmscp10_a-scp_parser.Tpo" -c -o libmscp10_a-scp_parser.o `test -f 'scp_parser.cc' || echo '$(srcdir)/'`scp_parser.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmscp10_a-scp_parser.Tpo" "$(DEPDIR)/libmscp10_a-scp_parser.Po"; else rm -f "$(DEPDIR)/libmscp10_a-scp_parser.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scp_parser.cc' object='libmscp10_a-scp_parser.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmscp10_a-scp_parser.o `test -f 'scp_parser.cc' || echo '$(srcdir)/'`scp_parser.cc libmscp10_a-scp_parser.obj: scp_parser.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmscp10_a-scp_parser.obj -MD -MP -MF "$(DEPDIR)/libmscp10_a-scp_parser.Tpo" -c -o libmscp10_a-scp_parser.obj `if test -f 'scp_parser.cc'; then $(CYGPATH_W) 'scp_parser.cc'; else $(CYGPATH_W) '$(srcdir)/scp_parser.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmscp10_a-scp_parser.Tpo" "$(DEPDIR)/libmscp10_a-scp_parser.Po"; else rm -f "$(DEPDIR)/libmscp10_a-scp_parser.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scp_parser.cc' object='libmscp10_a-scp_parser.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmscp10_a-scp_parser.obj `if test -f 'scp_parser.cc'; then $(CYGPATH_W) 'scp_parser.cc'; else $(CYGPATH_W) '$(srcdir)/scp_parser.cc'; fi` libmscp10_a-scp_compiler.o: scp_compiler.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmscp10_a-scp_compiler.o -MD -MP -MF "$(DEPDIR)/libmscp10_a-scp_compiler.Tpo" -c -o libmscp10_a-scp_compiler.o `test -f 'scp_compiler.cc' || echo '$(srcdir)/'`scp_compiler.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmscp10_a-scp_compiler.Tpo" "$(DEPDIR)/libmscp10_a-scp_compiler.Po"; else rm -f "$(DEPDIR)/libmscp10_a-scp_compiler.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scp_compiler.cc' object='libmscp10_a-scp_compiler.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmscp10_a-scp_compiler.o `test -f 'scp_compiler.cc' || echo '$(srcdir)/'`scp_compiler.cc libmscp10_a-scp_compiler.obj: scp_compiler.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmscp10_a-scp_compiler.obj -MD -MP -MF "$(DEPDIR)/libmscp10_a-scp_compiler.Tpo" -c -o libmscp10_a-scp_compiler.obj `if test -f 'scp_compiler.cc'; then $(CYGPATH_W) 'scp_compiler.cc'; else $(CYGPATH_W) '$(srcdir)/scp_compiler.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmscp10_a-scp_compiler.Tpo" "$(DEPDIR)/libmscp10_a-scp_compiler.Po"; else rm -f "$(DEPDIR)/libmscp10_a-scp_compiler.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scp_compiler.cc' object='libmscp10_a-scp_compiler.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmscp10_a-scp_compiler.obj `if test -f 'scp_compiler.cc'; then $(CYGPATH_W) 'scp_compiler.cc'; else $(CYGPATH_W) '$(srcdir)/scp_compiler.cc'; fi` libmscp10_a-scp_memory.o: scp_memory.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmscp10_a-scp_memory.o -MD -MP -MF "$(DEPDIR)/libmscp10_a-scp_memory.Tpo" -c -o libmscp10_a-scp_memory.o `test -f 'scp_memory.cc' || echo '$(srcdir)/'`scp_memory.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmscp10_a-scp_memory.Tpo" "$(DEPDIR)/libmscp10_a-scp_memory.Po"; else rm -f "$(DEPDIR)/libmscp10_a-scp_memory.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scp_memory.cc' object='libmscp10_a-scp_memory.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmscp10_a-scp_memory.o `test -f 'scp_memory.cc' || echo '$(srcdir)/'`scp_memory.cc libmscp10_a-scp_memory.obj: scp_memory.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmscp10_a-scp_memory.obj -MD -MP -MF "$(DEPDIR)/libmscp10_a-scp_memory.Tpo" -c -o libmscp10_a-scp_memory.obj `if test -f 'scp_memory.cc'; then $(CYGPATH_W) 'scp_memory.cc'; else $(CYGPATH_W) '$(srcdir)/scp_memory.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmscp10_a-scp_memory.Tpo" "$(DEPDIR)/libmscp10_a-scp_memory.Po"; else rm -f "$(DEPDIR)/libmscp10_a-scp_memory.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scp_memory.cc' object='libmscp10_a-scp_memory.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmscp10_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmscp10_a-scp_memory.obj `if test -f 'scp_memory.cc'; then $(CYGPATH_W) 'scp_memory.cc'; else $(CYGPATH_W) '$(srcdir)/scp_memory.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/MSCP10/scp_kernel.hh0000644000147300135640000000453207666302265013525 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /************************************************ ** SCP Parsing Algorithm ** ** Maude Implementation ** ** Jose F. Quesada ** ** CSL - SRI Int. 1998 ** ************************************************/ /******* ******* scp_kernel.hh *******/ #ifndef _scp_kernel_hh_ #define _scp_kernel_hh_ class ScpBaseNT { friend class ScpParser; int smallestPrec; int largestPrec; int firstAbs; int lastAbs; }; class ScpAbslNT { friend class ScpParser; int baseNT; int precNT; int nextNT; int lhsdefs; char adjbubble; int bubblecov; int bubbletermn; int bubbleev; }; class ScpProdtn { friend class ScpParser; int lhs; int lrhs; int rhs; int lgather; int bubble; }; class ScpCov { friend class ScpParser; int prodtn; int next; int ldernext; }; class ScpBubble { friend class ScpParser; int abslnt; int lbound; int ubound; int lparen; int rparen; int addrbubexcept; int except; int lexcept; int prodtn; }; class ScpEvent { friend class ScpParser; int prodtn; int dot; int fpos; int nextsymbol; int addrnextsymbol; int nextevent; int subsumed; int prevevent; int prevnode; }; class ScpNode { friend class ScpParser; int fpos; int lpos; int symbol; int nextnode; int initanal; int skipanal; }; class ScpAnal { friend class ScpParser; int prodtn; int prevnode; int prevevent; int nextanal; }; #endif // _scp_kernel_hh Maude-2.6/src/MSCP10/ChangeLog0000644000147300135640000000110707666273555012635 000000000000002003-05-12 Steven Eker * scp_parser.cc: replaced with new version from J.-F. Quesada; removed "=0" initializers; reverted to original due to many problems ===================================Maude80a=========================================== 2003-04-10 Steven Eker * scp_compiler.cc: updated use of Assert() throughout 2003-02-25 Steven Eker * scp_parser.hh: removed #pragma * scp_kernel.hh: removed #pragma ===================================Maude79=========================================== Maude-2.6/src/MSCP10/scp_compiler.cc0000644000147300135640000007256007666302265014053 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /************************************************ ** SCP Parsing Algorithm ** ** Maude Implementation ** ** Jose F. Quesada ** ** CSL - SRI Int. 1998 ** ************************************************/ /******* ******* scp_compiler.cc *******/ #include "scp_parser.hh" static int auxntm; static int auxpbase; void ScpParser::insertProd(int xlhs, const Vector& xrhs, int xprec, const Vector& xgather) { register int regrhs; register int reggather; register int regcounter; curprodtn ++; Assert(!compiled, "SCP-ERROR: call to insertProd after parseSentence" << endl); Assert(xlhs < 0, "SCP-ERROR: Bad LHS (" << xlhs << ") " << "in production " << curprodtn-1 << endl); Assert(xrhs.length() > 0, "SCP-ERROR: RHS empty " << "in production " << curprodtn-1 << endl); if (curprodtn >= lenprodtn) { ScpProdtn* xmemprodtn = new ScpProdtn[lenprodtn+ADDPRODTN]; memcpy(xmemprodtn,memprodtn,lenprodtn*sizeof(ScpProdtn)); memset(xmemprodtn+lenprodtn,0,ADDPRODTN*sizeof(ScpProdtn)); lenprodtn += ADDPRODTN; delete [] memprodtn; memprodtn = xmemprodtn; } ScpProdtn* prodtn = &memprodtn[curprodtn]; prodtn->lhs = insertBasePrecNT(xlhs,xprec); memabslnt[-prodtn->lhs].lhsdefs ++; regrhs = xrhs.length(); prodtn->lrhs = regrhs; if (currhs+regrhs > lenrhs) { int* xmemrhs = new int[lenrhs+regrhs+ADDRHS]; memcpy(xmemrhs,memrhs,lenrhs*sizeof(int)); lenrhs += regrhs+ADDRHS; delete [] memrhs; memrhs = xmemrhs; } prodtn->rhs = currhs; reggather = 0; for (regcounter=0; regrhs; regrhs--) { if (xrhs[regcounter] < 0) { Assert(reggather < xgather.length(), "SCP-ERROR: Insufficient gather values " << "in production " << curprodtn-1 << endl); memrhs[currhs++] = insertBasePrecNT(xrhs[regcounter++], xgather[reggather++]); } else { if (xrhs[regcounter] > maxtermn) maxtermn = xrhs[regcounter]; memrhs[currhs++] = xrhs[regcounter++]; } } prodtn->lgather = reggather; prodtn->bubble = 0; } int ScpParser::insertBasePrecNT(int baseNT,int precNT) { if (baseNT < maxbasent) { maxbasent = baseNT; if (-baseNT >= lenbasent) { ScpBaseNT* xmembasent = new ScpBaseNT[-baseNT+ADDBASENT]; memcpy(xmembasent,membasent,lenbasent*sizeof(ScpBaseNT)); memset(xmembasent+lenbasent,-1, (-baseNT+ADDBASENT-lenbasent)*sizeof(ScpBaseNT)); lenbasent = -baseNT+ADDBASENT; delete [] membasent; membasent = xmembasent; } } if (membasent[-baseNT].smallestPrec == -1) { membasent[-baseNT].smallestPrec = precNT; membasent[-baseNT].largestPrec = precNT; maxabslnt--; if (-maxabslnt >= lenabslnt) { ScpAbslNT* xmemabslnt = new ScpAbslNT[lenabslnt+ADDABSLNT]; memcpy(xmemabslnt,memabslnt,lenabslnt*sizeof(ScpAbslNT)); memset(xmemabslnt+lenabslnt,0,ADDABSLNT*sizeof(ScpAbslNT)); lenabslnt += ADDABSLNT; delete [] memabslnt; memabslnt = xmemabslnt; } memabslnt[-maxabslnt].baseNT = baseNT; memabslnt[-maxabslnt].precNT = precNT; memabslnt[-maxabslnt].nextNT = 0; membasent[-baseNT].firstAbs = maxabslnt; membasent[-baseNT].lastAbs = maxabslnt; return maxabslnt; } else if (precNT < membasent[-baseNT].smallestPrec) { membasent[-baseNT].smallestPrec = precNT; maxabslnt--; if (-maxabslnt >= lenabslnt) { ScpAbslNT* xmemabslnt = new ScpAbslNT[lenabslnt+ADDABSLNT]; memcpy(xmemabslnt,memabslnt,lenabslnt*sizeof(ScpAbslNT)); memset(xmemabslnt+lenabslnt,0,ADDABSLNT*sizeof(ScpAbslNT)); lenabslnt += ADDABSLNT; delete [] memabslnt; memabslnt = xmemabslnt; } memabslnt[-maxabslnt].baseNT = baseNT; memabslnt[-maxabslnt].precNT = precNT; memabslnt[-maxabslnt].nextNT = membasent[-baseNT].firstAbs; membasent[-baseNT].firstAbs = maxabslnt; return maxabslnt; } else if (precNT > membasent[-baseNT].largestPrec) { membasent[-baseNT].largestPrec = precNT; maxabslnt--; if (-maxabslnt >= lenabslnt) { ScpAbslNT* xmemabslnt = new ScpAbslNT[lenabslnt+ADDABSLNT]; memcpy(xmemabslnt,memabslnt,lenabslnt*sizeof(ScpAbslNT)); memset(xmemabslnt+lenabslnt,0,ADDABSLNT*sizeof(ScpAbslNT)); lenabslnt += ADDABSLNT; delete [] memabslnt; memabslnt = xmemabslnt; } memabslnt[-maxabslnt].baseNT = baseNT; memabslnt[-maxabslnt].precNT = precNT; memabslnt[-maxabslnt].nextNT = 0; memabslnt[-membasent[-baseNT].lastAbs].nextNT = maxabslnt; membasent[-baseNT].lastAbs = maxabslnt; return maxabslnt; } else if (precNT == membasent[-baseNT].smallestPrec) { return membasent[-baseNT].firstAbs; } else if (precNT == membasent[-baseNT].largestPrec) { return membasent[-baseNT].lastAbs; } else { int curAbs = membasent[-baseNT].firstAbs; int nexAbs = memabslnt[-curAbs].nextNT; while (precNT >= memabslnt[-nexAbs].precNT) { if (precNT == memabslnt[-nexAbs].precNT) { return nexAbs; } curAbs = nexAbs; nexAbs = memabslnt[-curAbs].nextNT; } maxabslnt--; if (-maxabslnt >= lenabslnt) { ScpAbslNT* xmemabslnt = new ScpAbslNT[lenabslnt+ADDABSLNT]; memcpy(xmemabslnt,memabslnt,lenabslnt*sizeof(ScpAbslNT)); memset(xmemabslnt+lenabslnt,0,ADDABSLNT*sizeof(ScpAbslNT)); lenabslnt += ADDABSLNT; delete [] memabslnt; memabslnt = xmemabslnt; } memabslnt[-maxabslnt].baseNT = baseNT; memabslnt[-maxabslnt].precNT = precNT; memabslnt[-maxabslnt].nextNT = nexAbs; memabslnt[-curAbs].nextNT = maxabslnt; return maxabslnt; } } int ScpParser::getBaseNT(int absl) { return memabslnt[-absl].baseNT; } int ScpParser::getPrecNT(int absl) { return memabslnt[-absl].precNT; } void ScpParser::insertProd( int nonTerminal,int lowBound,int upperBound, int leftParenToken,int rightParenToken, const Vector& exceptionTokenList ) { register int reglength; register int regcounter; curprodtn ++; Assert(!compiled, "SCP-ERROR: call to insertProd after parseSentence" << endl); Assert(nonTerminal < 0, "SCP-ERROR: Bad nonTerminal(bubble) (" << nonTerminal << ") " << "in production " << curprodtn << endl); if (curprodtn >= lenprodtn) { // changed from > to fix bug 3/8/02 SME ScpProdtn* xmemprodtn = new ScpProdtn[lenprodtn+ADDPRODTN]; memcpy(xmemprodtn,memprodtn,lenprodtn*sizeof(ScpProdtn)); memset(xmemprodtn+lenprodtn,0,ADDPRODTN*sizeof(ScpProdtn)); lenprodtn += ADDPRODTN; delete [] memprodtn; memprodtn = xmemprodtn; } ScpProdtn* prodtn = &memprodtn[curprodtn]; // Store the bubble in membubble curbubble ++; prodtn->bubble = curbubble; prodtn->lgather = 0; if (curbubble > lenbubble) { ScpBubble* xmembubble = new ScpBubble[lenbubble+ADDBUBBLE]; memcpy(xmembubble,membubble,lenbubble*sizeof(ScpBubble)); lenbubble += ADDBUBBLE; delete [] membubble; membubble = xmembubble; } ScpBubble* bubble = &membubble[curbubble]; bubble->abslnt = insertBasePrecNT(nonTerminal,0); memabslnt[-bubble->abslnt].bubbletermn = curbubble; bubble->lbound = lowBound; bubble->ubound = upperBound; if (leftParenToken > maxtermn) maxtermn = leftParenToken; bubble->lparen = leftParenToken; if (rightParenToken > maxtermn) maxtermn = rightParenToken; bubble->rparen = rightParenToken; bubble->prodtn = curprodtn; reglength = exceptionTokenList.length(); bubble->lexcept = reglength; if (curexcept+reglength > lenexcept) { int* xmemexcept = new int[lenexcept+ADDEXCEPT]; memcpy(xmemexcept,memexcept,lenexcept*sizeof(int)); lenexcept += ADDEXCEPT; delete [] memexcept; memexcept = xmemexcept; } bubble->except = curexcept; for (regcounter=0; reglength; reglength--) { if (exceptionTokenList[regcounter] > maxtermn) maxtermn = exceptionTokenList[regcounter]; memexcept[curexcept++] = exceptionTokenList[regcounter++]; } } void ScpParser::compileParser() { if (compiled) return; compiled = 1; maxtermn ++; // 0-maxtermn => maxtermn+1 maxnontm = -maxabslnt+1; /* Prod 0 */ memprodtn[0].lrhs = 2; memprodtn[0].rhs = currhs; memprodtn[0].lgather = 1; /* We seem to have MEMORY CORRUPTION when currhs == lenrhs or currhs+1 == lenrhs because the memrhs is not being reallocated. cerr << memprodtn[0].rhs << '\t' << currhs << '\t' << lenrhs << endl; We add the following lines to fix this problem. 3/20/02 SME */ const int extrarhs = 2; if (currhs+extrarhs > lenrhs) { int* xmemrhs = new int[lenrhs+extrarhs+ADDRHS]; memcpy(xmemrhs,memrhs,lenrhs*sizeof(int)); lenrhs += extrarhs+ADDRHS; delete [] memrhs; memrhs = xmemrhs; } /* End of added code. */ memrhs[memprodtn[0].rhs+1] = maxtermn + 10; // MEMORY CORRUPTION memprodtn[0].bubble = 0; /* covnttb ldertmtb ldernttb rdernttb invrdernttb */ /* covtmtb */ int lentbl = (maxnontm + maxtermn + maxnontm + maxnontm + 1) * (maxnontm); covtbl = new int[lentbl]; memset(covtbl,0,lentbl*sizeof(int)); covnttb = covtbl; ldertmtb = covtmtb = covnttb + (maxnontm*maxnontm); ldernttb = ldertmtb + (maxtermn*maxnontm); rdernttb = ldernttb + (maxnontm*maxnontm); invrdernttb = rdernttb + (maxnontm*maxnontm); /* rdernttb adjtb */ lentbl = (maxnontm + maxtermn) * (maxnontm); adjtb = new char[lentbl]; memset(adjtb,0,lentbl*sizeof(char)); if (curbubble) { lentbl = curbubble * maxtermn; bubexcept = new char[lentbl]; memset(bubexcept,0,lentbl*sizeof(char)); } compileDerivationTables(); compileCoverageTables(); compileAdjacencyTables(); memprodruntoken = new int[(curprodtn+1)*2]; memprodrunnode = memprodruntoken+(curprodtn+1); } void ScpParser::compileDerivationTables() { register int tm; register int addrbase = 0; addrtermn = new int[maxtermn+maxnontm]; addrnontm = addrtermn+maxtermn; for (tm = 0; tm < maxtermn; tm++,addrbase+=maxnontm) addrtermn[tm] = addrbase; register int ntm; addrbase = maxnontm; for (ntm = 1; ntm < maxnontm; ntm++,addrbase+=maxnontm) addrnontm[ntm] = addrbase; /* ldgrprodtn ldgrabslnt ldgrtermn */ /* rdgrprodtn rdgrabslnt rdgrtermn */ int lentbl = ((curprodtn+1) + maxnontm + maxtermn) * 2; ldgrprodtn = new int[lentbl]; memset(ldgrprodtn,0,(lentbl)*sizeof(int)); ldgrabslnt = ldgrprodtn + (curprodtn+1); ldgrtermn = ldgrabslnt + maxnontm; rdgrprodtn = ldgrtermn + maxtermn; rdgrabslnt = rdgrprodtn + (curprodtn+1); rdgrtermn = rdgrabslnt + maxnontm; compileLDerGraph(); compileLDerTable(); compileRDerGraph(); compileRDerTable(); } void ScpParser::compileLDerGraph() { register int ip; register int rhs0; register int lhs; register int ldergraph; register int prevldergraph; register int addedldergraph; ScpProdtn* prodtn; for (ip = 1; ip <= curprodtn; ip++) { prodtn = &memprodtn[ip]; if (!prodtn->bubble) { rhs0 = memrhs[prodtn->rhs]; if (rhs0 < 0) { // lhs = memrhs[prodtn->lhs]; lhs = prodtn->lhs; ldergraph = ldgrabslnt[-rhs0]; if (!ldergraph) ldgrabslnt[-rhs0] = ip; else { if (lhs == memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrabslnt[-rhs0] = ip; } else if (lhs > memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrabslnt[-rhs0] = ip; } else { prevldergraph = ldergraph; addedldergraph = 0; ldergraph = ldgrprodtn[ldergraph]; while (!addedldergraph && ldergraph) { if (lhs == memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrprodtn[prevldergraph] = ip; addedldergraph = 1; } else if (lhs > memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrprodtn[prevldergraph] = ip; addedldergraph = 1; } else { prevldergraph = ldergraph; ldergraph = ldgrprodtn[ldergraph]; } } if (!addedldergraph) ldgrprodtn[prevldergraph] = ip; } } } else { // lhs = memrhs[prodtn->lhs]; lhs = prodtn->lhs; ldergraph = ldgrtermn[rhs0]; if (!ldergraph) { ldgrtermn[rhs0] = ip; } else { if (lhs == memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrtermn[rhs0] = ip; } else if (lhs > memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrtermn[rhs0] = ip; } else { prevldergraph = ldergraph; addedldergraph = 0; ldergraph = ldgrprodtn[ldergraph]; while (!addedldergraph && ldergraph) { if (lhs == memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrprodtn[prevldergraph] = ip; addedldergraph = 1; } else if (lhs > memprodtn[ldergraph].lhs) { ldgrprodtn[ip] = ldergraph; ldgrprodtn[prevldergraph] = ip; addedldergraph = 1; } else { prevldergraph = ldergraph; ldergraph = ldgrprodtn[ldergraph]; } } if (!addedldergraph) ldgrprodtn[prevldergraph] = ip; } } } } } } void ScpParser::compileLDerTable() { for (auxntm = 1,auxpbase = maxnontm; auxntm < maxnontm; auxntm++,auxpbase+=maxnontm) insertLDerNT(auxntm); } void ScpParser::insertLDerNT(int lder) { int curnt = lder; while (curnt) { if (!ldernttb[auxpbase+curnt]) { ldernttb[auxpbase+curnt] = ldernttb[auxpbase]+1; ldernttb[auxpbase] = curnt; ldernttb[auxntm]++; int ldergraph = ldgrabslnt[curnt]; while (ldergraph) { if (!ldernttb[auxpbase-memprodtn[ldergraph].lhs]) insertLDerNT(-memprodtn[ldergraph].lhs); ldergraph = ldgrprodtn[ldergraph]; } } curnt = -memabslnt[curnt].nextNT; } } void ScpParser::compileRDerGraph() { register int ip; register int rhsN; register int lhs; register int rdergraph; register int prevrdergraph; register int addedrdergraph; ScpProdtn* prodtn; for (ip = 1; ip <= curprodtn; ip++) { prodtn = &memprodtn[ip]; if (!prodtn->bubble) { rhsN = memrhs[prodtn->rhs+prodtn->lrhs-1]; if (rhsN < 0) { // lhs = memrhs[prodtn->lhs]; lhs = prodtn->lhs; rdergraph = rdgrabslnt[-rhsN]; if (!rdergraph) rdgrabslnt[-rhsN] = ip; else { if (lhs == memprodtn[rdergraph].lhs) ; else if (lhs > memprodtn[rdergraph].lhs) { rdgrprodtn[ip] = rdergraph; rdgrabslnt[-rhsN] = ip; } else { prevrdergraph = rdergraph; addedrdergraph = 0; rdergraph = rdgrprodtn[rdergraph]; while (!addedrdergraph && rdergraph) { if (lhs == memprodtn[rdergraph].lhs) addedrdergraph = 1; else if (lhs > memprodtn[rdergraph].lhs) { rdgrprodtn[ip] = rdergraph; rdgrprodtn[prevrdergraph] = ip; addedrdergraph = 1; } else { prevrdergraph = rdergraph; rdergraph = rdgrprodtn[rdergraph]; } } if (!addedrdergraph) rdgrprodtn[prevrdergraph] = ip; } } } else { // lhs = memrhs[prodtn->lhs]; lhs = prodtn->lhs; rdergraph = rdgrtermn[rhsN]; if (!rdergraph) rdgrtermn[rhsN] = ip; else { if (lhs == memprodtn[rdergraph].lhs) ; else if (lhs > memprodtn[rdergraph].lhs) { rdgrprodtn[ip] = rdergraph; rdgrtermn[rhsN] = ip; } else { prevrdergraph = rdergraph; addedrdergraph = 0; rdergraph = rdgrprodtn[rdergraph]; while (!addedrdergraph && rdergraph) { if (lhs == memprodtn[rdergraph].lhs) addedrdergraph = 1; else if (lhs > memprodtn[rdergraph].lhs) { rdgrprodtn[ip] = rdergraph; rdgrprodtn[prevrdergraph] = ip; addedrdergraph = 1; } else { prevrdergraph = rdergraph; rdergraph = rdgrprodtn[rdergraph]; } } if (!addedrdergraph) rdgrprodtn[prevrdergraph] = ip; } } } } } } void ScpParser::compileRDerTable() { for (auxntm = 1,auxpbase = maxnontm; auxntm < maxnontm; auxntm++,auxpbase+=maxnontm) insertRDerNT(auxntm); } void ScpParser::insertRDerNT(int rder) { int curnt = rder; while (curnt) { if (!rdernttb[auxpbase+curnt]) { rdernttb[auxpbase+curnt] = rdernttb[curnt]+1; rdernttb[curnt] = auxntm; int rdergraph = rdgrabslnt[curnt]; while (rdergraph) { if (!rdernttb[auxpbase-memprodtn[rdergraph].lhs]) insertRDerNT(-memprodtn[rdergraph].lhs); rdergraph = rdgrprodtn[rdergraph]; } } curnt = -memabslnt[curnt].nextNT; } } void ScpParser::compileCoverageTables() { register int ltcov = 1; register int ntm; register int addrbase = 0; for (ntm = 1; ntm < maxnontm; ntm++) ltcov += memabslnt[ntm].lhsdefs * ldernttb[ntm]; register int bub; for (bub = 1; bub <= curbubble; bub++) ltcov += ldernttb[-membubble[bub].abslnt]; memcov = new ScpCov[ltcov]; register int last; ltcov = 0; register int xldgr; register int addrbaset; register int lhs; for (ntm = 1; ntm < maxnontm; ntm++) { if (ldgrabslnt[ntm]) { xldgr = ldgrabslnt[ntm]; addrbaset = addrnontm[ntm]; while (xldgr) { lhs = -memprodtn[xldgr].lhs; addrbase = addrnontm[lhs]; last = ldernttb[addrbase]; while (last) { ltcov ++; memcov[ltcov].prodtn = xldgr; memcov[ltcov].next = covnttb[addrbaset+last]; covnttb[addrbaset+last] = ltcov; last = ldernttb[addrbase+last]-1; } xldgr = ldgrprodtn[xldgr]; } } } register int tm; for (tm = 0; tm < maxtermn; tm++) { if (ldgrtermn[tm]) { xldgr = ldgrtermn[tm]; addrbaset = addrtermn[tm]; while (xldgr) { lhs = -memprodtn[xldgr].lhs; addrbase = addrnontm[lhs]; last = ldernttb[addrbase]; while (last) { ltcov ++; memcov[ltcov].prodtn = xldgr; if (covtmtb[addrbaset+last]) { memcov[ltcov].ldernext = memcov[covtmtb[addrbaset+last]].ldernext; memcov[ltcov].next = covtmtb[addrbaset+last]; } else { memcov[ltcov].ldernext = invrdernttb[last]; memcov[ltcov].next = 0; } invrdernttb[last] = tm + 1; covtmtb[addrbaset+last] = ltcov; last = ldernttb[addrbase+last]-1; } xldgr = ldgrprodtn[xldgr]; } } } if (!curbubble) return; int xbubexcept = 0; for (bub = 1; bub <= curbubble; bub++) { int abslnt = -membubble[bub].abslnt; addrbase = addrnontm[abslnt]; last = ldernttb[addrbase]; while (last) { ltcov ++; memcov[ltcov].prodtn = membubble[bub].prodtn; memcov[ltcov].next = memabslnt[last].bubblecov; memabslnt[last].bubblecov = ltcov; last = ldernttb[addrbase+last]-1; } membubble[bub].addrbubexcept = xbubexcept; int lexcept = membubble[bub].lexcept; int except = membubble[bub].except; for (int ex=0; ex < lexcept; ex++) bubexcept[xbubexcept+memexcept[except+ex]] = (char)1; xbubexcept += maxtermn; abslnt = -memabslnt[abslnt].nextNT; while (abslnt) { memabslnt[abslnt].bubbletermn = 1; abslnt = -memabslnt[abslnt].nextNT; } } int lenbubcov = MEMBUBCOV; bubcov = new ScpCov[lenbubcov]; int curbubcov = 0; register int pro; for (pro = 1; pro <= curprodtn; pro++) { if (!memprodtn[pro].bubble && ((ntm = memrhs[memprodtn[pro].rhs]) < 0) && (memabslnt[-ntm].bubblecov)) { ntm = -ntm; if (ldgrabslnt[ntm]) { int bcov = memabslnt[ntm].bubblecov; while (bcov) { xldgr = ldgrabslnt[ntm]; addrbaset = addrnontm[ntm]; while (xldgr) { lhs = -memprodtn[xldgr].lhs; addrbase = addrnontm[lhs]; last = ldernttb[addrbase]; while (last) { curbubcov++; if (curbubcov >= lenbubcov) { ScpCov* xbubcov = new ScpCov[lenbubcov+ADDBUBCOV]; memcpy(xbubcov,bubcov,lenbubcov*sizeof(ScpCov)); lenbubcov += ADDBUBCOV; delete [] bubcov; bubcov = xbubcov; } int found = 0; int blastcov = memabslnt[last].bubbleev; while (!found && blastcov) { if (bubcov[blastcov].prodtn == pro) found = 1; else blastcov = bubcov[blastcov].next; } if (!found) { bubcov[curbubcov].prodtn = pro; bubcov[curbubcov].next = memabslnt[last].bubbleev; memabslnt[last].bubbleev = curbubcov; } last = ldernttb[addrbase+last]-1; } xldgr = ldgrprodtn[xldgr]; } bcov = memcov[bcov].next; } } } } } void ScpParser::compileAdjacencyTables() { register int ip; register int rhs; ScpProdtn* prodtn; register int rhsN0; register int rhsN1; register int addrbase; int *rhsN; for (ip = 1; ip <= curprodtn; ip++) { prodtn = &memprodtn[ip]; if (!prodtn->bubble && (prodtn->lrhs > 1)) { rhsN = &memrhs[prodtn->rhs]; for (rhs = 1; rhs < prodtn->lrhs; rhs++) { if (*rhsN < 0) { rhsN0 = -(*rhsN); rhsN1 = *(rhsN+1); if (rhsN1 >= 0) { addrbase = addrtermn[rhsN1]; if (!adjtb[addrbase+rhsN0]) { // adjtb[addrbase+rhsN0] = 1; insertAdjTM(addrbase,rhsN0); } } else { if (memabslnt[-rhsN1].bubblecov) { int xnext = -membasent[-memabslnt[rhsN0].baseNT].firstAbs; while (xnext != rhsN0) { memabslnt[xnext].adjbubble = 1; xnext = -memabslnt[xnext].nextNT; } memabslnt[rhsN0].adjbubble = 1; } insertAdjNT(-rhsN1,rhsN0); } } rhsN++; } } } } void ScpParser::insertAdjTM(int pbase,int adj) { int last = rdernttb[adj]; while (last) { adjtb[pbase+last] = 1; last = rdernttb[addrnontm[last]+adj]-1; } } void ScpParser::insertAdjNT(int base,int adj) { int last = invrdernttb[base]; while (last) { if (!adjtb[addrtermn[last-1]+adj]) insertAdjTM(addrtermn[last-1],adj); last = memcov[ldertmtb[addrtermn[last-1]+base]].ldernext; } } void ScpParser::printGrammar() { cout << "============================" << endl; cout << "Grammar" << endl; cout << "============================" << endl; cout << " Number of productions ..........: " << curprodtn << endl; cout << " Number of bubbles ..............: " << curbubble << endl; cout << " Max/Number base-nonterminal ....: " << maxbasent << endl; cout << " Max/Number absl-nonterminal ....: " << maxabslnt << endl; cout << " Max terminal ...................: " << maxtermn-1 << endl; cout << " Number of terminals ............: " << maxtermn << endl; cout << " curprodtn ...: " << curprodtn << endl; cout << " lenprodtn ...: " << lenprodtn << endl; cout << " currhs ......: " << currhs << endl; cout << " lenrhs ......: " << lenrhs << endl; cout << " curbubble ...: " << curbubble << endl; cout << " lenbubble ...: " << lenbubble << endl; cout << " curexcept ...: " << curexcept << endl; cout << " lenexcept ...: " << lenexcept << endl; cout << endl; cout << "============================" << endl; cout << "Base/Absl Translation Model" << endl; cout << "============================" << endl; for (int basent = -1; basent >= maxbasent; basent--) { cout << " BaseNT: " << basent << endl; cout << " (smP:" << membasent[-basent].smallestPrec << "," << "lgP:" << membasent[-basent].largestPrec << "," << "ftA:" << membasent[-basent].firstAbs << "," << "ltA:" << membasent[-basent].lastAbs << ")" << endl; int cA = membasent[-basent].firstAbs; while (cA) { cout << " AbslNT: " << cA << " [" << "baseNT:" << memabslnt[-cA].baseNT << "," << "precNT:" << memabslnt[-cA].precNT << "," << "nextNT:" << memabslnt[-cA].nextNT << "]" << endl; cA = memabslnt[-cA].nextNT; } cout << endl; } cout << endl; cout << "============================" << endl; cout << "Productions" << endl; cout << "============================" << endl; for (int ip = 1; ip <= curprodtn; ip++) { if (!memprodtn[ip].bubble) { cout << "(" << ip-1 << ") production: " << memprodtn[ip].lhs ; cout << "<" << getBaseNT(memprodtn[ip].lhs) << "/"; cout << getPrecNT(memprodtn[ip].lhs) << ">"; cout << " ::= " ; for (int rh = 0; rh < memprodtn[ip].lrhs; rh ++) { cout << memrhs[memprodtn[ip].rhs+rh]; if (memrhs[memprodtn[ip].rhs+rh] < 0) { cout << "<" << getBaseNT(memrhs[memprodtn[ip].rhs+rh]) << "/" << getPrecNT(memrhs[memprodtn[ip].rhs+rh]) << ">"; } cout << " "; } cout << endl; } else { cout << "(" << ip-1 << ") production: " ; ScpBubble* bubble = &membubble[memprodtn[ip].bubble]; cout << bubble->abslnt; cout << "<" << getBaseNT(bubble->abslnt) << "/"; cout << getPrecNT(bubble->abslnt) << ">"; cout << ", "; cout << bubble->lbound << ", " ; cout << bubble->ubound << ", " ; cout << bubble->lparen << ", " ; cout << bubble->rparen << ", " ; for (int ex = 0; ex < bubble->lexcept; ex ++) cout << memexcept[bubble->except+ex] << " "; cout << " || "; for (int tm = 0; tm < maxtermn; tm++) if (bubexcept[bubble->addrbubexcept + tm]) cout << tm << " "; cout << endl; } } cout << endl; cout << "============================" << endl; cout << "Non-Terminals " << endl; cout << "============================" << endl; for (int nt=1; nt <= -maxabslnt ; nt ++) { printf(" Non-Terminal: [%4d]\n",-nt); if (ldgrabslnt[nt]) { int linderg; cout << " LDerGraph: " ; int lderg = ldgrabslnt[nt]; linderg = 0; while (lderg) { if (linderg > 10) { cout << endl << " " ; linderg = 0; } printf("(%4d) ",lderg); lderg = ldgrprodtn[lderg]; linderg ++ ; } cout << endl; } cout << " LDerTable: " ; int linderg = 0; for (int lder = 1; lder <= -maxabslnt; lder++) { if (ldernttb[addrnontm[nt]+lder]) { if (linderg > 7) { cout << endl << " " ; linderg = 0; } printf("[%4d] ",-lder); linderg ++; } } cout << endl; if (rdgrabslnt[nt]) { int linderg; cout << " RDerGraph: " ; int rderg = rdgrabslnt[nt]; linderg = 0; while (rderg) { if (linderg > 10) { cout << endl << " " ; linderg = 0; } printf("(%4d) ",rderg); rderg = rdgrprodtn[rderg]; linderg ++ ; } cout << endl; } cout << " RDerTable: " ; linderg = 0; for (int rder = 1; rder < maxnontm; rder++) { if (rdernttb[addrnontm[nt]+rder]) { if (linderg > 7) { cout << endl << " " ; linderg = 0; } printf("[%4d] ",-rder); linderg ++; } } cout << endl; cout << " TMCovTable: " << endl; for (int tm = 0; tm < maxtermn; tm++) { int tmaddrbase = addrtermn[tm]; if (covtmtb[tmaddrbase+nt]) { printf(" [%4d]: ",tm); int lincov = 0; int cov = covtmtb[tmaddrbase+nt]; while (cov) { if (lincov > 8) { cout << endl << " " ; lincov = 0; } lincov++; printf("(%4d) ",memcov[cov].prodtn-1); cov = memcov[cov].next; } cout << endl; } } cout << " NTCovTable: " << endl; for (int ntm = 1; ntm <= -maxabslnt; ntm++) { int ntaddrbase = addrnontm[ntm]; if (covnttb[ntaddrbase+nt]) { printf(" [%4d]: ",-ntm); int lincov = 0; int cov = covnttb[ntaddrbase+nt]; while (cov) { if (lincov > 8) { cout << endl << " " ; lincov = 0; } lincov++; printf("(%4d) ",memcov[cov].prodtn-1); cov = memcov[cov].next; } cout << endl; } } if (memabslnt[nt].bubblecov) { cout << " BubbleCov: " ; int bcov = memabslnt[nt].bubblecov; int lincov = 0; while (bcov) { if (lincov > 8) { cout << endl << " " ; lincov = 0; } lincov++; printf("(%4d) ",memcov[bcov].prodtn-1); bcov = memcov[bcov].next; } cout << endl; } if (memabslnt[nt].bubbletermn) cout << " BubbleTermn: 1" << endl; if (memabslnt[nt].bubbleev) { cout << " BubbleEv: "; int bcov = memabslnt[nt].bubbleev; int lincov = 0; while (bcov) { if (lincov > 8) { cout << endl << " " ; lincov = 0; } lincov++; printf("(%4d) ",bubcov[bcov].prodtn-1); bcov = bubcov[bcov].next; } cout << endl; } cout << " AdjTable: "; int linadj = 0; for (int tm = 0; tm < maxtermn; tm++) { if (adjtb[addrtermn[tm]+nt]) { if (linadj > 8) { cout << endl << " " ; linadj = 0; } printf("[%4d] ",tm); linadj++; } } cout << endl; if (memabslnt[nt].adjbubble) cout << " AdjBubble: 1 " << endl; cout << " ----------------------------" << endl; } cout << endl; cout << "============================" << endl; cout << "Terminals" << endl; cout << "============================" << endl; for (int term = 0; term < maxtermn; term ++) { printf(" Terminal: [%4d]\n",term); cout << " LDerTable: " ; int linderg = 0; for (int lder = 1; lder <= -maxabslnt; lder++) { if (ldertmtb[addrtermn[term]+lder]) { if (linderg > 7) { cout << endl << " " ; linderg = 0; } printf("[%4d] ",-lder); linderg ++; } } cout << endl; } } Maude-2.6/src/MSCP10/scp_parser.hh0000644000147300135640000002572207666302265013545 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /************************************************ ** SCP Parsing Algorithm ** ** Maude Implementation ** ** Jose F. Quesada ** ** CSL - SRI Int. 1998 ** ************************************************/ /******* ******* scp_parser.hh *******/ #ifndef _scp_parser_hh_ #define _scp_parser_hh_ #include "macros.hh" #include "vector.hh" #include "string.h" #include "scp_kernel.hh" class ScpParser { class ScpBaseNT* membasent; int lenbasent; int maxbasent; class ScpAbslNT* memabslnt; int lenabslnt; int maxabslnt; int* ldgrabslnt; int* rdgrabslnt; int maxnontm; class ScpProdtn* memprodtn; int lenprodtn; int curprodtn; int* ldgrprodtn; int* rdgrprodtn; int* memrhs; int lenrhs; int currhs; int maxtermn; int* ldgrtermn; int* rdgrtermn; class ScpBubble* membubble; int lenbubble; int curbubble; int* memexcept; int lenexcept; int curexcept; int compiled; int* addrtermn; int* addrnontm; int* covtbl; int* covnttb; int* covtmtb; int* ldertmtb; /* same as covtmtb */ int* ldernttb; int* rdernttb; int* invrdernttb; char* adjtb; char* bubexcept; class ScpCov* memcov; class ScpCov* bubcov; int* nodeterm; int* eventterm; int* inputterm; int maxlenterm; int lengthterm; int rootterm; int ambnodes; int rootnode; class ScpEvent* memevent; int lenevent; int curevent; class ScpNode* memnode; int lennode; int curnode; class ScpAnal* memanal; int lenanal; int curanal; int prevnextanal; int* memdetect; int* typedetect; int curdetect; int lendetect; int lasttokendetect; int prevlasttokendetect; int* errorlist; int* errorlevel; int curerrorlist; char* memalter; int lenalter; int curalter; int* memprodruntoken; int* memprodrunnode; int* memambnode; int prevambnode; int parseErrorRecover; /* MEMRHS must be at least 2 */ /* MEMPRODTN must be at least 2 */ enum { MEMPRODTN = 1000, ADDPRODTN = 1000, MEMBASENT = 200, ADDBASENT = 200, MEMABSLNT = 400, ADDABSLNT = 400, MEMRHS = 5000, ADDRHS = 5000, MEMBUBBLE = 10, ADDBUBBLE = 10, MEMBUBCOV = 100, ADDBUBCOV = 100, MEMEXCEPT = 50, ADDEXCEPT = 50, MEMTERMN = 500, ADDTERMN = 500, MEMLENTERM= 100, ADDLENTERM= 100, MEMEVENT = 500, ADDEVENT = 500, MEMNODE = 500, ADDNODE = 500, MEMANAL = 500, ADDANAL = 500, MEMDETECT = 50, ADDDETECT = 50, ADDALTER = 10}; // insertProd int insertBasePrecNT(int,int); int getBaseNT(int); int getPrecNT(int); // compileParser void compileDerivationTables(); void compileLDerGraph(); void compileLDerTable(); void insertLDerNT(int); void compileRDerGraph(); void compileRDerTable(); void insertRDerNT(int); void compileCoverageTables(); void compileAdjacencyTables(); void insertAdjTM(int,int); void insertAdjNT(int,int); // parseSentence void tryEvent(int,int,int,int,int,int); void runToken(int); void runTokenBubble(int); void tryNode(int,int,int,int,int); void runNode(int); void runBubble(int,int,int,int,int,int=0); void initAnalysis(); int skipAnalysis(int); int setAmbNode(int); void printErrorDetect(); // Error Detection and Recovery void errorDetect(int,int,int = 0,int = 0); void errorRecovery(int = 0); enum { STANDARD_ERROR = 0, EXCEPTION_ERROR = 1, CLOSEPAR_ERROR = 2, MAXERRORLEVEL = 10}; // printSentence void printAnalNodes(int); char* printSymbol(int); public: // ScpParser // creates a new parser ScpParser(); // ~ScpParser // deletes a previously created parser ~ScpParser(); // insertProd (rule version) // inserts a new production in a previously created parser void insertProd (int xlhs, const Vector& xrhs, int xprec,const Vector& xgather); void compileParser(); // insertProd (bubble version) // indicates to the parser that a symbol is of type bubble, // and specifies its properties // Description: // nonTerminal: must be a negative number, // it is not necessary de define previously nonTerminal // lowBound: a natural number (0 to INT_MAX) // 0 means that the bubble may be empty // upperBound: an integer number // if lowBound == upperBound then the Bubble has // a fixed length and is not checked with the grammar // to define a bubble without a fixed maximum length, // use upperBound = -1 // leftParenToken: // 0-N : the token number associated with the // left parenthesis // -1 : the bubble doesn't use parenthesis // rightParenToken: similar to leftParenToken // // void insertProd(int nonTerminal, int lowBound, int upperBound, int leftParenToken, int rightParenToken, const Vector& exceptionTokenList ); // parseSentence // returns the number of analysis: // 0 => ungrammatical input (parsing failure) // 1 => grammatical and non-ambiguous input (1) // N>1 => grammatical and ambiguous input // double parseSentence(Vector& term,int root); int parseSentence(Vector& term,int root,int errorRecover=0); // getRootNode // returns the index of the root node // -1 => there isn't a root node (ungrammatical input) // N>=0 => the index of the root node int getRootNode(); // getProductionNumber(int node) // returns the production index which created the node // -1 => if the node is a token, or the node index // is incorrect // N>=0 => the production index int getProductionNumber(int node); // getFirstPosition(int node) // returns the position of the left-most token // covered by node // -1 => no active parser or incorrect node index // N>=0 => token position int getFirstPosition(int node); // getLastPosition(int node) // returns the position of the right-most token // covered by node // -1 => no active parser or incorrect node index // N>=0 => token position int getLastPosition(int node); // getNumberOfChildren(int node) // returns the number of Non-Terminal children of node // that is, the length of the gather of the // production taht created the node // -1 => no active parser, or incorrect node // N>=0 => number of NT children (maybe = 0) int getNumberOfChildren(int node); // getChild(int node,int childnumber) // returns the index of the node corresponding to // the position indicated by childnumber // This function only considers NonTerminal children // The numeration of children begins with 0 // That is, the set of possible children goes // from 0 to getNumberOfNTChildren - 1 // -1 => something wrong // N>=0 => node index int getChild(int node,int childnumber); // nextAnalysis() // changes the configuration of the parser to the // next parser // -1 => there is no active parser // 0 => there isn't more analysis // 1 => the parser has changed the configuration int nextAnalysis(); // freeCurrentParse() // frees the memory used by the current parse void freeCurrentParse(); // getNumberOfErrors() // when parseSentence() returns 0, getNumberOfErrors() // obtains the total number of errors that the error // detection and error recovery have been able to detect // Errors are numbered beginning with 1 int getNumberOfErrors(); // getErrorPosition(int errornumber) // for each value errorn in 1 - getNumberOfErrors(), the function // getErrorPosition(errorn) obtains the position where the error // has appeared. Positions are numbered beginning with 0. So, // for an input term of length L, the usual positions of errors // are 0 - (L-1). Nevertheless, getErrorPosition() may return L, // which means that the error has appeared at the end of the // input: premature end. // The function will return -1 is the argument (errornumber) // isn't in the interval 1 - getNumberOfErrors() // int getErrorPosition(int); // The error detection strategy includes three kinds of errors. // 1.- Standard Errors // 2.- Exception Errors (inside Bubbles) // 3.- CloseParenthesis Errors (inside Bubbles) // As it is possible that more than just one type of error appears // at one position, the system distinguishes three functions: // getAlternativesStandardError(int errornumber) // returns the set of alternatives (tokens) that may appear // at the position of the error Vector getAlternativesStandardError(int errornumber); // getBubblesExceptionError(int errornumber) // returns the set of bubbles (non-terminals) that have failed // at that position due to an exception error Vector getBubblesExceptionError(int errornumber); // getBubblesCloseParenthesisError(int errornumber) // returns the set of bubbles (non-terminals) that have failed // at that position due to an unbalanced close parenthesis Vector getBubblesCloseParenthesisError(int errornumber); // Notes: // 1.- If the three functions return 0-length vectors, this means // that the input must end at the position of the error // Auxiliar Functions void printGrammar(); void printSentence(); int getLHSProduction(int); void printCurrentParse(); void printNode(int); }; typedef ScpParser Parser; #endif Maude-2.6/src/MSCP10/Makefile.am0000644000147300135640000000032607674446527013121 00000000000000noinst_LIBRARIES = libmscp10.a libmscp10_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility libmscp10_a_SOURCES = \ scp_parser.cc \ scp_compiler.cc \ scp_memory.cc noinst_HEADERS = \ scp_kernel.hh \ scp_parser.hh Maude-2.6/src/Temporal/0000777000147300135640000000000011500304117011773 500000000000000Maude-2.6/src/Temporal/temporal.hh0000644000147300135640000000215307666300727014101 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for temporal classes. // #ifndef _temporal_hh_ #define _temporal_hh_ class LogicFormula; class TransitionSet; class RawTransitionSet; class VeryWeakAlternatingAutomaton; class GenBuchiAutomaton; class BuchiAutomaton2; class ModelChecker2; #endif Maude-2.6/src/Temporal/buchiAutomaton2.cc0000644000147300135640000001601307666300727015310 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class BuchiAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "temporal.hh" // temporal class definitions #include "genBuchiAutomaton.hh" #include "buchiAutomaton2.hh" BuchiAutomaton2::BuchiAutomaton2(LogicFormula* formula, int top) { GenBuchiAutomaton g(formula, top); g.simplify(); int nrOldStates = g.getNrStates(); if (nrOldStates == 0) return; initialStates = g.getInitialStates(); int nrFairnessSets = g.getNrFairnessSets(); int nrStates = nrOldStates * (nrFairnessSets + 1); states.expandTo(nrStates); for (int i = 0; i < nrStates; i++) states[i] = NONE; const NatSet::const_iterator e = initialStates.end(); for (NatSet::const_iterator i = initialStates.begin(); i != e; ++i) generate(g, *i, 0); #ifdef TDEBUG dump(cout); #endif if (transitionMaps.size() < states.length()) { int nrStates; do { nrStates = states.length(); collapseStates(); #ifdef TDEBUG dump(cout); #endif } while (states.length() < nrStates); } } void BuchiAutomaton2::generate(const GenBuchiAutomaton& g, int oldStateNr, int instanceNr) { int nrFairnessSets = g.getNrFairnessSets(); int nrOldStates = g.getNrStates(); int stateNr = oldStateNr + instanceNr * nrOldStates; states[stateNr] = UNBOUNDED; // to prevent looping TransitionMap m; const GenBuchiAutomaton::FairTransitionSet& ts = g.getTransitions(oldStateNr); GenBuchiAutomaton::FairTransitionSet::const_iterator e = ts.end(); for (GenBuchiAutomaton::FairTransitionSet::const_iterator i = ts.begin(); i != e; ++i) { Transition t; const NatSet& fairness = g.getFairnessCombination(i->first.second); int newInstanceNr = (instanceNr == nrFairnessSets) ? 0 : instanceNr; while (fairness.contains(newInstanceNr)) ++newInstanceNr; int oldTarget = i->first.first; int newTarget = oldTarget + newInstanceNr * nrOldStates; t.first = newTarget; t.second = i->second; insertTransition(m, t); if (states[newTarget] == NONE) generate(g, oldTarget, newInstanceNr); } states[stateNr] = transitionMaps.insert(m); if (instanceNr == nrFairnessSets) acceptingStates.insert(stateNr); } void BuchiAutomaton2::insertTransition(TransitionMap& m, const Transition& t) { pair i = m.insert(t); if (!(i.second)) i.first->second = bdd_or(i.first->second, t.second); } void BuchiAutomaton2::collapseStates() { // // Identify transition sets that are used by both accepting // and non-accepting states. // NatSet usedByAccepting; NatSet usedByNonAccepting; int nrStates = states.length(); for (int i = 0; i < nrStates; i++) { int tsIndex = states[i]; if (tsIndex != UNDEFINED) { if (acceptingStates.contains(i)) usedByAccepting.insert(tsIndex); else usedByNonAccepting.insert(tsIndex); } } usedByAccepting.intersect(usedByNonAccepting); // // Build a map on transition set indices that maps indices of // shared transition sets that where some of the transitions lead // to non-accepting states to fresh indices. // int nrTransitionSets = transitionMaps.size(); Vector acceptingMap(nrTransitionSets); int freshIndices = nrTransitionSets; for (int i = 0; i < nrTransitionSets; i++) { if (usedByAccepting.contains(i) && hasNonAcceptingTarget(transitionMaps.ithElement(i))) acceptingMap[i] = freshIndices++; else acceptingMap[i] = UNDEFINED; } // // Accepting states that used these shared transition sets // now use these fresh indices. // for (int i = 0; i < nrStates; i++) { if (acceptingStates.contains(i)) { int replacement = acceptingMap[states[i]]; if (replacement != UNDEFINED) states[i] = replacement; } } // // Now rebuild the Buchi Automata, collapsing states with the // same transition sets. // NatSet newInitialStates; NatSet newAcceptingStates; Vector newStates(freshIndices); TransitionMapTable newTransitionMaps; remapNatSet(newInitialStates, initialStates, states); remapNatSet(newAcceptingStates, acceptingStates, states); for (int i = 0; i < nrTransitionSets; i++) { TransitionMap transformed; transformTransitionMap(transformed, transitionMaps.ithElement(i)); newStates[i] = newTransitionMaps.insert(transformed); int acceptingCopy = acceptingMap[i]; if (acceptingCopy != UNDEFINED) newStates[acceptingCopy] = newStates[i]; } // // Swap new and old automata. // initialStates.swap(newInitialStates); acceptingStates.swap(newAcceptingStates); states.swap(newStates); transitionMaps.swap(newTransitionMaps); } void BuchiAutomaton2::transformTransitionMap(TransitionMap& transformed, const TransitionMap& original) { TransitionMap::const_iterator e = original.end(); for (TransitionMap::const_iterator i = original.begin(); i != e; ++i) { Transition t(states[i->first], i->second); insertTransition(transformed, t); } } bool BuchiAutomaton2::hasNonAcceptingTarget(const TransitionMap& tm) { TransitionMap::const_iterator e = tm.end(); for (TransitionMap::const_iterator i = tm.begin(); i != e; ++i) { if (!(acceptingStates.contains(i->first))) return true; } return false; } void BuchiAutomaton2::remapNatSet(NatSet& newSet, const NatSet& oldSet, const Vector& natMap) { for (int i = natMap.length() - 1; i >= 0; i--) { int t = natMap[i]; if (t != NONE && oldSet.contains(i)) newSet.insert(t); } } void BuchiAutomaton2::dump(ostream& s) { s << "begin{BuchiAutomaton2}\n"; int nrStates = states.length(); for (int i = 0; i < nrStates; i++) { s << "state " << i; if (acceptingStates.contains(i)) s << "\taccepting"; s << '\n'; if (states[i] != NONE) { const TransitionMap& t = transitionMaps.ithElement(states[i]); TransitionMap::const_iterator e = t.end(); for(TransitionMap::const_iterator j = t.begin(); j != e; ++j) { s << j->first << '\t'; BddUser::dump(s, j->second); s << '\n'; } } s << '\n'; } s << "initial states: " << initialStates << '\n'; s << "end{BuchiAutomaton2}\n"; } Maude-2.6/src/Temporal/genBuchiAutomaton.hh0000644000147300135640000001175407666300727015701 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for Generalized Buchi Automata. // // We implement the VWAA to GBA translation and GBA optimization // algorithms from: // Paul Gastin and Denis Oddoux, // "Fast LTL to Buchi Automaton Translation", // CAV 2001, LNCS 2102, pp 53-65, 2001. // // We also do SCC based optimization using ideas from: // Fabio Somenzi and Roderick Bloem, // "Efficient Buchi Automata from LTL Formulae", // CAV 2000, LNCS 1633, p247-263, 2000. // However our GBAs have fairness conditions on the transitions // rather than on the states. // #ifndef _genBuchiAutomaton_hh_ #define _genBuchiAutomaton_hh_ #include #include #include "bddUser.hh" #include "natSet.hh" #include "bdd.hh" #include "indexedSet.hh" class GenBuchiAutomaton : private BddUser { public: typedef pair Key; // (state index, fairness set index) typedef pair FairTransition; typedef map FairTransitionSet; GenBuchiAutomaton(LogicFormula* formula, int top); void simplify(); bool satSolve(list& leadIn, list& cycle); int getNrStates() const; int getNrFairnessSets() const; const NatSet& getInitialStates() const; const NatSet& getFairnessCombination(int fairnessIndex) const; const FairTransitionSet& getTransitions(int stateNr) const; void dump(ostream& s) const; private: typedef IndexedSet NatSetTable; typedef IndexedSet FairTransitionSetTable; void generateState(int index); int getStateIndex(const NatSet& stateSet); void insertFairTransition(FairTransitionSet& fts, const FairTransition& ft); void insertFairTransition2(FairTransitionSet& fts, const FairTransition& ft); void transformFairTransitionSet(FairTransitionSet& transformed, const FairTransitionSet& original); void maximallyCollapseStates(); void collapseStates(); void sccOptimizations(); void sccAnalysis(); int strongConnected(int v); void handleComponent(int component); void eliminateFairness(FairTransitionSet& transformed, const FairTransitionSet& original, const Vector& stateMap); void transformFairTransitionSet2(NatSetTable& oldFairnessConditions, FairTransitionSet& transformed, const FairTransitionSet& original, const Vector& stateMap, const Vector& fairMap, int component); void remapNatSet(NatSet& newSet, const NatSet& oldSet, const Vector& natMap); void bfsToFairComponent(int& fairState, list& path) const; void bfsToMoreFairness(NatSet& fairness, int& start, list& path) const; void bfsToTarget(int start, int target, list& path) const; NatSet initialStates; Vector states; FairTransitionSetTable fairTransitionSets; int nrFairnessSets; NatSetTable fairnessConditions; // // Temporary data used during construction. // VeryWeakAlternatingAutomaton* vwaa; NatSetTable vwaaStateSets; // // Structures used for SCC Optimizations. // struct StateInfo { int traversalNumber; // DFS traversal number int component; // number of the component we're in }; enum ComponentStatus { DEAD, // unfair and can't reach a fair SCC UNFAIR, // unfair and can reach a fair SCC FAIR // has internal transitions covering all fairness sets }; struct ComponentInfo { ComponentStatus status; NatSet redundant; // redundant fairness sets for a fair component }; int traversalCount; int componentCount; stack stateStack; Vector stateInfo; Vector componentInfo; NatSet allFair; NatSet essential; // // Stucture used for sat solving. // struct Step; }; inline int GenBuchiAutomaton::getNrStates() const { return states.length(); } inline int GenBuchiAutomaton::getNrFairnessSets() const { return nrFairnessSets; } inline const NatSet& GenBuchiAutomaton::getInitialStates() const { return initialStates; } inline const NatSet& GenBuchiAutomaton::getFairnessCombination(int fairnessIndex) const { return fairnessConditions.ithElement(fairnessIndex); } inline const GenBuchiAutomaton::FairTransitionSet& GenBuchiAutomaton::getTransitions(int stateNr) const { return fairTransitionSets.ithElement(states[stateNr]); } #endif Maude-2.6/src/Temporal/transitionSet.cc0000644000147300135640000001014007666300727015105 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class TransitionSet. // #include // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" #include "bddUser.hh" // for dump() // temporal class definitions #include "transitionSet.hh" void TransitionSet::insert(const Transition& transition) { Bdd formula = transition.second; if (formula == bdd_false()) return; // for robustness const TransitionMap::iterator e = transitionMap.end(); TransitionMap::iterator equal = e; for (TransitionMap::iterator i = transitionMap.begin(); i != e;) { TransitionMap::iterator t = i++; if (t->first == transition.first) equal = t; else if (t->first.contains(transition.first)) { t->second = bdd_and(t->second, bdd_not(formula)); if (t->second == bdd_false()) transitionMap.erase(t); // existing pair completely subsumed } else if (transition.first.contains(t->first)) { formula = bdd_and(formula, bdd_not(t->second)); if (formula == bdd_false()) return; // new transition completely subsumed } } if (equal == e) { pair p = transitionMap.insert(transition); Assert(p.second, "failed to insert"); p.first->second = formula; } else equal->second = bdd_or(equal->second, formula); } void TransitionSet::insert(const TransitionSet& transitionSet) { const TransitionMap::const_iterator e = transitionSet.transitionMap.end(); for (TransitionMap::const_iterator i = transitionSet.transitionMap.begin(); i != e; ++i) insert(*i); } void TransitionSet::product(const TransitionSet& ts1, const TransitionSet& ts2) { transitionMap.clear(); const TransitionMap::const_iterator ie = ts1.transitionMap.end(); const TransitionMap::const_iterator je = ts2.transitionMap.end(); Transition newTransition; for (TransitionMap::const_iterator i = ts1.transitionMap.begin(); i != ie; ++i) { for (TransitionMap::const_iterator j = ts2.transitionMap.begin(); j != je; ++j) { newTransition.second = bdd_and(i->second, j->second); if (newTransition.second != bdd_false()) { newTransition.first = i->first; newTransition.first.insert(j->first); insert(newTransition); } } } } void TransitionSet::rename(const TransitionSet& original, const Vector& renaming) { // // Renaming must be injective: no two old states must map to // the name new state. We make use of that to do a fast insertion // of the renamed state sets. // transitionMap.clear(); const TransitionMap::const_iterator ei = original.transitionMap.end(); for (TransitionMap::const_iterator i = original.transitionMap.begin(); i != ei; ++i) { Transition t; const NatSet::const_iterator ej = i->first.end(); for (NatSet::const_iterator j = i->first.begin(); j != ej; ++j) { Assert(renaming[*j] != NONE, "no renaming for " << *j); t.first.insert(renaming[*j]); } t.second = i->second; transitionMap.insert(t); } } void TransitionSet::dump(ostream& s, int indentLevel) const { const TransitionMap::const_iterator e = transitionMap.end(); for (TransitionMap::const_iterator i = transitionMap.begin(); i != e; ++i) { s << Indent(indentLevel) << i->first << '\t'; BddUser::dump(s, i->second); s << '\n'; } } Maude-2.6/src/Temporal/Makefile.in0000644000147300135640000007203311500303156013763 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/Temporal DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libtemporal_a_AR = $(AR) $(ARFLAGS) libtemporal_a_LIBADD = am_libtemporal_a_OBJECTS = libtemporal_a-logicFormula.$(OBJEXT) \ libtemporal_a-buchiAutomaton2.$(OBJEXT) \ libtemporal_a-transitionSet.$(OBJEXT) \ libtemporal_a-veryWeakAlternatingAutomaton.$(OBJEXT) \ libtemporal_a-rawTransitionSet.$(OBJEXT) \ libtemporal_a-genBuchiAutomaton.$(OBJEXT) \ libtemporal_a-modelChecker2.$(OBJEXT) libtemporal_a_OBJECTS = $(am_libtemporal_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libtemporal_a_SOURCES) DIST_SOURCES = $(libtemporal_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libtemporal.a libtemporal_a_CPPFLAGS = -I$(top_srcdir)/src/Utility libtemporal_a_SOURCES = \ logicFormula.cc \ buchiAutomaton2.cc \ transitionSet.cc \ veryWeakAlternatingAutomaton.cc \ rawTransitionSet.cc \ genBuchiAutomaton.cc \ modelChecker2.cc EXTRA_DIST = \ collapseStates.cc \ sccOptimizations.cc \ sccAnalysis.cc \ satSolve.cc noinst_HEADERS = \ buchiAutomaton2.hh \ genBuchiAutomaton.hh \ logicFormula.hh \ modelChecker2.hh \ rawTransitionSet.hh \ temporal.hh \ transitionSet.hh \ veryWeakAlternatingAutomaton.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Temporal/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Temporal/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libtemporal.a: $(libtemporal_a_OBJECTS) $(libtemporal_a_DEPENDENCIES) -rm -f libtemporal.a $(libtemporal_a_AR) libtemporal.a $(libtemporal_a_OBJECTS) $(libtemporal_a_LIBADD) $(RANLIB) libtemporal.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-buchiAutomaton2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-logicFormula.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-modelChecker2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-rawTransitionSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-transitionSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libtemporal_a-logicFormula.o: logicFormula.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-logicFormula.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-logicFormula.Tpo" -c -o libtemporal_a-logicFormula.o `test -f 'logicFormula.cc' || echo '$(srcdir)/'`logicFormula.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-logicFormula.Tpo" "$(DEPDIR)/libtemporal_a-logicFormula.Po"; else rm -f "$(DEPDIR)/libtemporal_a-logicFormula.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logicFormula.cc' object='libtemporal_a-logicFormula.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-logicFormula.o `test -f 'logicFormula.cc' || echo '$(srcdir)/'`logicFormula.cc libtemporal_a-logicFormula.obj: logicFormula.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-logicFormula.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-logicFormula.Tpo" -c -o libtemporal_a-logicFormula.obj `if test -f 'logicFormula.cc'; then $(CYGPATH_W) 'logicFormula.cc'; else $(CYGPATH_W) '$(srcdir)/logicFormula.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-logicFormula.Tpo" "$(DEPDIR)/libtemporal_a-logicFormula.Po"; else rm -f "$(DEPDIR)/libtemporal_a-logicFormula.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logicFormula.cc' object='libtemporal_a-logicFormula.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-logicFormula.obj `if test -f 'logicFormula.cc'; then $(CYGPATH_W) 'logicFormula.cc'; else $(CYGPATH_W) '$(srcdir)/logicFormula.cc'; fi` libtemporal_a-buchiAutomaton2.o: buchiAutomaton2.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-buchiAutomaton2.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Tpo" -c -o libtemporal_a-buchiAutomaton2.o `test -f 'buchiAutomaton2.cc' || echo '$(srcdir)/'`buchiAutomaton2.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Tpo" "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Po"; else rm -f "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='buchiAutomaton2.cc' object='libtemporal_a-buchiAutomaton2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-buchiAutomaton2.o `test -f 'buchiAutomaton2.cc' || echo '$(srcdir)/'`buchiAutomaton2.cc libtemporal_a-buchiAutomaton2.obj: buchiAutomaton2.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-buchiAutomaton2.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Tpo" -c -o libtemporal_a-buchiAutomaton2.obj `if test -f 'buchiAutomaton2.cc'; then $(CYGPATH_W) 'buchiAutomaton2.cc'; else $(CYGPATH_W) '$(srcdir)/buchiAutomaton2.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Tpo" "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Po"; else rm -f "$(DEPDIR)/libtemporal_a-buchiAutomaton2.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='buchiAutomaton2.cc' object='libtemporal_a-buchiAutomaton2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-buchiAutomaton2.obj `if test -f 'buchiAutomaton2.cc'; then $(CYGPATH_W) 'buchiAutomaton2.cc'; else $(CYGPATH_W) '$(srcdir)/buchiAutomaton2.cc'; fi` libtemporal_a-transitionSet.o: transitionSet.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-transitionSet.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-transitionSet.Tpo" -c -o libtemporal_a-transitionSet.o `test -f 'transitionSet.cc' || echo '$(srcdir)/'`transitionSet.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-transitionSet.Tpo" "$(DEPDIR)/libtemporal_a-transitionSet.Po"; else rm -f "$(DEPDIR)/libtemporal_a-transitionSet.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='transitionSet.cc' object='libtemporal_a-transitionSet.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-transitionSet.o `test -f 'transitionSet.cc' || echo '$(srcdir)/'`transitionSet.cc libtemporal_a-transitionSet.obj: transitionSet.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-transitionSet.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-transitionSet.Tpo" -c -o libtemporal_a-transitionSet.obj `if test -f 'transitionSet.cc'; then $(CYGPATH_W) 'transitionSet.cc'; else $(CYGPATH_W) '$(srcdir)/transitionSet.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-transitionSet.Tpo" "$(DEPDIR)/libtemporal_a-transitionSet.Po"; else rm -f "$(DEPDIR)/libtemporal_a-transitionSet.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='transitionSet.cc' object='libtemporal_a-transitionSet.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-transitionSet.obj `if test -f 'transitionSet.cc'; then $(CYGPATH_W) 'transitionSet.cc'; else $(CYGPATH_W) '$(srcdir)/transitionSet.cc'; fi` libtemporal_a-veryWeakAlternatingAutomaton.o: veryWeakAlternatingAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-veryWeakAlternatingAutomaton.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Tpo" -c -o libtemporal_a-veryWeakAlternatingAutomaton.o `test -f 'veryWeakAlternatingAutomaton.cc' || echo '$(srcdir)/'`veryWeakAlternatingAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Tpo" "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Po"; else rm -f "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='veryWeakAlternatingAutomaton.cc' object='libtemporal_a-veryWeakAlternatingAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-veryWeakAlternatingAutomaton.o `test -f 'veryWeakAlternatingAutomaton.cc' || echo '$(srcdir)/'`veryWeakAlternatingAutomaton.cc libtemporal_a-veryWeakAlternatingAutomaton.obj: veryWeakAlternatingAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-veryWeakAlternatingAutomaton.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Tpo" -c -o libtemporal_a-veryWeakAlternatingAutomaton.obj `if test -f 'veryWeakAlternatingAutomaton.cc'; then $(CYGPATH_W) 'veryWeakAlternatingAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/veryWeakAlternatingAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Tpo" "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Po"; else rm -f "$(DEPDIR)/libtemporal_a-veryWeakAlternatingAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='veryWeakAlternatingAutomaton.cc' object='libtemporal_a-veryWeakAlternatingAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-veryWeakAlternatingAutomaton.obj `if test -f 'veryWeakAlternatingAutomaton.cc'; then $(CYGPATH_W) 'veryWeakAlternatingAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/veryWeakAlternatingAutomaton.cc'; fi` libtemporal_a-rawTransitionSet.o: rawTransitionSet.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-rawTransitionSet.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-rawTransitionSet.Tpo" -c -o libtemporal_a-rawTransitionSet.o `test -f 'rawTransitionSet.cc' || echo '$(srcdir)/'`rawTransitionSet.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-rawTransitionSet.Tpo" "$(DEPDIR)/libtemporal_a-rawTransitionSet.Po"; else rm -f "$(DEPDIR)/libtemporal_a-rawTransitionSet.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rawTransitionSet.cc' object='libtemporal_a-rawTransitionSet.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-rawTransitionSet.o `test -f 'rawTransitionSet.cc' || echo '$(srcdir)/'`rawTransitionSet.cc libtemporal_a-rawTransitionSet.obj: rawTransitionSet.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-rawTransitionSet.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-rawTransitionSet.Tpo" -c -o libtemporal_a-rawTransitionSet.obj `if test -f 'rawTransitionSet.cc'; then $(CYGPATH_W) 'rawTransitionSet.cc'; else $(CYGPATH_W) '$(srcdir)/rawTransitionSet.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-rawTransitionSet.Tpo" "$(DEPDIR)/libtemporal_a-rawTransitionSet.Po"; else rm -f "$(DEPDIR)/libtemporal_a-rawTransitionSet.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rawTransitionSet.cc' object='libtemporal_a-rawTransitionSet.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-rawTransitionSet.obj `if test -f 'rawTransitionSet.cc'; then $(CYGPATH_W) 'rawTransitionSet.cc'; else $(CYGPATH_W) '$(srcdir)/rawTransitionSet.cc'; fi` libtemporal_a-genBuchiAutomaton.o: genBuchiAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-genBuchiAutomaton.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Tpo" -c -o libtemporal_a-genBuchiAutomaton.o `test -f 'genBuchiAutomaton.cc' || echo '$(srcdir)/'`genBuchiAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Tpo" "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Po"; else rm -f "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='genBuchiAutomaton.cc' object='libtemporal_a-genBuchiAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-genBuchiAutomaton.o `test -f 'genBuchiAutomaton.cc' || echo '$(srcdir)/'`genBuchiAutomaton.cc libtemporal_a-genBuchiAutomaton.obj: genBuchiAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-genBuchiAutomaton.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Tpo" -c -o libtemporal_a-genBuchiAutomaton.obj `if test -f 'genBuchiAutomaton.cc'; then $(CYGPATH_W) 'genBuchiAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/genBuchiAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Tpo" "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Po"; else rm -f "$(DEPDIR)/libtemporal_a-genBuchiAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='genBuchiAutomaton.cc' object='libtemporal_a-genBuchiAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-genBuchiAutomaton.obj `if test -f 'genBuchiAutomaton.cc'; then $(CYGPATH_W) 'genBuchiAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/genBuchiAutomaton.cc'; fi` libtemporal_a-modelChecker2.o: modelChecker2.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-modelChecker2.o -MD -MP -MF "$(DEPDIR)/libtemporal_a-modelChecker2.Tpo" -c -o libtemporal_a-modelChecker2.o `test -f 'modelChecker2.cc' || echo '$(srcdir)/'`modelChecker2.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-modelChecker2.Tpo" "$(DEPDIR)/libtemporal_a-modelChecker2.Po"; else rm -f "$(DEPDIR)/libtemporal_a-modelChecker2.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='modelChecker2.cc' object='libtemporal_a-modelChecker2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-modelChecker2.o `test -f 'modelChecker2.cc' || echo '$(srcdir)/'`modelChecker2.cc libtemporal_a-modelChecker2.obj: modelChecker2.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libtemporal_a-modelChecker2.obj -MD -MP -MF "$(DEPDIR)/libtemporal_a-modelChecker2.Tpo" -c -o libtemporal_a-modelChecker2.obj `if test -f 'modelChecker2.cc'; then $(CYGPATH_W) 'modelChecker2.cc'; else $(CYGPATH_W) '$(srcdir)/modelChecker2.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libtemporal_a-modelChecker2.Tpo" "$(DEPDIR)/libtemporal_a-modelChecker2.Po"; else rm -f "$(DEPDIR)/libtemporal_a-modelChecker2.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='modelChecker2.cc' object='libtemporal_a-modelChecker2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libtemporal_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libtemporal_a-modelChecker2.obj `if test -f 'modelChecker2.cc'; then $(CYGPATH_W) 'modelChecker2.cc'; else $(CYGPATH_W) '$(srcdir)/modelChecker2.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/Temporal/transitionSet.hh0000644000147300135640000000465007666300727015130 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Intuitively a transition set maps each valuation to a disjunction // of conjunctions of next states. In practice is it maintained as a set of // // pairs where the truth of the boolean formula on a valuation indicates that // the set of states in the pair is in the disjunction for that valuation. // // We have the simplification rule that for any valuation, a conjunction // of states in its disjunction subsumes any larger conjunction of states // in its disjunction. // // We maintain a canonical form by storing the set of pairs as a map // from sets of states to formulae such that for any set Q of states, the // formulae is true on exactly those valuations in which Q appears as part // of the simplified disjunction. // #ifndef _transitionSet_hh_ #define _transitionSet_hh_ #include #include "natSet.hh" #include "bdd.hh" typedef pair Transition; // HACK class TransitionSet { public: typedef map TransitionMap; void insert(const Transition& transition); void insert(const TransitionSet& transitionSet); void product(const TransitionSet& ts1, const TransitionSet& ts2); void swap(TransitionSet& other); void rename(const TransitionSet& original, const Vector& renaming); const TransitionMap& getMap() const; void dump(ostream& s, int indentLevel = 0) const; private: TransitionMap transitionMap; }; inline void TransitionSet::swap(TransitionSet& other) { transitionMap.swap(other.transitionMap); } inline const TransitionSet::TransitionMap& TransitionSet::getMap() const { return transitionMap; } #endif Maude-2.6/src/Temporal/modelChecker2.hh0000644000147300135640000000472207666300727014731 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for LTL model checking. // // We implement the double depth first search method from: // G. J. Holzmann, D. Peled and M. Yannakakis, // "On nested depth first search", // Second SPIN Workshop, pp23-32, AMS 1996. // #ifndef _modelChecker2_hh_ #define _modelChecker2_hh_ #include #include "natSet.hh" #include "buchiAutomaton2.hh" class ModelChecker2 { NO_COPYING(ModelChecker2); public: struct System { virtual int getNextState(int stateNr, int transitionNr) = 0; virtual bool checkProposition(int stateNr, int propositionIndex) const = 0; }; ModelChecker2(System& system, LogicFormula& property, int top); bool findCounterexample(); const list& getLeadIn() const; const list& getCycle() const; private: struct StateSet { NatSet dfs1Seen; NatSet onDfs1Stack; NatSet dfs2Seen; NatSet testedProps; NatSet trueProps; }; bool dfs1PropertyTransitions(int systemStateNr, int propertyStateNr); bool dfs2PropertyTransitions(int systemStateNr, int propertyStateNr); bool dfs1SystemTransitions(int systemStateNr, int propertyStateNr); bool dfs2SystemTransitions(int systemStateNr, int propertyStateNr); bool satisfiesPropositionalFormula(int systemStateNr, Bdd formula); System& system; BuchiAutomaton2 propertyAutomaton; Vector intersectionStates; // // Stuff for recovering counterexample. // int cycleSystemStateNr; int cyclePropertyStateNr; list path; list cycle; }; inline const list& ModelChecker2::getLeadIn() const { return path; } inline const list& ModelChecker2::getCycle() const { return cycle; } #endif Maude-2.6/src/Temporal/veryWeakAlternatingAutomaton.cc0000644000147300135640000001620507704653237020125 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class VeryWeakAlternatingAutomaton. // #include // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "temporal.hh" // temporal class definitions #include "logicFormula.hh" #include "veryWeakAlternatingAutomaton.hh" VeryWeakAlternatingAutomaton::VeryWeakAlternatingAutomaton(LogicFormula* formula, int top) : states(top + 1), formula(formula), renaming(top + 1) { dnf(top, initialStates); #ifdef TDEBUG dump(cout); #endif reachabilityOpt(); #ifdef TDEBUG dump(cout); #endif } void VeryWeakAlternatingAutomaton::dnf(int subformulaIndex, TransitionSet& result) { // // Compute a disjunction of conjunctions of states. For convenience // we store this set of conjunctions of states as a set of transitions // where each conjunction is a transition (hyperarc) with the label true. // We also call computeTransitionSet() on all reachable states. // switch (formula->getOp(subformulaIndex)) { case LogicFormula::AND: { TransitionSet left; dnf(formula->getArg(subformulaIndex, 0), left); TransitionSet right; dnf(formula->getArg(subformulaIndex, 1), right); result.product(left, right); break; } case LogicFormula::OR: { dnf(formula->getArg(subformulaIndex, 0), result); TransitionSet right; dnf(formula->getArg(subformulaIndex, 1), right); result.insert(right); break; } default: { Transition t; t.first.insert(subformulaIndex); t.second = bdd_true(); result.insert(t); computeTransitionSet(subformulaIndex); // reachable } } } void VeryWeakAlternatingAutomaton::computeTransitionSet(int subformulaIndex) { TransitionSet& result = states[subformulaIndex]; if (!(result.getMap().empty())) return; // already computed (actually we miss false case - but false case does nothing) LogicFormula::Op op = formula->getOp(subformulaIndex); switch (op) { case LogicFormula::PROPOSITION: { Transition t; t.second = ithvar(formula->getProp(subformulaIndex)); result.insert(t); break; } case LogicFormula::LTL_TRUE: { Transition t; t.second = bdd_true(); result.insert(t); break; } case LogicFormula::LTL_FALSE: break; // empty transition set case LogicFormula::NOT: { Transition t; t.second = nithvar(formula->getProp(formula->getArg(subformulaIndex, 0))); result.insert(t); break; } case LogicFormula::NEXT: { dnf(formula->getArg(subformulaIndex, 0), result); break; } default: { int leftIndex = formula->getArg(subformulaIndex, 0); int rightIndex = formula->getArg(subformulaIndex, 1); computeTransitionSet(leftIndex); computeTransitionSet(rightIndex); const TransitionSet& left = states[leftIndex]; const TransitionSet& right = states[rightIndex]; switch (op) { case LogicFormula::AND: { result.product(left, right); break; } case LogicFormula::OR: { result = left; // deep copy result.insert(right); break; } default: { Transition t; t.first.insert(subformulaIndex); t.second = bdd_true(); if (op == LogicFormula::UNTIL) { TransitionSet self; self.insert(t); result.product(left, self); result.insert(right); finalStates.append(subformulaIndex); } else { Assert(op == LogicFormula::RELEASE, "bad op"); TransitionSet sum(left); sum.insert(t); result.product(sum, right); } } } } } } void VeryWeakAlternatingAutomaton::reachabilityOpt() { int nrStates = states.length(); nrNewStates = 0; for (int i = 0; i < nrStates; i++) renaming[i] = NONE; findReachable(initialStates); TransitionSet newInitialStates; newInitialStates.rename(initialStates, renaming); initialStates.swap(newInitialStates); Vector newStates(nrNewStates); for (int i = 0; i < nrStates; i++) { int newName = renaming[i]; if (newName != NONE) newStates[newName].rename(states[i], renaming); } states.swap(newStates); Vector newFinalStates; int nrFinalStates = finalStates.length(); for (int i = 0; i < nrFinalStates; i++) { int newName = renaming[finalStates[i]]; if (newName != NONE) newFinalStates.append(newName); } finalStates.swap(newFinalStates); } void VeryWeakAlternatingAutomaton::findReachable(const TransitionSet& ts) { const TransitionSet::TransitionMap& tm = ts.getMap(); TransitionSet::TransitionMap::const_iterator ei = tm.end(); for (TransitionSet::TransitionMap::const_iterator i = tm.begin(); i != ei; ++i) { NatSet::const_iterator ej = i->first.end(); for (NatSet::const_iterator j = i->first.begin(); j != ej; ++j) { int k = *j; if (renaming[k] == NONE) { renaming[k] = nrNewStates++; findReachable(states[k]); } } } } bool VeryWeakAlternatingAutomaton::checkFairness(const Transition& transition, int finalStateIndex) const { if (!(transition.first.contains(finalStateIndex))) return true; const TransitionSet::TransitionMap& tm = states[finalStateIndex].getMap(); TransitionSet::TransitionMap::const_iterator e = tm.end(); for (TransitionSet::TransitionMap::const_iterator i = tm.begin(); i != e; ++i) { if (!(i->first.contains(finalStateIndex)) && // no self loop transition.first.contains(i->first) && // contained in test transition transition.second.implies(i->second)) // implied by test transition return true; } return false; } void VeryWeakAlternatingAutomaton::computeFairnessSet(const Transition& transition, NatSet& fairnessSet) { int nrFinalsStates = finalStates.length(); for (int i = 0; i < nrFinalsStates; i++) { if (checkFairness(transition, finalStates[i])) fairnessSet.insert(i); } } void VeryWeakAlternatingAutomaton::dump(ostream& s) const { s << "begin{VeryWeakAlternatingAutomaton}\n"; int nrFinalStates = finalStates.length(); int nrStates = states.length(); for (int i = 0; i < nrStates; i++) { s << "state " << i; for (int j = 0 ; j < nrFinalStates; j++) { if (finalStates[j] == i) { s << "\tfinal"; break; } } s << '\n'; states[i].dump(s); s << '\n'; } s << "initial state conjunctions\n"; initialStates.dump(s); s << "end{VeryWeakAlternatingAutomaton}\n"; } Maude-2.6/src/Temporal/modelChecker2.cc0000644000147300135640000001274707666300727014725 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ModelChecker2. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "temporal.hh" // utility class definitions #include "modelChecker2.hh" ModelChecker2::ModelChecker2(System& system, LogicFormula& property, int top) : system(system), propertyAutomaton(&property, top) { Verbose("ModelChecker: Property automaton has " << propertyAutomaton.getNrStates() << " states."); } bool ModelChecker2::findCounterexample() { intersectionStates.expandTo(1); const NatSet& initialStates = propertyAutomaton.getInitialStates(); const NatSet::const_iterator e = initialStates.end(); for (NatSet::const_iterator i = initialStates.begin(); i != e; ++i) { if (dfs1PropertyTransitions(0, *i)) return true; } return false; } // // First depth first search: find all reachable accepting states // in the intersection (synchronous product). // local_inline bool ModelChecker2::dfs1SystemTransitions(int systemStateNr, int propertyStateNr) { intersectionStates[systemStateNr].dfs1Seen.insert(propertyStateNr); for (int i = 0;; i++) { int n = system.getNextState(systemStateNr, i); if (n == NONE) break; if (n >= intersectionStates.length()) intersectionStates.expandTo(n + 1); if (dfs1PropertyTransitions(n, propertyStateNr)) return true; } return false; } bool ModelChecker2::dfs1PropertyTransitions(int systemStateNr, int propertyStateNr) { const BuchiAutomaton2::TransitionMap& tMap = propertyAutomaton.getTransitions(propertyStateNr); BuchiAutomaton2::TransitionMap::const_iterator e = tMap.end(); for (BuchiAutomaton2::TransitionMap::const_iterator i = tMap.begin(); i != e; ++i) { if (satisfiesPropositionalFormula(systemStateNr, i->second)) { int newPropertyStateNr = i->first; StateSet& s = intersectionStates[systemStateNr]; if (!(s.dfs1Seen.contains(newPropertyStateNr))) { s.onDfs1Stack.insert(newPropertyStateNr); if (dfs1SystemTransitions(systemStateNr, newPropertyStateNr) || (propertyAutomaton.isAccepting(newPropertyStateNr) && dfs2SystemTransitions(systemStateNr, newPropertyStateNr))) { path.push_front(systemStateNr); if (systemStateNr == cycleSystemStateNr && newPropertyStateNr == cyclePropertyStateNr) cycle.swap(path); return true; } intersectionStates[systemStateNr].onDfs1Stack.subtract(newPropertyStateNr); } } } return false; } // // Second depth first search: look for a path back to an intersection // state on the first DFS stack. // local_inline bool ModelChecker2::dfs2PropertyTransitions(int systemStateNr, int propertyStateNr) { const BuchiAutomaton2::TransitionMap& tMap = propertyAutomaton.getTransitions(propertyStateNr); BuchiAutomaton2::TransitionMap::const_iterator e = tMap.end(); for (BuchiAutomaton2::TransitionMap::const_iterator i = tMap.begin(); i != e; ++i) { if (satisfiesPropositionalFormula(systemStateNr, i->second)) { int newPropertyStateNr = i->first; StateSet& s = intersectionStates[systemStateNr]; if (s.onDfs1Stack.contains(newPropertyStateNr)) { cycleSystemStateNr = systemStateNr; cyclePropertyStateNr = newPropertyStateNr; return true; } if (!(s.dfs2Seen.contains(newPropertyStateNr))) { if (dfs2SystemTransitions(systemStateNr, newPropertyStateNr)) { path.push_front(systemStateNr); return true; } } } } return false; } bool ModelChecker2::dfs2SystemTransitions(int systemStateNr, int propertyStateNr) { intersectionStates[systemStateNr].dfs2Seen.insert(propertyStateNr); for (int i = 0;; i++) { int n = system.getNextState(systemStateNr, i); if (n == NONE) break; Assert(n < intersectionStates.length(), "visited system state for the first time on dfs2"); if (dfs2PropertyTransitions(n, propertyStateNr)) return true; } return false; } bool ModelChecker2::satisfiesPropositionalFormula(int systemStateNr, Bdd formula) { NatSet& testedProps = intersectionStates[systemStateNr].testedProps; NatSet& trueProps = intersectionStates[systemStateNr].trueProps; for(;;) { if (formula == bdd_true()) return true; if (formula == bdd_false()) return false; int propIndex = bdd_var(formula); if (testedProps.contains(propIndex)) formula = trueProps.contains(propIndex) ? bdd_high(formula) : bdd_low(formula); else { testedProps.insert(propIndex); if (system.checkProposition(systemStateNr, propIndex)) { trueProps.insert(propIndex); formula = bdd_high(formula); } else formula = bdd_low(formula); } } } Maude-2.6/src/Temporal/logicFormula.cc0000644000147300135640000001330607704653162014666 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class LogicFormula. // // utility stuff #include "macros.hh" #include "vector.hh" #include "natSet.hh" // temporal class definitions #include "logicFormula.hh" int LogicFormula::makeProp(int propIndex) { int nrNodes = nodes.length(); for (int i = 0; i < nrNodes; i++) { Node& n = nodes[i]; if (n.op == PROPOSITION && n.args[0] == propIndex) return i; } nodes.expandBy(1); Node& n = nodes[nrNodes]; n.op = PROPOSITION; n.args[0] = propIndex; n.propositional = true; return nrNodes; } int LogicFormula::makeOp(Op op, int firstArg, int secondArg) { int nrNodes = nodes.length(); for (int i = 0; i < nrNodes; i++) { Node& n = nodes[i]; if (n.op == op && n.args[0] == firstArg && n.args[1] == secondArg) return i; } nodes.expandBy(1); Node& n = nodes[nrNodes]; n.op = op; n.args[0] = firstArg; n.args[1] = secondArg; n.propositional = false; switch (op) { case AND: case OR: { if (!(nodes[secondArg].propositional)) break; // fall thru } case NOT: { if (!(nodes[firstArg].propositional)) break; // fall thru } case LTL_TRUE: case LTL_FALSE: { n.propositional = true; break; } default: break; } return nrNodes; } /* bool LogicFormula::structuallyImplies(const NatSet& now, const NatSet& next, int candidate) const { if (now.contains(candidate)) return true; switch (getOp(candidate)) { case LTL_TRUE: return true; case NEXT: return next.contains(getArg(candidate, 0)); case AND: { return structuallyImplies(now, next, getArg(candidate, 0)) && structuallyImplies(now, next, getArg(candidate, 1)); } case OR: { return structuallyImplies(now, next, getArg(candidate, 0)) || structuallyImplies(now, next, getArg(candidate, 1)); } case UNTIL: { return structuallyImplies(now, next, getArg(candidate, 1)) || (structuallyImplies(now, next, getArg(candidate, 0)) && next.contains(candidate)); } case RELEASE: { return structuallyImplies(now, next, getArg(candidate, 1)) && (structuallyImplies(now, next, getArg(candidate, 0)) || next.contains(candidate)); } default: break; } return false; } bool LogicFormula::structuallyContradicts(const NatSet& now, const NatSet& next, int candidate) const { if (containsNegation(now, candidate)) return true; switch (getOp(candidate)) { case LTL_FALSE: return true; case NEXT: return containsNegation(next, getArg(candidate, 0)); case AND: { return structuallyContradicts(now, next, getArg(candidate, 0)) || structuallyContradicts(now, next, getArg(candidate, 1)); } case OR: { return structuallyContradicts(now, next, getArg(candidate, 0)) && structuallyContradicts(now, next, getArg(candidate, 1)); } case UNTIL: { return structuallyContradicts(now, next, getArg(candidate, 1)) && (structuallyContradicts(now, next, getArg(candidate, 0)) || containsNegation(next, candidate)); } case RELEASE: { return structuallyContradicts(now, next, getArg(candidate, 1)) || (structuallyContradicts(now, next, getArg(candidate, 0)) && containsNegation(next, candidate)); } default: break; } return false; } bool LogicFormula::containsNegation(const NatSet& indexSet, int formulaIndex) const { int max = indexSet.max(); for (int i = 0; i <= max; i++) { if (indexSet.contains(i) && isNegation(i, formulaIndex)) return true; } return false; } bool LogicFormula::isNegation(int f1, int f2) const { static Op inv[] = { NOT, LTL_FALSE, LTL_TRUE, PROPOSITION, NEXT, OR, AND, RELEASE, UNTIL }; Op op1 = getOp(f1); if (getOp(f2) == inv[op1]) { switch (op1) { case PROPOSITION: return getArg(f2, 0) == f1; case LTL_TRUE: case LTL_FALSE: return true; case NOT: return getArg(f1, 0) == f2; case NEXT: return isNegation(getArg(f1, 0), getArg(f2, 0)); case AND: case OR: case UNTIL: case RELEASE: { return isNegation(getArg(f1, 0), getArg(f2, 0)) && isNegation(getArg(f1, 1), getArg(f2, 1)); } } } return false; } */ void LogicFormula::dump(ostream& s) { int nrNodes = nodes.length(); for (int i = 0; i < nrNodes; i++) { s << i << '\t'; Node& n = nodes[i]; switch (n.op) { case PROPOSITION: s << "prop" << n.args[0]; break; case LTL_TRUE: s << "True"; break; case LTL_FALSE: s << "False"; break; case NOT: s << "~ " << n.args[0]; break; case NEXT: s << "@ " << n.args[0]; break; case AND: s << n.args[0] << " /\\ " << n.args[1]; break; case OR: s << n.args[0] << " \\/ " << n.args[1]; break; case UNTIL: s << n.args[0] << " U " << n.args[1]; break; case RELEASE: s << n.args[0] << " R " << n.args[1]; break; } s << '\n'; } } Maude-2.6/src/Temporal/sccAnalysis.cc0000644000147300135640000001274307666300727014526 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for strongly connected component analysis. // void GenBuchiAutomaton::sccAnalysis() { // // First we partition the graph of states into strongly connected // components, assigning a component number to each state in such // a way that components can only reach lower numbered components. // int nrStates = states.length(); stateInfo.expandTo(nrStates); for (int i = 0; i < nrStates; i++) stateInfo[i].traversalNumber = 0; traversalCount = 0; componentCount = 0; const NatSet::const_iterator e = initialStates.end(); for (NatSet::const_iterator i = initialStates.begin(); i != e; ++i) strongConnected(*i); // // Then we analyse each component to see if it is fair, unfair or dead. // For fair components, we also compute a set of redundant fairness sets; // non-redundant fairness sets in fair components have their indices // inserted into essential. // componentInfo.expandTo(componentCount); for (int i = 0; i < componentCount; i++) { handleComponent(i); #ifdef TDEBUG static const char* const text[] = {"dead", "unfair", "fair"}; cout << "Component " << i << "\tstatus: " << text[componentInfo[i].status] << "\tredundant fair sets" << componentInfo[i].redundant << endl; #endif } #ifdef TDEBUG cout << "essential fairness " << essential << endl; #endif } int GenBuchiAutomaton::strongConnected(int v) { // // Push state v on the stack and give it a traversal order number. // stateStack.push(v); int vLowLink = ++traversalCount; stateInfo[v].traversalNumber = vLowLink; // // Examine each outgoing arc from state v. // const FairTransitionSet& fts = fairTransitionSets.ithElement(states[v]); FairTransitionSet::const_iterator e = fts.end(); for(FairTransitionSet::const_iterator i = fts.begin(); i != e; ++i) { int w = i->first.first; int wNumber = stateInfo[w].traversalNumber; if (wNumber == 0) { // // Tree arc. // int wLowLink = strongConnected(w); if (wLowLink < vLowLink) vLowLink = wLowLink; } else { if (wNumber < vLowLink) // implies wNumber < stateInfo[v].traversalNumber; vLowLink = wNumber; // i.e. cross-link or frond } } if (stateInfo[v].traversalNumber == vLowLink) { // // Root of a new SCC; remove SCC from stack. // #ifdef TDEBUG cout << "Component " << componentCount << endl; #endif int i; do { i = stateStack.top(); stateStack.pop(); #ifdef TDEBUG cout << i << ' '; #endif stateInfo[i].traversalNumber = INT_MAX; // mark as no longer in stack stateInfo[i].component = componentCount; } while (i != v); #ifdef TDEBUG cout << endl; #endif ++componentCount; } return vLowLink; } void GenBuchiAutomaton::handleComponent(int number) { // // implies[i] is the set of indices of fairness sets implied by // the ith fairness set. We start with everything and remove // contradictions for each internal transition. // Vector implies(nrFairnessSets); for (int i = 0; i < nrFairnessSets; i++) implies[i] = allFair; NatSet sum; bool reachLiveScc = false; bool hasInternalTransitions = false; // to detect degenerate SCCs int nrStates = states.length(); for (int i = 0; i < nrStates; i++) { if (stateInfo[i].component == number) { const FairTransitionSet& fts = fairTransitionSets.ithElement(states[i]); FairTransitionSet::const_iterator e = fts.end(); for(FairTransitionSet::const_iterator j = fts.begin(); j != e; ++j) { int target = j->first.first; int targetComponentNr = stateInfo[target].component; if (targetComponentNr == number) { // // Internal transition. // hasInternalTransitions = true; const NatSet& fairness = fairnessConditions.ithElement(j->first.second); sum.insert(fairness); for (int k = 0; k < nrFairnessSets; k++) { if (fairness.contains(k)) implies[k].intersect(fairness); } } else { // // External transition. // Assert(targetComponentNr < number, "SCC partial order problem"); if (componentInfo[targetComponentNr].status != DEAD) reachLiveScc = true; } } } } if (!hasInternalTransitions || sum != allFair) { componentInfo[number].status = reachLiveScc ? UNFAIR : DEAD; return; } componentInfo[number].status = FAIR; NatSet& redundant = componentInfo[number].redundant; for (int i = 0; i < nrFairnessSets; i++) { if (!(redundant.contains(i))) { implies[i].subtract(i); redundant.insert(implies[i]); }; } NatSet used(allFair); used.subtract(redundant); essential.insert(used); } Maude-2.6/src/Temporal/rawTransitionSet.cc0000644000147300135640000000353407666300727015570 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class RawTransitionSet. // #include // utility stuff #include "macros.hh" #include "vector.hh" // temporal class definitions #include "rawTransitionSet.hh" RawTransitionSet::RawTransitionSet(const TransitionSet& transitionSet) { const TransitionSet::TransitionMap& tm = transitionSet.getMap(); copy(tm.begin(), tm.end(), inserter(*this, begin())); } RawTransitionSet::RawTransitionSet(const RawTransitionSet& ts1, const RawTransitionSet& ts2) { // // Construct the raw product of the two argument transition sets. // const const_iterator ie = ts1.end(); const const_iterator je = ts2.end(); Transition newTransition; for (const_iterator i = ts1.begin(); i != ie; ++i) { for (const_iterator j = ts2.begin(); j != je; ++j) { newTransition.second = bdd_and(i->second, j->second); if (newTransition.second != bdd_false()) { newTransition.first = i->first; newTransition.first.insert(j->first); insert(newTransition); } } } } Maude-2.6/src/Temporal/sccOptimizations.cc0000644000147300135640000001130207666300727015602 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for strongly connected component optimizations. // void GenBuchiAutomaton::sccOptimizations() { sccAnalysis(); // // We now renumber states and fairness sets to take account of // states in dead components and fairness sets which are not essential. // int nrStates = states.length(); Vector stateMap(nrStates); int nrLive = 0; for (int i = 0; i < nrStates; i++) stateMap[i] = (componentInfo[stateInfo[i].component].status == DEAD) ? NONE : nrLive++; Vector fairMap(nrFairnessSets); int nrFair = 0; for (int i = 0; i < nrFairnessSets; i++) fairMap[i] = essential.contains(i) ? nrFair++ : NONE; // // Then we rebuild the GBA, removing dead states, non-essential fairness // sets together fairness info from every transition that is not // internal to a fair component. For transitions within a fair component // each arc will belong to the (surviving) redundant fairness sets for // that component in addition to anything they belonged to previously. // NatSet newInitialStates; Vector newStates(nrLive); FairTransitionSetTable newFairTransitionSets; NatSetTable oldFairnessConditions; oldFairnessConditions.swap(fairnessConditions); for (int i = 0; i < nrStates; i++) { if (stateMap[i] != NONE) { FairTransitionSetTable::FastPair transformed; int component = stateInfo[i].component; const FairTransitionSet& original = fairTransitionSets.ithElement(states[i]); if (componentInfo[component].status == UNFAIR) eliminateFairness(transformed.first, original, stateMap); else { transformFairTransitionSet2(oldFairnessConditions, transformed.first, original, stateMap, fairMap, component); } newStates[stateMap[i]] = newFairTransitionSets.insert(transformed); } } remapNatSet(newInitialStates, initialStates, stateMap); initialStates.swap(newInitialStates); fairTransitionSets.swap(newFairTransitionSets); states.swap(newStates); nrFairnessSets = nrFair; } void GenBuchiAutomaton::eliminateFairness(FairTransitionSet& transformed, const FairTransitionSet& original, const Vector& stateMap) { FairTransitionSet::const_iterator e = original.end(); for (FairTransitionSet::const_iterator i = original.begin(); i != e; ++i) { int to = i->first.first; if (stateMap[to] != NONE) { FairTransition f; f.first.first = stateMap[to]; NatSet emptySet; f.first.second = fairnessConditions.insert(emptySet); f.second = i->second; insertFairTransition2(transformed, f); } } } void GenBuchiAutomaton::transformFairTransitionSet2(NatSetTable& oldFairnessConditions, FairTransitionSet& transformed, const FairTransitionSet& original, const Vector& stateMap, const Vector& fairMap, int component) { FairTransitionSet::const_iterator e = original.end(); for (FairTransitionSet::const_iterator i = original.begin(); i != e; ++i) { int to = i->first.first; if (stateMap[to] != NONE) { FairTransition f; f.first.first = stateMap[to]; if (stateInfo[to].component == component) { // // Internal transition in fair component. // NatSet fairness(oldFairnessConditions.ithElement(i->first.second)); #ifdef TDEBUG cout << "start " << fairness; #endif fairness.insert(componentInfo[component].redundant); #ifdef TDEBUG cout << " after insert " << fairness; #endif NatSet newFairness; remapNatSet(newFairness, fairness, fairMap); #ifdef TDEBUG cout << " after remap " << newFairness << '\n'; #endif f.first.second = fairnessConditions.insert(newFairness); } else { NatSet emptySet; f.first.second = fairnessConditions.insert(emptySet); } f.second = i->second; insertFairTransition2(transformed, f); } } } Maude-2.6/src/Temporal/collapseStates.cc0000644000147300135640000000734207666300727015237 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for collapsing states which have same fair transition set. // void GenBuchiAutomaton::maximallyCollapseStates() { while (fairTransitionSets.size() < states.length()) { collapseStates(); #ifdef TDEBUG dump(cout); #endif } } void GenBuchiAutomaton::collapseStates() { int nrNewStates = fairTransitionSets.size(); // // We build collapsed automaton in these data structures. // Fairness combinations does not change. // NatSet newInitialStates; Vector newStates(nrNewStates); FairTransitionSetTable newFairTransitionSets; // // Use states as a surjection to collapse equivalent states. // remapNatSet(newInitialStates, initialStates, states); for (int i = 0; i < nrNewStates; i++) { FairTransitionSetTable::FastPair transformed; transformFairTransitionSet(transformed.first, fairTransitionSets.ithElement(i)); newStates[i] = newFairTransitionSets.insert(transformed); } // // Swap new and old automata. // initialStates.swap(newInitialStates); states.swap(newStates); fairTransitionSets.swap(newFairTransitionSets); } void GenBuchiAutomaton::transformFairTransitionSet(FairTransitionSet& transformed, const FairTransitionSet& original) { FairTransitionSet::const_iterator e = original.end(); for (FairTransitionSet::const_iterator i = original.begin(); i != e; ++i) { FairTransition f; f.first.first = states[i->first.first]; Assert(f.first.first != UNDEFINED, "state not generated"); f.first.second = i->first.second; f.second = i->second; insertFairTransition2(transformed, f); } } void GenBuchiAutomaton::insertFairTransition2(FairTransitionSet& fts, const FairTransition& ft) { Bdd formula = ft.second; Assert(formula != bdd_false(), "tried to insert false transition"); const FairTransitionSet::iterator e = fts.end(); FairTransitionSet::iterator equal = e; for (FairTransitionSet::iterator i = fts.begin(); i != e;) { FairTransitionSet::iterator t = i++; if (t->first == ft.first) equal = t; else if (t->first.first == ft.first.first) { const NatSet& existingFairness = fairnessConditions.ithElement(t->first.second); const NatSet& newFairness = fairnessConditions.ithElement(ft.first.second); if (newFairness.contains(existingFairness)) { t->second = bdd_and(t->second, bdd_not(formula)); if (t->second == bdd_false()) fts.erase(t); // existing pair completely subsumed } else if (existingFairness.contains(newFairness)) { formula = bdd_and(formula, bdd_not(t->second)); if (formula == bdd_false()) return; // new transition completely subsumed } } } if (equal == e) { pair p = fts.insert(ft); Assert(p.second, "failed to insert"); p.first->second = formula; } else equal->second = bdd_or(equal->second, formula); } Maude-2.6/src/Temporal/buchiAutomaton2.hh0000644000147300135640000000461507666300727015327 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for Buchi Automata. // #ifndef _buchiAutomaton2_hh_ #define _buchiAutomaton2_hh_ #include #include "bddUser.hh" #include "bdd.hh" #include "indexedSet.hh" class BuchiAutomaton2 : private BddUser { public: typedef pair Transition; typedef map TransitionMap; BuchiAutomaton2(LogicFormula* formula, int top); int getNrStates() const; const NatSet& getInitialStates() const; bool isAccepting(int stateNr) const; const TransitionMap& getTransitions(int stateNr) const; void dump(ostream& s); private: typedef IndexedSet TransitionMapTable; static void remapNatSet(NatSet& newSet, const NatSet& oldSet, const Vector& natMap); bool hasNonAcceptingTarget(const TransitionMap& tm); void transformTransitionMap(TransitionMap& transformed, const TransitionMap& original); void collapseStates(); void generate(const GenBuchiAutomaton& g, int oldStateNr, int instanceNr); void insertTransition(TransitionMap& m, const Transition& t); NatSet initialStates; NatSet acceptingStates; Vector states; TransitionMapTable transitionMaps; }; inline int BuchiAutomaton2::getNrStates() const { return states.length(); } inline const NatSet& BuchiAutomaton2::getInitialStates() const { return initialStates; } inline bool BuchiAutomaton2::isAccepting(int stateNr) const { return acceptingStates.contains(stateNr); } inline const BuchiAutomaton2::TransitionMap& BuchiAutomaton2::getTransitions(int stateNr) const { return transitionMaps.ithElement(states[stateNr]); } #endif Maude-2.6/src/Temporal/logicFormula.hh0000644000147300135640000000437607704652705014711 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for formulae in some propositional logic. // #ifndef _logicFormula_hh_ #define _logicFormula_hh_ class LogicFormula { public: enum Op { // // Primitive // PROPOSITION, LTL_TRUE, LTL_FALSE, // // Unary // NOT, NEXT, // // Binary // AND, OR, UNTIL, RELEASE }; int makeProp(int propIndex); int makeOp(Op op, int firstArg = NONE, int secondArg = NONE); int getProp(int nodeNr) const; Op getOp(int nodeNr) const; int getArg(int nodeNr, int argNr = 0) const; bool isPropositional(int nodeNr) const; /* bool structuallyImplies(const NatSet& now, const NatSet& next, int candidate) const; bool structuallyContradicts(const NatSet& now, const NatSet& next, int candidate) const; bool containsNegation(const NatSet& indexSet, int formulaIndex) const; bool isNegation(int f1, int f2) const; */ void dump(ostream& s); private: struct Node { short op; Bool propositional; int args[2]; }; Vector nodes; }; inline LogicFormula::Op LogicFormula::getOp(int nodeNr) const { return static_cast(nodes[nodeNr].op); } inline int LogicFormula::getProp(int nodeNr) const { return nodes[nodeNr].args[0]; } inline int LogicFormula::getArg(int nodeNr, int argNr) const { return nodes[nodeNr].args[argNr]; } inline bool LogicFormula::isPropositional(int nodeNr) const { return nodes[nodeNr].propositional; } #endif Maude-2.6/src/Temporal/rawTransitionSet.hh0000644000147300135640000000245107666300727015577 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // A raw transition set is a non-canonical set of transitions. // // The only reason to define it is to encapsulate the (unsimplified) // product operation. // #ifndef _rawTransitionSet_hh_ #define _rawTransitionSet_hh_ #include #include "transitionSet.hh" class RawTransitionSet : public set { public: RawTransitionSet(const TransitionSet& transitionSet); RawTransitionSet(const RawTransitionSet& ts1, const RawTransitionSet& ts2); }; #endif Maude-2.6/src/Temporal/ChangeLog0000644000147300135640000002402307704653301013477 000000000000002003-07-14 Steven Eker * veryWeakAlternatingAutomaton.cc (computeTransitionSet): TRUE -> LTL_TRUE, FALSE -> LTL_FALSE * logicFormula.cc: TRUE -> LTL_TRUE, FALSE -> LTL_FALSE * logicFormula.hh (class LogicFormula): TRUE -> LTL_TRUE, FALSE -> LTL_FALSE because TRUE and FALSE are #defined on some platforms ===================================Maude81=========================================== 2003-02-25 Steven Eker * veryWeakAlternatingAutomaton.cc: removed #pragma (computeTransitionSet): updated Assert() * veryWeakAlternatingAutomaton.hh: removed #pragma * transitionSet.cc: removed #pragma (insert): updated Assert() (rename): updated Assert() * transitionSet.hh: removed #pragma * sccAnalysis.cc (handleComponent): updated Assert() * satSolve.cc (bfsToFairComponent): updated Assert() (bfsToMoreFairness): updated Assert() (bfsToTarget): updated Assert() * rawTransitionSet.cc: removed #pragma * rawTransitionSet.hh: removed #pragma * parityGame.cc: removed #pragma (makeNode): updated Assert()s * parityGame.hh: removed #pragma * modelChecker2.cc: removed #pragma (dfs2SystemTransitions): updated Assert() * modelChecker2.hh: removed #pragma * logicFormula.cc: removed #pragma * logicFormula.hh: removed #pragma * genBuchiAutomaton.cc: removed #pragma (getStateIndex): updated Assert() (insertFairTransition): updated Assert()s * genBuchiAutomaton.hh: removed #pragma * collapseStates.cc (transformFairTransitionSet): updated Assert() (insertFairTransition2): updated Assert()s * buchiAutomaton2.cc: removed #pragma * buchiAutomaton2.hh: removed #pragma ===================================Maude79=========================================== 2002-03-01 Steven Eker * parityGame.hh: created * parityGame.cc: created 2002-02-28 Steven Eker * satSolve.cc (satSolve): try to get a shorter cycle by ignoring redundant fairness conditions * modelChecker2.cc (findCounterExample): renamed to findCounterexample() * modelChecker2.hh (class ModelChecker2): findCounterExample() -> findCounterexample() * satSolve.cc (satSolve): use Bdd:implies() * veryWeakAlternatingAutomaton.cc: use Bdd:implies() 2002-02-27 Steven Eker * satSolve.cc (satSolve): added call to maximallyCollapseStates(); in turn out this produce simpler models by combining states that have arcs into a fair SCC with states with self arcs actually in SCC (satSolve): added lead-in roll-into-cycle optimization; does this subsume the advantage of calling maximallyCollapseStates()? * veryWeakAlternatingAutomaton.cc (dnf): added comment as reorder statements in the default case to make this more understandable 2002-02-26 Steven Eker * logicFormula.cc (makeProp): (makeProp): set propositional flag (makeOp): compute propositional flag (structuallyImplies): commented out (structuallyContradicts): commented out (containsNegation): commented out (isNegation): commented out * logicFormula.hh (class LogicFormula): added propositional field to struct Node, made op field short (isPropositional): added (getOp): use cast 2002-02-22 Steven Eker * genBuchiAutomaton.hh (class GenBuchiAutomaton): updated decls for satSolve(), bfsToFairComponent(), bfsToMoreFairness(), bfsToTarget() * satSolve.cc (satSolve): rewritten (bfsToFairComponent): rewritten (bfsToMoreFairness): rewritten (bfsToTarget): rewritten (bfsToMoreFairness): need to make sure we don't leave SCC (bfsToTarget): need to make sure we don't leave SCC 2002-02-21 Steven Eker * genBuchiAutomaton.hh (class GenBuchiAutomaton): added decls for bfsToFairComponent(), bfsToMoreFairness(), bfsToTarget() * satSolve.cc: created * genBuchiAutomaton.hh (class GenBuchiAutomaton): stateCount -> traversalCount; .number -> .traversalNumber * sccAnalysis.cc (strongConnected): stateCount -> traversalCount (sccAnalysis): stateCount -> traversalCount (strongConnected): .number -> .traversalNumber (sccAnalysis): .number -> .traversalNumber * sccOptimizations.cc (sccOptimizations): use sccAnalysis() * genBuchiAutomaton.hh (class GenBuchiAutomaton): added decl for sccAnalysis() * sccAnalysis.cc (sccAnalysis): added (strongConnected): moved here (handleComponent): moved here * genBuchiAutomaton.hh (class GenBuchiAutomaton): added decl for satSolve() * buchiAutomaton2.cc (BuchiAutomaton2): call simplify() on GenBuchiAutomaton * genBuchiAutomaton.hh (class GenBuchiAutomaton): added decls for maximallyCollapseStates() and simplify() * genBuchiAutomaton.cc (simplify): added (GenBuchiAutomaton): optimization code deleted; we now call simplify() if we want to do this stuff; for sat solving we want to do things differently * collapseStates.cc (maximallyCollapseStates): added * genBuchiAutomaton.cc (getStateIndex): added comment * veryWeakAlternatingAutomaton.cc (VeryWeakAlternatingAutomaton): removed commented out code 2002-01-24 Steven Eker * modelChecker2.cc (ModelChecker2): added Verbose() call to print out the number of property automtaton states 2001-12-17 Steven Eker * modelChecker2.cc (dfs1PropertyTransitions): merged 3 if statements into 1 (dfs1SystemTransitions): made local_inline (dfs2PropertyTransitions): made local_inline * collapseStates.cc (collapseStates): use FastPair optimization for inserting fair transition sets into table * sccOptimizations.cc (sccOptimizations): use FastPair optimization for inserting fair transition sets into table * genBuchiAutomaton.cc (generateState): use FastPair optimization for inserting fair transition sets into table * veryWeakAlternatingAutomaton.hh (class VeryWeakAlternatingAutomaton): updated decl for dnf() * veryWeakAlternatingAutomaton.cc (dnf): no longer const * veryWeakAlternatingAutomaton.hh (class VeryWeakAlternatingAutomaton): updated decl for computeTransitionSet() * veryWeakAlternatingAutomaton.cc (dnf): call computeTransitionSet() on subformulas that are reachable from dnf; i.e. there is a transition going to their state in the dnf transition set (computeTransitionSet): don't take result arg; write result directly into state; check to see if state is already computed; recursive calls to compute transition sets for states that we need in out computation (computeTransitionSet): turned op == LogicFormula::RELEASE into an Assert (VeryWeakAlternatingAutomaton): don't iterate over states; they are now computed on demand 2001-12-14 Steven Eker * modelChecker2.cc (findCounterExample): use NatSet::const_iterator (dfs1PropertyTransitions): use pre rather than post increment (dfs2PropertyTransitions): use pre rather than post increment (dfs1PropertyTransitions): use i->foo rather than (*i).foo (dfs2PropertyTransitions): use i->foo rather than (*i).foo * buchiAutomaton2.cc (BuchiAutomaton2): use NatSet::const_iterator (generate): use pre rather than post increment (transformTransitionMap): use pre rather than post increment (hasNonAcceptingTarget): use pre rather than post increment (dump): use pre rather than post increment (generate): use i->foo rather than (*i).foo (insertTransition): use i->foo rather than (*i).foo (transformTransitionMap): use i->foo rather than (*i).foo (hasNonAcceptingTarget): use i->foo rather than (*i).foo * rawTransitionSet.cc (RawTransitionSet): use i->foo rather than (*i).foo; use pre rather than post increment * sccOptimizations.cc (eliminateFairness): use pre rather than post increment (sccOptimizations): use NatSet::const_iterator (strongConnected): use pre rather than post increment (transformFairTransitionSet2): use pre rather than post increment (handleComponent): use pre rather than post increment (eliminateFairness): use i->foo rather than (*i).foo (transformFairTransitionSet2): use i->foo rather than (*i).foo (strongConnected): use i->foo rather than (*i).foo (handleComponent): use i->foo rather than (*i).foo * collapseStates.cc (transformFairTransitionSet): use pre rather than post increment (transformFairTransitionSet): use i->foo rather than (*i).foo (insertFairTransition2): use i->foo rather than (*i).foo * genBuchiAutomaton.cc (generateState): use NatSet::const_iterator (GenBuchiAutomaton): use pre rather than post increment (generateState): use pre rather than post increment (GenBuchiAutomaton): use i->foo rather than (*i).foo (generateState): use i->foo rather than (*i).foo (insertFairTransition): use i->foo rather than (*i).foo (dump): use i->foo rather than (*i).foo * veryWeakAlternatingAutomaton.cc (findReachable): use i->foo rather than (*i).foo (checkFairness): use i->foo rather than (*i).foo * transitionSet.cc (insert): use pre rather than post increment (product): use pre rather than post increment (rename): use pre rather than post increment (rename): use NatSet::const_iterator (insert): use i->foo rather than (*i).foo for complex iterators (product): use i->foo rather than (*i).foo for complex iterators (dump): use i->foo rather than (*i).foo for complex iterators (rename): use i->foo rather than (*i).foo for complex iterators * veryWeakAlternatingAutomaton.cc (findReachable): use NatSet::const_iterator; use pre rather than post increment for complex iterators (checkFairness): use pre rather than post increment for complex iterators 2001-12-12 Steven Eker * modelChecker2.hh: removed class LogicFormula hack * buchiAutomaton2.cc: cleaned up includes * buchiAutomaton2.hh: cleaned up includes * genBuchiAutomaton.cc: cleaned up includes * genBuchiAutomaton.hh: cleaned up includes * logicFormula.cc: cleaned up includes * transitionSet.cc: cleaned up includes * transition.hh: deleted * transitionSet.hh: cleaned up includes * veryWeakAlternatingAutomaton.hh: removed class LogicFormula hack * veryWeakAlternatingAutomaton.cc: cleaned up includes * temporal.hh: created ===================================Maude69================================================== Maude-2.6/src/Temporal/veryWeakAlternatingAutomaton.hh0000644000147300135640000000506207666300727020136 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for Very Weak Alternating Automata. // // We implement the LTL to VWAA translation and VWAA optimization // algorithms from: // Paul Gastin and Denis Oddoux. // "Fast LTL to Buchi Automaton Translation", // CAV 2001, LNCS 2102, pp 53-65, 2001. // #ifndef _veryWeakAlternationAutomaton_hh_ #define _veryWeakAlternationAutomaton_hh_ #include "bddUser.hh" #include "transitionSet.hh" #include "natSet.hh" class VeryWeakAlternatingAutomaton : private BddUser { public: VeryWeakAlternatingAutomaton(LogicFormula* formula, int top); int getNrStates() const; int getNrFinalStates() const; const TransitionSet& getInitialStates(); const TransitionSet& getTransitionSet(int stateIndex) const; void computeFairnessSet(const Transition& transition, NatSet& fairnessSet); void dump(ostream& s) const; private: void dnf(int subformulaIndex, TransitionSet& result); void computeTransitionSet(int subformulaIndex); void reachabilityOpt(); void findReachable(const TransitionSet& ts); bool checkFairness(const Transition& transition, int finalStateIndex) const; TransitionSet initialStates; Vector states; Vector finalStates; // // Temporary data used during construction. // LogicFormula* const formula; int nrNewStates; Vector renaming; }; inline int VeryWeakAlternatingAutomaton::getNrStates() const { return states.length(); } inline int VeryWeakAlternatingAutomaton::getNrFinalStates() const { return finalStates.length(); } inline const TransitionSet& VeryWeakAlternatingAutomaton::getInitialStates() { return initialStates; } inline const TransitionSet& VeryWeakAlternatingAutomaton::getTransitionSet(int stateIndex) const { return states[stateIndex]; } #endif Maude-2.6/src/Temporal/satSolve.cc0000644000147300135640000001536007666300727014050 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for LTL satisfiability solving. // #include struct GenBuchiAutomaton::Step { Step(); int parent; Bdd formula; }; local_inline GenBuchiAutomaton::Step::Step() { parent = NONE; } bool GenBuchiAutomaton::satSolve(list& leadIn, list& cycle) { #ifdef TDEBUG dump(cout); #endif maximallyCollapseStates(); #ifdef TDEBUG dump(cout); #endif sccAnalysis(); int nrComponents = componentInfo.length(); for (int i = 0; i < nrComponents; i++) { if (componentInfo[i].status == FAIR) { // // First we find a shortest path to a state in a fair component. // leadIn.clear(); cycle.clear(); int fairState; bfsToFairComponent(fairState, leadIn); // // Now we need to find a path within this component with // transitions satisfying each of the fairness conditions. // We try to minimize the length of this path by only looking // for subpaths that satisfy at least one additional non-redundant // fairness condition. // int currentState = fairState; NatSet fairness(componentInfo[stateInfo[fairState].component].redundant); while (fairness != allFair) { list path; bfsToMoreFairness(fairness, currentState, path); cycle.splice(cycle.end(), path); } // // Finally we need to complete the cycle. // if (currentState != fairState || cycle.empty()) { list path; bfsToTarget(currentState, fairState, path); cycle.splice(cycle.end(), path); } // // We now see if the lead-in can be "rolled" into the cycle. // while (!(leadIn.empty()) && cycle.back().implies(leadIn.back())) { // // Last formula of cycle implies last formula of leadIn // so right-rotate cycle and delete last formula of leadIn. // cycle.splice(cycle.begin(), cycle, --(cycle.end())); leadIn.pop_back(); } return true; } } return false; } void GenBuchiAutomaton::bfsToFairComponent(int& fairState, list& path) const { // // Find a (possibly empty) shortest path to a state in a fair component. // Vector steps(states.length()); queue toVisit; const NatSet::const_iterator e = initialStates.end(); for (NatSet::const_iterator i = initialStates.begin(); i != e; ++i) { int s = *i; if (componentInfo[stateInfo[s].component].status == FAIR) { fairState = s; return; } toVisit.push(s); steps[s].parent = UNBOUNDED; } for (;;) { Assert(!(toVisit.empty()), "toVisit empty"); int stateNr = toVisit.front(); toVisit.pop(); const FairTransitionSet& fts = fairTransitionSets.ithElement(states[stateNr]); FairTransitionSet::const_iterator e = fts.end(); for(FairTransitionSet::const_iterator i = fts.begin(); i != e; ++i) { int s = i->first.first; if (componentInfo[stateInfo[s].component].status == FAIR) { fairState = s; path.push_front(i->second); for(;;) { const Step& step = steps[stateNr]; stateNr = step.parent; if (stateNr == UNBOUNDED) break; path.push_front(step.formula); } return; } Step& step = steps[s]; if (step.parent == NONE) { step.parent = stateNr; step.formula = i->second; toVisit.push(s); } } } } void GenBuchiAutomaton::bfsToMoreFairness(NatSet& fairness, int& start, list& path) const { // // Staying within the connected component containing start, find a // shortest sequence of transitions that give us additional fairness. // int ourComponent = stateInfo[start].component; Vector steps(states.length()); queue toVisit; toVisit.push(start); steps[start].parent = UNBOUNDED; for (;;) { Assert(!(toVisit.empty()), "toVisit empty"); int stateNr = toVisit.front(); toVisit.pop(); const FairTransitionSet& fts = fairTransitionSets.ithElement(states[stateNr]); FairTransitionSet::const_iterator e = fts.end(); for(FairTransitionSet::const_iterator i = fts.begin(); i != e; ++i) { int s = i->first.first; if (stateInfo[s].component == ourComponent) { const NatSet& arcFairness = fairnessConditions.ithElement(i->first.second); if (!(fairness.contains(arcFairness))) { fairness.insert(arcFairness); start = s; path.push_front(i->second); for(;;) { const Step& step = steps[stateNr]; stateNr = step.parent; if (stateNr == UNBOUNDED) break; path.push_front(step.formula); } return; } Step& step = steps[s]; if (step.parent == NONE) { step.parent = stateNr; step.formula = i->second; toVisit.push(s); } } } } } void GenBuchiAutomaton::bfsToTarget(int start, int target, list& path) const { // // Staying within the connected component containing start, find a // shortest non-empty sequence of transitions that arrives at target. // int ourComponent = stateInfo[start].component; Vector steps(states.length()); queue toVisit; toVisit.push(start); steps[start].parent = UNBOUNDED; for (;;) { Assert(!(toVisit.empty()), "toVisit empty"); int stateNr = toVisit.front(); toVisit.pop(); const FairTransitionSet& fts = fairTransitionSets.ithElement(states[stateNr]); FairTransitionSet::const_iterator e = fts.end(); for(FairTransitionSet::const_iterator i = fts.begin(); i != e; ++i) { int s = i->first.first; if (stateInfo[s].component == ourComponent) { if (s == target) { path.push_front(i->second); for(;;) { const Step& step = steps[stateNr]; stateNr = step.parent; if (stateNr == UNBOUNDED) break; path.push_front(step.formula); } return; } Step& step = steps[s]; if (step.parent == NONE) { step.parent = stateNr; step.formula = i->second; toVisit.push(s); } } } } } Maude-2.6/src/Temporal/genBuchiAutomaton.cc0000644000147300135640000001627007666300727015665 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class GenBuchiAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "temporal.hh" // temporal class definitions #include "veryWeakAlternatingAutomaton.hh" #include "rawTransitionSet.hh" #include "genBuchiAutomaton.hh" #include "collapseStates.cc" #include "sccAnalysis.cc" #include "sccOptimizations.cc" #include "satSolve.cc" GenBuchiAutomaton::GenBuchiAutomaton(LogicFormula* formula, int top) { vwaa = new VeryWeakAlternatingAutomaton(formula, top); nrFairnessSets = vwaa->getNrFinalStates(); for (int i = nrFairnessSets - 1; i >= 0; i--) allFair.insert(i); const TransitionSet& vwaaInitialStates = vwaa->getInitialStates(); const TransitionSet::TransitionMap& tm = vwaaInitialStates.getMap(); TransitionSet::TransitionMap::const_iterator e = tm.end(); for (TransitionSet::TransitionMap::const_iterator i = tm.begin(); i != e; ++i) { int index = getStateIndex(i->first); initialStates.insert(index); generateState(index); } vwaaStateSets.clear(); delete vwaa; } void GenBuchiAutomaton::simplify() { #ifdef TDEBUG dump(cout); #endif maximallyCollapseStates(); sccOptimizations(); #ifdef TDEBUG dump(cout); #endif maximallyCollapseStates(); } void GenBuchiAutomaton::generateState(int index) { // // Construct the fair transition set for a GBA state if it has not // been done already. // if (states[index] != UNDEFINED) return; FairTransitionSetTable::FastPair fts; const NatSet& components = vwaaStateSets.ithElement(index); // set of VWAA state indices if (components.empty()) { // // If we hit the empty state, there are no future obligations // to be discharged and all future infinite sequences are acceptable. // We model this with a "true" self transition which has all fairness // conditions. // FairTransition f; f.first.first = index; f.first.second = fairnessConditions.insert(allFair); f.second = bdd_true(); insertFairTransition(fts.first, f); states[index] = fairTransitionSets.insert(fts); return; } // // We first compute the raw (unsimplified) product of the // transition sets for each component state in the VWAA. // NatSet::const_iterator i = components.begin(); RawTransitionSet pi(vwaa->getTransitionSet(*i)); { const NatSet::const_iterator e = components.end(); for (++i; i != e; ++i) { RawTransitionSet c(vwaa->getTransitionSet(*i)); RawTransitionSet t(pi, c); pi.swap(t); } } // // Each transition in the raw product must have a fairness set // computed for it. Any simplification must explicitly take fairness // into account so we don't end up discarding more fair transitions // in favor of less fair transitions. // RawTransitionSet::const_iterator e = pi.end(); for (RawTransitionSet::const_iterator i = pi.begin(); i != e; ++i) { NatSet fairness; vwaa->computeFairnessSet(*i, fairness); FairTransition f; f.first.first = getStateIndex(i->first); f.first.second = fairnessConditions.insert(fairness); f.second = i->second; insertFairTransition(fts.first, f); } states[index] = fairTransitionSets.insert(fts); // // Now generate states reachable from new state. // FairTransitionSet::const_iterator e2 = fts.first.end(); for (FairTransitionSet::const_iterator i = fts.first.begin(); i != e2; ++i) generateState(i->first.first); } int GenBuchiAutomaton::getStateIndex(const NatSet& stateSet) { // // Convert a set of VWAA state indices into a GBA state index, // creating a new GBA state index if we haven't seen this set before. // int index = vwaaStateSets.insert(stateSet); if (index >= states.length()) { Assert(index == states.length(), "states synch error"); states.expandTo(index + 1); states[index] = UNDEFINED; } return index; } void GenBuchiAutomaton::insertFairTransition(FairTransitionSet& fts, const FairTransition& ft) { Bdd formula = ft.second; Assert(formula != bdd_false(), "tried to insert false transition"); const FairTransitionSet::iterator e = fts.end(); FairTransitionSet::iterator equal = e; for (FairTransitionSet::iterator i = fts.begin(); i != e;) { FairTransitionSet::iterator t = i++; if (t->first == ft.first) equal = t; else { const NatSet& existingStates = vwaaStateSets.ithElement(t->first.first); const NatSet& existingFairness = fairnessConditions.ithElement(t->first.second); const NatSet& newStates = vwaaStateSets.ithElement(ft.first.first); const NatSet& newFairness = fairnessConditions.ithElement(ft.first.second); if (existingStates.contains(newStates) && newFairness.contains(existingFairness)) { t->second = bdd_and(t->second, bdd_not(formula)); if (t->second == bdd_false()) fts.erase(t); // existing pair completely subsumed } else if (newStates.contains(existingStates) && existingFairness.contains(newFairness)) { formula = bdd_and(formula, bdd_not(t->second)); if (formula == bdd_false()) return; // new transition completely subsumed } } } if (equal == e) { pair p = fts.insert(ft); Assert(p.second, "failed to insert"); p.first->second = formula; } else equal->second = bdd_or(equal->second, formula); } void GenBuchiAutomaton::remapNatSet(NatSet& newSet, const NatSet& oldSet, const Vector& natMap) { for (int i = natMap.length() - 1; i >= 0; i--) { int t = natMap[i]; if (t != NONE && oldSet.contains(i)) newSet.insert(t); } } void GenBuchiAutomaton::dump(ostream& s) const { s << "begin{GenBuchiAutomaton}\n"; int nrStates = states.length(); for (int i = 0; i < nrStates; i++) { s << "state " << i << "\t(" << states[i] << ")\n"; if (states[i] != UNDEFINED) { const FairTransitionSet& fts = fairTransitionSets.ithElement(states[i]); FairTransitionSet::const_iterator e = fts.end(); for (FairTransitionSet::const_iterator j = fts.begin(); j != e; ++j) { s << j->first.first << '\t' << fairnessConditions.ithElement(j->first.second) << '\t'; BddUser::dump(s, j->second); s << '\n'; } } s << '\n'; } s << "initial states: " << initialStates << '\n'; s << "\nend{GenBuchiAutomaton}\n"; } Maude-2.6/src/Temporal/Makefile.am0000644000147300135640000000106207711551662013764 00000000000000noinst_LIBRARIES = libtemporal.a libtemporal_a_CPPFLAGS = -I$(top_srcdir)/src/Utility libtemporal_a_SOURCES = \ logicFormula.cc \ buchiAutomaton2.cc \ transitionSet.cc \ veryWeakAlternatingAutomaton.cc \ rawTransitionSet.cc \ genBuchiAutomaton.cc \ modelChecker2.cc EXTRA_DIST = \ collapseStates.cc \ sccOptimizations.cc \ sccAnalysis.cc \ satSolve.cc noinst_HEADERS = \ buchiAutomaton2.hh \ genBuchiAutomaton.hh \ logicFormula.hh \ modelChecker2.hh \ rawTransitionSet.hh \ temporal.hh \ transitionSet.hh \ veryWeakAlternatingAutomaton.hh Maude-2.6/src/StrategyLanguage/0000777000147300135640000000000011500304122013452 500000000000000Maude-2.6/src/StrategyLanguage/strategicSearch.cc0000644000147300135640000000656411446473773017057 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class StrategicTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // core class definitions #include "rewritingContext.hh" // strategy language class definitions #include "strategyExpression.hh" #include "strategicProcess.hh" #include "strategicSearch.hh" #include "decompositionProcess.hh" StrategicSearch::StrategicSearch(RewritingContext* initial, StrategyExpression* strategy) : StrategicTask(static_cast(0)), initial(initial), strategy(strategy) { Assert(initial != 0, "null context"); Assert(initial->root() != 0, "null root"); Assert(strategy != 0, "null strategy"); nextToRun = new DecompositionProcess(insert(initial->root()), push(EMPTY_STACK, strategy), getDummyExecution(), 0); exhausted = false; } StrategicSearch::~StrategicSearch() { delete initial; delete strategy; } DagNode* StrategicSearch::findNextSolution() { solutionIndex = NONE; while (!exhausted) { // // Run can delete any process except nextToRun, which must // request deletion by returning DIE. // Survival s = nextToRun->run(*this); // // t will always be a valid process, but might be equal to // nextToRun in the degenerate case. // StrategicProcess* t = nextToRun->getNextProcess(); Assert(s == SURVIVE || t != nextToRun || exhausted, "ran out of processes without exhausted being set"); // // Now safe to delete nextToRun if it requested deletion. // if (s == DIE) delete nextToRun; // // Now safe to abort. // if (RewritingContext::getTraceStatus() && initial->traceAbort()) break; // // t may not be valid anymore, but in this case we should be // exhausted. // nextToRun = t; // // If the run triggered a solution we're done. // if (solutionIndex != NONE) return getCanonical(solutionIndex); } return 0; } StrategicExecution::Survival StrategicSearch::executionSucceeded(int resultIndex, StrategicProcess* /* insertionPoint */) { Assert(solutionIndex == NONE, "multiple solutions from a single step"); solutionIndex = resultIndex; return SURVIVE; // still want more solutions } StrategicExecution::Survival StrategicSearch::executionsExhausted(StrategicProcess* /* insertionPoint */) { exhausted = true; return SURVIVE; // root task cannot die in the usual way } Maude-2.6/src/StrategyLanguage/strategicTask.hh0000644000147300135640000000407511446473033016546 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for event triggered strategic execution. // #ifndef _stategicTask_hh_ #define _stategicTask_hh_ #include #include "strategicExecution.hh" #include "strategyStackManager.hh" class StrategicTask : public StrategicExecution { NO_COPYING(StrategicTask); public: StrategicTask(StrategicTask* master); StrategicTask(StrategicExecution* sibling); ~StrategicTask(); // // Call-backs for interesting events. // virtual Survival executionSucceeded(int resultIndex, StrategicProcess* insertionPoint) = 0; virtual Survival executionsExhausted(StrategicProcess* insertionPoint) = 0; bool alreadySeen(int dagIndex, StrategyStackManager::StackId stackId); protected: StrategicExecution* getDummyExecution(); private: // // A state is an index to a dag and a stack identifier. // typedef pair State; typedef set SeenSet; // // To simplify coding, the head and tail of our list of slaves // (processes and tasks working for us) is stored as a dummy // execution, essentially forming a circular list. // StrategicExecution slaveList; SeenSet seenSet; }; inline StrategicExecution* StrategicTask::getDummyExecution() { return &slaveList; } #endif Maude-2.6/src/StrategyLanguage/strategyStackManager.cc0000644000147300135640000000425610540370414020041 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class StrategyStackManager. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "strategyStackManager.hh" StrategyStackManager::StrategyStackManager() : stackTable(1) { // // Create empty stack entry. // Entry& e = stackTable[0]; e.strategy = 0; e.restOfStack = NONE; e.firstSuccessor = NONE; e.nextPeer = NONE; } StrategyStackManager::StackId StrategyStackManager::push(StackId stackId, StrategyExpression* strategy) { for (StackId i = stackTable[stackId].firstSuccessor; i != NONE; i = stackTable[i].nextPeer) { // // Ideally we would like to compare strategies for equality rather than pointers // but for the moment we just use pointers for simplicity. We don't expect too many // sucessors to a given stack otherwise hashing might be a win. // if (stackTable[i].strategy == strategy) return i; } StackId newStackId = stackTable.size(); stackTable.expandBy(1); Entry& e = stackTable[newStackId]; e.strategy = strategy; e.restOfStack = stackId; e.firstSuccessor = NONE; e.nextPeer = stackTable[stackId].firstSuccessor; stackTable[stackId].firstSuccessor = newStackId; return newStackId; } Maude-2.6/src/StrategyLanguage/trivialStrategy.hh0000644000147300135640000000246110524155375017132 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for idle and fail strategies. // #ifndef _trivialStrategy_hh_ #define _trivialStrategy_hh_ #include "strategyExpression.hh" class TrivialStrategy : public StrategyExpression { public: TrivialStrategy(bool result); bool getResult() const; StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: const bool result; }; inline bool TrivialStrategy::getResult() const { return result; } #endif Maude-2.6/src/StrategyLanguage/strategicSearch.hh0000644000147300135640000000352411446473517017056 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for performing a search using a strategy. // #ifndef _stategicSearch_hh_ #define _stategicSearch_hh_ #include #include "hashConsSet.hh" #include "strategicTask.hh" #include "strategyStackManager.hh" class StrategicSearch : public HashConsSet, public StrategyStackManager, private StrategicTask { NO_COPYING(StrategicSearch); public: // // We take ownership of initial and strategy and delete them in our dtor. // StrategicSearch(RewritingContext* initial, StrategyExpression* strategy); ~StrategicSearch(); DagNode* findNextSolution(); RewritingContext* getContext(); private: // // Virtual in StrategicTask. // Survival executionSucceeded(int resultIndex, StrategicProcess* insertionPoint); Survival executionsExhausted(StrategicProcess* insertionPoint); RewritingContext* initial; StrategyExpression* strategy; bool exhausted; int solutionIndex; StrategicProcess* nextToRun; }; inline RewritingContext* StrategicSearch::getContext() { return initial; } #endif Maude-2.6/src/StrategyLanguage/sharedRewriteSearchState.cc0000644000147300135640000000357710515270760020667 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class SharedRewriteSearchState. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" // interface class definitions #include "term.hh" // strategy language class definitions #include "sharedRewriteSearchState.hh" SharedRewriteSearchState::SharedRewriteSearchState(RewritingContext* parentContext, DagNode* start, int label, int maxDepth) : RewriteSearchState(parentContext->makeSubcontext(start), label, GC_CONTEXT | ALLOW_NONEXEC | IGNORE_CONDITION, 0, maxDepth) { refCount = 1; } SharedRewriteSearchState::Ptr::Ptr(RewritingContext* parentContext, DagNode* start, int label, int maxDepth) { ptr = new SharedRewriteSearchState(parentContext, start, label, maxDepth); } SharedRewriteSearchState::Ptr::Ptr(const Ptr& other) { ptr = other.ptr; ++(ptr->refCount); } SharedRewriteSearchState::Ptr::~Ptr() { if (--(ptr->refCount) == 0) delete ptr; } Maude-2.6/src/StrategyLanguage/applicationStrategy.cc0000644000147300135640000000517111446506203017744 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // interface class definitions #include "term.hh" // strategy language class definitions #include "strategicSearch.hh" #include "applicationStrategy.hh" #include "applicationProcess.hh" #include "decompositionProcess.hh" ApplicationStrategy::ApplicationStrategy(int label, const Vector& variables, const Vector& values, const Vector& strategies) : label(label), variables(variables), valueDags(values.size()), strategies(strategies) { Assert(label != NONE || (variables.empty() && strategies.empty()), "substitutions and condition strategies aren't allowed without a label"); top = false; int nrValues = values.size(); Assert(variables.size() == nrValues, "bad substitution"); for (int i = 0; i < nrValues; ++i) { valueDags[i].setTerm(values[i]); valueDags[i].normalize(); valueDags[i].prepare(); } } ApplicationStrategy::~ApplicationStrategy() { int nrVariables = variables.size(); for (int i = 0; i < nrVariables; ++i) variables[i]->deepSelfDestruct(); int nrStrategies = strategies.size(); for (int i = 0; i < nrStrategies; ++i) delete strategies[i]; } StrategicExecution::Survival ApplicationStrategy::decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) { (void) new ApplicationProcess(searchObject, remainder->getDagIndex(), this, remainder->getPending(), remainder, // working for same task remainder); // place in process queue ahead of old process return StrategicExecution::DIE; // request deletion of DecompositionProcess } Maude-2.6/src/StrategyLanguage/iterationStrategy.hh0000644000147300135640000000316610524240660017451 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for iteration strategies. // #ifndef _iterationStrategy_hh_ #define _iterationStrategy_hh_ #include "strategyExpression.hh" class IterationStrategy : public StrategyExpression { public: IterationStrategy(StrategyExpression* child, bool zeroAllowed); ~IterationStrategy(); StrategyExpression* getStrategy() const; bool getZeroAllowed() const; StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: StrategyExpression* const child; StrategyExpression* const star; // for a s+ expression we keep an s* expression here for decomposition }; inline StrategyExpression* IterationStrategy::getStrategy() const { return child; } inline bool IterationStrategy::getZeroAllowed() const { return star == 0; } #endif Maude-2.6/src/StrategyLanguage/applicationStrategy.hh0000644000147300135640000000454010506607560017761 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for rule application strategy. // #ifndef _applicationStrategy_hh_ #define _applicationStrategy_hh_ #include "strategyExpression.hh" #include "cachedDag.hh" class ApplicationStrategy : public StrategyExpression { public: // // label == NONE means try all rules, labeled or not. // ApplicationStrategy(int label, const Vector& variables, const Vector& values, const Vector& strategies); ~ApplicationStrategy(); void setTop(); bool getTop() const; int getLabel() const; const Vector& getVariables() const; Vector& getValues(); const Vector& getStrategies() const; StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: bool top; // restrict rewrites to top of term const int label; Vector variables; // substitution Vector valueDags; Vector strategies; // strategies for searches in conditions }; inline void ApplicationStrategy::setTop() { top = true; } inline bool ApplicationStrategy::getTop() const { return top; } inline int ApplicationStrategy::getLabel() const { return label; } inline const Vector& ApplicationStrategy::getVariables() const { return variables; } inline Vector& ApplicationStrategy::getValues() { return valueDags; } inline const Vector& ApplicationStrategy::getStrategies() const { return strategies; } #endif Maude-2.6/src/StrategyLanguage/strategicProcess.hh0000644000147300135640000000301310476150513017246 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for round-robin based strategic execution. // #ifndef _strategicProcess_hh_ #define _strategicProcess_hh_ #include "strategicExecution.hh" class StrategicProcess : public StrategicExecution { NO_COPYING(StrategicProcess); public: StrategicProcess(StrategicExecution* taskSibling, StrategicProcess* other); ~StrategicProcess(); StrategicProcess* getNextProcess() const; virtual Survival run(StrategicSearch& searchObject) = 0; private: StrategicProcess* prev; // previous process in circular queue StrategicProcess* next; // next process in circular queue }; inline StrategicProcess* StrategicProcess::getNextProcess() const { return next; } #endif Maude-2.6/src/StrategyLanguage/strategicProcess.cc0000644000147300135640000000341410466742121017242 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class StrategicTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "strategicProcess.hh" StrategicProcess::StrategicProcess(StrategicExecution* taskSibling, StrategicProcess* other) : StrategicExecution(taskSibling) { if (other == 0) { // // Make degenerate circular list. // next = prev = this; } else { // // Insert us into circular list just before other; i.e. we become // the tail of the list w.r.t. other to ensure that all the remaining // processes get to run before us. // prev = other->prev; prev->next = this; next = other; next->prev = this; } } StrategicProcess::~StrategicProcess() { prev->next = next; next->prev = prev; } Maude-2.6/src/StrategyLanguage/Makefile.in0000644000147300135640000016601611500303156015453 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/StrategyLanguage DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libstrategyLanguage_a_AR = $(AR) $(ARFLAGS) libstrategyLanguage_a_LIBADD = am_libstrategyLanguage_a_OBJECTS = \ libstrategyLanguage_a-trivialStrategy.$(OBJEXT) \ libstrategyLanguage_a-applicationStrategy.$(OBJEXT) \ libstrategyLanguage_a-concatenationStrategy.$(OBJEXT) \ libstrategyLanguage_a-iterationStrategy.$(OBJEXT) \ libstrategyLanguage_a-branchStrategy.$(OBJEXT) \ libstrategyLanguage_a-unionStrategy.$(OBJEXT) \ libstrategyLanguage_a-testStrategy.$(OBJEXT) \ libstrategyLanguage_a-strategicExecution.$(OBJEXT) \ libstrategyLanguage_a-strategicTask.$(OBJEXT) \ libstrategyLanguage_a-branchTask.$(OBJEXT) \ libstrategyLanguage_a-strategicProcess.$(OBJEXT) \ libstrategyLanguage_a-decompositionProcess.$(OBJEXT) \ libstrategyLanguage_a-applicationProcess.$(OBJEXT) \ libstrategyLanguage_a-strategicSearch.$(OBJEXT) \ libstrategyLanguage_a-sharedRewriteSearchState.$(OBJEXT) \ libstrategyLanguage_a-matchProcess.$(OBJEXT) \ libstrategyLanguage_a-rewriteTask.$(OBJEXT) \ libstrategyLanguage_a-strategyStackManager.$(OBJEXT) libstrategyLanguage_a_OBJECTS = $(am_libstrategyLanguage_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libstrategyLanguage_a_SOURCES) DIST_SOURCES = $(libstrategyLanguage_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libstrategyLanguage.a libstrategyLanguage_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Higher \ -I$(top_srcdir)/src/FullCompiler libstrategyLanguage_a_SOURCES = \ trivialStrategy.cc \ applicationStrategy.cc \ concatenationStrategy.cc \ iterationStrategy.cc \ branchStrategy.cc \ unionStrategy.cc \ testStrategy.cc \ strategicExecution.cc \ strategicTask.cc \ branchTask.cc \ strategicProcess.cc \ decompositionProcess.cc \ applicationProcess.cc \ strategicSearch.cc \ sharedRewriteSearchState.cc \ matchProcess.cc \ rewriteTask.cc \ strategyStackManager.cc noinst_HEADERS = \ strategyLanguage.hh \ strategyExpression.hh \ trivialStrategy.hh \ applicationStrategy.hh \ concatenationStrategy.hh \ iterationStrategy.hh \ branchStrategy.hh \ unionStrategy.hh \ testStrategy.hh \ strategicExecution.hh \ strategicTask.hh \ branchTask.hh \ strategicProcess.hh \ decompositionProcess.hh \ applicationProcess.hh \ strategicSearch.hh \ sharedRewriteSearchState.hh \ matchProcess.hh \ rewriteTask.hh \ strategyStackManager.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/StrategyLanguage/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/StrategyLanguage/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libstrategyLanguage.a: $(libstrategyLanguage_a_OBJECTS) $(libstrategyLanguage_a_DEPENDENCIES) -rm -f libstrategyLanguage.a $(libstrategyLanguage_a_AR) libstrategyLanguage.a $(libstrategyLanguage_a_OBJECTS) $(libstrategyLanguage_a_LIBADD) $(RANLIB) libstrategyLanguage.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-branchTask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-matchProcess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-strategicTask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-testStrategy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libstrategyLanguage_a-trivialStrategy.o: trivialStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-trivialStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Tpo" -c -o libstrategyLanguage_a-trivialStrategy.o `test -f 'trivialStrategy.cc' || echo '$(srcdir)/'`trivialStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='trivialStrategy.cc' object='libstrategyLanguage_a-trivialStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-trivialStrategy.o `test -f 'trivialStrategy.cc' || echo '$(srcdir)/'`trivialStrategy.cc libstrategyLanguage_a-trivialStrategy.obj: trivialStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-trivialStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Tpo" -c -o libstrategyLanguage_a-trivialStrategy.obj `if test -f 'trivialStrategy.cc'; then $(CYGPATH_W) 'trivialStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/trivialStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-trivialStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='trivialStrategy.cc' object='libstrategyLanguage_a-trivialStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-trivialStrategy.obj `if test -f 'trivialStrategy.cc'; then $(CYGPATH_W) 'trivialStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/trivialStrategy.cc'; fi` libstrategyLanguage_a-applicationStrategy.o: applicationStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-applicationStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Tpo" -c -o libstrategyLanguage_a-applicationStrategy.o `test -f 'applicationStrategy.cc' || echo '$(srcdir)/'`applicationStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='applicationStrategy.cc' object='libstrategyLanguage_a-applicationStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-applicationStrategy.o `test -f 'applicationStrategy.cc' || echo '$(srcdir)/'`applicationStrategy.cc libstrategyLanguage_a-applicationStrategy.obj: applicationStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-applicationStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Tpo" -c -o libstrategyLanguage_a-applicationStrategy.obj `if test -f 'applicationStrategy.cc'; then $(CYGPATH_W) 'applicationStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/applicationStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-applicationStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='applicationStrategy.cc' object='libstrategyLanguage_a-applicationStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-applicationStrategy.obj `if test -f 'applicationStrategy.cc'; then $(CYGPATH_W) 'applicationStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/applicationStrategy.cc'; fi` libstrategyLanguage_a-concatenationStrategy.o: concatenationStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-concatenationStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Tpo" -c -o libstrategyLanguage_a-concatenationStrategy.o `test -f 'concatenationStrategy.cc' || echo '$(srcdir)/'`concatenationStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='concatenationStrategy.cc' object='libstrategyLanguage_a-concatenationStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-concatenationStrategy.o `test -f 'concatenationStrategy.cc' || echo '$(srcdir)/'`concatenationStrategy.cc libstrategyLanguage_a-concatenationStrategy.obj: concatenationStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-concatenationStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Tpo" -c -o libstrategyLanguage_a-concatenationStrategy.obj `if test -f 'concatenationStrategy.cc'; then $(CYGPATH_W) 'concatenationStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/concatenationStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-concatenationStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='concatenationStrategy.cc' object='libstrategyLanguage_a-concatenationStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-concatenationStrategy.obj `if test -f 'concatenationStrategy.cc'; then $(CYGPATH_W) 'concatenationStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/concatenationStrategy.cc'; fi` libstrategyLanguage_a-iterationStrategy.o: iterationStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-iterationStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Tpo" -c -o libstrategyLanguage_a-iterationStrategy.o `test -f 'iterationStrategy.cc' || echo '$(srcdir)/'`iterationStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='iterationStrategy.cc' object='libstrategyLanguage_a-iterationStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-iterationStrategy.o `test -f 'iterationStrategy.cc' || echo '$(srcdir)/'`iterationStrategy.cc libstrategyLanguage_a-iterationStrategy.obj: iterationStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-iterationStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Tpo" -c -o libstrategyLanguage_a-iterationStrategy.obj `if test -f 'iterationStrategy.cc'; then $(CYGPATH_W) 'iterationStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/iterationStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-iterationStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='iterationStrategy.cc' object='libstrategyLanguage_a-iterationStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-iterationStrategy.obj `if test -f 'iterationStrategy.cc'; then $(CYGPATH_W) 'iterationStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/iterationStrategy.cc'; fi` libstrategyLanguage_a-branchStrategy.o: branchStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-branchStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Tpo" -c -o libstrategyLanguage_a-branchStrategy.o `test -f 'branchStrategy.cc' || echo '$(srcdir)/'`branchStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='branchStrategy.cc' object='libstrategyLanguage_a-branchStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-branchStrategy.o `test -f 'branchStrategy.cc' || echo '$(srcdir)/'`branchStrategy.cc libstrategyLanguage_a-branchStrategy.obj: branchStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-branchStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Tpo" -c -o libstrategyLanguage_a-branchStrategy.obj `if test -f 'branchStrategy.cc'; then $(CYGPATH_W) 'branchStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/branchStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-branchStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='branchStrategy.cc' object='libstrategyLanguage_a-branchStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-branchStrategy.obj `if test -f 'branchStrategy.cc'; then $(CYGPATH_W) 'branchStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/branchStrategy.cc'; fi` libstrategyLanguage_a-unionStrategy.o: unionStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-unionStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Tpo" -c -o libstrategyLanguage_a-unionStrategy.o `test -f 'unionStrategy.cc' || echo '$(srcdir)/'`unionStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='unionStrategy.cc' object='libstrategyLanguage_a-unionStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-unionStrategy.o `test -f 'unionStrategy.cc' || echo '$(srcdir)/'`unionStrategy.cc libstrategyLanguage_a-unionStrategy.obj: unionStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-unionStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Tpo" -c -o libstrategyLanguage_a-unionStrategy.obj `if test -f 'unionStrategy.cc'; then $(CYGPATH_W) 'unionStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/unionStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-unionStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='unionStrategy.cc' object='libstrategyLanguage_a-unionStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-unionStrategy.obj `if test -f 'unionStrategy.cc'; then $(CYGPATH_W) 'unionStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/unionStrategy.cc'; fi` libstrategyLanguage_a-testStrategy.o: testStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-testStrategy.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Tpo" -c -o libstrategyLanguage_a-testStrategy.o `test -f 'testStrategy.cc' || echo '$(srcdir)/'`testStrategy.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='testStrategy.cc' object='libstrategyLanguage_a-testStrategy.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-testStrategy.o `test -f 'testStrategy.cc' || echo '$(srcdir)/'`testStrategy.cc libstrategyLanguage_a-testStrategy.obj: testStrategy.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-testStrategy.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Tpo" -c -o libstrategyLanguage_a-testStrategy.obj `if test -f 'testStrategy.cc'; then $(CYGPATH_W) 'testStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/testStrategy.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Tpo" "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-testStrategy.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='testStrategy.cc' object='libstrategyLanguage_a-testStrategy.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-testStrategy.obj `if test -f 'testStrategy.cc'; then $(CYGPATH_W) 'testStrategy.cc'; else $(CYGPATH_W) '$(srcdir)/testStrategy.cc'; fi` libstrategyLanguage_a-strategicExecution.o: strategicExecution.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicExecution.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Tpo" -c -o libstrategyLanguage_a-strategicExecution.o `test -f 'strategicExecution.cc' || echo '$(srcdir)/'`strategicExecution.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicExecution.cc' object='libstrategyLanguage_a-strategicExecution.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicExecution.o `test -f 'strategicExecution.cc' || echo '$(srcdir)/'`strategicExecution.cc libstrategyLanguage_a-strategicExecution.obj: strategicExecution.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicExecution.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Tpo" -c -o libstrategyLanguage_a-strategicExecution.obj `if test -f 'strategicExecution.cc'; then $(CYGPATH_W) 'strategicExecution.cc'; else $(CYGPATH_W) '$(srcdir)/strategicExecution.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicExecution.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicExecution.cc' object='libstrategyLanguage_a-strategicExecution.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicExecution.obj `if test -f 'strategicExecution.cc'; then $(CYGPATH_W) 'strategicExecution.cc'; else $(CYGPATH_W) '$(srcdir)/strategicExecution.cc'; fi` libstrategyLanguage_a-strategicTask.o: strategicTask.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicTask.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Tpo" -c -o libstrategyLanguage_a-strategicTask.o `test -f 'strategicTask.cc' || echo '$(srcdir)/'`strategicTask.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicTask.cc' object='libstrategyLanguage_a-strategicTask.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicTask.o `test -f 'strategicTask.cc' || echo '$(srcdir)/'`strategicTask.cc libstrategyLanguage_a-strategicTask.obj: strategicTask.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicTask.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Tpo" -c -o libstrategyLanguage_a-strategicTask.obj `if test -f 'strategicTask.cc'; then $(CYGPATH_W) 'strategicTask.cc'; else $(CYGPATH_W) '$(srcdir)/strategicTask.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicTask.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicTask.cc' object='libstrategyLanguage_a-strategicTask.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicTask.obj `if test -f 'strategicTask.cc'; then $(CYGPATH_W) 'strategicTask.cc'; else $(CYGPATH_W) '$(srcdir)/strategicTask.cc'; fi` libstrategyLanguage_a-branchTask.o: branchTask.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-branchTask.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-branchTask.Tpo" -c -o libstrategyLanguage_a-branchTask.o `test -f 'branchTask.cc' || echo '$(srcdir)/'`branchTask.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-branchTask.Tpo" "$(DEPDIR)/libstrategyLanguage_a-branchTask.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-branchTask.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='branchTask.cc' object='libstrategyLanguage_a-branchTask.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-branchTask.o `test -f 'branchTask.cc' || echo '$(srcdir)/'`branchTask.cc libstrategyLanguage_a-branchTask.obj: branchTask.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-branchTask.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-branchTask.Tpo" -c -o libstrategyLanguage_a-branchTask.obj `if test -f 'branchTask.cc'; then $(CYGPATH_W) 'branchTask.cc'; else $(CYGPATH_W) '$(srcdir)/branchTask.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-branchTask.Tpo" "$(DEPDIR)/libstrategyLanguage_a-branchTask.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-branchTask.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='branchTask.cc' object='libstrategyLanguage_a-branchTask.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-branchTask.obj `if test -f 'branchTask.cc'; then $(CYGPATH_W) 'branchTask.cc'; else $(CYGPATH_W) '$(srcdir)/branchTask.cc'; fi` libstrategyLanguage_a-strategicProcess.o: strategicProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicProcess.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Tpo" -c -o libstrategyLanguage_a-strategicProcess.o `test -f 'strategicProcess.cc' || echo '$(srcdir)/'`strategicProcess.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicProcess.cc' object='libstrategyLanguage_a-strategicProcess.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicProcess.o `test -f 'strategicProcess.cc' || echo '$(srcdir)/'`strategicProcess.cc libstrategyLanguage_a-strategicProcess.obj: strategicProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicProcess.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Tpo" -c -o libstrategyLanguage_a-strategicProcess.obj `if test -f 'strategicProcess.cc'; then $(CYGPATH_W) 'strategicProcess.cc'; else $(CYGPATH_W) '$(srcdir)/strategicProcess.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicProcess.cc' object='libstrategyLanguage_a-strategicProcess.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicProcess.obj `if test -f 'strategicProcess.cc'; then $(CYGPATH_W) 'strategicProcess.cc'; else $(CYGPATH_W) '$(srcdir)/strategicProcess.cc'; fi` libstrategyLanguage_a-decompositionProcess.o: decompositionProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-decompositionProcess.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Tpo" -c -o libstrategyLanguage_a-decompositionProcess.o `test -f 'decompositionProcess.cc' || echo '$(srcdir)/'`decompositionProcess.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='decompositionProcess.cc' object='libstrategyLanguage_a-decompositionProcess.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-decompositionProcess.o `test -f 'decompositionProcess.cc' || echo '$(srcdir)/'`decompositionProcess.cc libstrategyLanguage_a-decompositionProcess.obj: decompositionProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-decompositionProcess.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Tpo" -c -o libstrategyLanguage_a-decompositionProcess.obj `if test -f 'decompositionProcess.cc'; then $(CYGPATH_W) 'decompositionProcess.cc'; else $(CYGPATH_W) '$(srcdir)/decompositionProcess.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-decompositionProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='decompositionProcess.cc' object='libstrategyLanguage_a-decompositionProcess.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-decompositionProcess.obj `if test -f 'decompositionProcess.cc'; then $(CYGPATH_W) 'decompositionProcess.cc'; else $(CYGPATH_W) '$(srcdir)/decompositionProcess.cc'; fi` libstrategyLanguage_a-applicationProcess.o: applicationProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-applicationProcess.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Tpo" -c -o libstrategyLanguage_a-applicationProcess.o `test -f 'applicationProcess.cc' || echo '$(srcdir)/'`applicationProcess.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='applicationProcess.cc' object='libstrategyLanguage_a-applicationProcess.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-applicationProcess.o `test -f 'applicationProcess.cc' || echo '$(srcdir)/'`applicationProcess.cc libstrategyLanguage_a-applicationProcess.obj: applicationProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-applicationProcess.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Tpo" -c -o libstrategyLanguage_a-applicationProcess.obj `if test -f 'applicationProcess.cc'; then $(CYGPATH_W) 'applicationProcess.cc'; else $(CYGPATH_W) '$(srcdir)/applicationProcess.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-applicationProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='applicationProcess.cc' object='libstrategyLanguage_a-applicationProcess.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-applicationProcess.obj `if test -f 'applicationProcess.cc'; then $(CYGPATH_W) 'applicationProcess.cc'; else $(CYGPATH_W) '$(srcdir)/applicationProcess.cc'; fi` libstrategyLanguage_a-strategicSearch.o: strategicSearch.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicSearch.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Tpo" -c -o libstrategyLanguage_a-strategicSearch.o `test -f 'strategicSearch.cc' || echo '$(srcdir)/'`strategicSearch.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicSearch.cc' object='libstrategyLanguage_a-strategicSearch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicSearch.o `test -f 'strategicSearch.cc' || echo '$(srcdir)/'`strategicSearch.cc libstrategyLanguage_a-strategicSearch.obj: strategicSearch.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategicSearch.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Tpo" -c -o libstrategyLanguage_a-strategicSearch.obj `if test -f 'strategicSearch.cc'; then $(CYGPATH_W) 'strategicSearch.cc'; else $(CYGPATH_W) '$(srcdir)/strategicSearch.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategicSearch.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategicSearch.cc' object='libstrategyLanguage_a-strategicSearch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategicSearch.obj `if test -f 'strategicSearch.cc'; then $(CYGPATH_W) 'strategicSearch.cc'; else $(CYGPATH_W) '$(srcdir)/strategicSearch.cc'; fi` libstrategyLanguage_a-sharedRewriteSearchState.o: sharedRewriteSearchState.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-sharedRewriteSearchState.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Tpo" -c -o libstrategyLanguage_a-sharedRewriteSearchState.o `test -f 'sharedRewriteSearchState.cc' || echo '$(srcdir)/'`sharedRewriteSearchState.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Tpo" "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sharedRewriteSearchState.cc' object='libstrategyLanguage_a-sharedRewriteSearchState.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-sharedRewriteSearchState.o `test -f 'sharedRewriteSearchState.cc' || echo '$(srcdir)/'`sharedRewriteSearchState.cc libstrategyLanguage_a-sharedRewriteSearchState.obj: sharedRewriteSearchState.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-sharedRewriteSearchState.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Tpo" -c -o libstrategyLanguage_a-sharedRewriteSearchState.obj `if test -f 'sharedRewriteSearchState.cc'; then $(CYGPATH_W) 'sharedRewriteSearchState.cc'; else $(CYGPATH_W) '$(srcdir)/sharedRewriteSearchState.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Tpo" "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-sharedRewriteSearchState.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sharedRewriteSearchState.cc' object='libstrategyLanguage_a-sharedRewriteSearchState.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-sharedRewriteSearchState.obj `if test -f 'sharedRewriteSearchState.cc'; then $(CYGPATH_W) 'sharedRewriteSearchState.cc'; else $(CYGPATH_W) '$(srcdir)/sharedRewriteSearchState.cc'; fi` libstrategyLanguage_a-matchProcess.o: matchProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-matchProcess.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Tpo" -c -o libstrategyLanguage_a-matchProcess.o `test -f 'matchProcess.cc' || echo '$(srcdir)/'`matchProcess.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='matchProcess.cc' object='libstrategyLanguage_a-matchProcess.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-matchProcess.o `test -f 'matchProcess.cc' || echo '$(srcdir)/'`matchProcess.cc libstrategyLanguage_a-matchProcess.obj: matchProcess.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-matchProcess.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Tpo" -c -o libstrategyLanguage_a-matchProcess.obj `if test -f 'matchProcess.cc'; then $(CYGPATH_W) 'matchProcess.cc'; else $(CYGPATH_W) '$(srcdir)/matchProcess.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Tpo" "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-matchProcess.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='matchProcess.cc' object='libstrategyLanguage_a-matchProcess.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-matchProcess.obj `if test -f 'matchProcess.cc'; then $(CYGPATH_W) 'matchProcess.cc'; else $(CYGPATH_W) '$(srcdir)/matchProcess.cc'; fi` libstrategyLanguage_a-rewriteTask.o: rewriteTask.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-rewriteTask.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Tpo" -c -o libstrategyLanguage_a-rewriteTask.o `test -f 'rewriteTask.cc' || echo '$(srcdir)/'`rewriteTask.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Tpo" "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rewriteTask.cc' object='libstrategyLanguage_a-rewriteTask.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-rewriteTask.o `test -f 'rewriteTask.cc' || echo '$(srcdir)/'`rewriteTask.cc libstrategyLanguage_a-rewriteTask.obj: rewriteTask.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-rewriteTask.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Tpo" -c -o libstrategyLanguage_a-rewriteTask.obj `if test -f 'rewriteTask.cc'; then $(CYGPATH_W) 'rewriteTask.cc'; else $(CYGPATH_W) '$(srcdir)/rewriteTask.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Tpo" "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-rewriteTask.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rewriteTask.cc' object='libstrategyLanguage_a-rewriteTask.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-rewriteTask.obj `if test -f 'rewriteTask.cc'; then $(CYGPATH_W) 'rewriteTask.cc'; else $(CYGPATH_W) '$(srcdir)/rewriteTask.cc'; fi` libstrategyLanguage_a-strategyStackManager.o: strategyStackManager.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategyStackManager.o -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Tpo" -c -o libstrategyLanguage_a-strategyStackManager.o `test -f 'strategyStackManager.cc' || echo '$(srcdir)/'`strategyStackManager.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategyStackManager.cc' object='libstrategyLanguage_a-strategyStackManager.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategyStackManager.o `test -f 'strategyStackManager.cc' || echo '$(srcdir)/'`strategyStackManager.cc libstrategyLanguage_a-strategyStackManager.obj: strategyStackManager.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libstrategyLanguage_a-strategyStackManager.obj -MD -MP -MF "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Tpo" -c -o libstrategyLanguage_a-strategyStackManager.obj `if test -f 'strategyStackManager.cc'; then $(CYGPATH_W) 'strategyStackManager.cc'; else $(CYGPATH_W) '$(srcdir)/strategyStackManager.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Tpo" "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Po"; else rm -f "$(DEPDIR)/libstrategyLanguage_a-strategyStackManager.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strategyStackManager.cc' object='libstrategyLanguage_a-strategyStackManager.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstrategyLanguage_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libstrategyLanguage_a-strategyStackManager.obj `if test -f 'strategyStackManager.cc'; then $(CYGPATH_W) 'strategyStackManager.cc'; else $(CYGPATH_W) '$(srcdir)/strategyStackManager.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/StrategyLanguage/testStrategy.cc0000644000147300135640000000470211446507265016430 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // higher class definitions #include "matchSearchState.hh" // strategy language class definitions #include "decompositionProcess.hh" #include "strategicSearch.hh" #include "testStrategy.hh" TestStrategy::TestStrategy(Term* patternTerm, int depth, const Vector& condition) : pattern(patternTerm, depth >= 0, condition), depth(depth) { WarningCheck(pattern.getUnboundVariables().empty(), *patternTerm << ": variable " << QUOTE(pattern.index2Variable(pattern.getUnboundVariables().min())) << " is used before it is bound in condition of test strategy."); // need to do something about recovery } StrategicExecution::Survival TestStrategy::decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) { if (!pattern.getUnboundVariables().empty()) return StrategicExecution::DIE; // bad condition always fails RewritingContext* context = searchObject.getContext(); RewritingContext* newContext = context->makeSubcontext(searchObject.getCanonical(remainder->getDagIndex())); MatchSearchState* state = new MatchSearchState(newContext, &pattern, MatchSearchState::GC_CONTEXT, 0, depth); bool result = state->findNextMatch(); state->transferCount(*context); delete state; return result ? StrategicExecution::SURVIVE : StrategicExecution::DIE; } Maude-2.6/src/StrategyLanguage/concatenationStrategy.cc0000644000147300135640000000351110540335405020260 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "concatenationStrategy.hh" #include "decompositionProcess.hh" #include "strategicSearch.hh" ConcatenationStrategy::ConcatenationStrategy(const Vector strategies) : strategies(strategies) { Assert(!strategies.empty(), "no strategies"); } ConcatenationStrategy::~ConcatenationStrategy() { int nrStrategies = strategies.size(); for (int i = 0; i < nrStrategies; ++i) delete strategies[i]; } StrategicExecution::Survival ConcatenationStrategy::decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) { for (int i = strategies.size() - 1; i >= 0; --i) remainder->pushStrategy(searchObject, strategies[i]); return StrategicExecution::SURVIVE; // remainder should not request deletion } Maude-2.6/src/StrategyLanguage/strategicTask.cc0000644000147300135640000000422111444523205016520 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class StrategicTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "strategicTask.hh" StrategicTask::StrategicTask(StrategicTask* master) : StrategicExecution(master), slaveList(this) { } StrategicTask::StrategicTask(StrategicExecution* sibling) : StrategicExecution(sibling), slaveList(this) { } StrategicTask::~StrategicTask() { // // Once we disappear, our slaves will have no place to report to, so // we must delete them first. // StrategicExecution* next; for (StrategicExecution* i = slaveList.getNextSlave(); i != &slaveList; i = next) { next = i->getNextSlave(); delete i; } } /* bool StrategicTask::alreadySeen(int dagIndex, StrategyStackManager::StackId stackId) { State s(dagIndex, stackId); return !(seenSet.insert(s).second); } */ bool StrategicTask::alreadySeen(int dagIndex, StrategyStackManager::StackId stackId) { DebugAdvisory("alreadySeen( " << dagIndex << ", " << stackId << ") - seenSet.size() " << seenSet.size()); State s(dagIndex, stackId); pair p = seenSet.insert(s); // to avoid UMR in purify return !(p.second); } Maude-2.6/src/StrategyLanguage/rewriteTask.cc0000644000147300135640000001212611446505126016223 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class RewriteTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" // interface class definitions #include "term.hh" #include "extensionInfo.hh" #include "subproblem.hh" // core class definitions #include "cachedDag.hh" #include "rule.hh" // higher class definitions #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" // strategy language class definitions #include "strategicSearch.hh" #include "strategyExpression.hh" #include "applicationStrategy.hh" #include "applicationProcess.hh" #include "decompositionProcess.hh" #include "matchProcess.hh" #include "rewriteTask.hh" RewriteTask::RewriteTask(StrategicSearch& searchObject, SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, Substitution* substitutionSoFar, Rule* rule, int fragmentNr, const Vector& strategies, int strategyNr, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* insertionPoint) : StrategicTask(taskSibling), hashConsSet(searchObject), rewriteState(rewriteState), // share rewrite state redexIndex(redexIndex), // copy redex index extensionInfoCopy((extensionInfo == 0) ? 0 : extensionInfo->makeClone()), // clone extension info rule(rule), // copy rule pointer fragmentNr(fragmentNr), // copy fragment number strategies(strategies), // share reference to strategies vector strategyNr(strategyNr), // copy strategy number pending(pending) // copy pending stack { // // Find the L => R fragment that we are going to test. // rcf = safeCast(RewriteConditionFragment*, (rule->getCondition())[fragmentNr]); // // Make a subcontext, construct and evalutate the instance of L. // RewritingContext* baseContext = rewriteState->getContext(); newContext = baseContext->makeSubcontext(rcf->makeLhsInstance(*substitutionSoFar), RewritingContext::CONDITION_EVAL); newContext->reduce(); // // We won't be doing anymore rewriting with newContext so it is safe to add in its rewrites here. // searchObject.getContext()->addInCount(*newContext); // // We now reuse newContext to save a copy of the partial substitution (since we don't // own substitutionSoFar an it will probably change between now and our call-backs being // called. We use clone() rather than copy() since the copy size will be wrong. // newContext->clone(*substitutionSoFar); // // Start a new search from the result of evaluating L, using a substrategy. // StrategyExpression* substrategy = strategies[strategyNr]; (void) new DecompositionProcess(searchObject.insert(newContext->root()), searchObject.push(StrategyStackManager::EMPTY_STACK, substrategy), getDummyExecution(), insertionPoint); } RewriteTask::~RewriteTask() { delete newContext; // Can we delete this earlier? } StrategicExecution::Survival RewriteTask::executionSucceeded(int resultIndex, StrategicProcess* insertionPoint) { // // We now need to match the result of a rewrite seach against our rhs pattern. // DagNode* result = hashConsSet.getCanonical(resultIndex); RewritingContext* matchContext = rewriteState->getContext()->makeSubcontext(result, RewritingContext::CONDITION_EVAL); // // We need to use clone() rather than copy() since matchContext with have a copy size of zero. // matchContext->clone(*newContext); Subproblem* subproblem; if (rcf->matchRoot(*matchContext, subproblem)) { (void) new MatchProcess(rewriteState, redexIndex, extensionInfoCopy, matchContext, // MatchProcess takes over ownership of matchContext subproblem, // MatchProcess takes over ownership of subproblem rule, fragmentNr, strategies, strategyNr + 1, pending, this, insertionPoint); } return SURVIVE; } StrategicExecution::Survival RewriteTask::executionsExhausted(StrategicProcess* insertionPoint) { // // We don't have any more slave executions so there are no more solutions to // rewrite condition fragment. // return DIE; } Maude-2.6/src/StrategyLanguage/iterationStrategy.cc0000644000147300135640000000365110540335430017434 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class IterationStrategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "iterationStrategy.hh" #include "decompositionProcess.hh" #include "strategicSearch.hh" IterationStrategy::IterationStrategy(StrategyExpression* child, bool zeroAllowed) : child(child), star(zeroAllowed ? 0 : new IterationStrategy(child, true)) { } IterationStrategy::~IterationStrategy() { delete (star != 0 ? star : child); } StrategicExecution::Survival IterationStrategy::decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) { if (star) // + case; push * subexpression remainder->pushStrategy(searchObject, star); else // * case { (void) new DecompositionProcess(remainder); // idle alternative remainder->pushStrategy(searchObject, this); } remainder->pushStrategy(searchObject, child); return StrategicExecution::SURVIVE; // remainder should not request deletion } Maude-2.6/src/StrategyLanguage/unionStrategy.hh0000644000147300135640000000267110524241377016611 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for union strategies. // #ifndef _unionStrategy_hh_ #define _unionStrategy_hh_ #include "strategyExpression.hh" class UnionStrategy : public StrategyExpression { public: UnionStrategy(const Vector& strategies); ~UnionStrategy(); const Vector& getStrategies() const; StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: const Vector strategies; }; inline const Vector& UnionStrategy::getStrategies() const { return strategies; } #endif Maude-2.6/src/StrategyLanguage/unionStrategy.cc0000644000147300135640000000370610540335415016572 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "unionStrategy.hh" #include "decompositionProcess.hh" #include "strategicSearch.hh" UnionStrategy::UnionStrategy(const Vector& strategies) : strategies(strategies) { Assert(!strategies.empty(), "no strategies"); } UnionStrategy::~UnionStrategy() { int nrStrategies = strategies.size(); for (int i = 0; i < nrStrategies; ++i) delete strategies[i]; } StrategicExecution::Survival UnionStrategy::decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) { int last = strategies.size() - 1; for (int i = 0; i < last; ++i) { DecompositionProcess* p = new DecompositionProcess(remainder); // clone remainder p->pushStrategy(searchObject, strategies[i]); } remainder->pushStrategy(searchObject, strategies[last]); return StrategicExecution::SURVIVE; // remainder should not request deletion } Maude-2.6/src/StrategyLanguage/branchTask.cc0000644000147300135640000001051211446506757016007 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class StrategicTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "branchTask.hh" #include "decompositionProcess.hh" BranchTask::BranchTask(StrategyStackManager& strategyStackManager, StrategicExecution* sibling, int startIndex, StrategyExpression* initialStrategy, BranchStrategy::Action successAction, StrategyExpression* successStrategy, BranchStrategy::Action failureAction, StrategyExpression* failureStrategy, StrategyStackManager::StackId pending, StrategicProcess* insertionPoint) : StrategicTask(sibling), strategyStackManager(strategyStackManager), startIndex(startIndex), initialStrategy(initialStrategy), successAction(successAction), successStrategy(successStrategy), failureAction(failureAction), failureStrategy(failureStrategy), pending(pending) { success = false; (void) new DecompositionProcess(startIndex, strategyStackManager.push(StrategyStackManager::EMPTY_STACK, initialStrategy), getDummyExecution(), insertionPoint); } StrategicExecution::Survival BranchTask::executionSucceeded(int resultIndex, StrategicProcess* insertionPoint) { success = true; switch (successAction) { case BranchStrategy::FAIL: return DIE; case BranchStrategy::IDLE: { (void) new DecompositionProcess(startIndex, pending, this, insertionPoint); return DIE; } case BranchStrategy::PASS_THRU: { (void) new DecompositionProcess(resultIndex, pending, this, insertionPoint); break; } case BranchStrategy::NEW_STRATEGY: { // // Start a new process that applies the success strategy followed by the pending // strategies to the result. It will report to our owner. // DecompositionProcess* p = new DecompositionProcess(resultIndex, pending, this, insertionPoint); p->pushStrategy(strategyStackManager, successStrategy); break; } case BranchStrategy::ITERATE: { // // We set up another branch task on the new result and we stay alive to // process any new results. // (void) new BranchTask(strategyStackManager, this, resultIndex, initialStrategy, successAction, successStrategy, failureAction, failureStrategy, pending, insertionPoint); break; } default: CantHappen("bad success action"); } return SURVIVE; } StrategicExecution::Survival BranchTask::executionsExhausted(StrategicProcess* insertionPoint) { if (!success) { // // We didn't have any successes with initial strategy from the original term. // switch (failureAction) { case BranchStrategy::FAIL: break; case BranchStrategy::IDLE: { (void) new DecompositionProcess(startIndex, pending, this, insertionPoint); break; } case BranchStrategy::NEW_STRATEGY: { // // Start a new process that applies the failure strategy followed by the pending // strategies to the original term. It will report to our owner. // DecompositionProcess* p = new DecompositionProcess(startIndex, pending, this, insertionPoint); p->pushStrategy(strategyStackManager, failureStrategy); break; } default: CantHappen("bad failure action"); } } // // We don't have any more slave executions so we can pack up and go home. // return DIE; } Maude-2.6/src/StrategyLanguage/concatenationStrategy.hh0000644000147300135640000000277110524235450020302 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for concatenation strategy combinator. // #ifndef _concatenationStrategy_hh_ #define _concatenationStrategy_hh_ #include "strategyExpression.hh" class ConcatenationStrategy : public StrategyExpression { public: ConcatenationStrategy(const Vector strategies); ~ConcatenationStrategy(); const Vector& getStrategies() const; StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: const Vector strategies; }; inline const Vector& ConcatenationStrategy::getStrategies() const { return strategies; } #endif Maude-2.6/src/StrategyLanguage/strategicExecution.hh0000644000147300135640000000377311446472671017622 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Base class for an item of strategic execution that is owned by a task. // #ifndef _strategicExecution_hh_ #define _strategicExecution_hh_ class StrategicExecution { NO_COPYING(StrategicExecution); public: // // Return values to indicate whether the StrategicExecution object // called should be deleted, possibly after some book-keeping. // enum Survival { DIE, SURVIVE }; StrategicExecution(StrategicTask* owner); StrategicExecution(StrategicExecution* other); // // Needed so that things can be deleted through a StrategicExecution*. // virtual ~StrategicExecution(); StrategicExecution* getNextSlave() const; void finished(StrategicProcess* insertionPoint); void succeeded(int resultIndex, StrategicProcess* insertionPoint); StrategicTask* getOwner() const; private: StrategicTask* const owner; // our owner StrategicExecution* prev; // previous execution belonging to owner StrategicExecution* next; // next exectution belonging to owner }; inline StrategicExecution* StrategicExecution::getNextSlave() const { return next; } inline StrategicTask* StrategicExecution::getOwner() const { return owner; } #endif Maude-2.6/src/StrategyLanguage/decompositionProcess.hh0000644000147300135640000000412711446505626020153 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for a process that tries to decompose a strategy to reach a leaf. // #ifndef _decompositionProcess_hh_ #define _decompositionProcess_hh_ #include "strategicProcess.hh" #include "strategyStackManager.hh" class DecompositionProcess : public StrategicProcess { public: DecompositionProcess(int dagIndex, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* other); // // We can't pass const here because we need to touch original to // handle double linking both on the task list and the process queue. // DecompositionProcess(DecompositionProcess* original); Survival run(StrategicSearch& searchObject); void pushStrategy(StrategyStackManager& stackManager, StrategyExpression* strategy); StrategyStackManager::StackId getPending() const; int getDagIndex() const; private: int dagIndex; StrategyStackManager::StackId pending; }; inline void DecompositionProcess::pushStrategy(StrategyStackManager& stackManager, StrategyExpression* strategy) { pending = stackManager.push(pending, strategy); } inline StrategyStackManager::StackId DecompositionProcess::getPending() const { return pending; } inline int DecompositionProcess::getDagIndex() const { return dagIndex; } #endif Maude-2.6/src/StrategyLanguage/branchTask.hh0000644000147300135640000000421111446507145016010 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for task that will make a branch in the strategy depending // on what happens with some initial strategy. // #ifndef _branchTask_hh_ #define _branchTask_hh_ #include "strategicTask.hh" #include "branchStrategy.hh" #include "strategyStackManager.hh" class BranchTask : public StrategicTask { NO_COPYING(BranchTask); public: BranchTask(StrategyStackManager& strategyStackManager, StrategicExecution* sibling, int startIndex, StrategyExpression* initialStrategy, BranchStrategy::Action successAction, StrategyExpression* successStrategy, BranchStrategy::Action failureAction, StrategyExpression* failureStrategy, StrategyStackManager::StackId pending, StrategicProcess* insertionPoint); // // Call-backs for interesting events. // virtual Survival executionSucceeded(int resultIndex, StrategicProcess* insertionPoint); virtual Survival executionsExhausted(StrategicProcess* insertionPoint); private: StrategyStackManager& strategyStackManager; const int startIndex; StrategyExpression* const initialStrategy; BranchStrategy::Action successAction; StrategyExpression* const successStrategy; BranchStrategy::Action failureAction; StrategyExpression* const failureStrategy; StrategyStackManager::StackId pending; bool success; }; #endif Maude-2.6/src/StrategyLanguage/rewriteTask.hh0000644000147300135640000000532711446504754016250 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for task that solves a rewrite condition fragment by initiating // a search with a substrategy. // #ifndef _rewriteTask_hh_ #define _rewriteTask_hh_ #include "strategicTask.hh" #include "strategyStackManager.hh" class RewriteTask : public StrategicTask { NO_COPYING(RewriteTask); public: RewriteTask(StrategicSearch& searchObject, SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, Substitution* substitutionSoFar, Rule* rule, int fragmentNr, const Vector& strategies, int strategyNr, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* insertionPoint); ~RewriteTask(); // // Call-backs for interesting events. // virtual Survival executionSucceeded(int resultindex, StrategicProcess* insertionPoint); virtual Survival executionsExhausted(StrategicProcess* insertionPoint); private: const HashConsSet& hashConsSet; // reference to shared hash cons set SharedRewriteSearchState::Ptr rewriteState; // smart pointer to rewrite state that found our redex const PositionState::PositionIndex redexIndex; // index of redex withing rewrite state ExtensionInfo* extensionInfoCopy; // copy of extension info from original match Rule* const rule; // pointer to rule whose lhs matched const int fragmentNr; // number of condition fragment within rule const Vector& strategies; // vector of strategies for rewrite fragments const int strategyNr; // number of next strategy to use StrategyStackManager::StackId pending; // continuation once we finally do a rewrite RewriteConditionFragment* rcf; // // We generate a fresh subcontext to evaluate the lhs of the rewrite condition fragment. // RewritingContext* newContext; }; #endif Maude-2.6/src/StrategyLanguage/sharedRewriteSearchState.hh0000644000147300135640000000321711444247411020667 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for a simplified RewriteSearchState, together with reference counting smart pointers to // determine when it is deleted, when it gets shared between multiple users. // #ifndef _sharedRewriteSearchState_hh_ #define _sharedRewriteSearchState_hh_ #include "rewriteSearchState.hh" class SharedRewriteSearchState : private RewriteSearchState { public: class Ptr { public: Ptr(RewritingContext* parentContext, DagNode* start, int label, int maxDepth); Ptr(const Ptr& other); ~Ptr(); RewriteSearchState* operator->(); private: SharedRewriteSearchState* ptr; }; private: SharedRewriteSearchState(RewritingContext* parentContext, DagNode* start, int label, int maxDepth); int refCount; }; inline RewriteSearchState* SharedRewriteSearchState::Ptr::operator->() { return ptr; } #endif Maude-2.6/src/StrategyLanguage/strategyExpression.hh0000644000147300135640000000241010524216322017637 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for expressions in the strategy language. // #ifndef _strategyExpression_hh_ #define _strategyExpression_hh_ #include "strategicExecution.hh" class StrategyExpression { public: virtual ~StrategyExpression() {} virtual StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) = 0; }; ostream& operator<<(ostream& s, StrategyExpression* strategy); #endif Maude-2.6/src/StrategyLanguage/strategyStackManager.hh0000644000147300135640000000417411444243560020057 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for managing a collection of persistent stacks of strategies with sharing. // #ifndef _strategyStackManager_hh_ #define _strategyStackManager_hh_ class StrategyStackManager { public: typedef int StackId; enum Constants { EMPTY_STACK = 0 }; StrategyStackManager(); static StackId emptyStack(); bool empty(StackId stackId) const; StrategyExpression* top(StackId stackId) const; StackId pop(StackId stackId) const; StackId push(StackId stackId, StrategyExpression* strategy); private: struct Entry { StrategyExpression* strategy; StackId restOfStack; // // This fields are use solelyto keep a linked list of entries having // the same restOfStack so we can minimize the creation of duplicate // entries. // StackId firstSuccessor; // first stack that has us as restOfStack StackId nextPeer; // next stack that shares our restOfStack }; Vector stackTable; }; inline bool StrategyStackManager::empty(StackId stackId) const { return stackId == EMPTY_STACK; } inline StrategyExpression* StrategyStackManager::top(StackId stackId) const { return stackTable[stackId].strategy; } inline StrategyStackManager::StackId StrategyStackManager::pop(StackId stackId) const { return stackTable[stackId].restOfStack; } #endif Maude-2.6/src/StrategyLanguage/trivialStrategy.cc0000644000147300135640000000300510476151734017114 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "trivialStrategy.hh" #include "decompositionProcess.hh" TrivialStrategy::TrivialStrategy(bool result) : result(result) { } StrategicExecution::Survival TrivialStrategy::decompose(StrategicSearch& /* searchObject */, DecompositionProcess* /* remainder */) { // // If we are idle, remainder survives; if we are fail, remainder dies. // return result ? StrategicExecution::SURVIVE : StrategicExecution::DIE; } Maude-2.6/src/StrategyLanguage/strategicExecution.cc0000644000147300135640000000656711446472611017606 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class StrategicTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "strategicExecution.hh" #include "strategicTask.hh" StrategicExecution::StrategicExecution(StrategicTask* owner) : owner(owner) { // // This ctor is only used for initializing the dummy list element. // prev = next = this; // needed for insertions to work correctly } StrategicExecution::StrategicExecution(StrategicExecution* other) : owner(other->owner) { // // This ctor inserts us into "other"s owners list of slaves before "other". // prev = other->prev; prev->next = this; next = other; next->prev = this; } StrategicExecution::~StrategicExecution() { // // We don't unlink from owners slave list here. Either we were deleted by // owner, in which case the owner has taken care of that, or we // requested deletion (running process) or we requested deletion by the return // value of executionSucceeded() or executionsExhausted() (task) and // a succeeded() or finished() call would have unlinked us. // // The upshot of this is that a StrategicProcess must always call succeeded() or // finished() before requesing deletion, otherwise there will be a dangling pointer // in its owners slave list. // } void StrategicExecution::finished(StrategicProcess* insertionPoint) { // // First we remove ourselves from our owners list of slaves. // prev->next = next; next->prev = prev; // // Then if we were the only slave on the list we report that. // if (next == prev) { if (owner->executionsExhausted(insertionPoint) == DIE) { owner->finished(insertionPoint); delete owner; } } } void StrategicExecution::succeeded(int resultIndex, StrategicProcess* insertionPoint) { // // Can an execution succceed multiple times? // - might be necessary for condition fragments. // // First we remove ourselves from our owners list of slaves. // prev->next = next; next->prev = prev; // // Then we report our success to our owner. // if (owner->executionSucceeded(resultIndex, insertionPoint) == DIE) { owner->finished(insertionPoint); delete owner; return; } // // Then if we were the only slave on the list we report that. // if (next == prev) { if (owner->executionsExhausted(insertionPoint) == DIE) { owner->finished(insertionPoint); delete owner; } } } Maude-2.6/src/StrategyLanguage/applicationProcess.hh0000644000147300135640000000454311446507372017604 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for applying rls. // #ifndef _applicationProcess_hh_ #define _applicationProcess_hh_ #include "strategicProcess.hh" #include "sharedRewriteSearchState.hh" #include "strategyStackManager.hh" class ApplicationProcess : public StrategicProcess { NO_COPYING(ApplicationProcess); public: ApplicationProcess(StrategicSearch& searchObject, int startIndex, ApplicationStrategy* strategy, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* insertionPoint); Survival run(StrategicSearch& searchObject); static StrategicExecution::Survival resolveRemainingConditionFragments(StrategicSearch& searchObject, SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, Substitution* substitutionSoFar, Rule* rule, int fragmentNr, const Vector& strategies, int strategyNr, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* other); private: static int doRewrite(StrategicSearch& searchObject, SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, Substitution* substitution, Rule* rule); SharedRewriteSearchState::Ptr rewriteState; StrategyStackManager::StackId pending; ApplicationStrategy* strategy; }; #endif Maude-2.6/src/StrategyLanguage/decompositionProcess.cc0000644000147300135640000000550311446472465020144 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class StrategicTask. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" #include "dagNode.hh" // strategy language class definitions #include "decompositionProcess.hh" #include "strategyExpression.hh" #include "strategicSearch.hh" DecompositionProcess::DecompositionProcess(int dagIndex, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* other) : StrategicProcess(taskSibling, other), dagIndex(dagIndex), pending(pending) { Assert(pending >= 0, "bad pending stack id " << pending); } DecompositionProcess::DecompositionProcess(DecompositionProcess* original) : StrategicProcess(original, original), dagIndex(original->dagIndex), pending(original->pending) { // // A copy of a process will be owned by same task as original and will // get put in the process queue just ahead of original. It will share // the dagIndex and persistant pending stack. // // Clones are handy when we want to explore several alternative futures in parallel. // } StrategicExecution::Survival DecompositionProcess::run(StrategicSearch& searchObject) { DebugAdvisory("DecompositionProcess::run(), dagIndex = " << dagIndex << " for " << searchObject.getCanonical(dagIndex)); if (getOwner()->alreadySeen(dagIndex, pending)) { DebugAdvisory("we've already been here: " << searchObject.getCanonical(dagIndex) << ", " << pending); finished(this); return DIE; } if (pending == StrategyStackManager::EMPTY_STACK) { // // Report our success. // succeeded(dagIndex, this); // // Request deletion. // return DIE; } StrategyExpression* s = searchObject.top(pending); pending = searchObject.pop(pending); Survival r = s->decompose(searchObject, this); if (r == DIE) finished(this); return r; } Maude-2.6/src/StrategyLanguage/ChangeLog0000644000147300135640000010575411446507411015173 000000000000002010-09-22 Steven Eker * applicationProcess.hh (class ApplicationProcess): updated decl for doRewrite() * branchTask.hh (class BranchTask): startIndex replaces startDag; updated decl for ctor * branchTask.cc (BranchTask::BranchTask): take startIndex rather than startDag (BranchTask::executionSucceeded): use startIndex rather than startDag (BranchTask::executionsExhausted): use startIndex rather than startDag * applicationProcess.hh (class ApplicationProcess): updated decl for ctor * applicationProcess.cc (ApplicationProcess::ApplicationProcess): take startIndex rather than startDag * applicationStrategy.cc (ApplicationStrategy::decompose): use getDagIndex() in place of getDag() * testStrategy.cc (TestStrategy::decompose): use getDagIndex() * branchStrategy.cc (BranchStrategy::decompose): use getDagIndex() rather than getDag() * applicationProcess.cc (ApplicationProcess::doRewrite): return result index (ApplicationProcess::run): use resultIndex * rewriteTask.cc (RewriteTask::RewriteTask): pass an index to DecompositionProcess() * rewriteTask.hh (class RewriteTask): updated decl for executionSucceeded() * rewriteTask.cc (RewriteTask::RewriteTask): initialize hashConsSet (RewriteTask::executionSucceeded): use hashConsSet and resultIndex * rewriteTask.hh (class RewriteTask): added data member hashConsSet * branchTask.hh (class BranchTask): updated decl for executionSucceeded() * branchTask.cc (BranchTask::executionSucceeded): use resultIndex rather than result * strategicSearch.cc (StrategicSearch::executionSucceeded): take resultIndex rather than result (StrategicSearch::findNextSolution): use solutionIndex * strategicSearch.hh (class StrategicSearch): solution becomes solutionIndex * strategicSearch.cc (StrategicSearch::StrategicSearch): call insert() to get a dagIndex to pass to DecompositionProcess() * strategicSearch.hh (class StrategicSearch): updated decl for executionSucceeded() * strategicTask.hh (class StrategicTask): updated decl for resultIndex * strategicExecution.hh (class StrategicExecution): updated decl for succeeded() * strategicExecution.cc (StrategicExecution::succeeded): take resultIndex rather than result * decompositionProcess.cc (DecompositionProcess::DecompositionProcess): take dagIndex (both versions) (DecompositionProcess::run): no need to look up dagIndex * decompositionProcess.hh (class DecompositionProcess): update ctor decl (class DecompositionProcess): dag becomes dagIndex (DecompositionProcess::getDag): becomes getDagIndex() 2010-09-16 Steven Eker * decompositionProcess.cc (DecompositionProcess::run): use HashConsSet rather than DagNodeCache * applicationProcess.cc (ApplicationProcess::doRewrite): use HashConsSet rather than DagNodeCache * strategicSearch.hh (class StrategicSearch): derive from HashConsSet rather than DagNodeCache ===================================Maude95=========================================== 2008-09-11 Steven Eker * applicationProcess.cc (resolveRemainingConditionFragments): remove cute coding; don't look up a AssignmentConditionFragment* twice ===================================Maude91a=========================================== 2007-09-28 Steven Eker * applicationProcess.cc (resolveRemainingConditionFragments): justify two uses of clone() and turn one into a copy() (doRewrite): justify use of clone() * rewriteTask.cc (RewriteTask, executionSucceeded): justify use of clone() ===================================Maude89h=========================================== 2007-01-23 Steven Eker * strategicTask.cc (alreadySeen): ugly hack to avoid a UMR in purify 2006-12-15 Steven Eker * decompositionProcess.cc (run): check if we've been here before on behalf of the same task (run): need to call finished if we are goind to die because of redundancy * strategicExecution.hh (getOwner): added * strategicTask.cc (alreadySeen): added * strategicTask.hh (class StrategicTask): added typedefs State and SeenSet and data member seenSet and decl for alreadySeen() 2006-12-14 Steven Eker * decompositionProcess.hh (class DecompositionProcess): deleted decl for non-stack verison of DecompositionProcess() * decompositionProcess.cc (DecompositionProcess): deleted non-stack version * strategyStackManager.cc (push): fix missing return statement bug * rewriteTask.cc (RewriteTask): pass a StackId to DecompositionProcess() * strategicSearch.cc (StrategicSearch): pass a StackId to DecompositionProcess() * rewriteTask.cc (RewriteTask): update pending argument * rewriteTask.hh (class RewriteTask): use StrategyStackManager for pending * matchProcess.cc (MatchProcess): update pending argument * matchProcess.hh (class MatchProcess): use StrategyStackManager for pending * branchTask.cc (BranchTask): initialize strategyStackManager; use a push() in order to call stack version of DecompositionProcess() (executionsExhausted, executionSucceeded): use strategyStackManager (executionSucceeded): pass strategyStackManager to our ctor * branchTask.hh (class BranchTask): added strategyStackManager data member * unionStrategy.cc (decompose): update now that we need to pass strategy manager to pushStrategy() * concatenationStrategy.cc (decompose): update now that we need to pass strategy manager to pushStrategy() * iterationStrategy.cc (decompose): update now that we need to pass strategy manager to pushStrategy() * branchStrategy.cc (decompose): pass strategyStackManager arg * branchTask.hh (class BranchTask): update decls as pending is now a StrategyStackManager::StackId * applicationProcess.cc: rewritten using class StrategyStackManager * applicationProcess.hh (class ApplicationProcess): update decls as pending is now a StrategyStackManager::StackId * decompositionProcess.cc (run): rewritten using StrategyStackManager * strategyStackManager.hh (class StrategyStackManager): added enum Constants * strategicExecution.hh (class StrategicExecution): deleted typedef StrategyStack * decompositionProcess.hh (class DecompositionProcess): update decls as pending is now a StrategyStackManager::StackId (pushStrategy): rewritten * strategicSearch.hh (class StrategicSearch): derive from StrategyStackManager * strategyLanguage.hh: added fwd decl for class StrategyStackManager 2006-12-13 Steven Eker * strategyStackManager.hh: created * strategyStackManager.cc: created ===================================Maude88d=========================================== 2006-11-10 Steven Eker * strategicSearch.hh (class StrategicSearch): added data member strategy and decl for dtor * strategicSearch.cc (StrategicSearch): save strategy (~StrategicSearch): added * testStrategy.cc (decompose): make test with unbound variables in condition always fail * matchProcess.cc (run): fixed uninitialized success bug 2006-11-09 Steven Eker * rewriteTask.hh (class RewriteTask): update decl for ctor * matchProcess.cc (run): use transferCount() to keep track of any rewrites generated by solve * applicationProcess.cc (resolveRemainingConditionFragments): use transferCount() to keep track of rewrites from reduction in assignment case * rewriteTask.cc (RewriteTask): take searchObject; use it to add in rewrite counts from reduction * applicationProcess.cc (resolveRemainingConditionFragments): fix a bug where we were losing eager copies of variables made by solve() (resolveRemainingConditionFragments): pass searchObject to RewriteTask() 2006-11-08 Steven Eker * applicationProcess.cc: ignore rewrites where the number of rewrite condition fragments in the rule differs from the number of substrategies * testStrategy.hh (getPatternTerm, getDepth, getCondition): added * branchStrategy.cc (BranchStrategy): rearranged initializers * branchStrategy.hh (class BranchStrategy): rearranged data members for better storage on 64bit matchines (getInitialStrategy, getSuccessStrategy, getFailureStrategy) (getSuccessAction, getFailureAction): added 2006-11-07 Steven Eker * unionStrategy.hh (getStrategies): added * iterationStrategy.hh (getStrategy): added (getZeroAllowed): added * concatenationStrategy.hh (getStrategies): added * strategyExpression.hh: added decl for operator<< * trivialStrategy.hh (getResult): added 2006-11-06 Steven Eker * strategyLanguage.hh: added classes MatchProcess and RewriteTask * rewriteTask.cc (executionSucceeded): use MatchProcess() * matchProcess.hh: created * matchProcess.cc: created * applicationProcess.cc (resolveRemainingConditionFragments): rewritten using MatchProcess * assignmentProcess.cc (run): new resolveRemainingConditionFragments() convention * applicationProcess.cc (run): new resolveRemainingConditionFragments() convention * assignmentProcess.hh (class AssignmentProcess): updated decl for one of the ctors * assignmentProcess.cc (AssignmentProcess): use substitutionSoFar instead of context * rewriteTask.cc (RewriteTask): use substitutionSoFar instead of context * rewriteTask.hh (class RewriteTask): updated decl for ctor * applicationProcess.hh (class ApplicationProcess): updated decl for resolveRemainingConditionFragments() * applicationProcess.cc (resolveRemainingConditionFragments) (doRewrite): rootContext -> baseContext (resolveRemainingConditionFragments): context -> substitutionSoFar 2006-11-03 Steven Eker * applicationProcess.cc (run): pass searchObject to doRewrite() (doRewrite): take search object; context now becomes just a substitution (resolveRemainingConditionFragments): pass searchObject to doRewrite() (doRewrite): handle caching new dag in searchObject (resolveRemainingConditionFragments): create special context to pass to solve() so we have the correct substituion as well as the correct root term; this fixes a bug that we weren't taking into account bindings made by previous condition fragments 2006-11-02 Steven Eker * rewriteTask.cc (RewriteTask): fix bug where rcf was declared local 2006-10-31 Steven Eker * applicationProcess.cc (resolveRemainingConditionFragments): use RewriteTask() * assignmentProcess.hh (class AssignmentProcess): added decl for rewrite version of ctor * assignmentProcess.cc (AssignmentProcess): added rewrite version 2006-10-30 Steven Eker * rewriteTask.hh: created * rewriteTask.cc: created 2006-10-26 Steven Eker * applicationProcess.cc (doRewrite): use new rebuildDag() semantics to fix trace bug 2006-10-25 Steven Eker * applicationProcess.cc (doRewrite): create a tracingContext that has both the correct whole term and the correct substitution; get hold of the redex specified by redexIndex using the PositionIndex version of getDagNode() * strategicSearch.cc (findNextSolution): check for aborts * assignmentProcess.cc (run): rewritten to make sure we call finished() before we return DIE * applicationProcess.cc (run): make sure we call finished() before we return DIE * assignmentProcess.cc (AssignmentProcess): fixed bug where we were storing new context in a local variable (run): call finished() when done 2006-10-24 Steven Eker * applicationProcess.cc (doRewrite): use context rather than substitution since we need to be able to trace substitutions via a context call * assignmentProcess.cc (run): use new resolveRemainingConditionFragments() conventions (AssignmentProcess): handle null extension info * applicationProcess.cc (resolveRemainingConditionFragments): rewritten to be more general (resolveRemainingConditionFragments): use AssignmentProcess() * applicationProcess.hh (doRewrite): deleted (class ApplicationProcess): update decl for resolveRemainingConditionFragments() * applicationProcess.cc (run): use new resolveRemainingConditionFragments() and doRewrite() conventions * applicationProcess.hh (doRewrite): updated * applicationProcess.cc (doRewrite): rewritten to take a substitution rather than a context (run): use simplified doRewrite() 2006-10-23 Steven Eker * applicationProcess.hh (class ApplicationProcess): added decl for new doRewrite() (doRewrite): added * applicationProcess.cc (doRewrite): rewritten to handle redexIndex, extensionInfo, substitution and rule that may have be saved from an earlier state of rewriteState * applicationProcess.hh (class ApplicationProcess): make resolveRemainingConditionFragments() static * assignmentProcess.hh: rewritten 2006-10-20 Steven Eker * assignmentProcess.cc: rewritten from scratch 2006-10-18 Steven Eker * strategyLanguage.hh: added class SharedRewriteSearchState 2006-10-17 Steven Eker * applicationProcess.cc: use SharedRewriteSearchState (~ApplicationProcess): deleted * applicationProcess.hh (class ApplicationProcess): use SharedRewriteSearchState; deleted data member initial * sharedRewriteSearchState.hh: created * sharedRewriteSearchState.cc: created 2006-10-11 Steven Eker * testStrategy.cc (decompose): pass depth to MatchSearchState() * testStrategy.hh: anywhere data member becomes depth; update decl for ctor * testStrategy.cc (TestStrategy): take depth arg ===================================Maude88b=========================================== 2006-09-29 Steven Eker * assignmentProcess.cc (AssignmentProcess): created * assignmentProcess.hh: created * applicationProcess.hh (class ApplicationProcess): updated decl for ctor * applicationProcess.cc (ApplicationProcess): take searchObject rather than context * applicationStrategy.cc (decompose): pass searchObject rather than context to ApplicationProcess() * applicationProcess.hh (class ApplicationProcess): updated decl for resolveRemainingConditionFragments(); delete data member context * applicationProcess.cc (ApplicationProcess): don't save context - just use it to make initial subcontext (resolveRemainingConditionFragments): don't take context; use getContext() (run): don't pass context to resolveRemainingConditionFragments(); use getContext() 2006-09-28 Steven Eker * applicationProcess.cc (run): use resolveRemainingConditionFragments() * applicationProcess.hh (class ApplicationProcess): added decl for resolveRemainingConditionFragments() (class ApplicationProcess): added data member strategy * applicationProcess.cc (doRewrite): become static; take rewriteState and context arguments (run): new doRewrite() convention (resolveRemainingConditionFragments): added * applicationProcess.hh (class ApplicationProcess): removed decl for run2(); added decl for doRewrite() * applicationProcess.cc (run2): deleted (run): rewritten (doRewrite): added 2006-09-27 Steven Eker * applicationStrategy.cc (decompose): use new ApplicationProcess convention * applicationProcess.hh (class ApplicationProcess): updated decl for ApplicationProcess() * applicationProcess.cc (ApplicationProcess): rewritten using new convention for passing ApplicationStrategy info * applicationStrategy.hh (getTop, getLabel, getVariables) (getValues, getStrategies): added * applicationProcess.cc (ApplicationProcess): pass IGNORE_CONDITION to rewriteState ctor 2006-09-15 Steven Eker * testStrategy.hh (class TestStrategy): withExtension becomes anywhere * testStrategy.cc (TestStrategy): withExtension becomes anywhere (decompose): withExtension becomes anywhere; allow unbounded depth in anywhere case 2006-09-14 Steven Eker * testStrategy.cc (decompose): implemented using class MatchSearchState 2006-09-13 Steven Eker * testStrategy.hh (class TestStrategy): need withExtension data member after all * testStrategy.cc (TestStrategy): check for unbound variables * testStrategy.hh (class TestStrategy): replace existing data members with pattern (class TestStrategy): update ctor decl * testStrategy.cc (TestStrategy): rewritten * strategyLanguage.hh: added class TestStrategy * testStrategy.cc: created * testStrategy.hh (class TestStrategy, class TestStrategy): update ctor decl; added data members condition and withExtension 2006-09-01 Steven Eker * testStrategy.hh (class TestStrategy): created * stateCache.hh: deleted * stateCache.cc: deleted * strategyLanguage.hh: rm class StateCache * branchStrategy.cc (decompose): use Survival data type * branchStrategy.hh (class BranchStrategy): update decl for decompose() * concatenationStrategy.cc (decompose): use Survival data type * concatenationStrategy.hh (class ConcatenationStrategy): update decl for decompose() * unionStrategy.cc (decompose): use Survival data type * unionStrategy.hh (class UnionStrategy): update decl for decompose() * iterationStrategy.cc (decompose): use Survival data type * iterationStrategy.hh (class IterationStrategy): update decl for decompose() * trivialStrategy.cc (decompose): rewritten * trivialStrategy.hh (class TrivialStrategy): update decl for decompose() * applicationStrategy.cc (decompose): use Survival data type * applicationStrategy.hh (class ApplicationStrategy): update decl for decompose() * strategicSearch.cc (findNextSolution): use Survival data type * strategyExpression.hh (class StrategyExpression): updated decl for decompose(); made pure virtual * strategicProcess.hh (class StrategicProcess): updated decl for run() * applicationProcess.hh (class ApplicationProcess): updated decl for run() * applicationProcess.cc (run): use Survival data type * decompositionProcess.hh (class DecompositionProcess): updated decl for run() * decompositionProcess.cc (run): use Survival data type * iterationStrategy.cc (decompose): remove normalForm Assert() (~IterationStrategy): simplified * iterationStrategy.hh (class IterationStrategy): rm zeroAllowed data member * iterationStrategy.cc (IterationStrategy): rewritten * iterationStrategy.hh (class IterationStrategy): rm normalForm data member; update ctor decl * strategyLanguage.hh: removed classes TrivialSetGenerator, ApplicationSetGenerator, SetGenerator, ConcatenationSetGenerator, IterationSetGenerator, BranchSetGenerator, UnionSetGenerator * setGenerator.hh: deleted * unionSetGenerator.cc: deleted * unionSetGenerator.hh: deleted * branchSetGenerator.cc: deleted * branchSetGenerator.hh: deleted * iterationSetGenerator.cc: deleted * iterationSetGenerator.hh: deleted * concatenationSetGenerator.cc: deleted * concatenationSetGenerator.hh: deleted * applicationSetGenerator.cc: deleted * applicationSetGenerator.hh: deleted * trivialSetGenerator.cc: deleted * trivialSetGenerator.hh: deleted * applicationStrategy.cc (execute): deleted * applicationStrategy.hh (class ApplicationStrategy): remove decl for execute() * trivialStrategy.cc (execute): deleted * trivialStrategy.hh (class TrivialStrategy): remove decl for execute() * iterationStrategy.hh (class IterationStrategy): remove decl for execute() * iterationStrategy.cc (execute): deleted * branchStrategy.cc (execute): deleted * branchStrategy.hh (class BranchStrategy): remove decl for execute() * concatenationStrategy.cc (execute): deleted * concatenationStrategy.hh (class ConcatenationStrategy): remove decl for execute() * unionStrategy.cc (execute): deleted * unionStrategy.hh (class UnionStrategy): remove decl for execute() * strategyExpression.hh (class StrategyExpression): remove decl for execute() * strategyLanguage.hh: removed class UnaryStrategy, class UnarySetGenerator * unarySetGenerator.cc: deleted * unarySetGenerator.hh (class UnarySetGenerator): deleted * unaryStrategy.hh: deleted * unaryStrategy.cc: deleted 2006-08-30 Steven Eker * branchStrategy.hh (class BranchStrategy): added ITERATE to enum Action * branchStrategy.cc (BranchStrategy): allow ITERATE * branchTask.cc (executionsExhausted): fixed bug where we were using successAction instead of failureAction (executionSucceeded): handle ITERATE case * branchStrategy.cc (BranchStrategy): rewritten (execute): rewritten (decompose): rewritten (BranchStrategy): added Assert()s (~BranchStrategy): updated * branchStrategy.hh (class BranchStrategy): added data members successAction and failureAction; renamed existing data members; updated ctor 2006-08-28 Steven Eker * strategicSearch.hh (class StrategicSearch): executionSucceeded() and executionsExhausted() now return Survival * strategicSearch.cc (executionSucceeded, executionsExhausted): now return Survival * branchTask.cc (executionsExhausted): rewritten (executionSucceeded): rewritten * branchTask.hh (class BranchTask): update decls for executionSucceeded() and executionsExhausted() * strategicExecution.cc (finished): handle return value from executionsExhausted() (succeeded): handle return values from executionSucceeded() and executionsExhausted() * strategicTask.hh (class StrategicTask): executionSucceeded() and executionsExhausted() now return survival flag * strategicExecution.hh (class StrategicExecution): added enum Survival * branchTask.hh (class BranchTask): remove enum Action * branchStrategy.hh (class BranchStrategy): added enum Action * branchStrategy.cc (decompose): new BranchTask() convention * branchTask.cc (executionSucceeded): make use of successAction (executionsExhausted): make use of failureAction * branchTask.hh (class BranchTask): added enum Action; added successAction and failureAction to ctor arg list (class BranchTask): added data members successAction and failureAction * strategicSearch.cc (StrategicSearch): disambig call to StrategicTask() * branchStrategy.cc (decompose): added * strategicTask.cc (StrategicTask): added sibling based ctor * strategicTask.hh (class StrategicTask): added decl for sibling based ctor * branchTask.hh (class BranchTask): updated decl for ctor * branchTask.cc (BranchTask): take sibling rather than master * branchStrategy.hh (class BranchStrategy): added decl for decompose() * branchTask.cc (executionsExhausted): use finished() rather than failed() * applicationProcess.cc (run): use finished() rather than failed() * decompositionProcess.cc (run): new convention for succeeded(); use finished() rather than failed() * strategicExecution.cc (failed): becomes finished(); use new insertionPoint convention (succeeded): use new insertionPoint convention * strategicSearch.hh (class StrategicSearch): updated decls for executionSucceeded(), executionsExhausted() * strategicExecution.hh (class StrategicExecution): updated decl for succeeded(), failed() becomes finished() * strategicTask.hh (class StrategicTask): updated decls for executionSucceeded(), executionsExhausted() * branchTask.hh (class BranchTask): updated decls for executionSucceeded(), executionsExhausted() * branchTask.cc (executionSucceeded, executionsExhausted): take insertionPoint arg 2006-08-25 Steven Eker * strategyLanguage.hh: added class BranchTask * branchTask.cc: created * branchTask.hh: created 2006-08-24 Steven Eker * iterationStrategy.hh (class IterationStrategy): added data member star * iterationStrategy.cc (decompose): added (IterationStrategy): create * subexpression in + case (~IterationStrategy): handle * subexpression (decompose): handle + case * iterationStrategy.hh (class IterationStrategy): added decl for decompose() * unionStrategy.cc (decompose): added * unionStrategy.hh (class UnionStrategy): added decl for decompose() * trivialStrategy.cc (decompose): take StrategicSearch&; don't call failed() * trivialStrategy.hh (class TrivialStrategy): updated decl for decompose() * strategicSearch.cc (findNextSolution): fix bad assert - if del == false we haven't run out of processes * concatenationStrategy.cc (decompose): fix obiwan bug in loop start * decompositionProcess.cc (run): call failed to unlink ourself if we are requesting destruction * applicationProcess.hh (class ApplicationProcess): fixed nasty bug where we were storing a reference to pending rather than a copy 2006-08-15 Steven Eker * decompositionProcess.cc (DecompositionProcess): fixed dag/start bug * strategicSearch.cc (StrategicSearch): added Assert()s for arguments * decompositionProcess.cc (DecompositionProcess): (2 versions) added Assert() * decompositionProcess.hh (getDag): added Assert() * applicationStrategy.cc (decompose): updated * concatenationStrategy.cc (decompose): updated * applicationStrategy.hh (class ApplicationStrategy): updated decl for decompose() * concatenationStrategy.hh (class ConcatenationStrategy): updated decl for decompose() * strategyExpression.hh (class StrategyExpression): updated decl for decompose() * decompositionProcess.cc (run): updated * applicationProcess.cc (run): updated * applicationProcess.hh (class ApplicationProcess): updated decl for run() * decompositionProcess.hh (class DecompositionProcess): updated decl for run() * strategicProcess.hh (class StrategicProcess): updated decl for run() * strategicSearch.cc (StrategicSearch): added * strategicTask.hh (getDummyExecution): added * strategicTask.cc (~StrategicTask): make consistent * strategicTask.hh (class StrategicTask): slaveList is a StrategicExecution not a StrategicExecution* * strategicSearch.hh (class StrategicSearch): added decl for getContext(); added data member initial (getContext): added 2006-08-14 Steven Eker * decompositionProcess.hh (getDag): added * applicationStrategy.hh (class ApplicationStrategy): added decl for decompose() * strategyLanguage.hh: add class ApplicationProcess; rm class StrategicProcessLink * applicationProcess.hh: created * applicationProcess.cc: created * strategicExecution.hh (class StrategicExecution): added typedef StrategyStack * decompositionProcess.hh (getPending): added (class DecompositionProcess): added decl for new ctor (class DecompositionProcess): removed typedef StrategyStack * concatenationStrategy.cc (decompose): added * concatenationStrategy.hh (class ConcatenationStrategy): added decl for decompose() 2006-08-11 Steven Eker * trivialStrategy.hh (class TrivialStrategy): added decl for decompose() * trivialStrategy.cc (decompose): added * strategyLanguage.hh: added class DecompositionProcess * strategyExpression.hh (class StrategyExpression): added new member function decompose() * decompositionProcess.cc: created (DecompositionProcess): take pointer rather than const ref for copy version * decompositionProcess.hh (pushStrategy): added (class DecompositionProcess): use stack<> rather than list<> 2006-08-10 Steven Eker * decompositionProcess.hh: created * strategicSearch.cc (findNextSolution): rewritten without explicit process queue * strategicProcess.hh (class StrategicProcess): derive from Strategic execution * strategicProcessLink.cc: becomes strategicProcess.cc * strategicProcessLink.hh: becomes strategicProcess.hh * strategicSearch.cc: new conventions * strategicSearch.hh: rewritten * strategyLanguage.hh: added classes StrategicProcessLink and StrategicProcess * strategicProcessLink.cc: created * strategicProcessLink.hh: created 2006-08-09 Steven Eker * strategicExecution.cc (succeeded): need to report executionsExhausted() (StrategicExecution): we do need to initialize to this pointer after all (StrategicExecution): insert before rather than after (~StrategicExecution): added * strategicTask.cc: rewritten to new design * strategicExecution.hh (getNextSlave): added * strategicTask.hh: rewritten to new design * strategicExecution.cc (StrategicExecution): initializing prev and next to 0 is as good as anything and should ease debugging 2006-08-08 Steven Eker * strategicSearch.cc: created * strategyLanguage.hh: added classes StrategicExecution, StrategicTask, StrategicSearch * strategicExecution.hh: created * strategicTask.cc: created * strategicTask.hh: created 2006-08-07 Steven Eker * strategicSearch.hh: created ===================================Maude88a=========================================== 2006-06-28 Steven Eker * iterationSetGenerator.cc (findNextSolution): fix new bug introduced by last fix (IterationSetGenerator): replace done with started (findNextSolution): use started hack rather that done * iterationSetGenerator.hh (class IterationSetGenerator): added data member done * iterationSetGenerator.cc (findNextSolution): fix bug where returning a normal form with an empty queue starts us over by using done flag (IterationSetGenerator): initialized done flag 2006-05-04 Steven Eker * strategyLanguage.hh: added class StateCache * stateCache.hh: created * stateCache.cc: created 2006-04-24 Steven Eker * strategyLanguage.hh: added classes UnaryStrategy and UnarySetGenerator 2006-04-21 Steven Eker * unarySetGenerator.cc: created * unaryStrategy.cc: created * unarySetGenerator.hh: created * unaryStrategy.hh: created 2006-04-18 Steven Eker * iterationStrategy.cc (IterationStrategy): set normalForm flag (execute): pass normalForm flag * iterationStrategy.hh (class IterationStrategy): added data member normalForm 2006-04-17 Steven Eker * iterationSetGenerator.hh (class IterationSetGenerator): updated decl for ctor * iterationSetGenerator.cc (IterationSetGenerator) (findNextSolution): support normalForm flag (IterationSetGenerator): updated * branchSetGenerator.hh (class BranchSetGenerator): rewritten for fairness * branchSetGenerator.cc: rewritten for fairness 2006-04-13 Steven Eker * applicationSetGenerator.hh (class ApplicationSetGenerator): update ctor decl * applicationStrategy.cc (execute): pass top flag to ApplicationSetGenerator() * applicationSetGenerator.cc (ApplicationSetGenerator): take and handle top flag 2006-04-12 Steven Eker * strategyLanguage.hh: removed classes StrategySequence and SequenceSetGenerator * strategySequence.hh: deleted * sequenceSetGenerator.hh: deleted * strategySequence.cc: deleted * sequenceSetGenerator.cc: deleted * concatenationSetGenerator.cc: created 2006-04-11 Steven Eker * concatenationSetGenerator.hh: created 2006-04-06 Steven Eker * concatenationStrategy.cc: created * concatenationStrategy.hh (class ConcatenationStrategy): created 2006-04-05 Steven Eker * applicationSetGenerator.cc (ApplicationSetGenerator): pass min and max depth args to RewriteSeachState init to fix bug that defaults only allow rewriting at top without extension ===================================Maude87a=========================================== 2006-03-24 Steven Eker * applicationStrategy.cc (ApplicationStrategy): need to call normalize() and prepare() on cached dags * unionSetGenerator.cc (findNextSolution): fix memory leak where we were not deleting failed set generators 2006-03-21 Steven Eker * unionSetGenerator.cc: created * unionSetGenerator.hh: created * strategyLanguage.hh: added decls for classes UnionStrategy and UnionSetGenerator * strategySequence.hh (class StrategySequence): made strategies const 2006-03-20 Steven Eker * applicationStrategy.hh (class ApplicationStrategy): fix ctor decl * applicationStrategy.cc (ApplicationStrategy): pass strategies by reference * unionStrategy.cc: created * unionStrategy.hh: created * strategyLanguage.hh: added decls for classes BranchStrategy and BranchSetGenerator * branchSetGenerator.hh: created * branchSetGenerator.cc: created * branchStrategy.hh: created * branchStrategy.cc: created 2006-03-17 Steven Eker * iterationStrategy.cc (~IterationStrategy): added 2006-03-07 Steven Eker * applicationStrategy.cc (execute): implemented * applicationSetGenerator.cc: created * strategyLanguage.hh: added class ApplicationSetGenerator * applicationSetGenerator.hh: created 2006-03-06 Steven Eker * iterationSetGenerator.cc: created * iterationSetGenerator.hh (class IterationSetGenerator): strategies -> strategy (class IterationSetGenerator): added data member start (class IterationSetGenerator): added data member zeroReturnable (class IterationSetGenerator): added typedef GenQueue 2006-02-27 Steven Eker * strategyLanguage.hh: added decls for IterationStrategy, IterationSetGenerator * iterationSetGenerator.hh: created * iterationStrategy.hh: created * iterationStrategy.cc: created * sequenceSetGenerator.cc (SequenceSetGenerator) (findNextSolution): simplified on the assumption that execute() never returns 0 (findNextSolution): change of variable * strategySequence.cc (execute): use SequenceSetGenerator() * strategyLanguage.hh: added decls for StrategySequence, TrivialSetGenerator, SequenceSetGenerator * sequenceSetGenerator.hh: updated * sequenceSetGenerator.cc: created 2006-02-15 Steven Eker * strategySequence.hh (StrategyExpression): created * trivialStrategy.cc (execute): use TrivialSetGenerator() * applicationStrategy.cc: was application.cc * applicationStrategy.hh: was application.hh * trivial.cc: becomes trivialStrategy.cc * trivial.hh: becomes trivialStrategy.hh * trivialSetGenerator.hh (class TrivialSetGenerator): created * trivialSetGenerator.cc: created * strategyLanguage.hh: created * application.cc (execute): updated * application.hh (StrategyExpression): update decl forexecute() * trivial.hh (StrategyExpression): update decl forexecute() * strategyExpression.hh (class StrategyExpression): update decl for execute() * setGenerator.hh (class SetGenerator): created 2006-02-13 Steven Eker * application.cc (Application): Assert() to check for label == NONE case * application.hh (StrategyExpression): added data member top (setTop): added 2006-02-06 Steven Eker * trivial.cc (Trivial): added ctor * trivial.hh (StrategyExpression): decl for ctor * application.cc (Application): added Assert() 2006-02-02 Steven Eker * application.cc (Application, ~Application): added 2006-02-01 Steven Eker * application.cc: created * idle.cc: becomes trivial.cc * idle.hh: becomes trivial.hh; add data member result * application.hh: created * strategyExpression.hh: created * idle.hh: created * idle.cc: created Maude-2.6/src/StrategyLanguage/testStrategy.hh0000644000147300135640000000351110524430742016426 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for idle and fail strategies. // #ifndef _testStrategy_hh_ #define _testStrategy_hh_ #include "strategyExpression.hh" #include "pattern.hh" class TestStrategy : public StrategyExpression { public: // // depth = -1 means at top, no extension // depth = 0 means at top, with extension // depth = UNBOUNDED means all the way down to the leaf nodes, with extension // TestStrategy(Term* patternTerm, int depth, const Vector& condition); Term* getPatternTerm() const; int getDepth() const; const Vector& getCondition(); StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: Pattern pattern; const int depth; }; inline Term* TestStrategy::getPatternTerm() const { return pattern.getLhs(); } inline int TestStrategy::getDepth() const { return depth; } inline const Vector& TestStrategy::getCondition() { return pattern.getCondition(); } #endif Maude-2.6/src/StrategyLanguage/strategyLanguage.hh0000644000147300135640000000264310540325234017234 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for strategy language classes. // #ifndef _strategyLanguage_hh_ #define _strategyLanguage_hh_ class StrategyExpression; class TrivialStrategy; class ApplicationStrategy; class ConcatenationStrategy; class IterationStrategy; class BranchStrategy; class UnionStrategy; class TestStrategy; class StrategicExecution; class StrategicProcess; class DecompositionProcess; class ApplicationProcess; class MatchProcess; class StrategicTask; class StrategicSearch; class BranchTask; class RewriteTask; class SharedRewriteSearchState; class StrategyStackManager; #endif Maude-2.6/src/StrategyLanguage/matchProcess.hh0000644000147300135640000000514410540357554016372 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for processes that solve matching problems associated with condition fragments. // #ifndef _matchProcess_hh_ #define _matchProcess_hh_ #include "strategicProcess.hh" #include "sharedRewriteSearchState.hh" #include "strategyStackManager.hh" class MatchProcess : public StrategicProcess { NO_COPYING(MatchProcess); public: MatchProcess(SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, RewritingContext* matchContext, Subproblem* subproblem, Rule* rule, int fragmentNr, const Vector& strategies, int strategyNr, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* insertionPoint); ~MatchProcess(); Survival run(StrategicSearch& searchObject); private: SharedRewriteSearchState::Ptr rewriteState; // smart pointer to rewrite state that found our redex const PositionState::PositionIndex redexIndex; // index of redex withing rewrite state ExtensionInfo* extensionInfoCopy; // copy of extension info from original rule match RewritingContext* matchContext; // rewrite context associated with our fragment match Subproblem* subproblem; // subproblem associated with our fragment match Rule* const rule; // pointer to rule whose lhs matched const int fragmentNr; // number of condition fragment within rule const Vector& strategies; // vector of strategies for rewrite fragments const int strategyNr; // number of next strategy to use StrategyStackManager::StackId pending; // continuation once we finally do a rewrite bool findFirst; // are we looking for a first solution to fragment match? }; #endif Maude-2.6/src/StrategyLanguage/matchProcess.cc0000644000147300135640000000763010677057013016360 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" // interface class definitions #include "term.hh" #include "extensionInfo.hh" #include "subproblem.hh" // core class definitions #include "cachedDag.hh" #include "rule.hh" // higher class definitions #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" // strategy language class definitions #include "strategicSearch.hh" #include "strategyExpression.hh" #include "applicationStrategy.hh" #include "applicationProcess.hh" #include "matchProcess.hh" MatchProcess::MatchProcess(SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, RewritingContext* matchContext, Subproblem* subproblem, Rule* rule, int fragmentNr, const Vector& strategies, int strategyNr, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* insertionPoint) : StrategicProcess(taskSibling, insertionPoint), rewriteState(rewriteState), // share rewrite state redexIndex(redexIndex), // copy redex index extensionInfoCopy((extensionInfo == 0) ? 0 : extensionInfo->makeClone()), // clone extension info matchContext(matchContext), // take over ownership of matchContext subproblem(subproblem), // take over ownership of subproblem rule(rule), // copy rule pointer fragmentNr(fragmentNr), // copy fragment number strategies(strategies), // share reference to strategies vector strategyNr(strategyNr), // copy strategy number pending(pending) // copy pending stack { DebugAdvisory("created MatchProcess, matchContext has nrFragileBindings = " << matchContext->nrFragileBindings()); findFirst = true; } MatchProcess::~MatchProcess() { delete extensionInfoCopy; delete matchContext; delete subproblem; } StrategicExecution::Survival MatchProcess::run(StrategicSearch& searchObject) { // // Each time we run we look for a new solution to the matching problem // If we find one we call resolveRemainingConditionFragments() which will // fork off a new process to continue the seach. If we don't find one, // there is no more work to do and we die. // bool success; if (subproblem) { success = subproblem->solve(findFirst, *matchContext); // // solve() could perform rewrites to apply cmbs. // searchObject.getContext()->transferCount(*matchContext); } else success = findFirst; if (success) { findFirst = false; if (ApplicationProcess::resolveRemainingConditionFragments(searchObject, rewriteState, redexIndex, extensionInfoCopy, matchContext, rule, fragmentNr + 1, strategies, strategyNr, pending, this, this) == SURVIVE) return SURVIVE; } finished(this); return DIE; } Maude-2.6/src/StrategyLanguage/branchStrategy.hh0000644000147300135640000000500010524423664016704 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for if-then-else-fi branch strategies. // #ifndef _branchStrategy_hh_ #define _branchStrategy_hh_ #include "strategyExpression.hh" class BranchStrategy : public StrategyExpression { public: enum Action { FAIL, // no results IDLE, // original term PASS_THRU, // results from test (success case only) NEW_STRATEGY, // apply new strategy ITERATE // apply the same branch strategy to any result }; BranchStrategy(StrategyExpression* initialStrategy, Action successAction, StrategyExpression* successStrategy, Action failureAction, StrategyExpression* failureStrategy); ~BranchStrategy(); StrategyExpression* getInitialStrategy() const; StrategyExpression* getSuccessStrategy() const; StrategyExpression* getFailureStrategy() const; Action getSuccessAction() const; Action getFailureAction() const; StrategicExecution::Survival decompose(StrategicSearch& searchObject, DecompositionProcess* remainder); private: StrategyExpression* const initialStrategy; StrategyExpression* const successStrategy; StrategyExpression* const failureStrategy; const Action successAction; const Action failureAction; }; inline StrategyExpression* BranchStrategy::getInitialStrategy() const { return initialStrategy; } inline StrategyExpression* BranchStrategy::getSuccessStrategy() const { return successStrategy; } inline StrategyExpression* BranchStrategy::getFailureStrategy() const { return failureStrategy; } inline BranchStrategy::Action BranchStrategy::getSuccessAction() const { return successAction; } inline BranchStrategy::Action BranchStrategy::getFailureAction() const { return failureAction; } #endif Maude-2.6/src/StrategyLanguage/branchStrategy.cc0000644000147300135640000000501011446506022016665 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class BranchStrategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" // strategy language class definitions #include "branchStrategy.hh" #include "branchTask.hh" #include "decompositionProcess.hh" #include "strategicSearch.hh" BranchStrategy::BranchStrategy(StrategyExpression* initialStrategy, Action successAction, StrategyExpression* successStrategy, Action failureAction, StrategyExpression* failureStrategy) : initialStrategy(initialStrategy), successStrategy(successStrategy), failureStrategy(failureStrategy), successAction(successAction), failureAction(failureAction) { Assert(successAction >= FAIL && successAction <= ITERATE, "bad success action"); Assert((successAction == NEW_STRATEGY) == (successStrategy != 0), "success inconsistancy"); Assert(failureAction == FAIL || failureAction == IDLE || failureAction == NEW_STRATEGY, "bad failure action"); Assert((failureAction == NEW_STRATEGY) == (failureStrategy != 0), "failure inconsistancy"); } BranchStrategy::~BranchStrategy() { delete initialStrategy; delete successStrategy; delete failureStrategy; } StrategicExecution::Survival BranchStrategy::decompose(StrategicSearch& searchObject, DecompositionProcess* remainder) { (void) new BranchTask(searchObject, remainder, remainder->getDagIndex(), initialStrategy, successAction, successStrategy, failureAction, failureStrategy, remainder->getPending(), remainder); return StrategicExecution::DIE; // request deletion of DecompositionProcess } Maude-2.6/src/StrategyLanguage/applicationProcess.cc0000644000147300135640000002622711446506407017573 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for abstract class Strategy. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" // interface class definitions #include "term.hh" #include "subproblem.hh" // core class definitions #include "cachedDag.hh" #include "rule.hh" #include "rewritingContext.hh" // higher class definitions #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" // strategy language class definitions #include "strategicSearch.hh" #include "strategyExpression.hh" #include "applicationStrategy.hh" #include "decompositionProcess.hh" #include "matchProcess.hh" #include "rewriteTask.hh" #include "applicationProcess.hh" ApplicationProcess::ApplicationProcess(StrategicSearch& searchObject, int startIndex, ApplicationStrategy* strategy, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* insertionPoint) : StrategicProcess(taskSibling, insertionPoint), rewriteState(searchObject.getContext(), searchObject.getCanonical(startIndex), strategy->getLabel(), strategy->getTop() ? NONE : UNBOUNDED), pending(pending), strategy(strategy) { Vector& values = strategy->getValues(); int nrValues = values.size(); if (nrValues > 0) { Vector tmpVariables(strategy->getVariables()); Vector tmpValues(nrValues); for (int i = 0; i < nrValues; ++i) tmpValues[i] = values[i].getDagRoot(); rewriteState->setInitialSubstitution(tmpVariables, tmpValues); } } StrategicExecution::Survival ApplicationProcess::run(StrategicSearch& searchObject) { if (rewriteState->findNextRewrite()) { Rule* rule = rewriteState->getRule(); if (rule->hasCondition()) { // // Need to check that we have the correct number of substrategies for our rule. // int nrStrategies = strategy->getStrategies().size(); int nrRewriteFragments = 0; const Vector& condition = rule->getCondition(); FOR_EACH_CONST(i, Vector, condition) { if (dynamic_cast(*i)) ++nrRewriteFragments; } if (nrStrategies != nrRewriteFragments) return SURVIVE; // might match a different rule on later runs // // We need to check the condition in a fair way, given // that rewrite conditions may have to follow a given strategy // may not terminate. Also processing the condition may // bind substitution entries needed to build an instance of // the rhs of the rule. // if (resolveRemainingConditionFragments(searchObject, rewriteState, rewriteState->getPositionIndex(), rewriteState->getExtensionInfo(), rewriteState->getContext(), rule, 0, strategy->getStrategies(), 0, pending, this, this) == SURVIVE) return SURVIVE; } else { if (strategy->getStrategies().size() > 0) return SURVIVE; // might match a different rule on later runs int resultIndex = doRewrite(searchObject, rewriteState, rewriteState->getPositionIndex(), rewriteState->getExtensionInfo(), rewriteState->getContext(), rule); if (resultIndex != NONE) { (void) new DecompositionProcess(resultIndex, pending, this, this); return SURVIVE; // stick around to look for another rewrite } } } finished(this); // need to unlink ourself from slave list before we request deletion return DIE; // request deletion } int ApplicationProcess::doRewrite(StrategicSearch& searchObject, SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, Substitution* substitution, Rule* rule) { // // The rule for using substitution is tricky: // It does not belong to us and we should never bind variables that // occur in the rule pattern or any fragment pattern in case we // disrupt matching in other branches of the search. But it is fine // to bind constructed entries, protected or not, since they will // simply be overwritten in other branches. // RewritingContext* baseContext = rewriteState->getContext(); bool trace = RewritingContext::getTraceStatus(); if (trace) { // // We have a problem: the whole term that is being rewritten is in the // rewriting context rewriteState->getContext() while the substitution we // will use is in context which may be a different rewriting context with // a different whole term. // // We resolve the issue by creating a special context containing the correct // whole term and substitution just for tracing. // RewritingContext* tracingContext = baseContext->makeSubcontext(baseContext->root()); // // We use clone() rather than copy() because tracingContext will have copy size of 0. // tracingContext->clone(*substitution); tracingContext->tracePreRuleRewrite(rewriteState->getDagNode(redexIndex), rule); delete tracingContext; if (baseContext->traceAbort()) return NONE; } // // Instantiate the rhs of the rule with the substitution. // //cout << "ApplicationProcess::doRewrite() nrFragileBindings = " << substitution->nrFragileBindings() << endl; DagNode* replacement = rule->getRhsBuilder().construct(*substitution); // // Rebuild the original term, using the replacement in place of the redex, // also accounting for any extension info; count this a rule rewrite // RewriteSearchState::DagPair r = rewriteState->rebuildDag(replacement, extensionInfo, redexIndex); searchObject.getContext()->incrementRlCount(); // // Make a new subcontext to equationally reduce the new term. // RewritingContext* c = baseContext->makeSubcontext(r.first); if (trace) { c->tracePostRuleRewrite(r.second); if (c->traceAbort()) { delete c; return NONE; } } c->reduce(); if (c->traceAbort()) { delete c; return NONE; } searchObject.getContext()->addInCount(*c); int dagIndex = searchObject.insert(c->root()); delete c; return dagIndex; } StrategicExecution::Survival ApplicationProcess::resolveRemainingConditionFragments(StrategicSearch& searchObject, SharedRewriteSearchState::Ptr rewriteState, PositionState::PositionIndex redexIndex, ExtensionInfo* extensionInfo, Substitution* substitutionSoFar, Rule* rule, int fragmentNr, const Vector& strategies, int strategyNr, StrategyStackManager::StackId pending, StrategicExecution* taskSibling, StrategicProcess* other) { const Vector& fragments = rule->getCondition(); int nrFragments = fragments.size(); for (; fragmentNr < nrFragments; ++fragmentNr) { ConditionFragment* fragment = fragments[fragmentNr]; if (dynamic_cast(fragment) != 0) { (void) new RewriteTask(searchObject, rewriteState, redexIndex, extensionInfo, substitutionSoFar, rule, fragmentNr, strategies, strategyNr, pending, taskSibling, other); return SURVIVE; } else if (AssignmentConditionFragment* acf = dynamic_cast(fragment)) { // // Make a subcontext, construct and evalutate the instance of R. // RewritingContext* newContext = rewriteState->getContext()-> makeSubcontext(acf->makeRhsInstance(*substitutionSoFar), RewritingContext::CONDITION_EVAL); newContext->reduce(); // // We transfer, rather than simply add in the rewrite count because MatchProcess may do // some more rewriting with newContext. // searchObject.getContext()->transferCount(*newContext); // // We use clone() rather than copy() because newContext will have the wrong copy size. // newContext->clone(*substitutionSoFar); // BUG: this seems to be reducing substitution size! Subproblem* subproblem; if (acf->matchRoot(*newContext, subproblem)) { (void) new MatchProcess(rewriteState, redexIndex, extensionInfo, newContext, // MatchProcess takes over ownership of newContext subproblem, // MatchProcess takes over ownership of subproblem rule, fragmentNr, strategies, strategyNr, pending, taskSibling, other); } else { delete subproblem; delete newContext; } return SURVIVE; } // // Since we don't recognize the fragment as needing special treatment, assume it // is branch free and solve it with a specially created context (to have the correct // root and substitution) and dummy state stack. // RewritingContext* baseContext = rewriteState->getContext(); RewritingContext* solveContext = baseContext->makeSubcontext(baseContext->root()); // // We use clone() rather than copy() because newContext will have copy size 0. // solveContext->clone(*substitutionSoFar); stack dummy; bool success = fragment->solve(true, *solveContext, dummy); searchObject.getContext()->addInCount(*solveContext); if (!success) { // // A fragment failed so this branch of the search is pruned. But the process // or task that called us should survive to generate other possibilities. // delete solveContext; return SURVIVE; } // // solve() may have bound some protected slots in solveContext as part of // making instantiations; for example eager copies of variables. These // must be copied back into substitutionSoFar. // substitutionSoFar->copy(*solveContext); delete solveContext; } // // The condition succeeded so now we need to do the rewrite and resume the strategy. // int resultIndex = doRewrite(searchObject, rewriteState, redexIndex, extensionInfo, substitutionSoFar, rule); if (resultIndex != NONE) { (void) new DecompositionProcess(resultIndex, pending, taskSibling, other); return SURVIVE; // stick around to look for another rewrite } return DIE; // only happens when we are aborting } Maude-2.6/src/StrategyLanguage/Makefile.am0000644000147300135640000000225010540133172015431 00000000000000noinst_LIBRARIES = libstrategyLanguage.a libstrategyLanguage_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Higher \ -I$(top_srcdir)/src/FullCompiler libstrategyLanguage_a_SOURCES = \ trivialStrategy.cc \ applicationStrategy.cc \ concatenationStrategy.cc \ iterationStrategy.cc \ branchStrategy.cc \ unionStrategy.cc \ testStrategy.cc \ strategicExecution.cc \ strategicTask.cc \ branchTask.cc \ strategicProcess.cc \ decompositionProcess.cc \ applicationProcess.cc \ strategicSearch.cc \ sharedRewriteSearchState.cc \ matchProcess.cc \ rewriteTask.cc \ strategyStackManager.cc noinst_HEADERS = \ strategyLanguage.hh \ strategyExpression.hh \ trivialStrategy.hh \ applicationStrategy.hh \ concatenationStrategy.hh \ iterationStrategy.hh \ branchStrategy.hh \ unionStrategy.hh \ testStrategy.hh \ strategicExecution.hh \ strategicTask.hh \ branchTask.hh \ strategicProcess.hh \ decompositionProcess.hh \ applicationProcess.hh \ strategicSearch.hh \ sharedRewriteSearchState.hh \ matchProcess.hh \ rewriteTask.hh \ strategyStackManager.hh Maude-2.6/src/FullCompiler/0000777000147300135640000000000011500304122012601 500000000000000Maude-2.6/src/FullCompiler/variableName.hh0000644000147300135640000000266007666302626015461 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for C++ variable names composed of a one character base and a short index. // #ifndef _variableName_hh_ #define _variableName_hh_ class VariableName { public: VariableName(); VariableName(char base, short index); private: int combined; friend ostream& operator<<(ostream& s, VariableName v); }; inline VariableName::VariableName() { } inline VariableName::VariableName(char base, short index) { combined = (base << 16) | index; } inline ostream& operator<<(ostream& s, VariableName v) { s << static_cast(v.combined >> 16) << (v.combined & 0xffff); return s; } #endif Maude-2.6/src/FullCompiler/compilationContext.hh0000644000147300135640000000467107666302626016762 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for info we have to keep around when compiling to C++. // #ifndef _compilationContext_hh_ #define _compilationContext_hh_ #include "natSet.hh" class CompilationContext { public: CompilationContext(ostream& hhFile, ostream& ccFile, bool countRewrites); ostream& head() const; ostream& body() const; void generateIncrement(int indent); void generateSortVectors(Module* module); void generateEval(Module* module); void beginNewFunction(); void setTailRecursive(); void setNrSafeSlots(int nrSlots); bool isTailRecursive() const; int getNrSafeSlots() const; void usedSort(const Sort* sort); private: // // Info global to compilation; set at construction and never changes. // ostream& hhFile; ostream& ccFile; const bool countRewrites; NatSet usedSorts; // // Info local to symbol currently being compiled. // bool tailRecursive; int nrSafeSlots; }; inline ostream& CompilationContext::head() const { return hhFile; } inline ostream& CompilationContext::body() const { return ccFile; } inline void CompilationContext::beginNewFunction() { tailRecursive = false; nrSafeSlots = 0; } inline void CompilationContext::setTailRecursive() { tailRecursive = true; } inline void CompilationContext::setNrSafeSlots(int nrSlots) { if (nrSlots > nrSafeSlots) nrSafeSlots = nrSlots; } inline bool CompilationContext::isTailRecursive() const { return tailRecursive; } inline int CompilationContext::getNrSafeSlots() const { return nrSafeSlots; } inline void CompilationContext::usedSort(const Sort* sort) { usedSorts.insert(sort->getIndexWithinModule()); } #endif Maude-2.6/src/FullCompiler/Makefile.in0000644000147300135640000004361611500303154014600 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/FullCompiler DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libfullCompiler_a_AR = $(AR) $(ARFLAGS) libfullCompiler_a_LIBADD = am__libfullCompiler_a_SOURCES_DIST = compilationContext.cc @BUILD_COMPILER_TRUE@am_libfullCompiler_a_OBJECTS = libfullCompiler_a-compilationContext.$(OBJEXT) libfullCompiler_a_OBJECTS = $(am_libfullCompiler_a_OBJECTS) libruntime_a_AR = $(AR) $(ARFLAGS) libruntime_a_LIBADD = am__libruntime_a_SOURCES_DIST = runtime.cc @BUILD_COMPILER_TRUE@am_libruntime_a_OBJECTS = \ @BUILD_COMPILER_TRUE@ libruntime_a-runtime.$(OBJEXT) libruntime_a_OBJECTS = $(am_libruntime_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libfullCompiler_a_SOURCES) $(libruntime_a_SOURCES) DIST_SOURCES = $(am__libfullCompiler_a_SOURCES_DIST) \ $(am__libruntime_a_SOURCES_DIST) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @BUILD_COMPILER_TRUE@noinst_LIBRARIES = libfullCompiler.a libruntime.a @BUILD_COMPILER_TRUE@libfullCompiler_a_CPPFLAGS = \ @BUILD_COMPILER_TRUE@ -I$(top_srcdir)/src/Utility \ @BUILD_COMPILER_TRUE@ -I$(top_srcdir)/src/Interface \ @BUILD_COMPILER_TRUE@ -I$(top_srcdir)/src/Core \ @BUILD_COMPILER_TRUE@ -I$(top_srcdir)/src/FullCompiler @BUILD_COMPILER_TRUE@libfullCompiler_a_SOURCES = \ @BUILD_COMPILER_TRUE@ compilationContext.cc @BUILD_COMPILER_TRUE@libruntime_a_CPPFLAGS = \ @BUILD_COMPILER_TRUE@ -I$(top_srcdir)/src/Utility \ @BUILD_COMPILER_TRUE@ -I$(top_srcdir)/src/FullCompiler @BUILD_COMPILER_TRUE@libruntime_a_SOURCES = \ @BUILD_COMPILER_TRUE@ runtime.cc EXTRA_DIST = \ compilationContext.cc \ runtime.cc noinst_HEADERS = \ compilationContext.hh \ fullCompiler.hh \ variableName.hh \ runtime.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/FullCompiler/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/FullCompiler/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libfullCompiler.a: $(libfullCompiler_a_OBJECTS) $(libfullCompiler_a_DEPENDENCIES) -rm -f libfullCompiler.a $(libfullCompiler_a_AR) libfullCompiler.a $(libfullCompiler_a_OBJECTS) $(libfullCompiler_a_LIBADD) $(RANLIB) libfullCompiler.a libruntime.a: $(libruntime_a_OBJECTS) $(libruntime_a_DEPENDENCIES) -rm -f libruntime.a $(libruntime_a_AR) libruntime.a $(libruntime_a_OBJECTS) $(libruntime_a_LIBADD) $(RANLIB) libruntime.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfullCompiler_a-compilationContext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libruntime_a-runtime.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libfullCompiler_a-compilationContext.o: compilationContext.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfullCompiler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libfullCompiler_a-compilationContext.o -MD -MP -MF "$(DEPDIR)/libfullCompiler_a-compilationContext.Tpo" -c -o libfullCompiler_a-compilationContext.o `test -f 'compilationContext.cc' || echo '$(srcdir)/'`compilationContext.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libfullCompiler_a-compilationContext.Tpo" "$(DEPDIR)/libfullCompiler_a-compilationContext.Po"; else rm -f "$(DEPDIR)/libfullCompiler_a-compilationContext.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='compilationContext.cc' object='libfullCompiler_a-compilationContext.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfullCompiler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libfullCompiler_a-compilationContext.o `test -f 'compilationContext.cc' || echo '$(srcdir)/'`compilationContext.cc libfullCompiler_a-compilationContext.obj: compilationContext.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfullCompiler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libfullCompiler_a-compilationContext.obj -MD -MP -MF "$(DEPDIR)/libfullCompiler_a-compilationContext.Tpo" -c -o libfullCompiler_a-compilationContext.obj `if test -f 'compilationContext.cc'; then $(CYGPATH_W) 'compilationContext.cc'; else $(CYGPATH_W) '$(srcdir)/compilationContext.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libfullCompiler_a-compilationContext.Tpo" "$(DEPDIR)/libfullCompiler_a-compilationContext.Po"; else rm -f "$(DEPDIR)/libfullCompiler_a-compilationContext.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='compilationContext.cc' object='libfullCompiler_a-compilationContext.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfullCompiler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libfullCompiler_a-compilationContext.obj `if test -f 'compilationContext.cc'; then $(CYGPATH_W) 'compilationContext.cc'; else $(CYGPATH_W) '$(srcdir)/compilationContext.cc'; fi` libruntime_a-runtime.o: runtime.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libruntime_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libruntime_a-runtime.o -MD -MP -MF "$(DEPDIR)/libruntime_a-runtime.Tpo" -c -o libruntime_a-runtime.o `test -f 'runtime.cc' || echo '$(srcdir)/'`runtime.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libruntime_a-runtime.Tpo" "$(DEPDIR)/libruntime_a-runtime.Po"; else rm -f "$(DEPDIR)/libruntime_a-runtime.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime.cc' object='libruntime_a-runtime.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libruntime_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libruntime_a-runtime.o `test -f 'runtime.cc' || echo '$(srcdir)/'`runtime.cc libruntime_a-runtime.obj: runtime.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libruntime_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libruntime_a-runtime.obj -MD -MP -MF "$(DEPDIR)/libruntime_a-runtime.Tpo" -c -o libruntime_a-runtime.obj `if test -f 'runtime.cc'; then $(CYGPATH_W) 'runtime.cc'; else $(CYGPATH_W) '$(srcdir)/runtime.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libruntime_a-runtime.Tpo" "$(DEPDIR)/libruntime_a-runtime.Po"; else rm -f "$(DEPDIR)/libruntime_a-runtime.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runtime.cc' object='libruntime_a-runtime.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libruntime_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libruntime_a-runtime.obj `if test -f 'runtime.cc'; then $(CYGPATH_W) 'runtime.cc'; else $(CYGPATH_W) '$(srcdir)/runtime.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/FullCompiler/compilationContext.cc0000644000147300135640000000720707720271065016737 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CompilationContext. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" // interface class definitions #include "symbol.hh" // core class definitions #include "module.hh" #include "sort.hh" // full compiler classes #include "compilationContext.hh" CompilationContext::CompilationContext(ostream& hhFile, ostream& ccFile, bool countRewrites) : hhFile(hhFile), ccFile(ccFile), countRewrites(countRewrites) { } void CompilationContext::generateIncrement(int indent) { if (countRewrites) ccFile << Indent(indent) << "++g.count;\n"; } void CompilationContext::generateSortVectors(Module* module) { const Vector& sorts = module->getSorts(); int nrSorts = sorts.length(); for (int i = 0; i < nrSorts; i++) { if (usedSorts.contains(i)) sorts[i]->generateSortVector(*this); } hhFile << '\n'; } void CompilationContext::generateEval(Module* module) { const Vector& symbols = module->getSymbols(); int nrSymbols = symbols.length(); ccFile << "Node*\neval(Node* a)\n{\n" << " EVAL;\n" << " safe[0].l = g.safePtr;\n" << " g.safePtr = safe;\n" << " safe[2].n = a;\n" << " Node* r;\n" << " switch (a->symbol)\n" << " {\n"; int maxArgs = 0; for (int i = 0; i < nrSymbols; i++) { Symbol* symbol = symbols[i]; int nrArgs = symbol->arity(); if (nrArgs > maxArgs) maxArgs = nrArgs; if (i == nrSymbols - 1) ccFile << " default:\n"; else ccFile << " case " << i << ":\n"; ccFile << " {\n safe[1].i = " << (nrArgs > 0 ? nrArgs : 1) << ";\n"; // // Generate code to clear all safe slots. // for (int j = 0; j < nrArgs - 1; j++) ccFile << " safe[" << j + 3 << "].n = 0;\n"; // // Generate code to evaluate each argument. // for (int j = 0; j < nrArgs; j++) { if (j == nrArgs - 1) ccFile << " Node* t"; else ccFile << " safe[" << j + 3 << "].n"; ccFile << " = eval(" << ((j == 0) ? "a" : "safe[2].n") << "->args[" << j << "]);\n"; } // // Generate code to evaulate at top. // ccFile << " r = f" << i << '('; for (int j = 0; j < nrArgs - 1; j++) ccFile << "safe[" << j + 3 << "].n, "; if (nrArgs > 0) ccFile << 't'; ccFile << ");\n"; // // Generate end code. // ccFile << " break;\n" << " }\n"; } // // Generate code to tidy up and return result. // ccFile << " }\n" << " g.safePtr = safe[0].l;\n" << " return r;\n" << "}\n\n"; // // Generate #define for safe slots. // hhFile << "#define EVAL\tLink safe[" << (maxArgs == 0 ? 3 : maxArgs + 2) << "]\n"; } Maude-2.6/src/FullCompiler/fullCompiler.hh0000644000147300135640000000177007666302626015531 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for full compiler classes. // #ifndef _fullCompiler_hh_ #define _fullCompiler_hh_ class CompilationContext; class VariableName; #endif Maude-2.6/src/FullCompiler/runtime.hh0000644000147300135640000000257707666302626014565 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ #define MAX_NR_ARGS 20 using namespace std; struct Flags { unsigned int sortIndex : 16; unsigned int evacuated : 1; }; struct Node { union { int symbol; Node* fwd; }; Flags flags; Node* args[0]; }; union Link { Link* l; int i; Node* n; }; struct Context { long long count; Link* safePtr; char* memNext; char* memEnd; int nrArgs; Node* args[MAX_NR_ARGS]; }; void collectGarbage(); int compare(Node*, Node*); Node* eval(Node*); extern Context g; extern const char inFileName[]; extern const char outFileName[]; Maude-2.6/src/FullCompiler/runtime.cc0000644000147300135640000002364207720271065014540 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ #include // utility stuff #include "macros.hh" #include "vector.hh" #include "pointerSet.hh" #include "runtime.hh" #define CHUNK_SIZE (1024 * 1024) #define E_SIZE (1024 * 1024) #define FACTOR 4 //template class Vector; extern int arity[]; extern int comparison[]; void outputGraph(Node* node); void depthFirstTraversal(Node* node, PointerSet& visited); Node* inputGraph(); Context g; // // Current half space // Vector currentSpace; Vector endMarker; // for breadth-first copying int curChunk; char* curNext; char* curEnd; // // Next half space // Vector newSpace; // // Ephemeral space // Node* ephemeralStart; Node* ephemeralEnd; inline Node* evacuate(Node* old) // // Copy node to current space. // { Flags flags = old->flags; if (flags.evacuated) return old->fwd; // forwarding pointer int symbol = old->symbol; int nrArgs = arity[symbol]; int nrBytes = sizeof(Node) + sizeof(Node*) * nrArgs; char* t = curNext + nrBytes; if (t > curEnd) { endMarker[curChunk] = reinterpret_cast(curNext); // mark end of used portion ++curChunk; curNext = reinterpret_cast(currentSpace[curChunk]); curEnd = curNext + CHUNK_SIZE; t = curNext + nrBytes; } Node* n = reinterpret_cast(curNext); curNext = t; n->symbol = symbol; n->flags = flags; for (int i = 0; i < nrArgs; i++) n->args[i] = old->args[i]; const Flags c = {0, true}; old->flags = c; old->fwd = n; return n; } char* nextChunk(char* cn) { endMarker[curChunk] = reinterpret_cast(cn); ++curChunk; return reinterpret_cast(currentSpace[curChunk]); } #define EVAC(old, dest, cn, ce) \ { \ Flags flags = old->flags; \ if (flags.evacuated) \ dest = old->fwd; \ else \ { \ int symbol = old->symbol; \ int nrArgs = arity[symbol]; \ int nrBytes = sizeof(Node) + sizeof(Node*) * nrArgs; \ char* w = cn + nrBytes; \ if (w > ce) \ { \ cn = nextChunk(cn); \ ce = cn + CHUNK_SIZE; \ w = cn + nrBytes; \ } \ Node* m = reinterpret_cast(cn); \ cn = w; \ m->symbol = symbol; \ m->flags = flags; \ for (int k = 0; k < nrArgs; k++) \ m->args[k] = old->args[k]; \ const Flags c = {0, true}; \ old->flags = c; \ old->fwd = m; \ dest = m; \ } \ } void ephemeralGC(); void fullGC(); void collectGarbage() { if (curChunk + 1 < currentSpace.length()) ephemeralGC(); else fullGC(); // // reuse ephemeral space. // g.memNext = reinterpret_cast(ephemeralStart); } void ephemeralGC() { // // keep track of where we start putting copies. // int copyStartChunk = curChunk; char* copyStart = curNext; char *cn = curNext; char *ce = curEnd; // // scan arg list for pointers into ephemeral space. // int nrArgs = g.nrArgs; for (int i = 0; i < nrArgs; i++) { Node* t = g.args[i]; if (t >= ephemeralStart && t < ephemeralEnd) EVAC(t, g.args[i], cn, ce) } // // scan stack for pointers into ephemeral space. // for (Link* s = g.safePtr; s != 0; s = s[0].l) { int nrSlots = s[1].i; for (int i = 2; i < nrSlots + 2; i++) { Node* t = s[i].n; if (t != 0 && t >= ephemeralStart && t < ephemeralEnd) EVAC(t, s[i].n, cn, ce) } } // // breadth-first scan of copies for pointers into ephemeral space. // for (int i = copyStartChunk; i <= curChunk; i++) { char* p = static_cast((i == copyStartChunk) ? copyStart : currentSpace[i]); for (;;) { if (i == curChunk) { if (p == cn) break; } else { if (p == endMarker[i]) break; } Node* n = reinterpret_cast(p); int nrArgs = arity[n->symbol]; p += sizeof(Node) + sizeof(Node*) * nrArgs; for (int j = 0; j < nrArgs; j++) { Node* t = n->args[j]; if (t >= ephemeralStart && t < ephemeralEnd) EVAC(t, n->args[j], cn, ce) } } } curNext = cn; curEnd = ce; } void fullGC() { // // Set up new current space. // currentSpace.swap(newSpace); curChunk = 0; curNext = reinterpret_cast(currentSpace[0]); curEnd = curNext + CHUNK_SIZE; // // scan arg list for pointers. // int nrArgs = g.nrArgs; for (int i = 0; i < nrArgs; i++) g.args[i] = evacuate(g.args[i]); // // scan stack for pointers. // for (Link* s = g.safePtr; s != 0; s = s[0].l) { int nrSlots = s[1].i; for (int i = 2; i < nrSlots + 2; i++) { Node* t = s[i].n; if (t != 0) s[i].n = evacuate(t); } } // // breadth-first scan of copies for pointers. // for (int i = 0; i <= curChunk; i++) { for (char* p = reinterpret_cast(currentSpace[i]);;) { if (i == curChunk) { if (p == curNext) break; } else { if (p == endMarker[i]) break; } Node* n = reinterpret_cast(p); int nrArgs = arity[n->symbol]; p += sizeof(Node) + sizeof(Node*) * nrArgs; for (int j = 0; j < nrArgs; j++) n->args[j] = evacuate(n->args[j]); } } int used = (curChunk + 1) * CHUNK_SIZE - (curEnd - curNext); int allocated = newSpace.length() * CHUNK_SIZE; int needed = FACTOR * used; while (needed > allocated) { currentSpace.append(malloc(CHUNK_SIZE)); newSpace.append(malloc(CHUNK_SIZE)); void* t = 0; endMarker.append(t); allocated += CHUNK_SIZE; } // // Keep length newSpace = length currentSpace + 1 // int t = currentSpace.length() - 1; newSpace.append(currentSpace[t]); currentSpace.contractTo(t); } static itimerval init = { {1000000, 0}, {1000000, 0} }; static itimerval result; static itimerval result2; void initMem() { ephemeralStart = static_cast(malloc(E_SIZE)); ephemeralEnd = ephemeralStart + E_SIZE / sizeof(Node); currentSpace.append(malloc(CHUNK_SIZE)); currentSpace.append(malloc(CHUNK_SIZE)); void* t = 0; endMarker.append(t); endMarker.append(t); curChunk = 1; curNext = static_cast(currentSpace[0]); curEnd = curNext + CHUNK_SIZE; newSpace.append(malloc(CHUNK_SIZE)); newSpace.append(malloc(CHUNK_SIZE)); newSpace.append(malloc(CHUNK_SIZE)); g.safePtr = 0; g.count = 0; g.memNext = reinterpret_cast(ephemeralStart); g.memEnd = reinterpret_cast(ephemeralEnd); } int main(/* int argc, char* argv[] */) { initMem(); Node* n = inputGraph(); setitimer(ITIMER_REAL, &init, 0); setitimer(ITIMER_PROF, &init, 0); n = eval(n); getitimer(ITIMER_PROF, &result); getitimer(ITIMER_REAL, &result2); outputGraph(n); /* //outputGraph(inputGraph()); outputGraph(eval(inputGraph())); for (;;) { Node* n = inputGraph(); // if (n == 0) // break; n = eval(n); outputGraph(n); } */ } void outputGraph(Node* node) { ofstream ofile(inFileName); const Int64 M = 1000000; ofile << g.count << ' ' << (M * (init.it_value.tv_sec - result.it_value.tv_sec) + init.it_value.tv_usec - result.it_value.tv_usec) << ' ' << (M * (init.it_value.tv_sec - result2.it_value.tv_sec) + init.it_value.tv_usec - result2.it_value.tv_usec) << '\n'; ofile << node->flags.sortIndex << '\n'; PointerSet visited; depthFirstTraversal(node, visited); int nrNodes = visited.cardinality(); for (int i = 0; i < nrNodes; i++) { Node* n = reinterpret_cast(visited.index2Pointer(i)); int symbol = n->symbol; ofile << symbol; int nrArgs = arity[symbol]; for (int j = 0; j < nrArgs; j++) ofile << ' ' << visited.pointer2Index(n->args[j]); ofile << '\n'; } } void depthFirstTraversal(Node* node, PointerSet& visited) { int nrArgs = arity[node->symbol]; for (int i = 0; i < nrArgs; i++) { Node* n = node->args[i]; if (!(visited.contains(n))) depthFirstTraversal(n, visited); } visited.insert(node); } Node* inputGraph() { ifstream ifile(outFileName); Vector built; for(;;) { int symbol; if(!(ifile >> symbol)) break; int nrArgs = arity[symbol]; // cerr << "symbol = " << symbol << " arity = " << nrArgs << '\n'; Node* r = reinterpret_cast(g.memNext); char* n = g.memNext + sizeof(Node) + nrArgs * sizeof(Node*); if (n > g.memEnd) { collectGarbage(); r = reinterpret_cast(g.memNext); g.memNext += sizeof(Node) + nrArgs * sizeof(Node*); } else g.memNext = n; r->symbol = symbol; const Flags c = {0, false}; r->flags = c; for (int i = 0; i < nrArgs; i++) { int t; ifile >> t; r->args[i] = reinterpret_cast(built[t]); } built.append(r); } return reinterpret_cast(built[built.length() - 1]); } int compare(Node* n1, Node* n2) { for (;;) { if (n1 == n2) return 0; int s1 = n1->symbol; int s2 = n2->symbol; if (s1 != s2) return comparison[s1] - comparison[s2]; int nrArgs = arity[s1]; if (nrArgs == 0) return 0; --nrArgs; for (int i = 0; i < nrArgs; i++) { int t = compare(n1->args[i], n2->args[i]); if (t != 0) return t; } n1 = n1->args[nrArgs]; n2 = n2->args[nrArgs]; } } Maude-2.6/src/FullCompiler/ChangeLog0000644000147300135640000000072307666273555014332 000000000000002003-05-30 Steven Eker * runtime.hh: added using namespace std ===================================Maude80b=========================================== 2003-02-25 Steven Eker * variableName.hh: removed #pragma * compilationContext.cc: removed #pragma * compilationContext.hh: removed #pragma * fullCompiler.cc: deleted ===================================Maude79=========================================== Maude-2.6/src/FullCompiler/Makefile.am0000644000147300135640000000106607741125414014575 00000000000000if BUILD_COMPILER noinst_LIBRARIES = libfullCompiler.a libruntime.a libfullCompiler_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/FullCompiler libfullCompiler_a_SOURCES = \ compilationContext.cc libruntime_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/FullCompiler libruntime_a_SOURCES = \ runtime.cc endif EXTRA_DIST = \ compilationContext.cc \ runtime.cc noinst_HEADERS = \ compilationContext.hh \ fullCompiler.hh \ variableName.hh \ runtime.hh Maude-2.6/src/BuiltIn/0000777000147300135640000000000011500304121011551 500000000000000Maude-2.6/src/BuiltIn/branchSymbol.cc0000644000147300135640000001406611371130303014433 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class BranchSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "rewritingContext.hh" // free theory class definitions #include "freeDagNode.hh" // built in class definitions #include "bindingMacros.hh" #include "branchSymbol.hh" BranchSymbol::BranchSymbol(int id, int nrArgs) : FreeSymbol(id, nrArgs) { } BranchSymbol::~BranchSymbol() { int nrTestTerms = testTerms.length(); for (int i = 0; i < nrTestTerms; i++) testTerms[i]->deepSelfDestruct(); } bool BranchSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { NULL_DATA(purpose, BranchSymbol, data); return FreeSymbol::attachData(opDeclaration, purpose, data); } bool BranchSymbol::attachTerm(const char* purpose, Term* term) { int index = atoi(purpose); if (index > 0) { int len = testTerms.length(); if (len < index) { testTerms.resize(index); for (; len < index; len++) testTerms[len] = 0; } if (testTerms[index - 1] == 0) { testTerms[index - 1] = term; return true; } else { DebugAdvisory("BranchSymbol::attachTerm(): " << index << " slot already contains " << testTerms[index - 1]); } } return FreeSymbol::attachTerm(purpose, term); } void BranchSymbol::copyAttachments(Symbol* original, SymbolMap* map) { BranchSymbol* orig = safeCast(BranchSymbol*, original); int nrTerms = orig->testTerms.length(); int len = testTerms.length(); if (len < nrTerms) { testTerms.resize(nrTerms); for (; len < nrTerms; len++) testTerms[len] = 0; } for (int i = 0; i < nrTerms; i++) { if (testTerms[i] == 0) { if (Term* t = orig->testTerms[i]) testTerms[i] = t->deepCopy(map); } } FreeSymbol::copyAttachments(original, map); } void BranchSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { APPEND_DATA(purposes, data, BranchSymbol); FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void BranchSymbol::getTermAttachments(Vector& purposes, Vector& terms) { static Vector numbers; int nrTerms = testTerms.length(); int nrNumbers = numbers.length(); if (nrNumbers < nrTerms) { numbers.resize(nrTerms); for (; nrNumbers < nrTerms; nrNumbers++) numbers[nrNumbers] = int64ToString(nrNumbers + 1); } for (int i = 0; i < nrTerms; i++) { if (Term* t = testTerms[i]) { purposes.append(numbers[i].c_str()); terms.append(t); } } FreeSymbol::getTermAttachments(purposes, terms); } bool BranchSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); FreeDagNode* f = static_cast(subject); DagNode *e = f->getArgument(0); e->reduce(context); int nrTerms = testTerms.length(); for (int i = 0; i < nrTerms; i++) { if(testTerms[i]->equal(e)) return context.builtInReplace(subject, f->getArgument(i + 1)); } // // First argument failed to match any of our test terms. We now need to reduce // all other arguments. // for (int i = 1; i <= nrTerms; i++) f->getArgument(i)->reduce(context); return FreeSymbol::eqRewrite(subject, context); } void BranchSymbol::compileOpDeclarations() { // // Add fake declarations to encode our sort structure. // const Vector& baseDecl = getOpDeclarations()[0].getDomainAndRange(); int declSize = baseDecl.size(); Vector domainAndRange(declSize); domainAndRange[0] = baseDecl[0]; ConnectedComponent* kind = baseDecl[1]->component(); int nrSorts = kind->nrSorts(); for (int i = 1; i < nrSorts; ++i) { Sort* sort = kind->sort(i); // // Add a declaration // firstSort sort sort ... sort -> sort // for (int j = 1; j < declSize; ++j) domainAndRange[j] = sort; addOpDeclaration(domainAndRange, false); // should never be a ctor } FreeSymbol::compileOpDeclarations(); } bool BranchSymbol::rangeSortNeverLeqThan(Sort* /* sort */) { return false; } bool BranchSymbol::rangeSortAlwaysLeqThan(Sort* /* sort */) { return false; } bool BranchSymbol::domainSortAlwaysLeqThan(Sort* /* sort */, int /* argNr */) { return false; } void BranchSymbol::stackArguments(DagNode* subject, Vector& stack, int parentIndex) { // // We need to define this because we have a builtin strategy. We stack // the first argument as eager and the rest as lazy. // const NatSet& frozen = getFrozen(); FreeDagNode* f = safeCast(FreeDagNode*, subject); DagNode* d = f->getArgument(0); if (!(frozen.contains(0)) && !(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, 0, true)); int nrTerms = testTerms.length(); for (int i = 1; i <= nrTerms; i++) { d = f->getArgument(i); if (!(frozen.contains(i)) && !(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, i, false)); } } Maude-2.6/src/BuiltIn/counterSymbol.cc0000644000147300135640000000621710505030575014664 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 2004 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NumberOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" // free theory class definitions #include "freeDagNode.hh" // built in stuff #include "succSymbol.hh" #include "counterSymbol.hh" CounterSymbol::CounterSymbol(int id) : NumberOpSymbol(id, 0) { currentValue = 0; } bool CounterSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { if (strcmp(purpose, "CounterSymbol") == 0) return true; return NumberOpSymbol::attachData(opDeclaration, purpose, data); } void CounterSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "CounterSymbol"; data.resize(nrDataAttachments + 1); NumberOpSymbol::getDataAttachments(opDeclaration, purposes, data); } void CounterSymbol::resetRules() { currentValue = 0; NumberOpSymbol::resetRules(); } void CounterSymbol::saveHiddenState() { currentValueStack.push(currentValue); NumberOpSymbol::saveHiddenState(); } void CounterSymbol::restoreHiddenState() { currentValue = currentValueStack.top(); currentValueStack.pop(); NumberOpSymbol::restoreHiddenState(); } bool CounterSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { // // NumberOpSymbol doesn't know how to deal with this. // return FreeSymbol::eqRewrite(subject, context); } DagNode* CounterSymbol::ruleRewrite(DagNode* subject, RewritingContext& context) { if (SuccSymbol* succSymbol = getSuccSymbol()) { if (RewritingContext::getTraceStatus()) { context.tracePreRuleRewrite(subject, 0); if (context.traceAbort()) return 0; } DagNode* r = succSymbol->makeNatDag(currentValue); ++currentValue; if (RewritingContext::getTraceStatus()) context.tracePostRuleRewrite(r); context.incrementRlCount(); return r; } return NumberOpSymbol::ruleRewrite(subject, context); } Maude-2.6/src/BuiltIn/numberOpSymbol.hh0000644000147300135640000000512510300757626015011 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in operations on numbers. // #ifndef _numberOpSymbol_hh_ #define _numberOpSymbol_hh_ #include "freeSymbol.hh" #include "cachedDag.hh" #include "gmpxx.h" class NumberOpSymbol : public FreeSymbol { public: NumberOpSymbol(int id, int arity); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); bool attachTerm(const char* purpose, Term* term); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); void getTermAttachments(Vector& purposes, Vector& terms); void postInterSymbolPass(); void reset(); bool eqRewrite(DagNode* subject, RewritingContext& context); // // Functions special to NumberOpSymbol. // /* DagNode* makeNegDag(const mpz_class& integer); bool isNeg(const DagNode* dagNode) const; const mpz_class& getNeg(const DagNode* dagNode, mpz_class& result) const; */ protected: SuccSymbol* getSuccSymbol() const; MinusSymbol* getMinusSymbol() const; bool getNumber(DagNode* dagNode, mpz_class& value) const; private: enum ImplementationConstants { EXPONENT_BOUND = 1000000 // max allowed exponent to limit runaway memory use }; int op; SuccSymbol* succSymbol; MinusSymbol* minusSymbol; CachedDag trueTerm; CachedDag falseTerm; }; inline SuccSymbol* NumberOpSymbol::getSuccSymbol() const { return succSymbol; } inline MinusSymbol* NumberOpSymbol::getMinusSymbol() const { return minusSymbol; } #endif Maude-2.6/src/BuiltIn/ACU_NumberOpSymbol.hh0000644000147300135640000000336307752304732015446 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in ACU operations on numbers. // #ifndef _ACU_NumberOpSymbol_hh_ #define _ACU_NumberOpSymbol_hh_ #include "ACU_Symbol.hh" class ACU_NumberOpSymbol : public ACU_Symbol { public: ACU_NumberOpSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); bool eqRewrite(DagNode* subject, RewritingContext& context); private: bool eqRewrite2(DagNode* subject, RewritingContext& context); int op; SuccSymbol* succSymbol; MinusSymbol* minusSymbol; }; #endif Maude-2.6/src/BuiltIn/branchSymbol.hh0000644000147300135640000000416011124042404014437 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in branch (if-then-else-fi type) operations. // #ifndef _branchSymbol_hh_ #define _branchSymbol_hh_ #include "freeSymbol.hh" class BranchSymbol : public FreeSymbol { public: BranchSymbol(int id, int nrArgs); ~BranchSymbol(); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachTerm(const char* purpose, Term* term); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getTermAttachments(Vector& purposes, Vector& terms); // // Built in equational rewriting semantics and strategy. // bool eqRewrite(DagNode* subject, RewritingContext& context); void stackArguments(DagNode* subject, Vector& stack, int parentIndex); // // We need to insert some fake declarations to encode our sort // structure and we disable sort based optimizations. // void compileOpDeclarations(); bool rangeSortNeverLeqThan(Sort* sort); bool rangeSortAlwaysLeqThan(Sort* sort); bool domainSortAlwaysLeqThan(Sort* sort, int argNr); private: Vector testTerms; }; #endif Maude-2.6/src/BuiltIn/succSymbol.hh0000644000147300135640000000420307752273544014164 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for successor operation. // #ifndef _succSymbol_hh_ #define _succSymbol_hh_ #include #include "S_Symbol.hh" #include "cachedDag.hh" class SuccSymbol : public S_Symbol { public: SuccSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachTerm(const char* purpose, Term* term); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getTermAttachments(Vector& purposes, Vector& terms); void postInterSymbolPass(); void reset(); // // Functions special to SuccSymbol. // Term* makeNatTerm(const mpz_class& nat); DagNode* makeNatDag(const mpz_class& nat); bool isNat(const Term* term) const; bool isNat(const DagNode* dagNode) const; const mpz_class& getNat(const Term* term) const; const mpz_class& getNat(const DagNode* dagNode) const; bool getSignedInt(const DagNode* dagNode, int& value) const; bool getSignedInt64(const DagNode* dagNode, Int64& value) const; bool rewriteToNat(DagNode* subject, RewritingContext& context, const mpz_class& result); private: CachedDag zeroTerm; }; #endif Maude-2.6/src/BuiltIn/randomOpSymbol.hh0000644000147300135640000000326010057732263014776 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 2004 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in operations on numbers. // #ifndef _randomOpSymbol_hh_ #define _randomOpSymbol_hh_ #include "numberOpSymbol.hh" #include "MersenneTwister.h" class RandomOpSymbol : public NumberOpSymbol { public: RandomOpSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); bool eqRewrite(DagNode* subject, RewritingContext& context); static void setGlobalSeed(MTRand::uint32 value); private: static MTRand::uint32 globalSeed; mpz_class currentIndex; MTRand currentState; MTRand::uint32 randomNumber; }; inline void RandomOpSymbol::setGlobalSeed(MTRand::uint32 value) { globalSeed = value; } #endif Maude-2.6/src/BuiltIn/matrixOpSymbol.hh0000644000147300135640000000465710777530720015040 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 2004 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in operations on matrices of numbers. // #ifndef _matrixOpSymbol_hh_ #define _matrixOpSymbol_hh_ #include #include "numberOpSymbol.hh" class MatrixOpSymbol : public NumberOpSymbol { public: MatrixOpSymbol(int id, int arity); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); bool eqRewrite(DagNode* subject, RewritingContext& context); private: enum Algorithm { SYSTEMS_CHOICE, CD, GCD }; typedef map SparseVector; typedef map SparseMatrix; typedef Vector IntVec; bool downMatrixEntry(DagNode* dagNode, SparseMatrix& matrix, int& maxRowNr, int& maxColNr); bool downMatrix(DagNode* dagNode, SparseMatrix& matrix, int& maxRowNr, int& maxColNr); bool downVectorEntry(DagNode* dagNode, IntVec& vec, int& maxRowNr); bool downVector(DagNode* dagNode, IntVec& vec, int& maxRowNr); bool downAlgorithm(DagNode* dagNode, Algorithm& algorithm); DagNode* upSet(const Vector& elts); DagNode* upVector(const IntVec& row); #define MACRO(SymbolName, SymbolClass, RequiredFlags, NrArgs) \ SymbolClass* SymbolName; #include "matrixOpSignature.cc" #undef MACRO }; #endif Maude-2.6/src/BuiltIn/stringOpSymbol.cc0000644000147300135640000004253511062337750015021 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class StringOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "NA_Theory.hh" #include "builtIn.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeNet.hh" #include "freeDagNode.hh" // built in class definitions #include "floatSymbol.hh" #include "floatDagNode.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "divisionSymbol.hh" #include "stringSymbol.hh" #include "stringDagNode.hh" #include "stringOpSymbol.hh" #include "bindingMacros.hh" StringOpSymbol::StringOpSymbol(int id, int arity) : FreeSymbol(id, arity) { op = NONE; stringSymbol = 0; succSymbol = 0; minusSymbol = 0; divisionSymbol = 0; floatSymbol = 0; decFloatSymbol = 0; } bool StringOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { BIND_OP(purpose, StringOpSymbol, op, data); return FreeSymbol::attachData(opDeclaration, purpose, data); } bool StringOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, stringSymbol, StringSymbol*); BIND_SYMBOL(purpose, symbol, succSymbol, SuccSymbol*); BIND_SYMBOL(purpose, symbol, minusSymbol, MinusSymbol*); BIND_SYMBOL(purpose, symbol, divisionSymbol, DivisionSymbol*); BIND_SYMBOL(purpose, symbol, floatSymbol, FloatSymbol*); BIND_SYMBOL(purpose, symbol, decFloatSymbol, Symbol*); return FreeSymbol::attachSymbol(purpose, symbol); } bool StringOpSymbol::attachTerm(const char* purpose, Term* term) { BIND_TERM(purpose, term, trueTerm); BIND_TERM(purpose, term, falseTerm); BIND_TERM(purpose, term, notFoundTerm); return FreeSymbol::attachTerm(purpose, term); } void StringOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { StringOpSymbol* orig = safeCast(StringOpSymbol*, original); op = orig->op; COPY_SYMBOL(orig, stringSymbol, map, StringSymbol*); COPY_SYMBOL(orig, succSymbol, map, SuccSymbol*); COPY_SYMBOL(orig, minusSymbol, map, MinusSymbol*); COPY_SYMBOL(orig, divisionSymbol, map, DivisionSymbol*); COPY_SYMBOL(orig, floatSymbol, map, FloatSymbol*); COPY_SYMBOL(orig, decFloatSymbol, map, Symbol*); COPY_TERM(orig, trueTerm, map); COPY_TERM(orig, falseTerm, map); COPY_TERM(orig, notFoundTerm, map); FreeSymbol::copyAttachments(original, map); } void StringOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "StringOpSymbol"; data.resize(nrDataAttachments + 1); data[nrDataAttachments].resize(1); const char*& d = data[nrDataAttachments][0]; switch (op) { CODE_CASE(d, 'f', 'l', "float") CODE_CASE(d, 'l', 'e', "length") CODE_CASE(d, 'a', 's', "ascii") CODE_CASE(d, '+', 0, "+") CODE_CASE(d, '<', 0, "<") CODE_CASE(d, '<', '=', "<=") CODE_CASE(d, '>', 0, ">") CODE_CASE(d, '>', '=', ">=") CODE_CASE(d, 'r', 'a', "rat") CODE_CASE(d, 's', 'u', "substr") CODE_CASE(d, 'f', 'i', "find") CODE_CASE(d, 'r', 'f', "rfind") CODE_CASE(d, 's', 't', "string") CODE_CASE(d, 'd', 'e', "decFloat") CODE_CASE(d, 'c', 'h', "char") default: CantHappen("bad string op"); } FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void StringOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, stringSymbol); APPEND_SYMBOL(purposes, symbols, succSymbol); APPEND_SYMBOL(purposes, symbols, minusSymbol); APPEND_SYMBOL(purposes, symbols, divisionSymbol); APPEND_SYMBOL(purposes, symbols, floatSymbol); APPEND_SYMBOL(purposes, symbols, decFloatSymbol); FreeSymbol::getSymbolAttachments(purposes, symbols); } void StringOpSymbol::getTermAttachments(Vector& purposes, Vector& terms) { APPEND_TERM(purposes, terms, trueTerm); APPEND_TERM(purposes, terms, falseTerm); APPEND_TERM(purposes, terms, notFoundTerm); FreeSymbol::getTermAttachments(purposes, terms); } void StringOpSymbol::postInterSymbolPass() { PREPARE_TERM(trueTerm); PREPARE_TERM(falseTerm); PREPARE_TERM(notFoundTerm); } void StringOpSymbol::reset() { trueTerm.reset(); // so true dag can be garbage collected falseTerm.reset(); // so false dag can be garbage collected notFoundTerm.reset(); // so notFound dag can be garbage collected FreeSymbol::reset(); // parents reset() tasks } bool StringOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); int nrArgs = arity(); FreeDagNode* d = safeCast(FreeDagNode*, subject); // // Evaluate our arguments. // for (int i = 0; i < nrArgs; i++) { DagNode* a = d->getArgument(i); a->reduce(context); } DagNode* a0 = d->getArgument(0); if (a0->symbol() == stringSymbol) { const crope& left = safeCast(StringDagNode*, a0)->getValue(); switch (nrArgs) { case 1: { mpz_class r; switch (op) { case CODE('f', 'l'): { bool error; #ifdef ROPE_C_STR_BROKEN // // This kudge doesn't seem to be need nowadays, but copy() doesn't work. // // This messing about is needed because Rope::c_str() // fails in libstdc++-v3 // int len = left.length(); char* t = new char[len + 1]; left.copy(t); t[len] = '\0'; double fl = stringToDouble(t, error); delete [] t; #else double fl = stringToDouble(left.c_str(), error); #endif if (error) goto fail; return floatSymbol->rewriteToFloat(subject, context, fl); } case CODE('l', 'e'): // length { r = left.length(); break; } case CODE('a', 's'): // acsii { if (left.length() != 1) goto fail; r = static_cast(left[0]); break; } default: CantHappen("bad string op"); } return succSymbol->rewriteToNat(subject, context, r); } case 2: { DagNode* a1 = d->getArgument(1); if (a1->symbol() == stringSymbol) { const crope& right = safeCast(StringDagNode*, a1)->getValue(); bool r; switch (op) { case '+': { crope t(left); t += right; return rewriteToString(subject, context, t); } case '<': r = left < right; break; case '>': r = left > right; break; case CODE('<', '='): r = left <= right; break; case CODE('>', '='): r = left >= right; break; default: CantHappen("bad string op"); r = false; // avoid compiler warning } Assert(trueTerm.getTerm() != 0 && falseTerm.getTerm() != 0, "null true/false for relational op"); return context.builtInReplace(subject, r ? trueTerm.getDag() : falseTerm.getDag()); } else if (op == CODE('r', 'a')) { DagNode* a1 = d->getArgument(1); Assert(succSymbol != 0, "succSymbol undefined"); if (succSymbol->isNat(a1)) { const mpz_class& n1 = succSymbol->getNat(a1); if (n1 >= 2 && n1 <= 36) { mpz_class numerator; mpz_class denominator; if (ropeToNumber(left, n1.get_si(), numerator, denominator)) { DagNode* r; if (denominator == 0) { if (numerator >= 0) return succSymbol->rewriteToNat(subject, context, numerator); r = minusSymbol->makeNegDag(numerator); } else r = divisionSymbol->makeRatDag(numerator, denominator); return context.builtInReplace(subject, r); } } } } break; } case 3: { switch (op) { case CODE('s', 'u'): // substr { DagNode* a1 = d->getArgument(1); DagNode* a2 = d->getArgument(2); Assert(succSymbol != 0, "succSymbol undefined"); if (succSymbol->isNat(a1) && succSymbol->isNat(a2)) { const mpz_class& n1 = succSymbol->getNat(a1); Uint index = n1.fits_uint_p() ? n1.get_ui() : UINT_MAX; const mpz_class& n2 = succSymbol->getNat(a2); Uint length = n2.fits_uint_p() ? n2.get_ui() : UINT_MAX; return rewriteToString(subject, context, substring(left, index, length)); } break; } default: { DagNode* a1 = d->getArgument(1); if (a1->symbol() == stringSymbol) { const crope& pattern = safeCast(StringDagNode*, a1)->getValue(); DagNode* a2 = d->getArgument(2); Assert(succSymbol != 0, "succSymbol undefined"); if (succSymbol->isNat(a2)) { const mpz_class& n2 = succSymbol->getNat(a2); Uint index = n2.fits_uint_p() ? n2.get_ui() : UINT_MAX; int r; switch (op) { case CODE('f', 'i'): // find r = fwdFind(left, pattern, index); break; case CODE('r', 'f'): // rfind r = revFind(left, pattern, index); break; default: CantHappen("bad string op"); r = 0; // avoid compiler warning } Assert(notFoundTerm.getTerm() != 0, "null notFound for find op"); if (r == NONE) return context.builtInReplace(subject, notFoundTerm.getDag()); return succSymbol->rewriteToNat(subject, context, r); } } break; } } } } } else if (a0->symbol() == floatSymbol) { if (nrArgs == 1 && op == CODE('s', 't')) { double fl = safeCast(FloatDagNode*, a0)->getValue(); return rewriteToString(subject, context, doubleToString(fl)); } else if (nrArgs == 2 && op == CODE('d', 'e')) { DagNode* a1 = d->getArgument(1); Assert(succSymbol != 0, "succSymbol undefined"); Assert(minusSymbol != 0, "minusSymbol undefined"); if (succSymbol->isNat(a1)) { double fl = safeCast(FloatDagNode*, a0)->getValue(); const mpz_class& n1 = succSymbol->getNat(a1); int nrDigits = (n1 < MAX_FLOAT_DIGITS) ? n1.get_si() : MAX_FLOAT_DIGITS; char buffer[MAX_FLOAT_DIGITS + 1]; int decPt; int sign; correctEcvt(fl, nrDigits, buffer, decPt, sign); Vector args(0, 3); args.append((sign < 0) ? minusSymbol->makeNegDag(sign) : succSymbol->makeNatDag(sign)); args.append(new StringDagNode(stringSymbol, buffer)); args.append((decPt < 0) ? minusSymbol->makeNegDag(decPt) : succSymbol->makeNatDag(decPt)); return context.builtInReplace(subject, decFloatSymbol->makeDagNode(args)); } } } else if (op == CODE('s', 't') && nrArgs == 2) { DagNode* a1 = d->getArgument(1); Assert(succSymbol != 0, "succSymbol undefined"); if (succSymbol->isNat(a1)) { const mpz_class& n1 = succSymbol->getNat(a1); if (n1 >= 2 && n1 <= 36) { int base = n1.get_si(); if (succSymbol->isNat(a0)) { if (succSymbol->isNat(a0)) { char* ts = mpz_get_str(0, base, succSymbol->getNat(a0).get_mpz_t()); crope tr(ts); free(ts); return rewriteToString(subject, context, tr); } } else if (a0->symbol() == minusSymbol) { if (minusSymbol->isNeg(a0)) { mpz_class result; char* ts = mpz_get_str(0, base, minusSymbol->getNeg(a0, result).get_mpz_t()); crope tr(ts); free(ts); return rewriteToString(subject, context, tr); } } else if (a0->symbol() == divisionSymbol) { if (divisionSymbol->isRat(a0)) { mpz_class numerator; const mpz_class& denomenator = divisionSymbol->getRat(a0, numerator); char* ns = mpz_get_str(0, base, numerator.get_mpz_t()); crope tr(ns); free(ns); tr += '/'; char* ds = mpz_get_str(0, base, denomenator.get_mpz_t()); tr += ds; free(ds); return rewriteToString(subject, context, tr); } } } } } else { switch (op) { case CODE('c', 'h'): // char { DagNode* a0 = d->getArgument(0); Assert(succSymbol != 0, "succSymbol undefined"); if (succSymbol->isNat(a0)) { const mpz_class& n0 = succSymbol->getNat(a0); if (n0 <= 255) { char c = n0.get_si(); return rewriteToString(subject, context, crope(c)); } } break; } default: ; // Can get here if args are bad } } fail: return FreeSymbol::eqRewrite(subject, context); } bool StringOpSymbol::rewriteToString(DagNode* subject, RewritingContext& context, const crope& result) { bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) StringDagNode(stringSymbol, result); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } crope StringOpSymbol::substring(const crope& subject, crope::size_type index, crope::size_type length) { crope::size_type sLen = subject.length(); // if (index < 0) // { // if (length > 0) // length += index; // index = 0; // } if (length == 0 || index >= sLen) return crope(); if (length > sLen - index) length = sLen - index; return subject.substr(index, length); } int StringOpSymbol::fwdFind(const crope& subject, const crope& pattern, crope::size_type start) { crope::size_type sLen = subject.length(); if (pattern.empty()) return (start <= sLen) ? static_cast(start) : NONE; // // Testing start < sLen is important because otherwise 2nd test // could succeed by wrap around. // if (start < sLen && start + pattern.length() <= sLen) { crope::const_iterator b(subject.begin()); crope::const_iterator e(subject.end()); crope::const_iterator p(search(b + start, e, pattern.begin(), pattern.end())); if (p != e) return p - b; } return NONE; } int StringOpSymbol::revFind(const crope& subject, const crope& pattern, crope::size_type start) { crope::size_type sLen = subject.length(); if (pattern.empty()) return (start <= sLen) ? start : sLen; crope::size_type pLen = pattern.length(); if (pLen <= sLen) { crope::size_type reflect = sLen - pLen; if (start > reflect) start = reflect; crope::const_reverse_iterator b(subject.rbegin()); crope::const_reverse_iterator e(subject.rend()); crope::const_reverse_iterator p = search(b + (reflect - start), e, pattern.rbegin(), pattern.rend()); if (p != e) return reflect - (p - b); } return NONE; } bool StringOpSymbol::ropeToNumber(const crope& subject, int base, mpz_class& numerator, mpz_class& denominator) { int len = subject.length(); if (len == 0) return false; int i = 0; if (subject[i] == '-') { if (len == 1) return false; ++i; } char c = subject[i]; if (!isalnum(c) || (c == '0' && len > 1)) return false; for (i++; i < len; i++) { char c = subject[i]; if (!isalnum(c)) { if (c == '/') { int j = i + 1; if (j == len || subject[j] == '0') return false; for (; j < len; j++) { if (!isalnum(subject[j])) return false; } // // We have detected a fraction form. // #ifdef ROPE_C_STR_BROKEN // // This kudge doesn't seem to be need nowadays, but copy() doesn't work. // char* t = new char[len]; // longer than needed but who cares int dLen = len - (i + 1); subject.copy(i + 1, dLen, t); t[dLen] = '\0'; if (mpz_set_str(denominator.get_mpz_t(), t, base) != 0) { delete [] t; return false; } subject.copy(0, i, t); t[i] = '\0'; if (mpz_set_str(numerator.get_mpz_t(), t, base) != 0) { delete [] t; return false; } delete [] t; return true; #else return mpz_set_str(denominator.get_mpz_t(), subject.substr(i + 1).c_str(), base) == 0 && mpz_set_str(numerator.get_mpz_t(), subject.substr(0,i).c_str(), base) == 0; #endif } else return false; } } // // We have a regular integer form. // denominator = 0; #ifdef ROPE_C_STR_BROKEN // // This kudge doesn't seem to be need nowadays, but copy() doesn't work. // char* t = new char[len + 1]; subject.copy(t); t[len] = '\0'; if (mpz_set_str(numerator.get_mpz_t(), t, base) == 0) { delete [] t; return true; } delete [] t; return false; #else return mpz_set_str(numerator.get_mpz_t(), subject.c_str(), base) == 0; #endif } Maude-2.6/src/BuiltIn/floatDagNode.hh0000644000147300135640000000266411062315176014364 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for dag nodes containing floating point numbers. // #ifndef _floatDagNode_hh_ #define _floatDagNode_hh_ #include "NA_DagNode.hh" class FloatDagNode : public NA_DagNode { public: FloatDagNode(FloatSymbol* symbol, double value); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); double getValue() const; private: const union { double value; Int64 bitPattern; }; friend class FloatTerm; // for comparison }; inline double FloatDagNode::getValue() const { return value; } #endif Maude-2.6/src/BuiltIn/stringTerm.cc0000644000147300135640000000536410505101501014143 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class StringTerm // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "symbolMap.hh" // built in class definitions #include "stringSymbol.hh" #include "stringTerm.hh" #include "stringDagNode.hh" #ifdef ALPHA // // This explicit template instantiation seems to be necessary to create // rope >::_S_min_len // template class rope; #endif StringTerm::StringTerm(StringSymbol* symbol, const crope& value) : NA_Term(symbol), value(value) { } Term* StringTerm::deepCopy2(SymbolMap* map) const { return new StringTerm(static_cast(map == 0 ? symbol() : map->translate(symbol())), value); } Term* StringTerm::instantiate2(const Vector& varBindings, SymbolMap* translator) { return new StringTerm(safeCast(StringSymbol*, translator->findTargetVersionOfSymbol(symbol())), value); } Term* StringTerm::normalize(bool /* full */, bool& changed) { changed = false; int hashValue = 0; for (crope::const_iterator i(value.begin()); i != value.end(); i++) hashValue = (hashValue << 1) + *i; setHashValue(hash(symbol()->getHashValue(), hashValue)); return this; } int StringTerm::compareArguments(const Term* other) const { return value.compare(static_cast(other)->value); } int StringTerm::compareArguments(const DagNode* other) const { return value.compare(static_cast(other)->getValue()); } void StringTerm::overwriteWithDagNode(DagNode* old) const { (void) new(old) StringDagNode(static_cast(symbol()), value); } NA_DagNode* StringTerm::makeDagNode() const { return new StringDagNode(static_cast(symbol()), value); } Maude-2.6/src/BuiltIn/succSymbol.cc0000644000147300135640000001276507752274734014170 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class SuccSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "S_Theory.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // S theory class definitions #include "S_Symbol.hh" #include "S_DagNode.hh" #include "S_Term.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" SuccSymbol::SuccSymbol(int id) : S_Symbol(id) { } bool SuccSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { NULL_DATA(purpose, SuccSymbol, data); return S_Symbol::attachData(opDeclaration, purpose, data); } bool SuccSymbol::attachTerm(const char* purpose, Term* term) { BIND_TERM(purpose, term, zeroTerm); return S_Symbol::attachTerm(purpose, term); } void SuccSymbol::copyAttachments(Symbol* original, SymbolMap* map) { SuccSymbol* orig = safeCast(SuccSymbol*, original); COPY_TERM(orig, zeroTerm, map); S_Symbol::copyAttachments(original, map); } void SuccSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { APPEND_DATA(purposes, data, SuccSymbol); S_Symbol::getDataAttachments(opDeclaration, purposes, data); } void SuccSymbol::getTermAttachments(Vector& purposes, Vector& terms) { APPEND_TERM(purposes, terms, zeroTerm); S_Symbol::getTermAttachments(purposes, terms); } void SuccSymbol::postInterSymbolPass() { PREPARE_TERM(zeroTerm); } void SuccSymbol::reset() { zeroTerm.reset(); // so zero dag can be garbage collected S_Symbol::reset(); // parents reset() tasks } Term* SuccSymbol::makeNatTerm(const mpz_class& nat) { Assert(zeroTerm.getTerm() != 0, "zero not defined for " << this); Term* zero = zeroTerm.getTerm()->deepCopy(); return (nat == 0) ? zero : (new S_Term(this, nat, zero)); } DagNode* SuccSymbol::makeNatDag(const mpz_class& nat) { Assert(zeroTerm.getTerm() != 0, "zero not defined"); DagNode* zero = zeroTerm.getDag(); return (nat == 0) ? zero : (new S_DagNode(this, nat, zero)); } bool SuccSymbol::isNat(const Term* term) const { const Symbol* s = term->symbol(); return zeroTerm.getTerm()-> equal((s != this) ? term : safeCast(const S_Term*, term)->getArgument()); } bool SuccSymbol::isNat(const DagNode* dagNode) const { const Symbol* s = dagNode->symbol(); return zeroTerm.getTerm()-> equal((s != this) ? dagNode : safeCast(const S_DagNode*, dagNode)->getArgument()); } const mpz_class& SuccSymbol::getNat(const Term* term) const { static mpz_class zero(0); const Symbol* s = term->symbol(); if (s != this) { Assert(zeroTerm.getTerm()->equal(term), "not a nat"); return zero; } const S_Term* st = safeCast(const S_Term*, term); Assert(zeroTerm.getTerm()->equal(st->getArgument()), "arg not zero"); return st->getNumber(); } const mpz_class& SuccSymbol::getNat(const DagNode* dagNode) const { static mpz_class zero(0); const Symbol* s = dagNode->symbol(); if (s != this) { Assert(zeroTerm.getTerm()->equal(dagNode), "not a nat"); return zero; } const S_DagNode* sd = safeCast(const S_DagNode*, dagNode); Assert(zeroTerm.getTerm()->equal(sd->getArgument()), "arg not zero"); return sd->getNumber(); } bool SuccSymbol::getSignedInt(const DagNode* dagNode, int& value) const { if (isNat(dagNode)) { const mpz_class& n = getNat(dagNode); if (n.fits_sint_p()) { value = n.get_si(); return true; } } return false; } bool SuccSymbol::getSignedInt64(const DagNode* dagNode, Int64& value) const { if (isNat(dagNode)) { const mpz_class& n = getNat(dagNode); mpz_class u = n >> BITS_PER_UINT; if (u.fits_sint_p()) { value = u.get_si(); value <<= BITS_PER_UINT; value |= n.get_ui(); return true; } } return false; } bool SuccSymbol::rewriteToNat(DagNode* subject, RewritingContext& context, const mpz_class& result) { Assert(result >= 0, "-ve"); Assert(zeroTerm.getTerm() != 0, "zero not defined"); DagNode* zero = zeroTerm.getDag(); if (result == 0) return context.builtInReplace(subject, zero); bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) S_DagNode(this, result, zero); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } Maude-2.6/src/BuiltIn/minusSymbol.cc0000644000147300135640000000757407752327002014353 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class MinusSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" #include "argumentIterator.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeNet.hh" #include "freeDagNode.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" #include "numberOpSymbol.hh" #include "minusSymbol.hh" MinusSymbol::MinusSymbol(int id) : NumberOpSymbol(id, 1) { } bool MinusSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { if (strcmp(purpose, "MinusSymbol") == 0) { if (data.length() != 0) return false; Vector t(1); t[0] = "-"; return NumberOpSymbol::attachData(opDeclaration, "NumberOpSymbol", t); } return NumberOpSymbol::attachData(opDeclaration, purpose, data); } void MinusSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { APPEND_DATA(purposes, data, MinusSymbol); // // Need to bypass NumberOpSymbol::getDataAttachments() in order to // avoid getting a NumberOpSymbol id hook. // FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } DagNode* MinusSymbol::makeNegDag(const mpz_class& integer) { Assert(integer < 0, "not negative"); Vector arg(1); arg[0] = getSuccSymbol()->makeNatDag(- integer); // would like to avoid copy return makeDagNode(arg); } bool MinusSymbol::isNeg(const DagNode* dagNode) const { Assert(static_cast(dagNode->symbol()) == this, "symbol mismatch"); DagNode* a = safeCast(const FreeDagNode*, dagNode)->getArgument(0); return a->symbol() == getSuccSymbol() && getSuccSymbol()->isNat(a); } const mpz_class& MinusSymbol::getNeg(const DagNode* dagNode, mpz_class& result) const { Assert(static_cast(dagNode->symbol()) == this, "symbol mismatch"); result = - getSuccSymbol()->getNat(safeCast(const FreeDagNode*, dagNode)->getArgument(0)); return result; } Term* MinusSymbol::makeIntTerm(const mpz_class& integer) { if (integer >= 0) return getSuccSymbol()->makeNatTerm(integer); Vector arg(1); arg[0] = getSuccSymbol()->makeNatTerm(- integer); // would like to avoid copy return makeTerm(arg); } bool MinusSymbol::isNeg(/* const */ Term* term) const { Assert(static_cast(term->symbol()) == this, "symbol mismatch"); ArgumentIterator i(*term); Term* t = i.argument(); return t->symbol() == getSuccSymbol() && getSuccSymbol()->isNat(t); } const mpz_class& MinusSymbol::getNeg(/* const */ Term* term, mpz_class& result) const { Assert(static_cast(term->symbol()) == this, "symbol mismatch"); ArgumentIterator i(*term); result = - getSuccSymbol()->getNat(i.argument()); return result; } Maude-2.6/src/BuiltIn/Makefile.in0000644000147300135640000016361711500303154013555 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/BuiltIn DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libbuiltIn_a_AR = $(AR) $(ARFLAGS) libbuiltIn_a_LIBADD = am_libbuiltIn_a_OBJECTS = libbuiltIn_a-equalitySymbol.$(OBJEXT) \ libbuiltIn_a-sortTestSymbol.$(OBJEXT) \ libbuiltIn_a-branchSymbol.$(OBJEXT) \ libbuiltIn_a-stringSymbol.$(OBJEXT) \ libbuiltIn_a-stringTerm.$(OBJEXT) \ libbuiltIn_a-stringDagNode.$(OBJEXT) \ libbuiltIn_a-stringOpSymbol.$(OBJEXT) \ libbuiltIn_a-floatSymbol.$(OBJEXT) \ libbuiltIn_a-floatTerm.$(OBJEXT) \ libbuiltIn_a-floatDagNode.$(OBJEXT) \ libbuiltIn_a-floatOpSymbol.$(OBJEXT) \ libbuiltIn_a-succSymbol.$(OBJEXT) \ libbuiltIn_a-numberOpSymbol.$(OBJEXT) \ libbuiltIn_a-minusSymbol.$(OBJEXT) \ libbuiltIn_a-ACU_NumberOpSymbol.$(OBJEXT) \ libbuiltIn_a-CUI_NumberOpSymbol.$(OBJEXT) \ libbuiltIn_a-divisionSymbol.$(OBJEXT) \ libbuiltIn_a-randomOpSymbol.$(OBJEXT) \ libbuiltIn_a-counterSymbol.$(OBJEXT) \ libbuiltIn_a-matrixOpSymbol.$(OBJEXT) libbuiltIn_a_OBJECTS = $(am_libbuiltIn_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libbuiltIn_a_SOURCES) DIST_SOURCES = $(libbuiltIn_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libbuiltIn.a libbuiltIn_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/NA_Theory \ -I$(top_srcdir)/src/ACU_Persistent \ -I$(top_srcdir)/src/ACU_Theory \ -I$(top_srcdir)/src/CUI_Theory \ -I$(top_srcdir)/src/S_Theory \ -I$(top_srcdir)/src/FreeTheory \ -I$(top_srcdir)/src/3rdParty libbuiltIn_a_SOURCES = \ equalitySymbol.cc \ sortTestSymbol.cc \ branchSymbol.cc \ stringSymbol.cc \ stringTerm.cc \ stringDagNode.cc \ stringOpSymbol.cc \ floatSymbol.cc \ floatTerm.cc \ floatDagNode.cc \ floatOpSymbol.cc \ succSymbol.cc \ numberOpSymbol.cc \ minusSymbol.cc \ ACU_NumberOpSymbol.cc \ CUI_NumberOpSymbol.cc \ divisionSymbol.cc \ randomOpSymbol.cc \ counterSymbol.cc \ matrixOpSymbol.cc EXTRA_DIST = \ matrixOpSignature.cc noinst_HEADERS = \ ACU_NumberOpSymbol.hh \ CUI_NumberOpSymbol.hh \ bindingMacros.hh \ branchSymbol.hh \ builtIn.hh \ divisionSymbol.hh \ equalitySymbol.hh \ floatDagNode.hh \ floatOpSymbol.hh \ floatSymbol.hh \ floatTerm.hh \ minusSymbol.hh \ numberOpSymbol.hh \ sortTestSymbol.hh \ stringDagNode.hh \ stringOpSymbol.hh \ stringSymbol.hh \ stringTerm.hh \ succSymbol.hh \ randomOpSymbol.hh \ counterSymbol.hh \ matrixOpSymbol.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/BuiltIn/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/BuiltIn/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libbuiltIn.a: $(libbuiltIn_a_OBJECTS) $(libbuiltIn_a_DEPENDENCIES) -rm -f libbuiltIn.a $(libbuiltIn_a_AR) libbuiltIn.a $(libbuiltIn_a_OBJECTS) $(libbuiltIn_a_LIBADD) $(RANLIB) libbuiltIn.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-branchSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-counterSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-divisionSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-equalitySymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-floatDagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-floatSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-floatTerm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-minusSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-stringDagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-stringSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-stringTerm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbuiltIn_a-succSymbol.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libbuiltIn_a-equalitySymbol.o: equalitySymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-equalitySymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Tpo" -c -o libbuiltIn_a-equalitySymbol.o `test -f 'equalitySymbol.cc' || echo '$(srcdir)/'`equalitySymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='equalitySymbol.cc' object='libbuiltIn_a-equalitySymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-equalitySymbol.o `test -f 'equalitySymbol.cc' || echo '$(srcdir)/'`equalitySymbol.cc libbuiltIn_a-equalitySymbol.obj: equalitySymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-equalitySymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Tpo" -c -o libbuiltIn_a-equalitySymbol.obj `if test -f 'equalitySymbol.cc'; then $(CYGPATH_W) 'equalitySymbol.cc'; else $(CYGPATH_W) '$(srcdir)/equalitySymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-equalitySymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='equalitySymbol.cc' object='libbuiltIn_a-equalitySymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-equalitySymbol.obj `if test -f 'equalitySymbol.cc'; then $(CYGPATH_W) 'equalitySymbol.cc'; else $(CYGPATH_W) '$(srcdir)/equalitySymbol.cc'; fi` libbuiltIn_a-sortTestSymbol.o: sortTestSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-sortTestSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Tpo" -c -o libbuiltIn_a-sortTestSymbol.o `test -f 'sortTestSymbol.cc' || echo '$(srcdir)/'`sortTestSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sortTestSymbol.cc' object='libbuiltIn_a-sortTestSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-sortTestSymbol.o `test -f 'sortTestSymbol.cc' || echo '$(srcdir)/'`sortTestSymbol.cc libbuiltIn_a-sortTestSymbol.obj: sortTestSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-sortTestSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Tpo" -c -o libbuiltIn_a-sortTestSymbol.obj `if test -f 'sortTestSymbol.cc'; then $(CYGPATH_W) 'sortTestSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/sortTestSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-sortTestSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sortTestSymbol.cc' object='libbuiltIn_a-sortTestSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-sortTestSymbol.obj `if test -f 'sortTestSymbol.cc'; then $(CYGPATH_W) 'sortTestSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/sortTestSymbol.cc'; fi` libbuiltIn_a-branchSymbol.o: branchSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-branchSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-branchSymbol.Tpo" -c -o libbuiltIn_a-branchSymbol.o `test -f 'branchSymbol.cc' || echo '$(srcdir)/'`branchSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-branchSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-branchSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-branchSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='branchSymbol.cc' object='libbuiltIn_a-branchSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-branchSymbol.o `test -f 'branchSymbol.cc' || echo '$(srcdir)/'`branchSymbol.cc libbuiltIn_a-branchSymbol.obj: branchSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-branchSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-branchSymbol.Tpo" -c -o libbuiltIn_a-branchSymbol.obj `if test -f 'branchSymbol.cc'; then $(CYGPATH_W) 'branchSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/branchSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-branchSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-branchSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-branchSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='branchSymbol.cc' object='libbuiltIn_a-branchSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-branchSymbol.obj `if test -f 'branchSymbol.cc'; then $(CYGPATH_W) 'branchSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/branchSymbol.cc'; fi` libbuiltIn_a-stringSymbol.o: stringSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringSymbol.Tpo" -c -o libbuiltIn_a-stringSymbol.o `test -f 'stringSymbol.cc' || echo '$(srcdir)/'`stringSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-stringSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringSymbol.cc' object='libbuiltIn_a-stringSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringSymbol.o `test -f 'stringSymbol.cc' || echo '$(srcdir)/'`stringSymbol.cc libbuiltIn_a-stringSymbol.obj: stringSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringSymbol.Tpo" -c -o libbuiltIn_a-stringSymbol.obj `if test -f 'stringSymbol.cc'; then $(CYGPATH_W) 'stringSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/stringSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-stringSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringSymbol.cc' object='libbuiltIn_a-stringSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringSymbol.obj `if test -f 'stringSymbol.cc'; then $(CYGPATH_W) 'stringSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/stringSymbol.cc'; fi` libbuiltIn_a-stringTerm.o: stringTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringTerm.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringTerm.Tpo" -c -o libbuiltIn_a-stringTerm.o `test -f 'stringTerm.cc' || echo '$(srcdir)/'`stringTerm.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringTerm.Tpo" "$(DEPDIR)/libbuiltIn_a-stringTerm.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringTerm.cc' object='libbuiltIn_a-stringTerm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringTerm.o `test -f 'stringTerm.cc' || echo '$(srcdir)/'`stringTerm.cc libbuiltIn_a-stringTerm.obj: stringTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringTerm.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringTerm.Tpo" -c -o libbuiltIn_a-stringTerm.obj `if test -f 'stringTerm.cc'; then $(CYGPATH_W) 'stringTerm.cc'; else $(CYGPATH_W) '$(srcdir)/stringTerm.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringTerm.Tpo" "$(DEPDIR)/libbuiltIn_a-stringTerm.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringTerm.cc' object='libbuiltIn_a-stringTerm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringTerm.obj `if test -f 'stringTerm.cc'; then $(CYGPATH_W) 'stringTerm.cc'; else $(CYGPATH_W) '$(srcdir)/stringTerm.cc'; fi` libbuiltIn_a-stringDagNode.o: stringDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringDagNode.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringDagNode.Tpo" -c -o libbuiltIn_a-stringDagNode.o `test -f 'stringDagNode.cc' || echo '$(srcdir)/'`stringDagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringDagNode.Tpo" "$(DEPDIR)/libbuiltIn_a-stringDagNode.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringDagNode.cc' object='libbuiltIn_a-stringDagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringDagNode.o `test -f 'stringDagNode.cc' || echo '$(srcdir)/'`stringDagNode.cc libbuiltIn_a-stringDagNode.obj: stringDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringDagNode.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringDagNode.Tpo" -c -o libbuiltIn_a-stringDagNode.obj `if test -f 'stringDagNode.cc'; then $(CYGPATH_W) 'stringDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/stringDagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringDagNode.Tpo" "$(DEPDIR)/libbuiltIn_a-stringDagNode.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringDagNode.cc' object='libbuiltIn_a-stringDagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringDagNode.obj `if test -f 'stringDagNode.cc'; then $(CYGPATH_W) 'stringDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/stringDagNode.cc'; fi` libbuiltIn_a-stringOpSymbol.o: stringOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Tpo" -c -o libbuiltIn_a-stringOpSymbol.o `test -f 'stringOpSymbol.cc' || echo '$(srcdir)/'`stringOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringOpSymbol.cc' object='libbuiltIn_a-stringOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringOpSymbol.o `test -f 'stringOpSymbol.cc' || echo '$(srcdir)/'`stringOpSymbol.cc libbuiltIn_a-stringOpSymbol.obj: stringOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-stringOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Tpo" -c -o libbuiltIn_a-stringOpSymbol.obj `if test -f 'stringOpSymbol.cc'; then $(CYGPATH_W) 'stringOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/stringOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-stringOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='stringOpSymbol.cc' object='libbuiltIn_a-stringOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-stringOpSymbol.obj `if test -f 'stringOpSymbol.cc'; then $(CYGPATH_W) 'stringOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/stringOpSymbol.cc'; fi` libbuiltIn_a-floatSymbol.o: floatSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatSymbol.Tpo" -c -o libbuiltIn_a-floatSymbol.o `test -f 'floatSymbol.cc' || echo '$(srcdir)/'`floatSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-floatSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatSymbol.cc' object='libbuiltIn_a-floatSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatSymbol.o `test -f 'floatSymbol.cc' || echo '$(srcdir)/'`floatSymbol.cc libbuiltIn_a-floatSymbol.obj: floatSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatSymbol.Tpo" -c -o libbuiltIn_a-floatSymbol.obj `if test -f 'floatSymbol.cc'; then $(CYGPATH_W) 'floatSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/floatSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-floatSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatSymbol.cc' object='libbuiltIn_a-floatSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatSymbol.obj `if test -f 'floatSymbol.cc'; then $(CYGPATH_W) 'floatSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/floatSymbol.cc'; fi` libbuiltIn_a-floatTerm.o: floatTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatTerm.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatTerm.Tpo" -c -o libbuiltIn_a-floatTerm.o `test -f 'floatTerm.cc' || echo '$(srcdir)/'`floatTerm.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatTerm.Tpo" "$(DEPDIR)/libbuiltIn_a-floatTerm.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatTerm.cc' object='libbuiltIn_a-floatTerm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatTerm.o `test -f 'floatTerm.cc' || echo '$(srcdir)/'`floatTerm.cc libbuiltIn_a-floatTerm.obj: floatTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatTerm.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatTerm.Tpo" -c -o libbuiltIn_a-floatTerm.obj `if test -f 'floatTerm.cc'; then $(CYGPATH_W) 'floatTerm.cc'; else $(CYGPATH_W) '$(srcdir)/floatTerm.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatTerm.Tpo" "$(DEPDIR)/libbuiltIn_a-floatTerm.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatTerm.cc' object='libbuiltIn_a-floatTerm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatTerm.obj `if test -f 'floatTerm.cc'; then $(CYGPATH_W) 'floatTerm.cc'; else $(CYGPATH_W) '$(srcdir)/floatTerm.cc'; fi` libbuiltIn_a-floatDagNode.o: floatDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatDagNode.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatDagNode.Tpo" -c -o libbuiltIn_a-floatDagNode.o `test -f 'floatDagNode.cc' || echo '$(srcdir)/'`floatDagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatDagNode.Tpo" "$(DEPDIR)/libbuiltIn_a-floatDagNode.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatDagNode.cc' object='libbuiltIn_a-floatDagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatDagNode.o `test -f 'floatDagNode.cc' || echo '$(srcdir)/'`floatDagNode.cc libbuiltIn_a-floatDagNode.obj: floatDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatDagNode.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatDagNode.Tpo" -c -o libbuiltIn_a-floatDagNode.obj `if test -f 'floatDagNode.cc'; then $(CYGPATH_W) 'floatDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/floatDagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatDagNode.Tpo" "$(DEPDIR)/libbuiltIn_a-floatDagNode.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatDagNode.cc' object='libbuiltIn_a-floatDagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatDagNode.obj `if test -f 'floatDagNode.cc'; then $(CYGPATH_W) 'floatDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/floatDagNode.cc'; fi` libbuiltIn_a-floatOpSymbol.o: floatOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Tpo" -c -o libbuiltIn_a-floatOpSymbol.o `test -f 'floatOpSymbol.cc' || echo '$(srcdir)/'`floatOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatOpSymbol.cc' object='libbuiltIn_a-floatOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatOpSymbol.o `test -f 'floatOpSymbol.cc' || echo '$(srcdir)/'`floatOpSymbol.cc libbuiltIn_a-floatOpSymbol.obj: floatOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-floatOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Tpo" -c -o libbuiltIn_a-floatOpSymbol.obj `if test -f 'floatOpSymbol.cc'; then $(CYGPATH_W) 'floatOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/floatOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-floatOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='floatOpSymbol.cc' object='libbuiltIn_a-floatOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-floatOpSymbol.obj `if test -f 'floatOpSymbol.cc'; then $(CYGPATH_W) 'floatOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/floatOpSymbol.cc'; fi` libbuiltIn_a-succSymbol.o: succSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-succSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-succSymbol.Tpo" -c -o libbuiltIn_a-succSymbol.o `test -f 'succSymbol.cc' || echo '$(srcdir)/'`succSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-succSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-succSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-succSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='succSymbol.cc' object='libbuiltIn_a-succSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-succSymbol.o `test -f 'succSymbol.cc' || echo '$(srcdir)/'`succSymbol.cc libbuiltIn_a-succSymbol.obj: succSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-succSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-succSymbol.Tpo" -c -o libbuiltIn_a-succSymbol.obj `if test -f 'succSymbol.cc'; then $(CYGPATH_W) 'succSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/succSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-succSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-succSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-succSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='succSymbol.cc' object='libbuiltIn_a-succSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-succSymbol.obj `if test -f 'succSymbol.cc'; then $(CYGPATH_W) 'succSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/succSymbol.cc'; fi` libbuiltIn_a-numberOpSymbol.o: numberOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-numberOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Tpo" -c -o libbuiltIn_a-numberOpSymbol.o `test -f 'numberOpSymbol.cc' || echo '$(srcdir)/'`numberOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='numberOpSymbol.cc' object='libbuiltIn_a-numberOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-numberOpSymbol.o `test -f 'numberOpSymbol.cc' || echo '$(srcdir)/'`numberOpSymbol.cc libbuiltIn_a-numberOpSymbol.obj: numberOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-numberOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Tpo" -c -o libbuiltIn_a-numberOpSymbol.obj `if test -f 'numberOpSymbol.cc'; then $(CYGPATH_W) 'numberOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/numberOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-numberOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='numberOpSymbol.cc' object='libbuiltIn_a-numberOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-numberOpSymbol.obj `if test -f 'numberOpSymbol.cc'; then $(CYGPATH_W) 'numberOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/numberOpSymbol.cc'; fi` libbuiltIn_a-minusSymbol.o: minusSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-minusSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-minusSymbol.Tpo" -c -o libbuiltIn_a-minusSymbol.o `test -f 'minusSymbol.cc' || echo '$(srcdir)/'`minusSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-minusSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-minusSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-minusSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='minusSymbol.cc' object='libbuiltIn_a-minusSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-minusSymbol.o `test -f 'minusSymbol.cc' || echo '$(srcdir)/'`minusSymbol.cc libbuiltIn_a-minusSymbol.obj: minusSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-minusSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-minusSymbol.Tpo" -c -o libbuiltIn_a-minusSymbol.obj `if test -f 'minusSymbol.cc'; then $(CYGPATH_W) 'minusSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/minusSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-minusSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-minusSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-minusSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='minusSymbol.cc' object='libbuiltIn_a-minusSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-minusSymbol.obj `if test -f 'minusSymbol.cc'; then $(CYGPATH_W) 'minusSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/minusSymbol.cc'; fi` libbuiltIn_a-ACU_NumberOpSymbol.o: ACU_NumberOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-ACU_NumberOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Tpo" -c -o libbuiltIn_a-ACU_NumberOpSymbol.o `test -f 'ACU_NumberOpSymbol.cc' || echo '$(srcdir)/'`ACU_NumberOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ACU_NumberOpSymbol.cc' object='libbuiltIn_a-ACU_NumberOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-ACU_NumberOpSymbol.o `test -f 'ACU_NumberOpSymbol.cc' || echo '$(srcdir)/'`ACU_NumberOpSymbol.cc libbuiltIn_a-ACU_NumberOpSymbol.obj: ACU_NumberOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-ACU_NumberOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Tpo" -c -o libbuiltIn_a-ACU_NumberOpSymbol.obj `if test -f 'ACU_NumberOpSymbol.cc'; then $(CYGPATH_W) 'ACU_NumberOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/ACU_NumberOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-ACU_NumberOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ACU_NumberOpSymbol.cc' object='libbuiltIn_a-ACU_NumberOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-ACU_NumberOpSymbol.obj `if test -f 'ACU_NumberOpSymbol.cc'; then $(CYGPATH_W) 'ACU_NumberOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/ACU_NumberOpSymbol.cc'; fi` libbuiltIn_a-CUI_NumberOpSymbol.o: CUI_NumberOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-CUI_NumberOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Tpo" -c -o libbuiltIn_a-CUI_NumberOpSymbol.o `test -f 'CUI_NumberOpSymbol.cc' || echo '$(srcdir)/'`CUI_NumberOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_NumberOpSymbol.cc' object='libbuiltIn_a-CUI_NumberOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-CUI_NumberOpSymbol.o `test -f 'CUI_NumberOpSymbol.cc' || echo '$(srcdir)/'`CUI_NumberOpSymbol.cc libbuiltIn_a-CUI_NumberOpSymbol.obj: CUI_NumberOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-CUI_NumberOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Tpo" -c -o libbuiltIn_a-CUI_NumberOpSymbol.obj `if test -f 'CUI_NumberOpSymbol.cc'; then $(CYGPATH_W) 'CUI_NumberOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_NumberOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-CUI_NumberOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_NumberOpSymbol.cc' object='libbuiltIn_a-CUI_NumberOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-CUI_NumberOpSymbol.obj `if test -f 'CUI_NumberOpSymbol.cc'; then $(CYGPATH_W) 'CUI_NumberOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_NumberOpSymbol.cc'; fi` libbuiltIn_a-divisionSymbol.o: divisionSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-divisionSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Tpo" -c -o libbuiltIn_a-divisionSymbol.o `test -f 'divisionSymbol.cc' || echo '$(srcdir)/'`divisionSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='divisionSymbol.cc' object='libbuiltIn_a-divisionSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-divisionSymbol.o `test -f 'divisionSymbol.cc' || echo '$(srcdir)/'`divisionSymbol.cc libbuiltIn_a-divisionSymbol.obj: divisionSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-divisionSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Tpo" -c -o libbuiltIn_a-divisionSymbol.obj `if test -f 'divisionSymbol.cc'; then $(CYGPATH_W) 'divisionSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/divisionSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-divisionSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='divisionSymbol.cc' object='libbuiltIn_a-divisionSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-divisionSymbol.obj `if test -f 'divisionSymbol.cc'; then $(CYGPATH_W) 'divisionSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/divisionSymbol.cc'; fi` libbuiltIn_a-randomOpSymbol.o: randomOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-randomOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Tpo" -c -o libbuiltIn_a-randomOpSymbol.o `test -f 'randomOpSymbol.cc' || echo '$(srcdir)/'`randomOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='randomOpSymbol.cc' object='libbuiltIn_a-randomOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-randomOpSymbol.o `test -f 'randomOpSymbol.cc' || echo '$(srcdir)/'`randomOpSymbol.cc libbuiltIn_a-randomOpSymbol.obj: randomOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-randomOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Tpo" -c -o libbuiltIn_a-randomOpSymbol.obj `if test -f 'randomOpSymbol.cc'; then $(CYGPATH_W) 'randomOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/randomOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-randomOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='randomOpSymbol.cc' object='libbuiltIn_a-randomOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-randomOpSymbol.obj `if test -f 'randomOpSymbol.cc'; then $(CYGPATH_W) 'randomOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/randomOpSymbol.cc'; fi` libbuiltIn_a-counterSymbol.o: counterSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-counterSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-counterSymbol.Tpo" -c -o libbuiltIn_a-counterSymbol.o `test -f 'counterSymbol.cc' || echo '$(srcdir)/'`counterSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-counterSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-counterSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-counterSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='counterSymbol.cc' object='libbuiltIn_a-counterSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-counterSymbol.o `test -f 'counterSymbol.cc' || echo '$(srcdir)/'`counterSymbol.cc libbuiltIn_a-counterSymbol.obj: counterSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-counterSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-counterSymbol.Tpo" -c -o libbuiltIn_a-counterSymbol.obj `if test -f 'counterSymbol.cc'; then $(CYGPATH_W) 'counterSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/counterSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-counterSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-counterSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-counterSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='counterSymbol.cc' object='libbuiltIn_a-counterSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-counterSymbol.obj `if test -f 'counterSymbol.cc'; then $(CYGPATH_W) 'counterSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/counterSymbol.cc'; fi` libbuiltIn_a-matrixOpSymbol.o: matrixOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-matrixOpSymbol.o -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Tpo" -c -o libbuiltIn_a-matrixOpSymbol.o `test -f 'matrixOpSymbol.cc' || echo '$(srcdir)/'`matrixOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='matrixOpSymbol.cc' object='libbuiltIn_a-matrixOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-matrixOpSymbol.o `test -f 'matrixOpSymbol.cc' || echo '$(srcdir)/'`matrixOpSymbol.cc libbuiltIn_a-matrixOpSymbol.obj: matrixOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libbuiltIn_a-matrixOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Tpo" -c -o libbuiltIn_a-matrixOpSymbol.obj `if test -f 'matrixOpSymbol.cc'; then $(CYGPATH_W) 'matrixOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/matrixOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Tpo" "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Po"; else rm -f "$(DEPDIR)/libbuiltIn_a-matrixOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='matrixOpSymbol.cc' object='libbuiltIn_a-matrixOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libbuiltIn_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libbuiltIn_a-matrixOpSymbol.obj `if test -f 'matrixOpSymbol.cc'; then $(CYGPATH_W) 'matrixOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/matrixOpSymbol.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/BuiltIn/randomOpSymbol.cc0000644000147300135640000000571610063425207014766 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 2004 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NumberOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" // free theory class definitions #include "freeDagNode.hh" // built in stuff #include "succSymbol.hh" #include "randomOpSymbol.hh" MTRand::uint32 RandomOpSymbol::globalSeed = 0; RandomOpSymbol::RandomOpSymbol(int id) : NumberOpSymbol(id, 1), currentIndex(0), currentState(globalSeed) { randomNumber = currentState.randInt(); } bool RandomOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { if (strcmp(purpose, "RandomOpSymbol") == 0) return true; return NumberOpSymbol::attachData(opDeclaration, purpose, data); } void RandomOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "RandomOpSymbol"; data.resize(nrDataAttachments + 1); NumberOpSymbol::getDataAttachments(opDeclaration, purposes, data); } bool RandomOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { FreeDagNode* d = safeCast(FreeDagNode*, subject); DagNode* a = d->getArgument(0); a->reduce(context); SuccSymbol* succSymbol = getSuccSymbol(); if (succSymbol != 0 && succSymbol->isNat(a)) { const mpz_class& wantedIndex = succSymbol->getNat(a); if (wantedIndex < currentIndex) { currentIndex = 0; currentState.seed(globalSeed); randomNumber = currentState.randInt(); } while (currentIndex < wantedIndex) { ++currentIndex; randomNumber = currentState.randInt(); } return succSymbol->rewriteToNat(subject, context, randomNumber); } // // NumberOpSymbol doesn't know how to deal with this. // return FreeSymbol::eqRewrite(subject, context); } Maude-2.6/src/BuiltIn/floatOpSymbol.cc0000644000147300135640000002710611161306535014612 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class FloatOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" #include "mathStuff.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "NA_Theory.hh" #include "builtIn.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeNet.hh" #include "freeDagNode.hh" // built in class definitions #include "succSymbol.hh" #include "minusSymbol.hh" #include "divisionSymbol.hh" #include "floatSymbol.hh" #include "floatDagNode.hh" #include "floatOpSymbol.hh" #include "bindingMacros.hh" FloatOpSymbol::FloatOpSymbol(int id, int arity) : FreeSymbol(id, arity) { op = NONE; floatSymbol = 0; succSymbol = 0; minusSymbol = 0; divisionSymbol = 0; } bool FloatOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { BIND_OP(purpose, FloatOpSymbol, op, data); return FreeSymbol::attachData(opDeclaration, purpose, data); } bool FloatOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, floatSymbol, FloatSymbol*); BIND_SYMBOL(purpose, symbol, succSymbol, SuccSymbol*); BIND_SYMBOL(purpose, symbol, minusSymbol, MinusSymbol*); BIND_SYMBOL(purpose, symbol, divisionSymbol, DivisionSymbol*); return FreeSymbol::attachSymbol(purpose, symbol); } bool FloatOpSymbol::attachTerm(const char* purpose, Term* term) { BIND_TERM(purpose, term, trueTerm); BIND_TERM(purpose, term, falseTerm); return FreeSymbol::attachTerm(purpose, term); } void FloatOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { FloatOpSymbol* orig = safeCast(FloatOpSymbol*, original); op = orig->op; COPY_SYMBOL(orig, floatSymbol, map, FloatSymbol*); COPY_SYMBOL(orig, succSymbol, map, SuccSymbol*); COPY_SYMBOL(orig, minusSymbol, map, MinusSymbol*); COPY_SYMBOL(orig, divisionSymbol, map, DivisionSymbol*); COPY_TERM(orig, trueTerm, map); COPY_TERM(orig, falseTerm, map); FreeSymbol::copyAttachments(original, map); } void FloatOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "FloatOpSymbol"; data.resize(nrDataAttachments + 1); data[nrDataAttachments].resize(1); const char*& d = data[nrDataAttachments][0]; switch (op) { CODE_CASE(d, '-', 0, "-") CODE_CASE(d, 'a', 'b', "abs") CODE_CASE(d, 'c', 'e', "ceiling") CODE_CASE(d, 's', 'q', "sqrt") CODE_CASE(d, 'e', 'x', "exp") CODE_CASE(d, 'l', 'o', "log") CODE_CASE(d, 's', 'i', "sin") CODE_CASE(d, 'c', 'o', "cos") CODE_CASE(d, 't', 'a', "tan") CODE_CASE(d, 'a', 's', "asin") CODE_CASE(d, 'a', 'c', "acos") CODE_CASE(d, 'a', 't', "atan") CODE_CASE(d, 'r', 'a', "rat") CODE_CASE(d, '+', 0, "+") CODE_CASE(d, '*', 0, "*") CODE_CASE(d, '/', 0, "/") CODE_CASE(d, 'r', 'e', "rem") CODE_CASE(d, '^', 0, "^") CODE_CASE(d, '<', 0, "<") CODE_CASE(d, '<', '=', "<=") CODE_CASE(d, '>', 0, ">") CODE_CASE(d, '>', '=', ">=") CODE_CASE(d, 'm', 'i', "min") CODE_CASE(d, 'm', 'a', "max") case CODE('f', 'l'): { d = (succSymbol == 0) ? "floor" : "float"; // HACK break; } default: CantHappen("bad float op"); } FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void FloatOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, floatSymbol); APPEND_SYMBOL(purposes, symbols, succSymbol); APPEND_SYMBOL(purposes, symbols, minusSymbol); APPEND_SYMBOL(purposes, symbols, divisionSymbol); FreeSymbol::getSymbolAttachments(purposes, symbols); } void FloatOpSymbol::getTermAttachments(Vector& purposes, Vector& terms) { APPEND_TERM(purposes, terms, trueTerm); APPEND_TERM(purposes, terms, falseTerm); FreeSymbol::getTermAttachments(purposes, terms); } void FloatOpSymbol::postInterSymbolPass() { PREPARE_TERM(trueTerm); PREPARE_TERM(falseTerm); } void FloatOpSymbol::reset() { trueTerm.reset(); // so true dag can be garbage collected falseTerm.reset(); // so false dag can be garbage collected FreeSymbol::reset(); // parents reset() tasks } bool FloatOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); int nrArgs = arity(); FreeDagNode* d = static_cast(subject); bool floatEval = true; // // Evaluate our arguments and check that they are all floats. // for (int i = 0; i < nrArgs; i++) { DagNode* a = d->getArgument(i); a->reduce(context); if (a->symbol() != floatSymbol) floatEval = false; } if (floatEval) { double a1 = static_cast(d->getArgument(0))->getValue(); double r; if (nrArgs == 1) { switch (op) { case '-': r = -a1; break; case CODE('a', 'b'): r = fabs(a1); break; case CODE('f', 'l'): r = floor(a1); break; case CODE('c', 'e'): r = ceil(a1); break; case CODE('s', 'q'): r = sqrt(a1); break; case CODE('e', 'x'): r = exp(a1); break; case CODE('l', 'o'): { if (a1 < 0) goto fail; // some platforms return NaN, some -Infinity r = log(a1); break; } case CODE('s', 'i'): r = sin(a1); break; case CODE('c', 'o'): r = cos(a1); break; case CODE('t', 'a'): r = tan(a1); break; case CODE('a', 's'): { if (a1 < -1.0 || a1 > 1.0) goto fail; r = asin(a1); break; } case CODE('a', 'c'): { if (a1 < -1.0 || a1 > 1.0) goto fail; r = acos(a1); break; } case CODE('a', 't'): r = atan(a1); break; case CODE('r', 'a'): { if (!(finite(a1))) goto fail; mpq_class t; mpq_set_d(t.get_mpq_t(), a1); const mpz_class& numerator = t.get_num(); const mpz_class& denominator = t.get_den(); DagNode* r; if (denominator == 1) { if (numerator >= 0) return succSymbol->rewriteToNat(subject, context, numerator); r = minusSymbol->makeNegDag(numerator); } else r = divisionSymbol->makeRatDag(numerator, denominator); return context.builtInReplace(subject, r); } default: CantHappen("bad float op"); r = 0.0; } } else { double a2 = static_cast(d->getArgument(1))->getValue(); switch (op) { case '+': r = a1 + a2; break; case '-': r = a1 - a2; break; case '*': r = a1 * a2; break; case '/': { if (a2 == 0) goto fail; r = a1 / a2; break; } case CODE('r', 'e'): { if (a2 == 0) goto fail; r = fmod(a1, a2); break; } case '^': { bool defined; r = safePow(a1, a2, defined); if (!defined) goto fail; break; } case CODE('a', 't'): { if (!finite(a1) && !finite(a2)) { // // Double infinity case: make args finite // a1 = (a1 < 0) ? -1 : 1; a2 = (a2 < 0) ? -1 : 1; } r = atan2(a1, a2); break; } case CODE('m', 'i'): { r = (a1 < a2) ? a1 : a2; break; } case CODE('m', 'a'): { r = (a1 < a2) ? a2 : a1; break; } default: { switch (op) { case '<': r = a1 < a2; break; case CODE('<', '='): r = a1 <= a2; break; case '>': r = a1 > a2; break; case CODE('>', '='): r = a1 >= a2; break; default: CantHappen("bad float op"); r = 0.0; // avoid compiler warning } Assert(trueTerm.getTerm() != 0 && falseTerm.getTerm() != 0, "null true/false for relational op"); return context.builtInReplace(subject, r ? trueTerm.getDag() : falseTerm.getDag()); } } } if (!isnan(r)) return floatSymbol->rewriteToFloat(subject, context, r); } else if (nrArgs == 1) { DagNode* a0 = d->getArgument(0); if (op == CODE('f', 'l') && succSymbol != 0) // check we're float() and not floor() { if (succSymbol->isNat(a0)) { mpq_class tq(succSymbol->getNat(a0), 1); return floatSymbol->rewriteToFloat(subject, context, mpq_get_d(tq.get_mpq_t())); } else if (a0->symbol() == minusSymbol) { if (minusSymbol->isNeg(a0)) { mpz_class result; mpq_class tq(minusSymbol->getNeg(a0, result), 1); return floatSymbol->rewriteToFloat(subject, context, mpq_get_d(tq.get_mpq_t())); } } else if (a0->symbol() == divisionSymbol) { if (divisionSymbol->isRat(a0)) { mpz_class numerator; const mpz_class& denomenator = divisionSymbol->getRat(a0, numerator); mpq_class tq(numerator, denomenator); return floatSymbol->rewriteToFloat(subject, context, mpq_get_d(tq.get_mpq_t())); } } } } fail: return FreeSymbol::eqRewrite(subject, context); } int FloatOpSymbol::isOdd(double n) { // // Decide if a floating point number is odd or even; // return -1 if neither or can't decide. // if (n != floor(n)) return -1; // fractional if (n < 0) n = -n; if (n > INT_DOUBLE_MAX) // oddness is essentially random return -1; return static_cast(n) & 1; } double FloatOpSymbol::safePow(double a1, double a2, bool& defined) { defined = true; if (isnan(a1)) { defined = false; return a1; } if (isnan(a2)) { defined = false; return a2; } if (!finite(a1)) { if (a2 == 0.0) return 1.0; if (a2 < 0) return 0.0; if (a1 > 0) return a1; int odd = isOdd(a2); if (odd == -1) { defined = false; return 0.0; } return odd ? a1 : -a1; } if (!finite(a2)) { if (a1 > 1.0) return a2 > 0 ? a2 : 0; if (a1 == 1.0) return 1.0; if (a1 > 0.0) return a2 < 0 ? -a2 : 0; if (a2 > 0) { if (a1 <= -1.0) defined = false; } else { if (a1 >= -1.0) defined = false; } return 0; } if (a1 == 0.0 && a2 < 0.0) { // // Some platforms return Infinity. // defined = false; return 0.0; } double r = pow(a1, a2); if (isnan(r)) defined = false; else if (a1 < 0.0 && r != 0.0) { // // Some platforms get this badly wrong. // int odd = isOdd(a2); if (odd == -1) defined = false; else if ((odd == 1) != (r < 0)) r = -r; // fix sign if pow() got it wrong } return r; } Maude-2.6/src/BuiltIn/stringSymbol.cc0000644000147300135640000000442611457445542014526 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class StringSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // built in class definitions #include "stringSymbol.hh" #include "stringTerm.hh" #include "stringDagNode.hh" StringSymbol::StringSymbol(int id) : NA_Symbol(id) { sort = 0; charSort = 0; } void StringSymbol::fillInSortInfo(Term* subject) { Sort* s = (static_cast(subject)->getValue().length() == 1) ? charSort : sort; subject->setSortInfo(s->component(), s->index()); } void StringSymbol::computeBaseSort(DagNode* subject) { Sort* s = (static_cast(subject)->getValue().length() == 1) ? charSort : sort; subject->setSortIndex(s->index()); } bool StringSymbol::isConstructor(DagNode* /* subject */) { return true; } void StringSymbol::compileOpDeclarations() { const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { Sort* s = opDecls[i].getDomainAndRange()[0]; if (sort == 0 || s->index() < sort->index()) sort = s; // set sort to largest (smallest index) declared sort if (charSort == 0 || s->index() > charSort->index()) charSort = s; // set charSort to smallest (largest index) declared sort } } Maude-2.6/src/BuiltIn/CUI_NumberOpSymbol.cc0000644000147300135640000000767110046556540015446 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_NumberOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "CUI_Theory.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" #include "CUI_NumberOpSymbol.hh" CUI_NumberOpSymbol::CUI_NumberOpSymbol(int id, Axioms axioms) : CUI_Symbol(id, standard, false, axioms) { op = NONE; succSymbol = 0; } bool CUI_NumberOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { BIND_OP(purpose, CUI_NumberOpSymbol, op, data); return CUI_Symbol::attachData(opDeclaration, purpose, data); } bool CUI_NumberOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, succSymbol, SuccSymbol*); return CUI_Symbol::attachSymbol(purpose, symbol); } void CUI_NumberOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { CUI_NumberOpSymbol* orig = safeCast(CUI_NumberOpSymbol*, original); op = orig->op; COPY_SYMBOL(orig, succSymbol, map, SuccSymbol*); CUI_Symbol::copyAttachments(original, map); } void CUI_NumberOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "CUI_NumberOpSymbol"; data.resize(nrDataAttachments + 1); data[nrDataAttachments].resize(1); const char*& d = data[nrDataAttachments][0]; switch (op) { CODE_CASE(d, 's', 'd', "sd") default: CantHappen("bad number op"); } CUI_Symbol::getDataAttachments(opDeclaration, purposes, data); } void CUI_NumberOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, succSymbol); CUI_Symbol::getSymbolAttachments(purposes, symbols); } bool CUI_NumberOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); CUI_DagNode* d = safeCast(CUI_DagNode*, subject); bool specialEval = true; // // Evaluate our arguments and check that they are both numbers. // for (int i = 0; i < 2; i++) { DagNode* a = d->getArgument(i); a->reduce(context); if (!(succSymbol != 0 && succSymbol->isNat(a))) specialEval = false; } if (specialEval) { const mpz_class& a0 = succSymbol->getNat(d->getArgument(0)); const mpz_class& a1 = succSymbol->getNat(d->getArgument(1)); mpz_class r; switch (op) { case CODE('s', 'd'): { r = abs(a0 - a1); break; } default: CantHappen("bad number op"); } return succSymbol->rewriteToNat(subject, context, r); } return CUI_Symbol::eqRewrite(subject, context); } Maude-2.6/src/BuiltIn/equalitySymbol.hh0000644000147300135640000000400207752552334015056 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in equality operations. // #ifndef _equalitySymbol_hh_ #define _equalitySymbol_hh_ #include "freeSymbol.hh" #include "cachedDag.hh" #include "fullCompiler.hh" class EqualitySymbol : public FreeSymbol { public: EqualitySymbol(int id, const Vector& strategy); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachTerm(const char* purpose, Term* term); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getTermAttachments(Vector& purposes, Vector& terms); void postInterSymbolPass(); void reset(); bool eqRewrite(DagNode* subject, RewritingContext& context); // // We don't accept or compile any equations. // bool acceptEquation(Equation* equation); void compileEquations(); bool domainSortAlwaysLeqThan(Sort* sort, int argNr); #ifdef COMPILER void generateCode(CompilationContext& context) const; #endif private: CachedDag equalTerm; CachedDag notEqualTerm; }; #endif Maude-2.6/src/BuiltIn/floatDagNode.cc0000644000147300135640000000412311062315071014334 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class FloatDagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // built in class definitions #include "floatSymbol.hh" #include "floatDagNode.hh" FloatDagNode::FloatDagNode(FloatSymbol* symbol, double value) : NA_DagNode(symbol), value((value == 0.0) ? 0.0 : value) // don't allow IEEE-754 -0.0 { } size_t FloatDagNode::getHashValue() { return hash(symbol()->getHashValue(), bitPattern ^ (bitPattern >> 32)); } int FloatDagNode::compareArguments(const DagNode* other) const { double otherValue = static_cast(other)->value; return (value == otherValue) ? 0 : ((value > otherValue) ? 1 : -1); } void FloatDagNode::overwriteWithClone(DagNode* old) { FloatDagNode* d = new(old) FloatDagNode(safeCast(FloatSymbol*, symbol()), value); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); } DagNode* FloatDagNode::makeClone() { FloatDagNode* d = new FloatDagNode(safeCast(FloatSymbol*, symbol()), value); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); return d; } Maude-2.6/src/BuiltIn/stringDagNode.cc0000644000147300135640000000446307666303207014561 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class StringDagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // built in class definitions #include "stringSymbol.hh" #include "stringDagNode.hh" StringDagNode::StringDagNode(StringSymbol* symbol, const crope& value) : NA_DagNode(symbol), value(value) { //Assert(sizeof(crope) <= DagNode::nrWords * sizeof(DagNode::Word), // cerr << "crope too big for internal storage"); // HACK setCallDtor(); // need our dtor called when garbage collected to destruct crope } size_t StringDagNode::getHashValue() { int hashValue = 0; for (crope::const_iterator i(value.begin()); i != value.end(); i++) hashValue = (hashValue << 1) + *i; return hash(symbol()->getHashValue(), hashValue); } int StringDagNode::compareArguments(const DagNode* other) const { return value.compare(static_cast(other)->value); } void StringDagNode::overwriteWithClone(DagNode* old) { StringDagNode* d = new(old) StringDagNode(safeCast(StringSymbol*, symbol()), value); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); } DagNode* StringDagNode::makeClone() { StringDagNode* d = new StringDagNode(safeCast(StringSymbol*, symbol()), value); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); return d; } Maude-2.6/src/BuiltIn/numberOpSymbol.cc0000644000147300135640000002525511062337607015004 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NumberOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeDagNode.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "numberOpSymbol.hh" NumberOpSymbol::NumberOpSymbol(int id, int arity) : FreeSymbol(id, arity) { op = NONE; succSymbol = 0; minusSymbol = 0; } bool NumberOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { BIND_OP(purpose, NumberOpSymbol, op, data); return FreeSymbol::attachData(opDeclaration, purpose, data); } bool NumberOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, succSymbol, SuccSymbol*); BIND_SYMBOL(purpose, symbol, minusSymbol, MinusSymbol*); return FreeSymbol::attachSymbol(purpose, symbol); } bool NumberOpSymbol::attachTerm(const char* purpose, Term* term) { BIND_TERM(purpose, term, trueTerm); BIND_TERM(purpose, term, falseTerm); return FreeSymbol::attachTerm(purpose, term); } void NumberOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { NumberOpSymbol* orig = safeCast(NumberOpSymbol*, original); op = orig->op; COPY_SYMBOL(orig, succSymbol, map, SuccSymbol*); COPY_SYMBOL(orig, minusSymbol, map, MinusSymbol*); COPY_TERM(orig, trueTerm, map); COPY_TERM(orig, falseTerm, map); FreeSymbol::copyAttachments(original, map); } void NumberOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { if (op != NONE) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "NumberOpSymbol"; data.resize(nrDataAttachments + 1); data[nrDataAttachments].resize(1); const char*& d = data[nrDataAttachments][0]; switch (op) { CODE_CASE(d, '-', 0, "-") CODE_CASE(d, '~', 0, "~") CODE_CASE(d, 'a', 'b', "abs") CODE_CASE(d, '+', 0, "+") CODE_CASE(d, '*', 0, "*") CODE_CASE(d, 'g', 'c', "gcd") CODE_CASE(d, 'l', 'c', "lcm") CODE_CASE(d, '|', 0, "|") CODE_CASE(d, '&', 0, "&") CODE_CASE(d, 'x', 'o', "xor") CODE_CASE(d, 'q', 'u', "quo") CODE_CASE(d, 'r', 'e', "rem") CODE_CASE(d, '^', 0, "^") CODE_CASE(d, '<', '<', "<<") CODE_CASE(d, '>', '>', ">>") CODE_CASE(d, '<', 0, "<") CODE_CASE(d, '<', '=', "<=") CODE_CASE(d, '>', 0, ">") CODE_CASE(d, '>', '=', ">=") CODE_CASE(d, 'd', 'i', "divides") CODE_CASE(d, 'm', 'o', "modExp") default: CantHappen("bad number op"); } } FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void NumberOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, succSymbol); APPEND_SYMBOL(purposes, symbols, minusSymbol); FreeSymbol::getSymbolAttachments(purposes, symbols); } void NumberOpSymbol::getTermAttachments(Vector& purposes, Vector& terms) { APPEND_TERM(purposes, terms, trueTerm); APPEND_TERM(purposes, terms, falseTerm); FreeSymbol::getTermAttachments(purposes, terms); } void NumberOpSymbol::postInterSymbolPass() { PREPARE_TERM(trueTerm); PREPARE_TERM(falseTerm); } void NumberOpSymbol::reset() { trueTerm.reset(); // so true dag can be garbage collected falseTerm.reset(); // so false dag can be garbage collected FreeSymbol::reset(); // parents reset() tasks } bool NumberOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); int nrArgs = arity(); FreeDagNode* d = safeCast(FreeDagNode*, subject); bool specialEval = (succSymbol != 0); // // Evaluate our arguments and check that they are all numbers // for (int i = 0; i < nrArgs; i++) { DagNode* a = d->getArgument(i); a->reduce(context); if (specialEval && !((a->symbol() == minusSymbol) ? minusSymbol->isNeg(a) : succSymbol->isNat(a))) specialEval = false; } if (specialEval) { mpz_class storage0; DagNode* d0 = d->getArgument(0); const mpz_class& a0 = (d0->symbol() == minusSymbol) ? minusSymbol->getNeg(d0, storage0) : succSymbol->getNat(d0); mpz_class r; if (nrArgs == 1) { switch (op) { case '-': { if (a0 > 0) // avoid infinite loop! goto fail; r = -a0; break; } case '~': { if (minusSymbol == 0) goto fail; r = ~a0; break; } case CODE('a', 'b'): { r = abs(a0); break; } default: CantHappen("bad number op"); } } else { mpz_class storage1; DagNode* d1 = d->getArgument(1); const mpz_class& a1 = (d1->symbol() == minusSymbol) ? minusSymbol->getNeg(d1, storage1) : succSymbol->getNat(d1); if (nrArgs == 2) { switch (op) { // // These seven operations are really AC and are just // included here for completeness. // case '+': { r = a0 + a1; break; } case '*': { r = a0 * a1; break; } case CODE('g', 'c'): { mpz_gcd(r.get_mpz_t(), a0.get_mpz_t(), a1.get_mpz_t()); break; } case CODE('l', 'c'): { mpz_lcm(r.get_mpz_t(), a0.get_mpz_t(), a1.get_mpz_t()); break; } case '&': { r = a0 & a1; break; } case '|': { r = a0 | a1; break; } case CODE('x', 'o'): { r = a0 ^ a1; break; } // // These remaining operations, together with the unary // operations above are the raison d'etre for this class. // case '-': { if (minusSymbol == 0) goto fail; r = a0 - a1; break; } case CODE('q', 'u'): { if (a1 == 0) goto fail; r = a0 / a1; break; } case CODE('r', 'e'): { if (a1 == 0) goto fail; r = a0 % a1; break; } case '^': { if (a1 < 0) goto fail; if (a1 > EXPONENT_BOUND) // handle a0 = -1, 0 or 1 { if (a0 == 0 || a0 == 1) { r = a0; break; } else if (a0 == -1) { mpz_class t = 1; r = ((a1 & t) == 0) ? 1 : -1; break; } goto fail; } mpz_pow_ui(r.get_mpz_t(), a0.get_mpz_t(), mpz_get_ui(a1.get_mpz_t())); break; } case CODE('<', '<'): { if (a1 < 0) goto fail; if (a1 > EXPONENT_BOUND) { if (a0 == 0) { r = 0; break; } goto fail; } r = a0 << mpz_get_ui(a1.get_mpz_t()); break; } case CODE('>', '>'): { if (a1 < 0) goto fail; if (mpz_fits_uint_p(a1.get_mpz_t())) { // // Note that that the C++ binding of operator>> defines // a0 >> a1 using mpz_tdiv_q_2exp() which gives a logical // rather than an arithmetic right shift // with respect to 2's complement representation. // mpz_fdiv_q_2exp(r.get_mpz_t(), a0.get_mpz_t(), mpz_get_ui(a1.get_mpz_t())); } else { mpz_fdiv_q_2exp(r.get_mpz_t(), a0.get_mpz_t(), UINT_MAX); if (r != 0 && r != -1) { // // We get here only in extreme cases where a1 // is in the billions and a0 has billions of // significant bits. // mpz_class t(a1); t -= UINT_MAX; while (!(mpz_fits_uint_p(t.get_mpz_t()))) { mpz_fdiv_q_2exp(r.get_mpz_t(), r.get_mpz_t(), UINT_MAX); if (r == 0 || r == -1) goto done; t -= UINT_MAX; } mpz_fdiv_q_2exp(r.get_mpz_t(), r.get_mpz_t(), mpz_get_ui(t.get_mpz_t())); } done: ; } break; } default: { bool b; switch (op) { case '<': { b = a0 < a1; break; } case CODE('<', '='): { b = a0 <= a1; break; } case '>': { b = a0 > a1; break; } case CODE('>', '='): { b = a0 >= a1; break; } case CODE('d', 'i'): { if (a0 == 0) goto fail; b = mpz_divisible_p(a1.get_mpz_t(), a0.get_mpz_t()); break; } default: CantHappen("bad number op " << op << " in subject " << subject); b = false; // avoid compiler warning } Assert(trueTerm.getTerm() != 0 && falseTerm.getTerm() != 0, "null true/false for relational op"); return context.builtInReplace(subject, b ? trueTerm.getDag() : falseTerm.getDag()); } } } else { Assert(nrArgs == 3, "bad number of args"); mpz_class storage2; DagNode* d2 = d->getArgument(2); const mpz_class& a2 = (d2->symbol() == minusSymbol) ? minusSymbol->getNeg(d2, storage2) : succSymbol->getNat(d2); switch (op) { case CODE('m', 'o'): { if (a0 < 0 || a1 < 0 || a2 < 0) goto fail; mpz_powm(r.get_mpz_t(), a0.get_mpz_t(), a1.get_mpz_t(), a2.get_mpz_t()); break; } default: CantHappen("bad number op"); } } } Assert(minusSymbol != 0 || r >= 0, "can't make -ve int"); return (r >= 0) ? succSymbol->rewriteToNat(subject, context, r) : context.builtInReplace(subject, minusSymbol->makeNegDag(r)); } fail: return FreeSymbol::eqRewrite(subject, context); } bool NumberOpSymbol::getNumber(DagNode* dagNode, mpz_class& value) const { if (dagNode->symbol() == minusSymbol) { if (minusSymbol->isNeg(dagNode)) { (void) minusSymbol->getNeg(dagNode, value); return true; } } else { if (succSymbol->isNat(dagNode)) { value = succSymbol->getNat(dagNode); return true; } } return false; } Maude-2.6/src/BuiltIn/minusSymbol.hh0000644000147300135640000000327307752306640014362 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for the unary minus operation. // #ifndef _minusSymbol_hh_ #define _minusSymbol_hh_ #include "numberOpSymbol.hh" class MinusSymbol : public NumberOpSymbol { public: MinusSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); // // Functions special to MinusSymbol. // DagNode* makeNegDag(const mpz_class& integer); bool isNeg(const DagNode* dagNode) const; const mpz_class& getNeg(const DagNode* dagNode, mpz_class& result) const; Term* makeIntTerm(const mpz_class& integer); bool isNeg(/* const */ Term* term) const; const mpz_class& getNeg(/* const */ Term* term, mpz_class& result) const; }; #endif Maude-2.6/src/BuiltIn/counterSymbol.hh0000644000147300135640000000331510505030562014666 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 2004 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in operations on numbers. // #ifndef _counterSymbol_hh_ #define _counterSymbol_hh_ #include #include #include "numberOpSymbol.hh" class CounterSymbol : public NumberOpSymbol { public: CounterSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void resetRules(); void saveHiddenState(); void restoreHiddenState(); bool eqRewrite(DagNode* subject, RewritingContext& context); DagNode* ruleRewrite(DagNode* subject, RewritingContext& context); private: typedef stack > MpzStack; // optimize for the empty case mpz_class currentValue; MpzStack currentValueStack; }; #endif Maude-2.6/src/BuiltIn/stringDagNode.hh0000644000147300135640000000265707705355445014603 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for dag nodes containing strings. // #ifndef _stringDagNode_hh_ #define _stringDagNode_hh_ #include "ropeStuff.hh" #include "NA_DagNode.hh" class StringDagNode : public NA_DagNode { public: StringDagNode(StringSymbol* symbol, const crope& value); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); const crope& getValue() const; private: const crope value; // assume that sizeof(crope) <= DagNode::nrWords }; inline const crope& StringDagNode::getValue() const { return value; } #endif Maude-2.6/src/BuiltIn/floatTerm.cc0000644000147300135640000000543311062314673013756 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class FloatTerm. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "symbolMap.hh" // built in class definitions #include "floatSymbol.hh" #include "floatTerm.hh" #include "floatDagNode.hh" FloatTerm::FloatTerm(FloatSymbol* symbol, double value) : NA_Term(symbol), value((value == 0.0) ? 0.0 : value) // don't allow IEEE-754 -0.0 { } Term* FloatTerm::deepCopy2(SymbolMap* map) const { return new FloatTerm(static_cast(map == 0 ? symbol() : map->translate(symbol())), value); } Term* FloatTerm::instantiate2(const Vector& varBindings, SymbolMap* translator) { return new FloatTerm(safeCast(FloatSymbol*, translator->findTargetVersionOfSymbol(symbol())), value); } Term* FloatTerm::normalize(bool /* full */, bool& changed) { changed = false; setHashValue(hash(symbol()->getHashValue(), bitPattern ^ (bitPattern >> 32))); return this; } int FloatTerm::compareArguments(const Term* other) const { double otherValue = static_cast(other)->value; // // Straight forward subtraction might fail for values near +- 2^63 // return (value == otherValue) ? 0 : ((value > otherValue) ? 1 : -1); } int FloatTerm::compareArguments(const DagNode* other) const { double otherValue = static_cast(other)->value; // // Straight forward subtraction might fail for values near +- 2^63 // return (value == otherValue) ? 0 : ((value > otherValue) ? 1 : -1); } void FloatTerm::overwriteWithDagNode(DagNode* old) const { (void) new(old) FloatDagNode(static_cast(symbol()), value); } NA_DagNode* FloatTerm::makeDagNode() const { return new FloatDagNode(static_cast(symbol()), value); } Maude-2.6/src/BuiltIn/bindingMacros.hh0000644000147300135640000000617107753026502014615 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Macros for binding stuff in builtins. // #ifndef _bindingMacros_hh_ #define _bindingMacros_hh_ // // This needs to be a macro in order to produce constant expressions. // #define CODE(c1, c2) ((c1) + ((c2) << 8)) #define BIND_OP(purpose, className, op, data) \ if (strcmp(purpose, #className) == 0) \ { \ if (data.length() == 1) \ { \ const char* opName = (data)[0]; \ if (opName[0] != '\0') \ { \ int t = CODE(opName[0], opName[1]); \ if (op == NONE) \ { \ op = t; \ return true; \ } \ if (op == t) \ return true; \ } \ } \ return false; \ } #define NULL_DATA(purpose, className, data) \ if (strcmp(purpose, #className) == 0) \ { \ return data.length() == 0; \ } #define BIND_SYMBOL(purpose, symbol, name, type) \ if (strcmp(purpose, #name) == 0) \ { \ if (name != 0) \ return name == symbol; \ name = dynamic_cast(symbol); \ return name != 0; \ } #define BIND_TERM(purpose, term, name) \ if (strcmp(purpose, #name) == 0) \ { \ bool r = true; \ if (Term* t = name.getTerm()) \ { \ r = term->equal(t); \ term->deepSelfDestruct(); \ } \ else \ name.setTerm(term); \ return r; \ } #define PREPARE_TERM(name) \ if (name.getTerm() != 0) \ { \ (void) name.normalize(); \ name.prepare(); \ } #define COPY_SYMBOL(original, name, mapping, type) \ if (name == 0) \ { \ if (type s = original->name) \ name = (mapping == 0) ? s : safeCast(type, mapping->translate(s)); \ } #define COPY_TERM(original, name, mapping) \ if (name.getTerm() == 0) \ { \ if (Term* t = original->name.getTerm()) \ name.setTerm(t->deepCopy(mapping)); \ } #define APPEND_DATA(purposes, data, name) \ { \ int n = purposes.length(); \ purposes.resize(n + 1); \ purposes[n] = #name; \ data.resize(n + 1); \ } #define APPEND_SYMBOL(purposes, symbols, name) \ if (name != 0) \ { \ purposes.append(#name); \ symbols.append(name); \ } #define APPEND_TERM(purposes, terms, name) \ if (Term* t = name.getTerm()) \ { \ purposes.append(#name); \ terms.append(t); \ } #define CODE_CASE(d, c1, c2, s) \ case CODE(c1, c2): \ { \ d = s; \ break; \ } #endif Maude-2.6/src/BuiltIn/stringOpSymbol.hh0000644000147300135640000000564507752312366015043 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in operations on strings. // #ifndef _stringOpSymbol_hh_ #define _stringOpSymbol_hh_ #include "ropeStuff.hh" #include "freeSymbol.hh" #include "cachedDag.hh" class StringOpSymbol : public FreeSymbol { public: StringOpSymbol(int id, int arity); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); bool attachTerm(const char* purpose, Term* term); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); void getTermAttachments(Vector& purposes, Vector& terms); bool eqRewrite(DagNode* subject, RewritingContext& context); void postInterSymbolPass(); void reset(); private: enum { // // Tha actual maximum number of significant digits in the exact // decimal represention of a IEEE-754 double is hard to calculate // but must be < 1074 since there can be at most 1074 binary places // and with 1074 binary places the first multiplications will produce // leading zeros. // MAX_FLOAT_DIGITS = 1074 }; bool rewriteToString(DagNode* subject, RewritingContext& context, const crope& result); static bool ropeToNumber(const crope& subject, int base, mpz_class& numerator, mpz_class& denominator); static crope substring(const crope& subject, crope::size_type index, crope::size_type length); static int fwdFind(const crope& subject, const crope& pattern, crope::size_type start); static int revFind(const crope& subject, const crope& pattern, crope::size_type start); int op; StringSymbol* stringSymbol; SuccSymbol* succSymbol; MinusSymbol* minusSymbol; DivisionSymbol* divisionSymbol; FloatSymbol* floatSymbol; Symbol* decFloatSymbol; CachedDag trueTerm; CachedDag falseTerm; CachedDag notFoundTerm; }; #endif Maude-2.6/src/BuiltIn/ACU_NumberOpSymbol.cc0000644000147300135640000001666410112753372015434 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ACU_NumberOpSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "ACU_Persistent.hh" #include "ACU_Theory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" #include "dagArgumentIterator.hh" // ACU theory class definitions #include "ACU_Symbol.hh" #include "ACU_DagNode.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "ACU_NumberOpSymbol.hh" ACU_NumberOpSymbol::ACU_NumberOpSymbol(int id) : ACU_Symbol(id) { op = NONE; succSymbol = 0; minusSymbol = 0; } bool ACU_NumberOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { BIND_OP(purpose, ACU_NumberOpSymbol, op, data); return ACU_Symbol::attachData(opDeclaration, purpose, data); } bool ACU_NumberOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, succSymbol, SuccSymbol*); BIND_SYMBOL(purpose, symbol, minusSymbol, MinusSymbol*); return ACU_Symbol::attachSymbol(purpose, symbol); } void ACU_NumberOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { ACU_NumberOpSymbol* orig = safeCast(ACU_NumberOpSymbol*, original); op = orig->op; COPY_SYMBOL(orig, succSymbol, map, SuccSymbol*); COPY_SYMBOL(orig, minusSymbol, map, MinusSymbol*); ACU_Symbol::copyAttachments(original, map); } void ACU_NumberOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "ACU_NumberOpSymbol"; data.resize(nrDataAttachments + 1); data[nrDataAttachments].resize(1); const char*& d = data[nrDataAttachments][0]; switch (op) { CODE_CASE(d, '+', 0, "+") CODE_CASE(d, '*', 0, "*") CODE_CASE(d, '|', 0, "|") CODE_CASE(d, '&', 0, "&") CODE_CASE(d, 'x', 'o', "xor") CODE_CASE(d, 'g', 'c', "gcd") CODE_CASE(d, 'l', 'c', "lcm") CODE_CASE(d, 'm', 'i', "min") CODE_CASE(d, 'm', 'a', "max") default: CantHappen("bad number op"); } ACU_Symbol::getDataAttachments(opDeclaration, purposes, data); } void ACU_NumberOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, succSymbol); APPEND_SYMBOL(purposes, symbols, minusSymbol); ACU_Symbol::getSymbolAttachments(purposes, symbols); } bool ACU_NumberOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); if (reduceArgumentsAndNormalize(subject, context)) return false; // collapsed under us return eqRewrite2(subject, context); // keep our stack frame small } bool ACU_NumberOpSymbol::eqRewrite2(DagNode* subject, RewritingContext& context) { // // If we are aborting we don't want to eagerly compute with // our numerical arguments and then throw the result away since // the unreduced dag node might normalize into our parent // which would do the same eager computation etc forming a // potentially very expensive cascade. We must do this check // after we have reduced our arguments otherwise we wouldn't // notice an abort that occurred "on the way up". // if (RewritingContext::getTraceStatus() && context.traceAbort()) return false; if (succSymbol != 0) { mpz_class accumulator; NatSet unused; int usedMultiplicity = 0; ACU_DagNode* d = getACU_DagNode(subject); int nrArgs = d->nrArgs(); for (int i = 0; i < nrArgs; i++) { DagNode* a = d->getArgument(i); Symbol* s = a->symbol(); if ((s == minusSymbol) ? minusSymbol->isNeg(a) : succSymbol->isNat(a)) { mpz_class storage; const mpz_class& n = (s == minusSymbol) ? minusSymbol->getNeg(a, storage) : succSymbol->getNat(a); int m = d->getMultiplicity(i); if (usedMultiplicity == 0) { usedMultiplicity = m; accumulator = n; if (--m == 0) continue; } else usedMultiplicity += m; switch (op) { case '+': { if (m == 1) accumulator += n; else accumulator += n * m; break; } case '*': { if (m == 1) accumulator *= n; else { mpz_class t; mpz_pow_ui (t.get_mpz_t(), n.get_mpz_t(), m); accumulator *= t; } break; } case '|': { accumulator |= n; break; } case '&': { accumulator &= n; break; } case CODE('x', 'o'): { if (m & 1) accumulator ^= n; break; } case CODE('g', 'c'): { mpz_gcd(accumulator.get_mpz_t(), accumulator.get_mpz_t(), n.get_mpz_t()); break; } case CODE('l', 'c'): { mpz_lcm(accumulator.get_mpz_t(), accumulator.get_mpz_t(), n.get_mpz_t()); break; } case CODE('m', 'i'): { if (n < accumulator) accumulator = n; break; } case CODE('m', 'a'): { if (n > accumulator) accumulator = n; break; } } } else unused.insert(i); } if (usedMultiplicity >= 2) { Assert(minusSymbol != 0 || accumulator >= 0, "can't make -ve int"); if (unused.empty()) { return (accumulator >= 0) ? succSymbol->rewriteToNat(subject, context, accumulator) : context.builtInReplace(subject, minusSymbol->makeNegDag(accumulator)); } // // Not everything was a number - need to make a new dag node by // copying unused arguments and including accumulated result. // int nrNewArgs = unused.size() + 1; Vector dagNodes(nrNewArgs); Vector multiplicities(nrNewArgs); int j = 0; FOR_EACH_CONST(i, NatSet, unused) { dagNodes[j] = d->getArgument(*i); multiplicities[j] = d->getMultiplicity(*i); ++j; } dagNodes[j] = (accumulator >= 0) ? succSymbol->makeNatDag(accumulator) : minusSymbol->makeNegDag(accumulator); multiplicities[j] = 1; return context.builtInReplace(subject, makeDagNode(dagNodes, multiplicities)); } } return ACU_Symbol::eqRewrite(subject, context); } Maude-2.6/src/BuiltIn/equalitySymbol.cc0000644000147300135640000001124207752552772015056 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class EqualitySymbol. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "rewritingContext.hh" // free theory class definitions #include "freeDagNode.hh" // built in class definitions #include "bindingMacros.hh" #include "equalitySymbol.hh" // full compiler classes #include "compilationContext.hh" #include "variableName.hh" EqualitySymbol::EqualitySymbol(int id, const Vector& strategy) : FreeSymbol(id, 2, strategy) { } bool EqualitySymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { NULL_DATA(purpose, EqualitySymbol, data); return FreeSymbol::attachData(opDeclaration, purpose, data); } bool EqualitySymbol::attachTerm(const char* purpose, Term* term) { BIND_TERM(purpose, term, equalTerm); BIND_TERM(purpose, term, notEqualTerm); return FreeSymbol::attachTerm(purpose, term); } void EqualitySymbol::copyAttachments(Symbol* original, SymbolMap* map) { EqualitySymbol* orig = safeCast(EqualitySymbol*, original); COPY_TERM(orig, equalTerm, map); COPY_TERM(orig, notEqualTerm, map); FreeSymbol::copyAttachments(original, map); } void EqualitySymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { APPEND_DATA(purposes, data, EqualitySymbol); FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void EqualitySymbol::getTermAttachments(Vector& purposes, Vector& terms) { APPEND_TERM(purposes, terms, equalTerm); APPEND_TERM(purposes, terms, notEqualTerm); FreeSymbol::getTermAttachments(purposes, terms); } void EqualitySymbol::postInterSymbolPass() { (void) equalTerm.normalize(); equalTerm.prepare(); (void) notEqualTerm.normalize(); notEqualTerm.prepare(); } void EqualitySymbol::reset() { equalTerm.reset(); // so equal dag can be garbage collected notEqualTerm.reset(); // so notEqualDag dag can be garbage collected FreeSymbol::reset(); // parents reset() tasks } bool EqualitySymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); FreeDagNode* f = static_cast(subject); DagNode* l = f->getArgument(0); DagNode* r = f->getArgument(1); if (standardStrategy()) { l->reduce(context); r->reduce(context); } else { const Vector& userStrategy = getStrategy(); for(int i = 0;; i++) { int a = userStrategy[i]; if (a == 0) break; f->getArgument(a - 1)->reduce(context); } l->computeTrueSort(context); // we don't need the sort but we do need to normalize r->computeTrueSort(context); } return context.builtInReplace(subject, l->equal(r) ? equalTerm.getDag() : notEqualTerm.getDag()); } bool EqualitySymbol::domainSortAlwaysLeqThan(Sort* /* sort */, int /* argNr */) { return false; } bool EqualitySymbol::acceptEquation(Equation* /* equation */) { return false; } void EqualitySymbol::compileEquations() { } #ifdef COMPILER void EqualitySymbol::generateCode(CompilationContext& context) const { Vector varNames; // dummy context.body() << Indent(1) << "if (compare(a0, a1) == 0)\n"; context.body() << Indent(2) << "{\n"; equalTerm.getTerm()->generateRhs(context, 3, varNames, 0); context.body() << Indent(2) << "}\n"; context.body() << Indent(1) << "else\n"; context.body() << Indent(2) << "{\n"; notEqualTerm.getTerm()->generateRhs(context, 3, varNames, 0); context.body() << Indent(2) << "}\n"; } #endif Maude-2.6/src/BuiltIn/floatTerm.hh0000644000147300135640000000316011062313373013757 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for terms containing floating point numbers. // #ifndef _floatTerm_hh_ #define _floatTerm_hh_ #include "NA_Term.hh" class FloatTerm : public NA_Term { public: FloatTerm(FloatSymbol* symbol, double value); Term* deepCopy2(SymbolMap* map) const; Term* normalize(bool full, bool& changed); int compareArguments(const Term* other) const; int compareArguments(const DagNode* other) const; void overwriteWithDagNode(DagNode* old) const; NA_DagNode* makeDagNode() const; // // Needed because we have hidden data. // Term* instantiate2(const Vector& varBindings, SymbolMap* translator); double getValue() const; private: const union { double value; Int64 bitPattern; }; }; inline double FloatTerm::getValue() const { return value; } #endif Maude-2.6/src/BuiltIn/builtIn.hh0000644000147300135640000000247610057734371013451 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for builtin symbol classes. // #ifndef _builtin_hh_ #define _builtin_hh_ class BranchSymbol; class EqualitySymbol; class SortTestSymbol; class SuccSymbol; class NumberOpSymbol; class MinusSymbol; class ACU_NumberOpSymbol; class DivisionSymbol; class FloatSymbol; class FloatTerm; class FloatDagNode; class FloatOpSymbol; class StringSymbol; class StringTerm; class StringDagNode; class StringOpSymbol; class RandomOpSymbol; class CounterSymbol; #endif Maude-2.6/src/BuiltIn/matrixOpSymbol.cc0000644000147300135640000002230111011115553014771 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 2004 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class NumberOpSymbol. // #include // utility stuff #include "macros.hh" #include "vector.hh" #include "mpzSystem.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "ACU_Persistent.hh" #include "ACU_Theory.hh" #include "NA_Theory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "dagArgumentIterator.hh" #include "symbolMap.hh" // free theory class definitions #include "freeSymbol.hh" #include "freeDagNode.hh" // ACU theory class definitions #include "ACU_Symbol.hh" #include "ACU_DagNode.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "stringSymbol.hh" #include "stringDagNode.hh" #include "matrixOpSymbol.hh" MatrixOpSymbol::MatrixOpSymbol(int id, int arity) : NumberOpSymbol(id, arity) { #define MACRO(SymbolName, SymbolClass, RequiredFlags, NrArgs) \ SymbolName = 0; #include "matrixOpSignature.cc" #undef MACRO } bool MatrixOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { if (strcmp(purpose, "MatrixOpSymbol") == 0) return true; return NumberOpSymbol::attachData(opDeclaration, purpose, data); } bool MatrixOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { #define MACRO(SymbolName, SymbolClass, RequiredFlags, NrArgs) \ BIND_SYMBOL(purpose, symbol, SymbolName, SymbolClass*); #include "matrixOpSignature.cc" #undef MACRO return NumberOpSymbol::attachSymbol(purpose, symbol); } void MatrixOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { MatrixOpSymbol* orig = safeCast(MatrixOpSymbol*, original); #define MACRO(SymbolName, SymbolClass, RequiredFlags, NrArgs) \ COPY_SYMBOL(orig, SymbolName, map, SymbolClass*); #include "matrixOpSignature.cc" #undef MACRO NumberOpSymbol::copyAttachments(original, map); } void MatrixOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "MatrixOpSymbol"; data.resize(nrDataAttachments + 1); (data[nrDataAttachments]).resize(1); data[nrDataAttachments][0] = "natSystemSolve"; NumberOpSymbol::getDataAttachments(opDeclaration, purposes, data); } void MatrixOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { #define MACRO(SymbolName, SymbolClass, RequiredFlags, NrArgs) \ APPEND_SYMBOL(purposes, symbols, SymbolName); #include "matrixOpSignature.cc" #undef MACRO NumberOpSymbol::getSymbolAttachments(purposes, symbols); } bool MatrixOpSymbol::downMatrixEntry(DagNode* dagNode, SparseMatrix& matrix, int& maxRowNr, int& maxColNr) { if (dagNode->symbol() == matrixEntrySymbol) { FreeDagNode* d = safeCast(FreeDagNode*, dagNode); DagNode* arg = d->getArgument(0); if (arg->symbol() == indexPairSymbol) { FreeDagNode* a = safeCast(FreeDagNode*, arg); int rowNr; int colNr; if (getSuccSymbol()->getSignedInt(a->getArgument(0), rowNr) && getSuccSymbol()->getSignedInt(a->getArgument(1), colNr) && getNumber(d->getArgument(1), matrix[rowNr][colNr])) { if (rowNr > maxRowNr) maxRowNr = rowNr; if (colNr > maxColNr) maxColNr = colNr; return true; } } } return false; } bool MatrixOpSymbol::downMatrix(DagNode* dagNode, SparseMatrix& matrix, int& maxRowNr, int& maxColNr) { Symbol* s = dagNode->symbol(); if (s == matrixSymbol) { for (DagArgumentIterator i(dagNode); i.valid(); i.next()) { if (!downMatrixEntry(i.argument(), matrix, maxRowNr, maxColNr)) return false; } } else if (s != emptyMatrixSymbol) return downMatrixEntry(dagNode, matrix, maxRowNr, maxColNr); return true; } bool MatrixOpSymbol::downVectorEntry(DagNode* dagNode, IntVec& vec, int& maxRowNr) { if (dagNode->symbol() == vectorEntrySymbol) { FreeDagNode* d = safeCast(FreeDagNode*, dagNode); int index; if (getSuccSymbol()->getSignedInt(d->getArgument(0), index)) { if (index > maxRowNr) { vec.resize(index + 1); for (int i = maxRowNr + 1; i < index; ++i) vec[i] = 0; maxRowNr = index; } if (getNumber(d->getArgument(1), vec[index])) return true; } } return false; } bool MatrixOpSymbol::downVector(DagNode* dagNode, IntVec& vec, int& maxRowNr) { vec.resize(maxRowNr + 1); for (int i = 0; i <= maxRowNr; ++i) vec[i] = 0; Symbol* s = dagNode->symbol(); if (s == vectorSymbol) { for (DagArgumentIterator i(dagNode); i.valid(); i.next()) { if (!downVectorEntry(i.argument(), vec, maxRowNr)) return false; } } else if (s != emptyVectorSymbol) return downVectorEntry(dagNode, vec, maxRowNr); return true; } bool MatrixOpSymbol::downAlgorithm(DagNode* dagNode, Algorithm& algorithm) { if (dagNode->symbol() == stringSymbol) { const crope& alg = safeCast(StringDagNode*, dagNode)->getValue(); if (alg.empty()) algorithm = SYSTEMS_CHOICE; else { const char* algStr = alg.c_str(); if (strcmp(algStr, "cd") == 0) algorithm = CD; else if (strcmp(algStr, "gcd") == 0) algorithm = GCD; else return false; } return true; } return false; } DagNode* MatrixOpSymbol::upSet(const Vector& elts) { int n = elts.size(); if (n == 0) return emptyVectorSetSymbol->makeDagNode(); return (n == 1) ? elts[0] : vectorSetSymbol->makeDagNode(elts); } DagNode* MatrixOpSymbol::upVector(const IntVec& row) { Vector elts; Vector pair(2); int nrRows = row.size(); for (int i = 1; i < nrRows; i++) { const mpz_class& v = row[i]; Assert(v >= 0, "-ve solution"); if (v > 0) { pair[0] = getSuccSymbol()->makeNatDag(i - 1); pair[1] = getSuccSymbol()->makeNatDag(v); elts.append(vectorEntrySymbol->makeDagNode(pair)); } } int n = elts.size(); if (n == 0) return emptyVectorSymbol->makeDagNode(); return (n == 1) ? elts[0] : vectorSymbol->makeDagNode(elts); } bool MatrixOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { FreeDagNode* d = safeCast(FreeDagNode*, subject); DagNode* m = d->getArgument(0); m->reduce(context); DagNode* v = d->getArgument(1); v->reduce(context); DagNode* a = d->getArgument(2); a->reduce(context); Algorithm algorithm; SparseMatrix matrix; IntVec vec; int maxRowNr = -1; int maxColNr = -1; if (downAlgorithm(a, algorithm) && downMatrix(m, matrix, maxRowNr, maxColNr) && maxRowNr >= 0 && downVector(v, vec, maxRowNr)) { Vector homogenous; Vector inhomogenous; // // Build Diophantine system. // MpzSystem ds; int rowSize = maxColNr + 2; IntVec row(rowSize); for (int i = 0; i <= maxRowNr; i++) { for (int j = 1; j < rowSize; j++) row[j] = 0; const mpz_class& v = vec[i]; const SparseVector& r = matrix[i]; // // If we have an equation with all zero coefficients and nonzero // constant term we can trivially fail. // if (r.empty() && v != 0) goto fail; row[0] = -v; FOR_EACH_CONST(j, SparseVector, r) row[j->first + 1] = j->second; ds.insertEqn(row); } for (int j = 1; j < rowSize; j++) row[j] = NONE; row[0] = 1; ds.setUpperBounds(row); // // Extract solutions. // if (algorithm == GCD || (algorithm == SYSTEMS_CHOICE && maxColNr <= maxRowNr + 1)) { while (ds.findNextMinimalSolutionGcd(row)) { if (row[0] == 0) homogenous.append(upVector(row)); else inhomogenous.append(upVector(row)); } } else { while (ds.findNextMinimalSolution(row)) { if (row[0] == 0) homogenous.append(upVector(row)); else inhomogenous.append(upVector(row)); } } // // Build result dag. // fail: Vector args(2); args[0] = upSet(inhomogenous); args[1] = inhomogenous.empty() ? args[0] : upSet(homogenous); return context.builtInReplace(subject, vectorSetPairSymbol->makeDagNode(args)); } // // NumberOpSymbol doesn't know how to deal with this. // return FreeSymbol::eqRewrite(subject, context); } Maude-2.6/src/BuiltIn/divisionSymbol.hh0000644000147300135640000000412307752310416015042 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for exact division operation on numbers. // #ifndef _divisionSymbol_hh_ #define _divisionSymbol_hh_ #include "freeSymbol.hh" #include "cachedDag.hh" class DivisionSymbol : public FreeSymbol { public: DivisionSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); bool eqRewrite(DagNode* subject, RewritingContext& context); // // Functions special to DivisionSymbol. // DagNode* makeRatDag(const mpz_class& nr, const mpz_class& dr); bool isRat(const DagNode* dagNode) const; const mpz_class& getRat(const DagNode* dagNode, mpz_class& numerator) const; Term* makeRatTerm(const mpz_class& nr, const mpz_class& dr); bool isRat(/* const */ Term* term) const; const mpz_class& getRat(/* const */ Term* term, mpz_class& numerator) const; SuccSymbol* succSymbol; MinusSymbol* minusSymbol; }; #endif Maude-2.6/src/BuiltIn/divisionSymbol.cc0000644000147300135640000001554007752310125015032 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class DivisionSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "builtIn.hh" // interface class definitions #include "term.hh" #include "argumentIterator.hh" // core class definitions #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeNet.hh" #include "freeDagNode.hh" // built in stuff #include "bindingMacros.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "divisionSymbol.hh" DivisionSymbol::DivisionSymbol(int id) : FreeSymbol(id, 2) { succSymbol = 0; minusSymbol = 0; } bool DivisionSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { NULL_DATA(purpose, DivisionSymbol, data) return FreeSymbol::attachData(opDeclaration, purpose, data); } bool DivisionSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, succSymbol, SuccSymbol*); BIND_SYMBOL(purpose, symbol, minusSymbol, MinusSymbol*); return FreeSymbol::attachSymbol(purpose, symbol); } void DivisionSymbol::copyAttachments(Symbol* original, SymbolMap* map) { DivisionSymbol* orig = safeCast(DivisionSymbol*, original); COPY_SYMBOL(orig, succSymbol, map, SuccSymbol*); COPY_SYMBOL(orig, minusSymbol, map, MinusSymbol*); FreeSymbol::copyAttachments(original, map); } void DivisionSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { APPEND_DATA(purposes, data, DivisionSymbol); FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void DivisionSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, succSymbol); APPEND_SYMBOL(purposes, symbols, minusSymbol); FreeSymbol::getSymbolAttachments(purposes, symbols); } bool DivisionSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); FreeDagNode* d = safeCast(FreeDagNode*, subject); DagNode* d0 = d->getArgument(0); d0->reduce(context); DagNode* d1 = d->getArgument(1); d1->reduce(context); if (isRat(subject)) { const mpz_class& denominator = succSymbol->getNat(d1); if (denominator == 1) return context.builtInReplace(subject, d0); mpz_class storage0; const mpz_class& numerator = (d0->symbol() == minusSymbol) ? minusSymbol->getNeg(d0, storage0) : succSymbol->getNat(d0); Assert(numerator != 0, "zero numerator"); mpz_class common; mpz_gcd(common.get_mpz_t(), numerator.get_mpz_t(), denominator.get_mpz_t()); if (common > 1) { if (denominator == common) { mpz_class nr = numerator / common; return (nr >= 0) ? succSymbol->rewriteToNat(subject, context, nr) : context.builtInReplace(subject, minusSymbol->makeNegDag(nr)); } (void) context.builtInReplace(subject, makeRatDag(numerator / common, denominator / common)); Assert(this == subject->symbol(), "unexpectedly changed top symbol"); // // we don't want to revisit this node since it is already simplified // - so fall into regular case. // } } return FreeSymbol::eqRewrite(subject, context); } DagNode* DivisionSymbol::makeRatDag(const mpz_class& nr, const mpz_class& dr) { Assert(nr != 0 && dr > 0, "not a strict rat"); DagNode* d = (nr >= 0) ? succSymbol->makeNatDag(nr) : minusSymbol->makeNegDag(nr); if (dr == 1) return d; Vector args(2); args[0] = d; args[1] = succSymbol->makeNatDag(dr); return makeDagNode(args); } bool DivisionSymbol::isRat(const DagNode* dagNode) const { Assert(this == static_cast(dagNode->symbol()), "bad symbol"); const FreeDagNode* d = safeCast(const FreeDagNode*, dagNode); DagNode* d0 = d->getArgument(0); DagNode* d1 = d->getArgument(1); return d1->symbol() == succSymbol && succSymbol->isNat(d1) && ((d0->symbol() == minusSymbol) ? minusSymbol->isNeg(d0) : (d0->symbol() == succSymbol && succSymbol->isNat(d0))); } const mpz_class& DivisionSymbol::getRat(const DagNode* dagNode, mpz_class& numerator) const { Assert(this == static_cast(dagNode->symbol()), "bad symbol"); const FreeDagNode* d = safeCast(const FreeDagNode*, dagNode); DagNode* d0 = d->getArgument(0); if (d0->symbol() == minusSymbol) (void) minusSymbol->getNeg(d0, numerator); else { Assert(d0->symbol() == succSymbol, "bad numerator"); numerator = succSymbol->getNat(d0); } DagNode* d1 = d->getArgument(1); Assert(d1->symbol() == succSymbol, "bad denominator"); return succSymbol->getNat(d1); } Term* DivisionSymbol::makeRatTerm(const mpz_class& nr, const mpz_class& dr) { Assert(nr != 0 && dr > 0, "not a strict rat"); Vector args(2); args[0] = (nr >= 0) ? succSymbol->makeNatTerm(nr) : minusSymbol->makeIntTerm(nr); args[1] = succSymbol->makeNatTerm(dr); return makeTerm(args); } bool DivisionSymbol::isRat(/* const */ Term* term) const { Assert(this == static_cast(term->symbol()), "bad symbol"); ArgumentIterator i(*term); Term* t0 = i.argument(); i.next(); Term* t1 = i.argument(); return t1->symbol() == succSymbol && succSymbol->isNat(t1) && ((t0->symbol() == minusSymbol) ? minusSymbol->isNeg(t0) : (t0->symbol() == succSymbol && succSymbol->isNat(t0))); } const mpz_class& DivisionSymbol::getRat(/* const */ Term* term, mpz_class& numerator) const { Assert(this == static_cast(term->symbol()), "bad symbol"); ArgumentIterator i(*term); Term* t0 = i.argument(); if (t0->symbol() == minusSymbol) (void) minusSymbol->getNeg(t0, numerator); else { Assert(t0->symbol() == succSymbol, "bad numerator"); numerator = succSymbol->getNat(t0); } i.next(); Term* t1 = i.argument(); Assert(t1->symbol() == succSymbol, "bad denominator"); return succSymbol->getNat(t1); } Maude-2.6/src/BuiltIn/sortTestSymbol.hh0000644000147300135640000000323207666303207015051 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in sort test operations. // #ifndef _sortTestSymbol_hh_ #define _sortTestSymbol_hh_ #include "freeSymbol.hh" class SortTestSymbol : public FreeSymbol { public: SortTestSymbol(int id, Sort* testSort, FreeSymbol* leq, FreeSymbol* nleq, bool eager); bool eqRewrite(DagNode* subject, RewritingContext& context); bool eager() const; const Sort* sort() const; // // We don't accept or compile any equations. // bool acceptEquation(Equation* equation); void compileEquations(); private: static const Vector& makeLazyStrategy(); Sort* cmpSort; FreeSymbol* leqResult; FreeSymbol* notLeqResult; bool eagerFlag; }; inline bool SortTestSymbol::eager() const { return eagerFlag; } inline const Sort* SortTestSymbol::sort() const { return cmpSort; } #endif Maude-2.6/src/BuiltIn/ChangeLog0000644000147300135640000022312711457445535013300 000000000000002010-10-19 Steven Eker * stringSymbol.cc (StringSymbol::makeCanonicalCopyEagerUptoReduced): deleted * stringSymbol.hh (class StringSymbol): deleted decl for makeCanonicalCopyEagerUptoReduced() * floatSymbol.cc (FloatSymbol::makeCanonicalCopyEagerUptoReduced): deleted * floatSymbol.hh (class FloatSymbol): deleted decl for makeCanonicalCopyEagerUptoReduced() ===================================Maude95a=========================================== 2010-09-29 Steven Eker * stringSymbol.hh (class StringSymbol): added decl for makeCanonicalCopyEagerUptoReduced() * stringSymbol.cc (StringSymbol::makeCanonicalCopyEagerUptoReduced): added * floatSymbol.hh (class FloatSymbol): added decl for makeCanonicalCopyEagerUptoReduced() * floatSymbol.cc (FloatSymbol::makeCanonicalCopyEagerUptoReduced): added ===================================Maude95=========================================== 2010-05-07 Steven Eker * branchSymbol.cc (BranchSymbol::attachTerm): added DebugAdvisory() ===================================Maude93d=========================================== 2009-03-21 Steven Eker * floatOpSymbol.cc (eqRewrite): fix bug where we were treating floor() with an unevaluated argument as float() 2008-12-22 Steven Eker * branchSymbol.hh (class BranchSymbol): deleted decls for fillInSortInfo() and computeBaseSort() * branchSymbol.cc (compileOpDeclarations): add fake declarations to encode our sort structure (computeBaseSort): deleted (fillInSortInfo): deleted 2008-09-11 Steven Eker * numberOpSymbol.cc (eqRewrite): assign dummy value to b in default case to silence compiler warning * floatOpSymbol.cc (eqRewrite): assign dummy values to r in default cases to silence compiler warning * stringOpSymbol.cc (eqRewrite): assign dummy values to r in default cases to silence compiler warning * floatDagNode.hh (class FloatDagNode): use anonymous union so I can get the bit pattern for hashing without breaking strict-aliasing rules under gcc 4 * floatDagNode.cc (getHashValue): remove the reinterpret_cast<> now I have an anonymous union * floatTerm.cc (normalize): remove the reinterpret_cast<> now I have an anonymous union * floatTerm.hh (class FloatTerm): use anonymous union so I can get the bit pattern for hashing without breaking strict-aliasing rules under gcc 4 2008-09-04 Steven Eker * stringOpSymbol.cc (eqRewrite): ifdef out the kudge that was avoiding Rope::c_str() (ropeToNumber): ifdef out similar kudges 2008-05-09 Steven Eker * matrixOpSymbol.cc (eqRewrite): pass NONE rather than UNBOUNDED to represent unbounded upper bound ===================================Maude91a=========================================== 2008-04-10 Steven Eker * matrixOpSymbol.cc (MACRO): added * matrixOpSymbol.hh (class MatrixOpSymbol): added decl for copyAttachments() ===================================Maude91=========================================== 2007-09-06 Steven Eker * branchSymbol.cc (computeBaseSort): added explanation of what it does following coverity inspection ===================================Maude89h=========================================== 2007-01-18 Steven Eker * branchSymbol.cc (compileOpDeclarations): call FreeSymbol::compileOpDeclarations() as a quick hack to get unification working ===================================Maude88d=========================================== 2006-11-14 Steven Eker * floatOpSymbol.cc (getDataAttachments): added min and max cases (eqRewrite): added min and max cases ===================================Maude88c=========================================== 2006-09-22 Steven Eker * floatTerm.cc (instantiate2): added * stringTerm.cc (instantiate2): added * floatTerm.hh (class FloatTerm): added decl for instantiate2() * stringTerm.hh (class StringTerm): added decl for instantiate2() 2005-09-08 Steven Eker * matrixOpSymbol.cc (eqRewrite): use GCD where algorithm == SYSTEMS_CHOICE and number of variables is <= number of equations + 1 2005-09-07 Steven Eker * matrixOpSymbol.cc (eqRewrite): init maxRowNr and maxColNr to -1 here; check that maxRowNr is >= 0 after downing stuff (downMatrix): don't init matrix, maxRowNr and maxColNr here (eqRewrite): revert to returning empty homogenous set if inhomogenous set is empty 2005-08-25 Steven Eker * matrixOpSignature.cc (MACRO): added stringSymbol * matrixOpSymbol.hh (class MatrixOpSymbol): added enum Algorithm and decl for downAlgorithm() * matrixOpSymbol.cc (downAlgorithm): addded (eqRewrite): use downAlgorithm() 2005-08-23 Steven Eker * matrixOpSymbol.cc (eqRewrite): code cleaning (upSet): code cleaning (upVector): code cleaning (downVector): clear vec (downVectorEntry): clear new vec entries after resize() (downMatrix): clear matrix (downMatrixEntry): optimize 2005-08-18 Steven Eker * matrixOpSymbol.hh (class MatrixOpSymbol): updated dec for upVector() * matrixOpSymbol.cc (upVector): work with IntVec (eqRewrite): use class MpzSystem * matrixOpSymbol.hh (class MatrixOpSymbol): added typedef IntVec 2005-08-17 Steven Eker * matrixOpSymbol.hh (class MatrixOpSymbol): updated decls for typedef SparseVector; deleted decl for downMatrixEntry(); updated decls for downVectorEntry() and downVector() * matrixOpSymbol.cc (downCoeff): deleted (downMatrixEntry): use getNumber() (downVectorEntry): rewritten (downVector): updated * numberOpSymbol.cc (getNumber): added * numberOpSymbol.hh (class NumberOpSymbol): added decl for getNumber() ===================================Maude86c=========================================== 2004-10-28 Steven Eker * matrixOpSymbol.cc (eqRewrite): quick hack to test DiophantineSystem3 2004-10-14 Steven Eker * matrixOpSymbol.cc (getDataAttachments): return natSystemSolve as data (eqRewrite): return nonempty homogenous solution set only if inhomogenous nonempty 2004-09-16 Steven Eker * matrixOpSymbol.cc (downMatrixEntry): fixed bug where we were returning true even after failing (upVector): fixed bug where we were generating null pointer vector entries 2004-09-15 Steven Eker * matrixOpSymbol.hh (class MatrixOpSymbol): added decls for new member functions * matrixOpSymbol.cc (downVector): added (downVectorEntry): added (downCoeff): added (downMatrixEntry): added (downMatrix): added * numberOpSymbol.hh (class NumberOpSymbol): commented out declarations for makeNegDag(), isNeg(), getNeg() (getMinusSymbol): added * matrixOpSymbol.cc (upSet): added (upVector): added 2004-09-14 Steven Eker * matrixOpSymbol.cc: created * matrixOpSymbol.hh: created * matrixOpSignature.cc: created 2004-09-09 Steven Eker * floatOpSymbol.cc (getDataAttachments): fixed bug where we were returning NumberSymbol rather than FloatOpSymbol 2004-08-24 Steven Eker * ACU_NumberOpSymbol.cc (getDataAttachments): handle min and max (eqRewrite2): added min and max ===================================Maude85=========================================== 2004-06-29 Steven Eker * floatOpSymbol.cc (safePow): fixed 0.0 ^ -1.0 = Infinity issue on certain plaforms ===================================Maude84d=========================================== 2004-06-14 Steven Eker * randomOpSymbol.cc (attachData): call NumberOpSymbol::attachData() for consistancy (getDataAttachments): call NumberOpSymbol::getDataAttachments() for consistancy * counterSymbol.cc (attachData): call NumberOpSymbol::attachData() for consistancy (getDataAttachments): call NumberOpSymbol::getDataAttachments() for consistancy * numberOpSymbol.cc (getDataAttachments): handle NONE case gracefully 2004-06-07 Steven Eker * counterSymbol.cc (resetRules): call NumberOpSymbol::resetRules() (saveHiddenState): added (restoreHiddenState): added * counterSymbol.hh (class CounterSymbol): added decl for saveHiddenState() and restoreHiddenState(); added data member currentValueStack * counterSymbol.cc (reset): becomes resetRules() * counterSymbol.hh (class CounterSymbol): replace reset() decl with resetRules() decl 2004-06-03 Steven Eker * builtIn.hh: added decls for class RandomOpSymbol and class CounterSymbol * numberOpSymbol.hh: #include "gmpxx.h" * counterSymbol.hh: created * counterSymbol.cc: created 2004-06-02 Steven Eker * randomOpSymbol.hh (setGlobalSeed): added * randomOpSymbol.cc: created * randomOpSymbol.hh: created ===================================Maude84c=========================================== 2004-05-06 Steven Eker * ACU_NumberOpSymbol.cc (getDataAttachments): fixed bug where we were reporting our id hook as NumberOpSymbol * CUI_NumberOpSymbol.cc (getDataAttachments): fixed bug where we were reporting our id hook as NumberOpSymbol * numberOpSymbol.cc (eqRewrite): added more detailed CantHappen() message ===================================Maude84a=========================================== 2003-11-10 Steven Eker * stringOpSymbol.cc (getDataAttachments): fixed bug where we were returning NumberOpSymbol rather than StringOpSymbol 2003-11-06 Steven Eker * branchSymbol.cc (getDataAttachments): added (getTermAttachments): added * branchSymbol.hh (class BranchSymbol): added decls for getDataAttachments() and getTermAttachments() * equalitySymbol.cc (getDataAttachments): added (getTermAttachments): added * equalitySymbol.hh (class EqualitySymbol): added decls for getDataAttachments() and getTermAttachments() 2003-11-05 Steven Eker * floatOpSymbol.cc (getDataAttachments): added (getSymbolAttachments): added (getTermAttachments): added * stringOpSymbol.cc (getDataAttachments): added (getSymbolAttachments): added (getTermAttachments): added * stringOpSymbol.hh (class StringOpSymbol): added decls for getDataAttachments(), getSymbolAttachments(), getTermAttachments() * floatOpSymbol.hh (class FloatOpSymbol): added decls for getDataAttachments(), getSymbolAttachments(), getTermAttachments() * divisionSymbol.hh (class DivisionSymbol): added decls for getDataAttachments() and getSymbolAttachments() * divisionSymbol.cc (getDataAttachments): added (getSymbolAttachments): added * minusSymbol.cc (getDataAttachments): added * minusSymbol.hh (class MinusSymbol): added decl for getDataAttachments() * ACU_NumberOpSymbol.cc (getDataAttachments): added (getSymbolAttachments): added * ACU_NumberOpSymbol.hh (class ACU_NumberOpSymbol): added decls for getDataAttachments() and getSymbolAttachments() * CUI_NumberOpSymbol.cc (getDataAttachments): added (getSymbolAttachments): added * CUI_NumberOpSymbol.hh (class CUI_NumberOpSymbol): added decls for getDataAttachments() and getSymbolAttachments() * numberOpSymbol.cc (getDataAttachments): added (getSymbolAttachments): added (getTermAttachments): added * numberOpSymbol.hh (class NumberOpSymbol): added decls for getDataAttachments(), getSymbolAttachments(), getTermAttachments() * succSymbol.cc (getDataAttachments): added (getTermAttachments): added * bindingMacros.hh (APPEND_DATA): added * succSymbol.hh (class SuccSymbol): added decls for getDataAttachments() and getTermAttachments() * bindingMacros.hh (APPEND_TERM): added 2003-11-03 Steven Eker * bindingMacros.hh (APPEND_SYMBOL): added 2003-10-23 Steven Eker * equalitySymbol.hh (class EqualitySymbol): updated decl for EqualitySymbol() * equalitySymbol.cc (EqualitySymbol): don't take term args * branchSymbol.hh (class BranchSymbol): updated decl for BranchSymbol() * branchSymbol.cc (BranchSymbol): take nrArgs arg rather than term arg * equalitySymbol.hh (class EqualitySymbol): deleted decl for ~EqualitySymbol() * equalitySymbol.cc (~EqualitySymbol): deleted now we no longer need to prevent deep self destruction of equalTerm and notEqualTerm * branchSymbol.cc (~BranchSymbol): deepSelfDestruct() test terms 2003-10-15 Steven Eker * equalitySymbol.cc (attachData): added (copyAttachments): added (attachTerm): added * equalitySymbol.hh (class EqualitySymbol): added declarations for attachData(), attachTerm(), copyAttachments() 2003-10-14 Steven Eker * branchSymbol.cc (attachData): added (attachTerm): added (copyAttachments): added * branchSymbol.hh (class BranchSymbol): added declarations for attachData(), attachTerm(), copyAttachments() ===================================Maude83=========================================== 2003-07-28 Steven Eker * floatSymbol.cc: need to include mathStuff.hh 2003-07-25 Steven Eker * floatSymbol.cc: removed #include and #include * floatOpSymbol.cc: use mathStuff.hh 2003-07-16 Steven Eker * stringOpSymbol.hh: use ropeStuff.hh * stringDagNode.hh: use ropeStuff.hh * stringTerm.hh: use ropeStuff.hh ===================================Maude81=========================================== 2003-05-30 Steven Eker * equalitySymbol.cc (domainSortAlwaysLeqThan): added * equalitySymbol.hh (class EqualitySymbol): added decl for domainSortAlwaysLeqThan() * branchSymbol.cc (rangeSortNeverLeqThan): added (rangeSortAlwaysLeqThan): added (domainSortAlwaysLeqThan): added * branchSymbol.hh (class BranchSymbol): added decls for rangeSortNeverLeqThan(), rangeSortAlwaysLeqThan(), domainSortAlwaysLeqThan() 2003-05-15 Steven Eker * ACU_NumberOpSymbol.cc (eqRewrite2): fix bug in case that some args aren't numbers * ACU_NumberOpSymbol.hh (class ACU_NumberOpSymbol): added decl for eqRewrite2() * ACU_NumberOpSymbol.cc (eqRewrite2): added; do most of the work here to avoid a large stack frame for eqRewrite() (eqRewrite): use new reduceArgumentsAndNormalize() convention; use eqRewrite2() (eqRewrite2): use getACU_DagNode(), getArgument(), getMultiplicity() ===================================Maude80a=========================================== 2003-05-01 Steven Eker * floatDagNode.cc (overwriteWithClone): rewritten (makeClone): rewritten * stringDagNode.cc (overwriteWithClone): rewritten (makeClone): rewritten ===================================Maude80=========================================== 2003-02-25 Steven Eker * stringOpSymbol.cc (fwdFind): static_cast(start) to avoid NONE being converted to unsigned * succSymbol.cc: removed #pragma (makeNatTerm): updated Assert() (makeNatDag): updated Assert() (getNat): updated Assert()s (both versions) (rewriteToNat): updated Assert()s * succSymbol.hh: removed #pragma * stringTerm.cc: removed #pragma * stringTerm.hh: removed #pragma * stringSymbol.cc: removed #pragma * stringSymbol.hh: removed #pragma * stringOpSymbol.cc: removed #pragma (eqRewrite): updated Assert()s * stringOpSymbol.hh: removed #pragma * stringDagNode.cc: removed #pragma * stringDagNode.hh: removed #pragma * sortTestSymbol.cc: removed #pragma (eqRewrite): updated Assert() * sortTestSymbol.hh: removed #pragma * numberOpSymbol.cc: removed #pragma (eqRewrite): updated Assert()s * numberOpSymbol.hh: removed #pragma * minusSymbol.cc: removed #pragma (makeNegDag): updated Assert() (isNeg): updated Assert() (both versions) (getNeg): updated Assert() (both versions) * minusSymbol.hh: removed #pragma * floatTerm.cc: removed #pragma * floatTerm.hh: removed #pragma * floatSymbol.cc: removed #pragma * floatSymbol.hh: removed #pragma * floatOpSymbol.cc: removed #pragma (eqRewrite): updated Assert()s; Assert() -> CantHappen() (*2) * floatOpSymbol.hh: removed #pragma * floatDagNode.cc: removed #pragma * floatDagNode.hh: removed #pragma * equalitySymbol.cc: removed #pragma (eqRewrite): updated Assert() * equalitySymbol.hh: removed #pragma * divisionSymbol.cc: removed #pragma (eqRewrite): updated Assert()s (makeRatDag): updated Assert() (isRat): updated Assert() (both versions) (getRat): updated Assert()s (both versions) (makeRatTerm): updated Assert() * divisionSymbol.hh: removed #pragma * branchSymbol.cc: removed #pragma (fillInSortInfo): updated Assert()s (eqRewrite): updated Assert() (computeBaseSort): updated Assert() * branchSymbol.hh: removed #pragma * CUI_NumberOpSymbol.cc: removed #pragma (eqRewrite): updated Assert() * CUI_NumberOpSymbol.hh: removed #pragma * ACU_NumberOpSymbol.cc: removed #pragma (eqRewrite): updated Assert()s * ACU_NumberOpSymbol.hh: removed #pragma ===================================Maude79=========================================== 2003-01-08 Steven Eker * ACU_NumberOpSymbol.cc (eqRewrite): rewritten to avoid making use of ACU_DagNode; less efficient - need to revisit this once red-black stuff is working ===================================Maude76================================================== 2002-11-25 Steven Eker * stringDagNode.cc (StringDagNode): commented out Assert() to avoid accessing MemoryCell::Word * stringTerm.hh: added using namespace __gnu_cxx to for g++3.2 * stringDagNode.hh: added using namespace __gnu_cxx to for g++3.2 2002-11-05 Steven Eker * stringOpSymbol.cc (fwdFind): changed semantics for empty pattern case (revFind): changed smenatics for empty pattern case (fwdFind): fixed wrap around bug introduced when we optimized the tests in previous change; added comment since this is a bug we fixed on 2001-01-17 and them optimized away the fix 2002-10-22 Steven Eker * stringOpSymbol.cc (eqRewrite): removed Assert(false,...) that could be reached if 1st arg was bad; converted other Assert(false,...)s to CantHappen()s 2002-10-09 Steven Eker * ACU_NumberOpSymbol.cc (eqRewrite): added check for abort after redcuing arguments and before doing expensive eager numerical calculations. This partly fixes the slow abort problem but cascading ACU normalizations during an abort can still be expensive 2002-10-04 Steven Eker * branchSymbol.cc (stackArguments): only stack args that aren't frozen or unstackable ===================================Maude76================================================== 2002-09-04 Steven Eker * floatSymbol.hh (class FloatSymbol): added decl for isConstructor() * floatSymbol.cc (isConstructor): added * stringSymbol.hh (class StringSymbol): added decl for isConstructor() * stringSymbol.cc (isConstructor): added 2002-08-26 Steven Eker * stringSymbol.cc (compileOpDeclarations): use new getOpDeclarations() semantics * floatSymbol.cc (compileOpDeclarations): use new getOpDeclarations() semantics * branchSymbol.cc (fillInSortInfo): use new getOpDeclarations() semantics (computeBaseSort): use new getOpDeclarations() semantics ===================================Maude75================================================== 2002-07-25 Steven Eker * builtIn.hh: deleted forward decls for classes MachineIntegerSymbol, MachineIntegerTerm, MachineIntegerDagNode and MachineIntegerOpSymbol * stringOpSymbol.cc (StringOpSymbol): don't clear machineIntegerSymbol (attachSymbol): don't bind machineIntegerSymbol (copyAttachments): don't copy machineIntegerSymbol (eqRewrite): deleted machineInt operation (eqRewrite): deleted string operation for machineInts * stringOpSymbol.hh (class StringOpSymbol): deleted data member machineIntegerSymbol * floatOpSymbol.cc (FloatOpSymbol): don't clear machineIntegerSymbol (attachSymbol): don't bind machineIntegerSymbol (copyAttachments): don't copy machineIntegerSymbol (eqRewrite): deleted machineInt operation (eqRewrite): deleted float operation for machineInts * floatOpSymbol.hh (class FloatOpSymbol): deleted data member machineIntegerSymbol ===================================Maude74================================================== 2002-06-12 Steven Eker * floatOpSymbol.cc (eqRewrite): support float(Rat) operation 2002-06-11 Steven Eker * floatOpSymbol.hh (class FloatOpSymbol): added data members succSymbol, minusSymbol and divisionSymbol * floatOpSymbol.cc (attachSymbol): handle succSymbol, minusSymbol and divisionSymbol (copyAttachments): handle succSymbol, minusSymbol and divisionSymbol (FloatOpSymbol): clear succSymbol, minusSymbol and divisionSymbol (eqRewrite): support rat(Float) op * stringOpSymbol.cc (eqRewrite): use Uint for substr index and length; use fits_uint_p(), get_ui() and UINT_MAX (substring): we no longer allow -ve index (fwdFind): we no longer allow -ve start (revFind): we no longer allow -ve start * stringOpSymbol.hh (class StringOpSymbol): updated decls for substring(), fwdFind() and revFind() (class StringOpSymbol): make ropeToNumber() static * stringOpSymbol.cc (substring): Int64 -> crope::size_type (fwdFind): Int64 -> crope::size_type (revFind): Int64 -> crope::size_type * stringOpSymbol.hh (class StringOpSymbol): added decl for ropeToNumber() * stringOpSymbol.cc (ropeToNumber): added (eqRewrite): support string(Rat, Nat) and rat(String, Nat) ops 2002-06-10 Steven Eker * stringOpSymbol.hh (class StringOpSymbol): added data member divisionSymbol * stringOpSymbol.cc: MachineFloat -> Float (StringOpSymbol): clear divisionSymbol (attachSymbol): handle divisionSymbol * stringOpSymbol.hh (class StringOpSymbol): data member machineFloatSymbol becomes floatSymbol * machineFloatOpSymbol.cc: MachineFloat -> Float; becomes floatOpSymbol.cc * machineFloatOpSymbol.hh: MachineFloat -> Float; becomes floatOpSymbol.hh * machineFloatDagNode.cc: MachineFloat -> Float; becomes floatDagNode.cc * machineFloatDagNode.hh: MachineFloat -> Float; becomes floatDagNode.hh * machineFloatTerm.cc: MachineFloat -> Float; becomes floatTerm.cc * machineFloatTerm.hh: MachineFloat -> Float; becomes floatTerm.hh * machineFloatSymbol.cc: MachineFloat -> Float; becomes floatSymbol.cc * machineFloatSymbol.hh: MachineFloat -> Float; becomes floatSymbol.hh * stringOpSymbol.hh (class StringOpSymbol): added data member minusSymbol * stringOpSymbol.cc (eqRewrite): machineFloat op becomes float (eqRewrite): converted decFloat to use Ints (StringOpSymbol): clear minusSymbol (attachSymbol): handle minusSymbol (copyAttachments): handle minusSymbol 2002-06-07 Steven Eker * succSymbol.hh (class SuccSymbol): added decl for getSignedInt64() * succSymbol.cc (getSignedInt64): added * succSymbol.hh (class SuccSymbol): added decl for getSignedInt() * succSymbol.cc (getSignedInt): added 2002-06-06 Steven Eker * stringOpSymbol.cc (eqRewrite): use Nats for substr (eqRewrite): use Nats for find and rfind (eqRewrite): use Nats for char 2002-06-05 Steven Eker * stringOpSymbol.cc (StringOpSymbol): init succSymbol (attachSymbol): handle succSymbol (copyAttachments): copy succSymbol (eqRewrite): use Nats for length and ascii ops * stringOpSymbol.hh (class StringOpSymbol): added data member succSymbol ===================================Maude73================================================== 2002-06-03 Steven Eker * numberOpSymbol.cc (eqRewrite): handle -1^bignum, 0^bignum, 1^bignum and 0 << bignum 2002-05-23 Steven Eker * divisionSymbol.cc (isRat): added Term* version (getRat): added Term* version * divisionSymbol.hh (class DivisionSymbol): added decl for Term* versions of isRat() and getRat() * minusSymbol.cc (isNeg): added Term* version (getNeg): added Term* version * minusSymbol.hh (class MinusSymbol): added decls for Term* versions of isNeg() and getNeg() * divisionSymbol.cc (getRat): added (makeRatTerm): added 2002-05-22 Steven Eker * divisionSymbol.cc (eqRewrite): use succSymbol->rewriteToNat() * CUI_NumberOpSymbol.cc (eqRewrite): use succSymbol->rewriteToNat() * ACU_NumberOpSymbol.cc (eqRewrite): use succSymbol->rewriteToNat() * numberOpSymbol.cc (eqRewrite): use succSymbol->rewriteToNat() * succSymbol.hh (class SuccSymbol): added decl for rewriteToNat() * succSymbol.cc (rewriteToNat): added * divisionSymbol.cc (eqRewrite): added optimization to avoid trying to simplify the same rational twice 2002-05-21 Steven Eker * divisionSymbol.cc: (isRat) don't treat 0 / NzNat as a Rat (eqRewrite): use isRat(); no longer try to simplify 0 / NzNat since it is not in ctor form. (eqRewrite): use makeRatDag() * minusSymbol.cc (isNeg): don't treat - 0 as neg since some caller expect to find a SuccSymbol under the MinusSymbol in the true case. * builtIn.hh: added fwd decl for class DivisionSymbol * divisionSymbol.hh: created * divisionSymbol.cc: created 2002-05-20 Steven Eker * minusSymbol.hh (class MinusSymbol): added decl for makeIntTerm() * minusSymbol.cc (makeIntTerm): added * succSymbol.cc (makeNatTerm): put more info in Assert() 2002-05-17 Steven Eker * numberOpSymbol.cc (eqRewrite): added abs operation * minusSymbol.cc (attachData): convert MinusSymbol attachment into NumberOpSymbol attachment * ACU_NumberOpSymbol.cc (attachSymbol): use MinusSymbol* (copyAttachments): use MinusSymbol* * ACU_NumberOpSymbol.hh (class ACU_NumberOpSymbol): minusSymbol now has type MinusSymbol* * numberOpSymbol.cc (copyAttachments): use MinusSymbol* * minusSymbol.hh: created * minusSymbol.cc: created * builtIn.hh: added fwd decl for MinusSymbol * numberOpSymbol.cc (makeNegDag): deleted (isNeg): deleted (getNeg): deleted (attachSymbol): use MinusSymbol* * numberOpSymbol.hh (getSuccSymbol): added (class NumberOpSymbol): minusSymbol now has type MinusSymbol* 2002-05-16 Steven Eker * numberOpSymbol.cc (eqRewrite): rewritten to handle -ve Ints * numberOpSymbol.hh (class NumberOpSymbol): updated decls * numberOpSymbol.cc (makeIntDag): becomes makeNegDag(); simplified for -ve case * ACU_NumberOpSymbol.cc (eqRewrite): use isNeg(), getNeg() and makeNegDag() * numberOpSymbol.cc (getInt): becomes getNeg(); simplified for -ve case (isInt): becomes isNeg(); simplified for -ve case * ACU_NumberOpSymbol.cc (eqRewrite): rewritten using isInt(), getInt() and makeIntDag() * numberOpSymbol.cc (makeIntDag): added (isInt): added (getInt): added * numberOpSymbol.hh (class NumberOpSymbol): added decls for makeIntDag(), isInt(), getInt() 2002-05-15 Steven Eker * numberOpSymbol.cc (eqRewrite): fix bad CODE for quo * CUI_NumberSymbol.hh: created * CUI_NumberSymbol.cc: created 2002-05-14 Steven Eker * numberOpSymbol.cc (eqRewrite): added div, mod, gcd, lcm, ^, << and >> cases (eqRewrite): have >> case work correctly even for extreme values of 2nd arg (eqRewrite): added - and modular exponent cases (eqRewrite): div becomes quo (eqRewrite): added divides case 2002-05-13 Steven Eker * ACU_NumberOpSymbol.cc (eqRewrite): updated usedMultiplicity (attachData): fixed bug where we were looking for hook named NumberOpSymbol rather than ACU_NumberOpSymbol (eqRewrite): handle the high multiplicity case for * (eqRewrite): added gcd and lcm cases (eqRewrite): fixed bug in xor case (eqRewrite): handle the case where >= 2 but not all of the args are numbers 2002-05-10 Steven Eker * builtIn.hh: added fwd decl for ACU_NumberOpSymbol * ACU_NumberOpSymbol.hh: created * ACU_NumberOpSymbol.cc: created 2002-05-09 Steven Eker * succSymbol.hh (class SuccSymbol): added decl for attachData() * succSymbol.cc (attachData): added in order to deal with null data attach * bindingMacros.hh (NULL_DATA): added * numberOpSymbol.hh: created * numberOpSymbol.cc: created * builtIn.hh: added forwards decls for SuccSymbol and NumberOpSymbol * succSymbol.hh: created * succSymbol.cc: created ===================================Maude72================================================== 2002-02-05 Steven Eker * stringOpSymbol.hh (class StringOpSymbol): deleted static data member eagerStrategy * stringOpSymbol.cc (StringOpSymbol): deleted strategy argument passed to FreeSymbol() * sortTestSymbol.hh (class SortTestSymbol): deleted static data member eagerStrategy * sortTestSymbol.cc (SortTestSymbol): use standard instead of eagerStrategy * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): deleted static data member eagerStrategy * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): deleted strategy argument passed to FreeSymbol() * machineFloatOpSymbol.hh (class MachineFloatOpSymbol): deleted static data member eagerStrategy * machineFloatOpSymbol.cc (MachineFloatOpSymbol): deleted strategy argument passed to FreeSymbol() * branchSymbol.hh (class BranchSymbol): deleted static data member eagerStrategy * branchSymbol.cc (BranchSymbol): deleted strategy argument passed to FreeSymbol() 2002-01-30 Steven Eker * stringTerm.hh: ifdef LIBv3 for libstdc++-v3 * stringDagNode.hh: ifdef LIBv3 for libstdc++-v3 * stringOpSymbol.hh: ifdef LIBv3 for libstdc++-v3 ===================================Maude70================================================== 2002-01-25 Steven Eker * stringOpSymbol.cc (eqRewrite): undid hack because it doesn't work - for unknown reasons; reverted to old library (eqRewrite): redid hack; fixed \0 termination bug in second copy of hack 2002-01-24 Steven Eker * stringOpSymbol.cc (eqRewrite): fixed bug where we weren't \0 terminating our temporary C-string copy of left arg rope; bug was introduced by hack below 2001-12-10 Steven Eker * stringDagNode.hh: #include -> #include * stringOpSymbol.cc (eqRewrite): added hacks to get around the problem of Rope::c_str() not working in libstdc++-v3 * stringTerm.hh: #include -> #include ===================================Maude69================================================== 2001-03-16 Steven Eker * stringOpSymbol.cc (rewriteToString): incrementCount() -> incrementEqCount() * sortTestSymbol.cc (eqRewrite): incrementCount() -> incrementEqCount() * machineIntegerOpSymbol.cc (eqRewrite): simplified using rewriteToMachineInteger() * machineIntegerSymbol.cc (rewriteToMachineInteger): incrementCount() -> incrementEqCount() * machineFloatSymbol.cc (rewriteToMachineFloat): incrementCount() -> incrementEqCount() 2001-03-08 Steven Eker * branchSymbol.hh (class BranchSymbol): added decl for stackArguments() * branchSymbol.cc (stackArguments): added ===================================Engine65================================================== 2001-02-16 Steven Eker * stringOpSymbol.cc (eqRewrite): put result of left + right in a local variable for safety (eqRewrite): put result of int64ToString() into a local variable for safety (eqRewrite): use safeCast() for down casting in many places 2001-02-12 Steven Eker * bindingMacros.hh (BIND_OP): return true in op == t case 2001-01-19 Steven Eker * stringOpSymbol.cc (attachData): simplified using BIND_OP; call FreeSymbol::attachData() (attachSymbol): call FreeSymbol::copyAttachments() (attachTerm): don't self destruct term; call FreeSymbol::attachTerm() (copyAttachments): simplified using COPY_SYMBOL and COPY_TERM; call FreeSymbol::copyAttachments() * machineFloatOpSymbol.cc (attachData): simplified using BIND_OP; call FreeSymbol::attachData() (attachSymbol): call FreeSymbol::copyAttachments() (attachTerm): don't self destruct term; call FreeSymbol::attachTerm() (copyAttachments): simplified using COPY_SYMBOL and COPY_TERM; call FreeSymbol::copyAttachments() * machineIntegerOpSymbol.cc (attachData): simplified using BIND_OP; call FreeSymbol::attachData() * bindingMacros.hh (BIND_OP): added (BIND_OP): added * machineIntegerOpSymbol.cc (copyAttachments): simplified using COPY_SYMBOL and COPY_TERM (copyAttachments): call FreeSymbol::copyAttachments() (attachTerm): don't self destruct term; call FreeSymbol::attachTerm() (attachSymbol): call FreeSymbol::attachSymbol() * bindingMacros.hh (COPY_SYMBOL): added (COPY_TERM): added 2001-01-17 Steven Eker * stringOpSymbol.cc (fwdFind): protect against wrap-around when start is close to the maximum 64 signed int (substring): protect against wrap-around when length or index are close to the minimum 64 signed int;protect against wrap-around when length is close to the maximum 64 signed int * machineFloatOpSymbol.cc (postInterSymbolPass): simplified using PREPARE_TERM() * machineIntegerOpSymbol.cc (postInterSymbolPass): simplified using PREPARE_TERM() * stringOpSymbol.cc (postInterSymbolPass): simplified using PREPARE_TERM() * bindingMacros.hh (PREPARE_TERM): added 2001-01-12 Steven Eker * machineFloatOpSymbol.hh (class MachineFloatOpSymbol): deleted decls for fixUp() and copyFixUp() * machineFloatOpSymbol.cc (fixUp): deleted (copyFixUp): deleted (attachSymbol): simplified using BIND_SYMBOL() (attachTerm): simplified using BIND_TERM(); self-destruct term in the case we don't recognize purpose * stringOpSymbol.hh (class StringOpSymbol): deleted decls for fixUp() and copyFixUp() * machineIntegerOpSymbol.cc (attachTerm): self-destruct term in the case we don't recognize purpose * stringOpSymbol.cc (attachSymbol): simplified using BIND_SYMBOL() (attachTerm): simplified using BIND_TERM(); self-destruct term in the case we don't recognize purpose so that when we return false caller knows they don't have to garbage collect term (fixUp): deleted (copyFixUp): deleted * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): deleted decls for fixUp() and copyFixUp() * bindingMacros.hh (BIND_SYMBOL): created * machineIntegerOpSymbol.cc (fixUp): deleted (copyFixUp): deleted (attachSymbol): simplified using BIND_SYMBOL() (attachTerm): simplified using BIND_TERM() 2001-01-10 Steven Eker * stringOpSymbol.cc (StringOpSymbol): initialize op, stringSymbol, machineIntegerSymbol, machineFloatSymbol, decFloatSymbol (attachData): added (attachSymbol): added (attachTerm): added (copyAttachments): added * machineFloatOpSymbol.cc (MachineFloatOpSymbol): initialize op, machineFloatSymbol, machineIntegerSymbol (attachData): added (attachSymbol): added (attachTerm): added (copyAttachments): added * machineFloatOpSymbol.hh (class MachineFloatOpSymbol): added decls for attachData(), attachSymbol(), attachTerm(), copyAttachments() * machineIntegerOpSymbol.cc (attachData): added purpose arg * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): added purpose argument to attachData() decl 2001-01-09 Steven Eker * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): initialize op = NONE and machineIntegerSymbol = 0 (attachTerm): handle the case where we are handed multiple terms with the same purpose - ok if they are equal, error otherwise * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): added declarations for attachData(), attachSymbol(), attachTerm(), copyAttachments() * machineIntegerOpSymbol.cc (attachData): added (attachTerm): added (attachSymbol): added (copyAttachments): added ===================================Engine64================================================== 2000-06-21 Steven Eker * machineFloatOpSymbol.cc (eqRewrite): check for wrap around in float to int conversion (happens on alpha and linux with -O2) * machineFloatOpSymbol.hh (class MachineFloatOpSymbol): added decl for use safePow() * machineFloatOpSymbol.cc (safePow): added (eqRewrite): use safePow() 2000-06-20 Steven Eker * machineFloatOpSymbol.cc (eqRewrite): define +/-Infinity ^ X properly (eqRewrite): check arguments to asin and acos (eqRewrite): define atan2(+/-Infinity, +/-Infinity) * machineFloatOpSymbol.hh (class MachineFloatOpSymbol): added decl for isOdd() * machineFloatOpSymbol.cc (eqRewrite): fix pow() again (we had it wrong the first time) (isOdd): added (eqRewrite): define -Infinity ^ X properly (eqRewrite): use isOdd 2000-06-19 Steven Eker * stringOpSymbol.cc (fixUp): save decFloatSymbol (copyFixUp): copy decFloatSymbol * stringOpSymbol.hh (class StringOpSymbol): added data member decFloatSymbol (class StringOpSymbol): upaded decl for fixUp() * stringOpSymbol.cc (eqRewrite): implemented decFloat operation 2000-06-14 Steven Eker * machineFloatOpSymbol.cc (eqRewrite): check for errno != 0 and NaN in result (eqRewrite): don't check for errno != 0 after all: solaris sets this for log(0) and pow() overflows whereas linux does not. Instead we check the inputs to functions whose output in extreme cases varies between platforms (eqRewrite): fix pow() result in the case that first arg is -ve and pow() produces wrongly sign result; goto failure if sign cannot be reliably determined 2000-06-13 Steven Eker * machineFloatTerm.cc (MachineFloatTerm): don't allow -0.0 to be stored * machineFloatDagNode.cc (MachineFloatDagNode): don't allow -0.0 to be stored * stringOpSymbol.cc (fixUp): store machineFloatSymbol (copyFixUp): copy machineFloatSymbol (eqRewrite): added code for MachineFloat <-> String * stringOpSymbol.hh (class StringOpSymbol): added data member machineFloatSymbol; updated decl for ctor 2000-06-12 Steven Eker * machineFloatOpSymbol.cc (eqRewrite): use rewriteToMachineFloat() (eqRewrite): handle machine integer to machine float conversion * machineFloatSymbol.hh (class MachineFloatSymbol): added decl for rewriteToMachineFloat() * machineFloatSymbol.cc (rewriteToMachineFloat): added * stringOpSymbol.hh (class StringOpSymbol): deleted decl for rewriteToMachineInteger() * stringOpSymbol.cc (eqRewrite): use MachineIntegerSymbol::rewriteToMachineInteger() (3 places) (rewriteToMachineInteger): deleted * machineFloatOpSymbol.cc (eqRewrite): support machine float to machine integer conversion * machineIntegerSymbol.hh (class MachineIntegerSymbol): added decl for rewriteToMachineInteger() * machineIntegerSymbol.cc (rewriteToMachineInteger): added * machineFloatOpSymbol.cc (fixUp): save machineIntegerSym (copyFixUp): copy machineIntegerSym * machineFloatOpSymbol.hh (class MachineFloatOpSymbol): added data member machineIntegerSymbol; updated decl for fixUp() 2000-06-09 Steven Eker * machineIntegerSymbol.cc (fillInSortInfo): use getValue() rather than isZero() * machineIntegerTerm.hh (isZero): deleted * machineFloatOpSymbol.hh: created * machineFloatOpSymbol.cc: created * machineFloatTerm.cc: created * machineFloatTerm.hh: created * builtIn.hh: added forward decls for MachineFloat classes * machineFloatDagNode.cc: created * machineFloatSymbol.cc: created * machineFloatDagNode.hh: created * machineFloatSymbol.hh: created 2000-05-16 Steven Eker * stringOpSymbol.cc (eqRewrite): parse becomes machineInt, format becomes string 2000-05-09 Steven Eker * stringOpSymbol.cc (eqRewrite): add code for format and parse operations 2000-04-25 Steven Eker * stringOpSymbol.cc (eqRewrite): added functionality for char() and ascii() ops * builtIn.hh: added forward decls for class StringSymbol, class StringTerm, class StringDagNode, class StringOpSymbol * stringOpSymbol.cc (fixUp): take StringSymbol* arg (copyFixUp): cast to StringSymbol* * stringOpSymbol.hh (class StringOpSymbol): updated fixUp() decl (class StringOpSymbol): stringSymbol becomes a StringSymbol* * stringDagNode.cc (StringDagNode): take StringSymbol* arg (overwriteWithClone): cast to StringSymbol* (makeClone): cast to StringSymbol* * stringDagNode.hh (class StringDagNode): updated decl for StringDagNode() * stringTerm.cc (StringTerm): take StringSymbol* arg (deepCopy2): cast to StringSymbol* (overwriteWithDagNode): cast to StringSymbol* (makeDagNode): cast to StringSymbol* * stringTerm.hh (class StringTerm): updated decl for StringTerm() * stringSymbol.hh: created * stringSymbol.cc: created 2000-04-24 Steven Eker * stringDagNode.cc (StringDagNode): call setCallDtor() so that crope can be destructed on garbage collection 2000-04-12 Steven Eker * stringOpSymbol.cc (substring): return crope rather than const crope& * stringOpSymbol.hh (class StringOpSymbol): substring() must return crope rather than const crope& 2000-04-11 Steven Eker * stringOpSymbol.cc: created * stringOpSymbol.hh: created 2000-04-10 Steven Eker * stringDagNode.cc: created * stringDagNode.hh: created 2000-04-07 Steven Eker * stringTerm.cc: created * stringTerm.hh: created ===================================Maude 1.0.5 finished======================================= 2000-03-14 Steven Eker * branchSymbol.cc (computeBaseSort): code cleaning ===================================Engine56================================================== 2000-01-28 Steven Eker * equalitySymbol.cc (generateCode): call generateIncrement() (generateCode): don't call generateIncrement() after all as generateRhs() does so 2000-01-27 Steven Eker * equalitySymbol.hh (class EqualitySymbol): added decl for generateCode() * equalitySymbol.cc (generateCode): added ===================================Engine54================================================== 1999-10-29 Steven Eker * machineIntegerDagNode.cc (getHashValue): cast to int before hashing * machineIntegerTerm.cc (normalize): cast to int before hashing * machineIntegerDagNode.cc (MachineIntegerDagNode): int -> Int64 * machineIntegerDagNode.hh (class MachineIntegerDagNode): int -> Int64 * machineIntegerOpSymbol.cc (eqRewrite): specialEval becomes a bool; int -> Int64 * machineIntegerTerm.cc (MachineIntegerTerm): int -> Int64 (compareArguments): (both versions) int -> Int64 * machineIntegerTerm.hh (class MachineIntegerTerm): int -> Int64 (getValue): int -> Int64 ===================================Engine53================================================== 1999-10-25 Steven Eker * sortTestSymbol.cc (eqRewrite): updated call to tracePreEqRewrite() * machineIntegerOpSymbol.cc (eqRewrite): updated call to tracePreEqRewrite() 1999-10-19 Steven Eker * machineIntegerDagNode.cc (getHashValue): added * machineIntegerDagNode.hh (class MachineIntegerDagNode): added decl for getHashValue() 1999-10-14 Steven Eker * sortTestSymbol.cc (eqRewrite): call constrainToExactSort(t, context); ===================================Engine52================================================== 1999-04-26 Steven Eker * branchSymbol.cc (compileSortConstraints): deleted (compileEquations): deleted (fillInSortInfo): added extra assert for component of 2nd arg * branchSymbol.hh (class BranchSymbol): deleted decls for compileEquations() and compileSortConstraints() * branchSymbol.cc (eqRewrite): call FreeSymbol::eqRewrite(subject, context) if we can't match 1st arg * sortTestSymbol.cc (makeLazyStrategy): made lazyStrategy a local static (fillInSortInfo): deleted (computeBaseSort): deleted (compileOpDeclarations): deleted (compileSortConstraints): deleted (acceptEquation): added * sortTestSymbol.hh (class SortTestSymbol): added decl for acceptEquation(); deleted decls for fillInSortInfo(), computeBaseSort(), compileOpDeclarations(), compileSortConstraints() (makeLazyStrategy): moved to sortTestSymbol.cc * equalitySymbol.cc (computeBaseSort): deleted (compileOpDeclarations): deleted (compileSortConstraints): deleted; fixes nasty bug where we dump core on uncompiled sort constraints (fillInSortInfo): deleted (acceptEquation): added * equalitySymbol.hh (class EqualitySymbol): added decl for acceptEquation(); deleted decls for fillInSortInfo(), computeBaseSort(), compileOpDeclarations(), compileSortConstraints() 1999-04-22 Steven Eker * machineIntegerSymbol.cc (compileOpDeclarations): don't do default sort processing anymore since rangeComponent() and domainComponent() no longer require this 1999-04-20 Steven Eker * equalitySymbol.cc (fillInSortInfo): use correct arg of op decl (computeBaseSort): use correct arg of op decl (fillInSortInfo): use domainComponent() in asserts * branchSymbol.cc (fillInSortInfo): use domainComponent() * branchSymbol.hh (class BranchSymbol): deleted data members expectedSort and range (class BranchSymbol): updated decl for ctor (class BranchSymbol): deleted decls for rangeComponent() and domainComponent() * branchSymbol.cc (rangeComponent): deleted; default will now work (domainComponent): deleted; default will now work (BranchSymbol): don't take range arg or initialize range (computeBaseSort): use (default) rangeComponent() rather than range data member (computeBaseSort): use getOpDeclarations() rather than expectedSort (fillInSortInfo): use getOpDeclarations() rather than expectedSort (BranchSymbol): don't take testSort arg or initialize expectedSort * equalitySymbol.hh (class EqualitySymbol): delete rangeSort and argComponent data members (class EqualitySymbol): delete obsolete strategy stuff (class EqualitySymbol): update ctor decl (class EqualitySymbol): deleted decls for rangeComponent() and domainComponent() * equalitySymbol.cc (domainComponent): deleted; default will now work (rangeComponent): deleted; default will now work (EqualitySymbol): don't take or initialize argComponent (fillInSortInfo): use getOpDeclarations() rather than rangeSort (fillInSortInfo): split Assert to check both args against op decl (computeBaseSort): use getOpDeclarations() rather than rangeSort (EqualitySymbol): don't initialize range sort or take resultSort arg * sortTestSymbol.hh (class SortTestSymbol): deleted rangeSort data member (class SortTestSymbol): updated ctor decl (class SortTestSymbol): deleted decls for rangeComponent() and domainComponent() * sortTestSymbol.cc (rangeComponent): (instance version) deleted (fillInSortInfo): use getOpDeclarations() rather than rangeSort (computeBaseSort): use getOpDeclarations() rather than rangeSort (rangeComponent): deleted; default will now work (domainComponent): deleted; default will now work (SortTestSymbol): don't initialize rangeSort; don't take resultSort arg * sortTestSymbol.hh (class SortTestSymbol): deleted decl for rangeComponent() instance version * branchSymbol.cc (rangeComponent): (instance version) deleted (computeBaseSort): don't use (instance version) rangeComponent() * branchSymbol.hh (class BranchSymbol): deleted decl for rangeComponent() instance version * equalitySymbol.cc (rangeComponent): (instance version) deleted * equalitySymbol.hh (class EqualitySymbol): deleted decl for rangeComponent() instance version * machineIntegerDagNode.cc (specialPrint): deleted * machineIntegerDagNode.hh (class MachineIntegerDagNode): decl for specialPrint() * machineIntegerTerm.cc (specialPrint): deleted * machineIntegerTerm.hh (class MachineIntegerTerm): deleted decl for specialPrint() 1999-04-19 Steven Eker * branchSymbol.cc: use equal() rather than compare() for checking 1st arg against test terms * equalitySymbol.cc (eqRewrite): call computeTrueSort() on bith args inorder to force normalization; we don't actually use the sorts; this fixes a bug that we shared with OBJ3 === op ===================================Engine48================================================== ===================================Maude 1.0.2 released======================================= ===================================Maude 1.0.1 released======================================= 1999-02-27 Steven Eker * branchSymbol.cc (fillInSortInfo): fixed bad Assert() test ===================================VectorExperiment========================================== 1999-02-04 Steven Eker * sortTestSymbol.cc (parse): deleted (fillInSortInfo): added * sortTestSymbol.hh (class SortTestSymbol): deleted decl for parse(); added decl for fillInSortInfo() * equalitySymbol.cc (parse): deleted (fillInSortInfo): added * equalitySymbol.hh (class EqualitySymbol): deleted decl for parse(); added decl for fillInSortInfo() * machineIntegerSymbol.cc (parse): deleted (fillInSortInfo): added * machineIntegerSymbol.hh (class MachineIntegerSymbol): deleted decl for parse(); added decl for fillInSortInfo() * branchSymbol.cc (parse): deleted (fillInSortInfo): added * branchSymbol.hh (class BranchSymbol): deleted decl for parse(); added decl for fillInSortInfo() ===================================Engine47================================================== ===================================Maude 1.00 released======================================= 1999-01-22 Steven Eker * branchSymbol.cc (BranchSymbol): don't delete TestTerms for the moment - another HACK * equalitySymbol.hh (class EqualitySymbol): added decl for ~EqualitySymbol() * equalitySymbol.cc (~EqualitySymbol): added so we can zero out terms in CachedDags to avoid them being deep self destructed; this is a hack - need to find a better solution after release. * branchSymbol.cc (BranchSymbol): use deep copy rather than loop =================================Engine46================================================== Sun Dec 13 16:44:05 1998 Steven Eker * machineIntegerOpSymbol.cc (copyFixUp): fixed bug where we we setting trueTerm twice and not setting falseTerm Thu Dec 10 14:33:33 1998 Steven Eker * sortTestSymbol.cc (rangeComponent): added (no args version) (domainComponent): added * sortTestSymbol.hh (class SortTestSymbol): added decls for rangeComponent() (no args version) and domainComponent() * branchSymbol.cc (domainComponent): added (rangeComponent): added (no args version) (BranchSymbol): handle range arg * branchSymbol.hh (class BranchSymbol): added decls for rangeComponent() (no args version) and domainComponent() (class BranchSymbol): added range arg to ctor (class BranchSymbol): added range data member * equalitySymbol.hh (class EqualitySymbol): added data member argComponent; deleted data member eagerFlag * equalitySymbol.cc (EqualitySymbol): handle argComponent (rangeComponent): added (no args version) (domainComponent): added * equalitySymbol.hh (class EqualitySymbol): added decls for rangeComponent() (no args version) and domainComponent() (class EqualitySymbol): added argComponent arg to ctor Tue Dec 8 11:45:16 1998 Steven Eker * machineIntegerOpSymbol.hh (getFalseTerm): deleted (getTrueTerm): deleted (getMachineIntegerSymbol): deleted (getOp): deleted (class MachineIntegerOpSymbol): updated decls * machineIntegerOpSymbol.cc (copyFixUp): replaces new version of fixUp() Mon Dec 7 11:44:21 1998 Steven Eker * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): added decl for new version of fixUp() * machineIntegerOpSymbol.cc (fixUp): added 2nd version that takes an op code rather than a name * machineIntegerOpSymbol.hh (getOp): added (getMachineIntegerSymbol): added (getTrueTerm): added (getFalseTerm): added =================================Engine44================================================== Wed Nov 25 17:22:39 1998 Steven Eker * sortTestSymbol.cc (eqRewrite): call traceAbort() * machineIntegerOpSymbol.cc (eqRewrite): return result of builtInReplace() since this may now be false in abort case (eqRewrite): call traceAbort() in the case that our result is a in place construction of a MachineIntegerDagNode * branchSymbol.cc (eqRewrite): return result of builtInReplace() since this may now be false in abort case * equalitySymbol.cc (eqRewrite): return result of builtInReplace() since this may now be false in abort case Mon Nov 16 10:13:54 1998 Steven Eker * branchSymbol.cc (eqRewrite): simplified using RewritingContext::builtInReplace() * machineIntegerOpSymbol.cc (eqRewrite): simplified using RewritingContext::builtInReplace() * equalitySymbol.cc (eqRewrite): simplified using RewritingContext::builtInReplace() * machineIntegerOpSymbol.cc (eqRewrite): use getTraceStatus() instead of traceStatus() * sortTestSymbol.cc (eqRewrite): use getTraceStatus() instead of traceStatus() * equalitySymbol.cc (eqRewrite): use getTraceStatus() instead of traceStatus() * branchSymbol.cc (eqRewrite): use getTraceStatus() instead of traceStatus() Fri Nov 6 16:30:22 1998 Steven Eker * machineIntegerTerm.cc (deepCopy): -> deepCopy2() * machineIntegerTerm.hh (class MachineIntegerTerm): deepCopy() -> deepCopy2() =================================Engine43================================================== Thu Oct 15 14:58:33 1998 Steven Eker * machineIntegerOpSymbol.cc: becomes postInterSymbolPass() (postInterSymbolPass): use CachedDag::normalize() and prepare() * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): interSymbolPass() decl becomes postInterSymbolPass() decl * equalitySymbol.hh (class EqualitySymbol): interSymbolPass() decl becomes postInterSymbolPass() decl * equalitySymbol.cc (interSymbolPass): becomes postInterSymbolPass() (postInterSymbolPass): use CachedDag::normalize() and prepare() Wed Oct 14 11:23:44 1998 Steven Eker * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): deleted decl for dtor * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): simplified (~MachineIntegerOpSymbol): deleted (interSymbolPass): use CachedDag::getTerm() and setTerm() (reset): use CachedDag::reset() (fixUp): use CachedDag::setTerm() (eqRewrite): simplified using CachedDag::getDag() * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): use CachedDag rather than DagRoot and Term* * equalitySymbol.hh (class EqualitySymbol): deleted decl for dtor * equalitySymbol.cc (EqualitySymbol): use CachedDag ctor (~EqualitySymbol): deleted (default will do) (reset): use CachedDag::reset() (eqRewrite): simplified using CachedDag::getDag() (interSymbolPass): use CachedDag::getTerm() and setTerm() * equalitySymbol.hh (class EqualitySymbol): use CachedDag rather than DagRoot and Term* =================================Engine42================================================== Thu Oct 8 14:35:23 1998 Steven Eker * machineIntegerDagNode.cc (compareArguments): added const * machineIntegerTerm.cc (compareArguments): (DagNode* version) inserted const (compareArguments): (Term* version) inserted const =================================Engine41================================================== Fri Sep 18 17:07:45 1998 Steven Eker * branchSymbol.cc (parse): use new setSortInfo() conventions, ConnectedComponent::getLeqSorts(), findIndex() (computeBaseSort): use setSortIndex(), ConnectedComponent::getLeqSorts(), findIndex() * equalitySymbol.cc (parse): use new setSortInfo() convention (computeBaseSort): se setSortIndex() * sortTestSymbol.cc (parse): use new setSortInfo() convention (eqRewrite): use DagNode::leq() (computeBaseSort): use setSortIndex() * machineIntegerSymbol.cc (parse): use new setSortInfo() convention (computeBaseSort): use setSortIndex() Fri Sep 11 18:31:56 1998 Steven Eker * sortTestSymbol.cc (eqRewrite): use <=(DagNode*,Sort&) Fri Jul 31 15:34:46 1998 Steven Eker * machineIntegerTerm.hh (class MachineIntegerTerm): added decl for getValue() (getValue): added Wed Jul 29 14:33:30 1998 Steven Eker * machineIntegerSymbol.cc (compileOpDeclarations): need to do default processing in order for rangeComponent() to work * machineIntegerSymbol.hh (class MachineIntegerSymbol): deletede decl for fixUp() * machineIntegerSymbol.cc (compileOpDeclarations): added (fixUp): deleted * machineIntegerSymbol.hh (class MachineIntegerSymbol): added decl for compileOpDeclarations(); Tue Jul 21 10:51:19 1998 Steven Eker * machineIntegerOpSymbol.cc (eqRewrite): use Terms and DagRoots rather than symbols for true/false results * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): added data members trueDag and falseDag * machineIntegerOpSymbol.cc (~MachineIntegerOpSymbol): added (interSymbolPass): added (reset): added * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): deleted decl for setSymbols(); added decl for fixUp(); updated decl for ctor (class MachineIntegerOpSymbol): trueSymbol -> trueTerm; falseSymbol -> falseTerm (class MachineIntegerOpSymbol): added decl for dtor; interSymbolPass() and reset() * machineIntegerOpSymbol.cc (fixUp): added (setSymbols): deleted (MachineIntegerOpSymbol): now just take name and arity * machineIntegerSymbol.hh (class MachineIntegerSymbol): updated ctor decl; added decl for fixUp(); * machineIntegerSymbol.cc (fixUp): added (MachineIntegerSymbol): so longer set sort info or pass it to NA_Symbol() * machineIntegerTerm.hh (class MachineIntegerTerm): added * machineIntegerTerm.cc (deepCopy): added Fri Jul 17 10:16:13 1998 Steven Eker * equalitySymbol.cc (EqualitySymbol): rewritten (~EqualitySymbol): added (interSymbolPass): added (reset): added (eqRewrite): obey general FreeSymbol strategy (eqRewrite): generate result DagNode and use overwriteWithClone() (eqRewrite): don't copy sort info when making dag * equalitySymbol.hh (class EqualitySymbol): deleted data members equalResult, notEqualResult and eager flag; added data members equalTerm, notEqualTerm, equalDag, notEqualDag (class EqualitySymbol): added decls for interSymbolPass() and reset() (class EqualitySymbol): take strategy arg rather than eager arg; args eq and neq become Term* (makeLazyStrategy): deleted (class EqualitySymbol): deleted decl for makeLazyStrategy() and static members eagerStrategy and lazyStrategy =================================Engine39================================================== Tue Jul 7 17:41:16 1998 Steven Eker * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): added decl for setSymbols() * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): no longer initialize symbol pointers like constants (setSymbols): added * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): removed const from symbol pointers to allow them to be initialized later; added defualt value of 0 for machineIntegerSymbol so we can call ctor without supplying necessary symbols Wed Jun 10 18:23:46 1998 Steven Eker * machineIntegerTerm.hh (class MachineIntegerTerm): updated normalize() decl * machineIntegerTerm.cc (normalize): clear changed flag =================================Engine38================================================== Fri Feb 13 14:42:16 1998 Steven Eker * branchSymbol.cc (~BranchSymbol): added to self destruct test terms * branchSymbol.hh (class BranchSymbol): added decl for ~BranchSymbol(); Thu Feb 12 14:51:37 1998 Steven Eker * equalitySymbol.cc (eqRewrite): compare() == 0 changed to equal() =================================Engine35================================================== Thu Dec 4 14:30:33 1997 Steven Eker * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): don't pass inert arg to FreeSymbol() * sortTestSymbol.cc (SortTestSymbol): don't pass inert arg to FreeSymbol() * equalitySymbol.cc (EqualitySymbol): don't pass inert arg to FreeSymbol() * branchSymbol.cc (BranchSymbol): don't pass inert arg to FreeSymbol() Wed Oct 15 16:40:07 1997 Steven Eker * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): remove constructor arg from call to FreeSymbol() * branchSymbol.cc (BranchSymbol): remove constructor arg from call to FreeSymbol() * sortTestSymbol.cc (SortTestSymbol): remove constructor arg from call to FreeSymbol() * equalitySymbol.cc (EqualitySymbol): remove constructor arg from call to FreeSymbol() =================================Engine30================================================== Wed Oct 1 16:38:08 1997 Steven Eker * sortTestSymbol.hh (eager): added (sort): added Tue Sep 30 14:30:53 1997 Steven Eker * machineIntegerTerm.hh (class MachineIntegerTerm): added decl for normalize() * machineIntegerTerm.cc (normalize): added in order to compute distict hash value =================================Engine28================================================== Fri Aug 29 16:31:24 1997 Steven Eker * sortTestSymbol.cc (eqRewrite): rewritten using FreeDagNode::getArgument() * equalitySymbol.cc (eqRewrite): rewritten using FreeDagNode::getArgument() (computeBaseSort): simplified * branchSymbol.cc (eqRewrite): rewritten using FreeDagNode::getArgument() (computeBaseSort): rewritten using FreeDagNode::getArgument() (rangeComponent): rewritten using FreeDagNode::getArgument() Thu Aug 28 11:07:50 1997 Steven Eker * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): update MachineIntegerOpSymbol() decl * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): now take arity argument; (eqRewrite): rewritten to use CODE() macro, remove u- and add >> and << =================================Engine27================================================== Tue Aug 12 17:19:15 1997 Steven Eker * machineIntegerSymbol.cc (computeBaseSort): use getValue() rather than isZero() * machineIntegerOpSymbol.cc (eqRewrite): use getValue() rather than acessing MachineIntegerDagNode private part * machineIntegerDagNode.hh (class MachineIntegerDagNode): removed friend class MachineIntegerOpSymbol * machineIntegerDagNode.cc: delete #include "intSet.hh" * machineIntegerDagNode.hh (isZero): replaced with getValue(); typically most applications of machine int (eg meta level) will need at least this. (class MachineIntegerDagNode): delete decl for isZero(), added decl for getValue() * builtIn.hh: added decls for MachineIntegerSymbol, MachineIntegerTerm, MachineIntegerDagNode and MachineIntegerOpSymbol Tue Aug 5 16:12:57 1997 Steven Eker * machineIntegerOpSymbol.cc (eqRewrite): use getArgument() rather than argArray() Mon Aug 4 11:10:25 1997 Steven Eker * machineIntegerOpSymbol.cc (eqRewrite): split call to context.tracePreEqRewrite() so that we don't call it in a div by zero situation * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): NA_Symbol -> MachineIntegerSymbol in ctor decl (class MachineIntegerOpSymbol): NA_Symbol -> MachineIntegerSymbol for data member * machineIntegerOpSymbol.cc (MachineIntegerOpSymbol): NA_Symbol -> MachineIntegerSymbol * machineIntegerTerm.hh (class MachineIntegerTerm): NA_Symbol -> MachineIntegerSymbol in ctor decl * machineIntegerTerm.cc (overwriteWithDagNode): NA_Symbol -> MachineIntegerSymbol (makeDagNode): NA_Symbol -> MachineIntegerSymbol (MachineIntegerTerm): NA_Symbol -> MachineIntegerSymbol * machineIntegerDagNode.hh (class MachineIntegerDagNode): NA_Symbol -> MachineIntegerSymbol in ctor decl * machineIntegerDagNode.cc (makeClone): NA_Symbol -> MachineIntegerSymbol (overwriteWithClone): NA_Symbol -> MachineIntegerSymbol (MachineIntegerDagNode): NA_Symbol -> MachineIntegerSymbol * machineIntegerDagNode.hh (isZero): added * machineIntegerTerm.hh (isZero): added * machineIntegerSymbol.cc: created * machineIntegerSymbol.hh (class MachineIntegerSymbol): created Thu Jul 31 10:33:28 1997 Steven Eker * machineIntegerOpSymbol.cc: created * machineIntegerOpSymbol.hh (class MachineIntegerOpSymbol): created * machineIntegerDagNode.cc: created * machineIntegerDagNode.hh (class MachineIntegerDagNode): created Wed Jul 30 19:27:49 1997 Steven Eker * machineIntegerTerm.hh (class MachineIntegerTerm): created * machineIntegerTerm.cc: created Wed Jul 23 11:59:39 1997 Steven Eker * metaRewriteSymbol.cc (pullDown2): pass full = false to normalize() =================================Engine26b================================================== Tue Jul 15 15:47:24 1997 Steven Eker * sortTestSymbol.cc (SortTestSymbol): pass inert = false * branchSymbol.cc (BranchSymbol): pass inert = false * metaRewriteSymbol.cc (MetaRewriteSymbol): pass inert = false * equalitySymbol.cc (EqualitySymbol): pass inert = false ================================Engine26===================================================== Mon Jun 30 10:59:50 1997 Steven Eker * metaRewriteSymbol.cc (pullDown): if symbol pulled down is a variable, set index to 0 to avoid uninitialized read in Variable::markEagerArguments(). This is a horrible hack the will disappear when this code is replaced by the new meta-level (pullDown): horrible hack removed in favour of change to Variable::markEagerArguments() whcih also works for top level reduction terms. Wed Jun 25 12:04:00 1997 Steven Eker * metaRewriteSymbol.cc (eqRewrite): pass purpose arg to makeSubcontext() Tue Jun 24 16:35:39 1997 Steven Eker * metaRewriteSymbol.cc: added #include "variable.hh" Thu Apr 10 18:34:40 1997 Steven Eker * metaRewriteSymbol.cc (errorRewrite): deepSelfDestruct t rather than relying on pushdUp2() to do it (eqRewrite): deepSelfDestruct t rather than relying on pushdUp2() to do it (pushUp2): don't deepSelfDestruct t (errorRewrite): increment rewrite count; handle tracing for the meta-*() ---> error* step. (eqRewrite): no longer start by incrementing rewrite count (eqRewrite): major rehack to handle tracing Tue Apr 8 14:38:01 1997 Steven Eker * branchSymbol.cc (eqRewrite): added tracing * sortTestSymbol.cc (eqRewrite): added tracing * equalitySymbol.cc (eqRewrite): added tracing Fri Apr 4 17:58:06 1997 Steven Eker * metaRewriteSymbol.cc (eqRewrite): removed trace flag from RewritingContext constructor calls Tue Apr 1 15:19:16 1997 Steven Eker * metaRewriteSymbol.cc (eqRewrite): heavily rewritten to use pushUpSubstitution() * metaRewriteSymbol.hh (class MetaRewriteSymbol): added decl for pushUpSubstitution() * metaRewriteSymbol.cc (pushUpSubstitution): added Mon Mar 31 10:28:16 1997 Steven Eker * metaRewriteSymbol.cc (errorRewrite): context arg removed (eqRewrite): removed context arg from errorRewrite() call * metaRewriteSymbol.hh (class MetaRewriteSymbol): added errorRewrite() decl * metaRewriteSymbol.cc (errorRewrite): added (eqRewrite): use errorRewrite() Fri Mar 28 16:08:10 1997 Steven Eker * metaRewriteSymbol.cc (pushUp2): added (pullDown2): added (eqRewrite): rewritten to use Rule::apply() (eqRewrite): in meta-apply() case use result of apply in final reduce! (pullDownSubstitution): added (pullDownAssignment): added (pushUp2): now take Term* rather than DagNode* (eqRewrite): meta-rewrite2 partly implemented (pullDownSubstitution): remember to move to next assignment within loop Thu Mar 27 16:23:48 1997 Steven Eker * metaRewriteSymbol.cc (MetaRewriteSymbol): added params for symbols needed to implement meta-apply2 (eqRewrite): use arity rather than applyFlag to determine which operator we are * metaRewriteSymbol.hh (class MetaRewriteSymbol): added data members for symbols needed to implement meta-apply2 Fri Jan 3 15:28:16 1997 Steven Eker * metaRewriteSymbol.cc (eqRewrite): fixed bug where we were failing to evaluate 3rd arg of meta-apply Tue Dec 24 18:33:42 1996 Steven Eker * sortTestSymbol.cc (eqRewrite): call to computeSort() replaced by computeTrueSort() * metaRewriteSymbol.cc (eqRewrite): name change from rewrite() * metaRewriteSymbol.hh (class MetaRewriteSymbol): rewrite() -> eqRewrite() * sortTestSymbol.cc (computeBaseSort): adapted from computeSort(); now we assume that subterms are correctly sorted * sortTestSymbol.hh (class SortTestSymbol): computeSort() -> computeBaseSort(); rewrite() -> eqRewrite() * equalitySymbol.cc (computeBaseSort): adapted from computeSort(); now we assume that subterms are correctly sorted; how should sorting work on ERROR_SORT? * equalitySymbol.hh (class EqualitySymbol): computeSort() -> computeBaseSort(); rewrite() -> eqRewrite() * branchSymbol.cc (computeBaseSort): adapted from computeSort(); now we assume that subterms are correctly sorted * branchSymbol.hh (class BranchSymbol): computeSort() -> computeBaseSort(); rewrite() -> eqRewrite() Mon Nov 25 19:08:24 1996 Steven Eker * sortTestSymbol.cc (SortTestSymbol): added constructor arg * metaRewriteSymbol.cc (MetaRewriteSymbol): added constructor arg * equalitySymbol.cc (EqualitySymbol): added constructor arg * branchSymbol.cc (BranchSymbol): added constructor arg Sun Aug 25 11:24:07 1996 Steven Eker * metaRewriteSymbol.cc (rewrite): added code to re-reduce result after a sucessful rewrite Thu Aug 15 11:35:27 1996 Steven Eker * metaRewriteSymbol.cc (pullDown): fixed infinite loop bug (MetaRewriteSymbol): apply flag added (rewrite): extended to handle apply case * builtIn.hh: added fwd decl of MetaRewriteSymbol * metaRewriteSymbol.cc: created * metaRewriteSymbol.hh (class MetaRewriteSymbol): created Fri Aug 2 16:02:34 1996 Steven Eker * sortTestSymbol.cc (SortTestSymbol): new strategy passing code * branchSymbol.cc (BranchSymbol): new strategy passing code * sortTestSymbol.hh (makeLazyStrategy): added * equalitySymbol.cc (EqualitySymbol): new strategy passing code * equalitySymbol.hh (makeLazyStrategy): added * sortTestSymbol.cc (compileSortConstraints): added (compileEquations): added (compileOpDeclarations): added * equalitySymbol.cc (compileSortConstraints): added (compileEquations): added (compileOpDeclarations): added * branchSymbol.cc (compileSortConstraints): added (compileEquations): added (compileOpDeclarations): added Thu Feb 8 11:11:19 1996 Steven Eker * branchSymbol.cc (computeSort): use dagNode::computeSort() * sortTestSymbol.cc (computeSort): use new dagNode::computeSort() (rewrite): now call dagNode::computeSort() on subterm in the lazy case * equalitySymbol.cc (computeSort): use new dagNode::computeSort() on arguments. * sortTestSymbol.hh: added lazyStrategy, eager parameter * equalitySymbol.cc: added lazyStrategy, eager parameter and code to store and handle it * equalitySymbol.hh: added lazyStrategy, eager parameter * sortTestSymbol.cc: added lazyStrategy, eager parameter and code to store and handle it Wed Feb 7 14:38:50 1996 Steven Eker * builtIn.hh: created * sortTestSymbol.cc: created * sortTestSymbol.hh: created Fri Feb 2 15:36:04 1996 Steven Eker * branchSymbol.hh: changed parse() parameters * branchSymbol.cc (parse): rewritten * equalitySymbol.cc (parse): rewritten * equalitySymbol.hh: changed parse() parameters Thu Feb 1 15:08:27 1996 Steven Eker * branchSymbol.cc (parse): added * branchSymbol.hh: parse() added * equalitySymbol.cc (parse): added * equalitySymbol.hh: parse() added Thu Jan 11 18:11:32 1996 Steven Eker * equalitySymbol.cc (computeSort): DagNode::SORT_UNKNOWN -> Sort::SORT_UNKNOWN * branchSymbol.cc (computeSort): DagNode::SORT_UNKNOWN -> Sort::SORT_UNKNOWN Wed Jan 10 17:21:28 1996 Steven Eker * branchSymbol.cc (BranchSymbol): don't pass sharable argument * equalitySymbol.cc (EqualitySymbol): don't pass sharable argument Thu Dec 14 12:17:30 1995 Steven Eker * equalitySymbol.cc (EqualitySymbol): store resultSort (rangeComponent): added (computeSort): implemented * equalitySymbol.hh (EqualitySymbol) added resultSort argument plus storage. Also rangeComponent() added. * branchSymbol.cc (computeSort): now use rangeComponent() (rangeComponent): added * branchSymbol.hh (BranchSymbol): we now take and store the sort of the test expression added rangeComponent() * branchSymbol.cc (computeSort): implemented Tue Dec 12 14:49:28 1995 Steven Eker * equalitySymbol.cc (computeSort): added * branchSymbol.cc (computeSort): added Fri Dec 8 15:07:58 1995 Steven Eker * branchSymbol.cc: created * branchSymbol.hh: created * equalitySymbol.hh: created * equalitySymbol.cc: created Maude-2.6/src/BuiltIn/CUI_NumberOpSymbol.hh0000644000147300135640000000324507752304224015451 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in CUI operations on numbers. // #ifndef _CUI_NumberOpSymbol_hh_ #define _CUI_NumberOpSymbol_hh_ #include "CUI_Symbol.hh" class CUI_NumberOpSymbol : public CUI_Symbol { public: CUI_NumberOpSymbol(int id, Axioms axioms); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); bool eqRewrite(DagNode* subject, RewritingContext& context); private: int op; SuccSymbol* succSymbol; }; #endif Maude-2.6/src/BuiltIn/stringTerm.hh0000644000147300135640000000315010505067577014174 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for terms containing strings. // #ifndef _stringTerm_hh_ #define _stringTerm_hh_ #include "ropeStuff.hh" #include "NA_Term.hh" class StringTerm : public NA_Term { public: StringTerm(StringSymbol* symbol, const crope& value); Term* deepCopy2(SymbolMap* map) const; Term* normalize(bool full, bool& changed); int compareArguments(const Term* other) const; int compareArguments(const DagNode* other) const; void overwriteWithDagNode(DagNode* old) const; NA_DagNode* makeDagNode() const; // // Needed because we have hidden data. // Term* instantiate2(const Vector& varBindings, SymbolMap* translator); const crope& getValue() const; private: const crope value; }; inline const crope& StringTerm::getValue() const { return value; } #endif Maude-2.6/src/BuiltIn/floatSymbol.hh0000644000147300135640000000251111457445426014331 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for floating point number symbols. // #ifndef _floatSymbol_hh_ #define _floatSymbol_hh_ #include "NA_Symbol.hh" class FloatSymbol : public NA_Symbol { public: FloatSymbol(int id); void fillInSortInfo(Term* subject); void computeBaseSort(DagNode* subject); void compileOpDeclarations(); bool isConstructor(DagNode* subject); bool rewriteToFloat(DagNode* subject, RewritingContext& context, double result); private: Sort* sort; Sort* finiteSort; }; #endif Maude-2.6/src/BuiltIn/matrixOpSignature.cc0000644000147300135640000000327510303436144015503 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // List of constructors specific to MatrixOpSymbol. // // We generate various chunks of linear (branching) code to handle // this hetrogeneous collection by macro expansion. // The format is: // MACRO(symbols name, symbols C++ class, required type flags, number of args) // MACRO(stringSymbol, StringSymbol, SymbolType::STRING, 0) MACRO(emptyVectorSymbol, Symbol, 0, 0) MACRO(vectorEntrySymbol, FreeSymbol, 0, 2) MACRO(vectorSymbol, ACU_Symbol, SymbolType::ASSOC | SymbolType::COMM, 2) MACRO(emptyMatrixSymbol, Symbol, 0, 0) MACRO(matrixEntrySymbol, FreeSymbol, 0, 2) MACRO(matrixSymbol, ACU_Symbol, SymbolType::ASSOC | SymbolType::COMM, 2) MACRO(indexPairSymbol, FreeSymbol, 0, 2) MACRO(emptyVectorSetSymbol, Symbol, 0, 0) MACRO(vectorSetSymbol, ACU_Symbol, SymbolType::ASSOC | SymbolType::COMM, 2) MACRO(vectorSetPairSymbol, FreeSymbol, 0, 2) Maude-2.6/src/BuiltIn/sortTestSymbol.cc0000644000147300135640000000525607666303207015047 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class SortTestSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "rewritingContext.hh" // free theory class definitions #include "freeDagNode.hh" // built in class definitions #include "sortTestSymbol.hh" const Vector& SortTestSymbol::makeLazyStrategy() { static Vector lazyStrategy; if (lazyStrategy.length() == 0) lazyStrategy.append(0); return lazyStrategy; } SortTestSymbol::SortTestSymbol(int id, Sort* testSort, FreeSymbol* leq, FreeSymbol* nleq, bool eager) : FreeSymbol(id, 1, eager ? standard : makeLazyStrategy()) { cmpSort = testSort; leqResult = leq; notLeqResult = nleq; eagerFlag = eager; } bool SortTestSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); DagNode *t = static_cast(subject)->getArgument(0); if (eagerFlag) t->reduce(context); else t->computeTrueSort(context); t->symbol()->constrainToExactSort(t, context); // HACK FreeSymbol* result = (t->leq(cmpSort)) ? leqResult : notLeqResult; bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) FreeDagNode(result); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } bool SortTestSymbol::acceptEquation(Equation* /* equation */) { return false; } void SortTestSymbol::compileEquations() { } Maude-2.6/src/BuiltIn/floatSymbol.cc0000644000147300135640000000555111457445454014327 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class FloatSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" #include "mathStuff.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "rewritingContext.hh" // built in class definitions #include "floatSymbol.hh" #include "floatTerm.hh" #include "floatDagNode.hh" FloatSymbol::FloatSymbol(int id) : NA_Symbol(id) { sort = 0; finiteSort = 0; } void FloatSymbol::fillInSortInfo(Term* subject) { Sort* s = finite(static_cast(subject)->getValue()) ? finiteSort : sort; subject->setSortInfo(s->component(), s->index()); } void FloatSymbol::computeBaseSort(DagNode* subject) { Sort* s = finite(static_cast(subject)->getValue()) ? finiteSort : sort; subject->setSortIndex(s->index()); } bool FloatSymbol::isConstructor(DagNode* /* subject */) { return true; } void FloatSymbol::compileOpDeclarations() { // NA_Symbol::compileOpDeclarations(); // default processing const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { Sort* s = opDecls[i].getDomainAndRange()[0]; if (sort == 0 || s->index() < sort->index()) sort = s; // set sort to largest (smallest index) declared sort if (finiteSort == 0 || s->index() > finiteSort->index()) finiteSort = s; // set finiteSort to smallest (largest index) declared sort } } bool FloatSymbol::rewriteToFloat(DagNode* subject, RewritingContext& context, double result) { bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) FloatDagNode(this, result); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } Maude-2.6/src/BuiltIn/floatOpSymbol.hh0000644000147300135640000000407507752312270014630 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in operations on floating point numbers. // #ifndef _FloatOpSymbol_hh_ #define _FloatOpSymbol_hh_ #include "freeSymbol.hh" #include "cachedDag.hh" class FloatOpSymbol : public FreeSymbol { public: FloatOpSymbol(int id, int arity); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); bool attachTerm(const char* purpose, Term* term); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); void getTermAttachments(Vector& purposes, Vector& terms); void postInterSymbolPass(); void reset(); bool eqRewrite(DagNode* subject, RewritingContext& context); private: int isOdd(double n); double safePow(double a1, double a2, bool& defined); int op; FloatSymbol* floatSymbol; SuccSymbol* succSymbol; MinusSymbol* minusSymbol; DivisionSymbol* divisionSymbol; CachedDag trueTerm; CachedDag falseTerm; }; #endif Maude-2.6/src/BuiltIn/stringSymbol.hh0000644000147300135640000000233111457445501014524 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for string symbols. // #ifndef _stringSymbol_hh_ #define _stringSymbol_hh_ #include "NA_Symbol.hh" class StringSymbol : public NA_Symbol { public: StringSymbol(int id); void fillInSortInfo(Term* subject); void computeBaseSort(DagNode* subject); bool isConstructor(DagNode* subject); void compileOpDeclarations(); private: Sort* sort; Sort* charSort; }; #endif Maude-2.6/src/BuiltIn/Makefile.am0000644000147300135640000000253010135522226013534 00000000000000noinst_LIBRARIES = libbuiltIn.a libbuiltIn_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/NA_Theory \ -I$(top_srcdir)/src/ACU_Persistent \ -I$(top_srcdir)/src/ACU_Theory \ -I$(top_srcdir)/src/CUI_Theory \ -I$(top_srcdir)/src/S_Theory \ -I$(top_srcdir)/src/FreeTheory \ -I$(top_srcdir)/src/3rdParty libbuiltIn_a_SOURCES = \ equalitySymbol.cc \ sortTestSymbol.cc \ branchSymbol.cc \ stringSymbol.cc \ stringTerm.cc \ stringDagNode.cc \ stringOpSymbol.cc \ floatSymbol.cc \ floatTerm.cc \ floatDagNode.cc \ floatOpSymbol.cc \ succSymbol.cc \ numberOpSymbol.cc \ minusSymbol.cc \ ACU_NumberOpSymbol.cc \ CUI_NumberOpSymbol.cc \ divisionSymbol.cc \ randomOpSymbol.cc \ counterSymbol.cc \ matrixOpSymbol.cc EXTRA_DIST = \ matrixOpSignature.cc noinst_HEADERS = \ ACU_NumberOpSymbol.hh \ CUI_NumberOpSymbol.hh \ bindingMacros.hh \ branchSymbol.hh \ builtIn.hh \ divisionSymbol.hh \ equalitySymbol.hh \ floatDagNode.hh \ floatOpSymbol.hh \ floatSymbol.hh \ floatTerm.hh \ minusSymbol.hh \ numberOpSymbol.hh \ sortTestSymbol.hh \ stringDagNode.hh \ stringOpSymbol.hh \ stringSymbol.hh \ stringTerm.hh \ succSymbol.hh \ randomOpSymbol.hh \ counterSymbol.hh \ matrixOpSymbol.hh Maude-2.6/src/IO_Stuff/0000777000147300135640000000000011500304121011661 500000000000000Maude-2.6/src/IO_Stuff/autoWrapBuffer.cc0000644000147300135640000001255407707565701015102 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AutoWrapBuffer. // // utility stuff #include "macros.hh" // system class definitions #include "autoWrapBuffer.hh" AutoWrapBuffer::AutoWrapBuffer(streambuf* outputBuffer, int lineWidth) : outputBuffer(outputBuffer), lineWidth(lineWidth) { pendingWidth = UNDEFINED; cursorPosition = 0; seenBackQuote = false; seenBackSlash = false; inString = false; inEscape = false; } int AutoWrapBuffer::sync() { Assert(pptr() - pbase() == 0, "not supposed to have a buffer"); // // We don't dump the pending buffer here because stderr sync()s all // the time and we would lose our opportunities for inserting a \n. // #if defined(__GNUC__) && __GNUC__ < 3 // // For the old version of the GNU Standard C++ library, // use the old sync function. // return outputBuffer->sync(); #else // // Otherwise use the new ANSI one. // return outputBuffer->pubsync(); #endif } void AutoWrapBuffer::dumpBuffer() { if (!(pendingBuffer.empty())) { outputBuffer->sputn(pendingBuffer.data(), pendingBuffer.size()); pendingBuffer.erase(); } } void AutoWrapBuffer::handleEscapeSequenceChar(int ch) { if (pendingWidth == UNDEFINED) outputBuffer->sputc(ch); // buffering disabled else pendingBuffer += ch; } void AutoWrapBuffer::handleChar(int ch) { if (pendingWidth == UNDEFINED) outputBuffer->sputc(ch); // buffering disabled else { pendingBuffer += ch; ++pendingWidth; if (pendingWidth > lineWidth - RIGHT_MARGIN - LEFT_MARGIN) { // // Even inserting a \n before the characters in pendingBuffer // would not avoid a hard-wrapped token, so we don't bother. // dumpBuffer(); pendingWidth = UNDEFINED; // disable buffering } } } void AutoWrapBuffer::decideOnBreak() { if (pendingWidth != UNDEFINED) { if (cursorPosition > lineWidth - RIGHT_MARGIN) { outputBuffer->sputc('\n'); for (int i = 0; i < LEFT_MARGIN; i++) outputBuffer->sputc(' '); int nrPending = pendingBuffer.size(); cursorPosition = LEFT_MARGIN; if (nrPending > 0) { int t = (pendingBuffer[0] == ' '); // need to skip leading space if (nrPending - t > 0) { outputBuffer->sputn(pendingBuffer.data() + t, nrPending - t); if (pendingBuffer[0] == '\t') cursorPosition = nextTabPosition(cursorPosition) + pendingWidth; else cursorPosition += pendingWidth - t; } pendingBuffer.erase(); } } else dumpBuffer(); pendingWidth = UNDEFINED; // disable buffering } } void AutoWrapBuffer::legalPositionToBreak() { // // We just ecountered a legal position to insert a \n so we place // subsequent characters in pendingBuffer and make sure cursor // position is in range. // pendingWidth = 0; cursorPosition %= lineWidth; } int AutoWrapBuffer::overflow(int ch) { Assert(pptr() - pbase() == 0, "not supposed to have a buffer"); if (ch == EOF) return EOF; if (inEscape) { handleEscapeSequenceChar(ch); if (ch == 'm') inEscape = false; return 0; } if (!isprint(ch)) inString = false; switch (ch) { case '"': { if (!seenBackSlash) inString = !inString; goto normal; } case '\033': { inEscape = true; handleEscapeSequenceChar(ch); break; } case '\n': { decideOnBreak(); outputBuffer->sputc(ch); cursorPosition = 0; break; } case '\t': { decideOnBreak(); legalPositionToBreak(); handleEscapeSequenceChar(ch); cursorPosition = nextTabPosition(cursorPosition); break; } case ' ': { if (!inString) { decideOnBreak(); legalPositionToBreak(); } goto normal; } #ifdef WRAP_BEFORE_CLOSING case ')': case ']': case '}': { if (!inString && !seenBackQuote) { // // ok to add new line before this character // decideOnBreak(); legalPositionToBreak(); } goto normal; } #endif case ',': case '(': case '[': case '{': { if (!inString && !seenBackQuote) { // // ok to add new line after this character // handleChar(ch); ++cursorPosition; decideOnBreak(); legalPositionToBreak(); break; } // // If we have just seen a backquote or we are in a string, // ,([{ lose their special properties and we fall thru // into default case. // } default: { normal: handleChar(ch); ++cursorPosition; break; } } seenBackQuote = (ch == '`'); seenBackSlash = inString && !seenBackSlash && (ch == '\\'); return 0; } Maude-2.6/src/IO_Stuff/IO_Manager.cc0000644000147300135640000000656607741337654014117 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class IO_Manager. // #include #include #include #include // utility stuff #include "macros.hh" // line editing stuff #ifdef USE_TECLA #if HAVE_SYS_TERMIOS_H #include #endif #include "libtecla.h" #endif // IO Stuff class definitions #include "autoWrapBuffer.hh" #include "IO_Manager.hh" IO_Manager::IO_Manager() { gl = 0; line = 0; contFlag = false; wrapOut = 0; wrapErr = 0; } void IO_Manager::setCommandLineEditing(size_t lineLength, size_t historyLength) { #ifdef USE_TECLA gl = new_GetLine(lineLength, historyLength); gl_trap_signal(gl, SIGINT, 0, GLS_ABORT, EINTR); #endif } void IO_Manager::setAutoWrap() { // // Set up autowrapping of standard output and standard error. // winsize w; int columns = DEFAULT_COLUMNS; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0 && w.ws_col > 0) columns = w.ws_col; // cout << "out columns " << columns << '\n'; wrapOut = new AutoWrapBuffer(cout.rdbuf(), columns); (void) cout.rdbuf(wrapOut); columns = DEFAULT_COLUMNS; if (ioctl(STDERR_FILENO, TIOCGWINSZ, &w) == 0 && w.ws_col > 0) columns = w.ws_col; // cout << "err columns " << columns << '\n'; wrapErr = new AutoWrapBuffer (cerr.rdbuf(), columns); (void) cerr.rdbuf(wrapErr); } int IO_Manager::getInput(char* buf, int maxSize, FILE* stream) { if (stream != stdin) { // // Some stdio libraries (notably that of linux) have a nasty habit // of restarting slow system calls aborted by signals. We avoid // this behaviour by doing input directly from the OS. // return read(fileno(stream), buf, maxSize); } #ifdef USE_TECLA if (gl != 0) { if (line == 0) { line = gl_get_line(gl, contFlag ? contPrompt.c_str() : prompt.c_str(), NULL, -1); GlTerminalSize ts = gl_terminal_size(gl, DEFAULT_COLUMNS, DEFAULT_LINES); if (wrapOut != 0) wrapOut->setLineWidth(ts.ncolumn); if (wrapErr != 0) wrapErr->setLineWidth(ts.ncolumn); contFlag = true; if (line == 0) return 0; } int n; for (n = 0;; n++) { char c = *line; if (c == '\0') { line = 0; break; } if (n == maxSize) break; *buf++ = c; ++line; } return n; } #endif // // Read from stdin without using tecla. // if (!contFlag) { fputs(prompt.c_str(), stdout); // HACK: bypass line wrapper fflush(stdout); } contFlag = true; return read(fileno(stream), buf, maxSize); } Maude-2.6/src/IO_Stuff/Makefile.in0000644000147300135640000004574511500303154013666 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/IO_Stuff DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libIO_Stuff_a_AR = $(AR) $(ARFLAGS) libIO_Stuff_a_LIBADD = am_libIO_Stuff_a_OBJECTS = libIO_Stuff_a-IO_Manager.$(OBJEXT) \ libIO_Stuff_a-autoWrapBuffer.$(OBJEXT) \ libIO_Stuff_a-directoryManager.$(OBJEXT) libIO_Stuff_a_OBJECTS = $(am_libIO_Stuff_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libIO_Stuff_a_SOURCES) DIST_SOURCES = $(libIO_Stuff_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libIO_Stuff.a libIO_Stuff_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility libIO_Stuff_a_SOURCES = \ IO_Manager.cc \ autoWrapBuffer.cc \ directoryManager.cc noinst_HEADERS = \ IO_Manager.hh \ autoWrapBuffer.hh \ directoryManager.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/IO_Stuff/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/IO_Stuff/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libIO_Stuff.a: $(libIO_Stuff_a_OBJECTS) $(libIO_Stuff_a_DEPENDENCIES) -rm -f libIO_Stuff.a $(libIO_Stuff_a_AR) libIO_Stuff.a $(libIO_Stuff_a_OBJECTS) $(libIO_Stuff_a_LIBADD) $(RANLIB) libIO_Stuff.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIO_Stuff_a-IO_Manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIO_Stuff_a-directoryManager.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libIO_Stuff_a-IO_Manager.o: IO_Manager.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libIO_Stuff_a-IO_Manager.o -MD -MP -MF "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Tpo" -c -o libIO_Stuff_a-IO_Manager.o `test -f 'IO_Manager.cc' || echo '$(srcdir)/'`IO_Manager.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Tpo" "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Po"; else rm -f "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='IO_Manager.cc' object='libIO_Stuff_a-IO_Manager.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libIO_Stuff_a-IO_Manager.o `test -f 'IO_Manager.cc' || echo '$(srcdir)/'`IO_Manager.cc libIO_Stuff_a-IO_Manager.obj: IO_Manager.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libIO_Stuff_a-IO_Manager.obj -MD -MP -MF "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Tpo" -c -o libIO_Stuff_a-IO_Manager.obj `if test -f 'IO_Manager.cc'; then $(CYGPATH_W) 'IO_Manager.cc'; else $(CYGPATH_W) '$(srcdir)/IO_Manager.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Tpo" "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Po"; else rm -f "$(DEPDIR)/libIO_Stuff_a-IO_Manager.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='IO_Manager.cc' object='libIO_Stuff_a-IO_Manager.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libIO_Stuff_a-IO_Manager.obj `if test -f 'IO_Manager.cc'; then $(CYGPATH_W) 'IO_Manager.cc'; else $(CYGPATH_W) '$(srcdir)/IO_Manager.cc'; fi` libIO_Stuff_a-autoWrapBuffer.o: autoWrapBuffer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libIO_Stuff_a-autoWrapBuffer.o -MD -MP -MF "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Tpo" -c -o libIO_Stuff_a-autoWrapBuffer.o `test -f 'autoWrapBuffer.cc' || echo '$(srcdir)/'`autoWrapBuffer.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Tpo" "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Po"; else rm -f "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='autoWrapBuffer.cc' object='libIO_Stuff_a-autoWrapBuffer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libIO_Stuff_a-autoWrapBuffer.o `test -f 'autoWrapBuffer.cc' || echo '$(srcdir)/'`autoWrapBuffer.cc libIO_Stuff_a-autoWrapBuffer.obj: autoWrapBuffer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libIO_Stuff_a-autoWrapBuffer.obj -MD -MP -MF "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Tpo" -c -o libIO_Stuff_a-autoWrapBuffer.obj `if test -f 'autoWrapBuffer.cc'; then $(CYGPATH_W) 'autoWrapBuffer.cc'; else $(CYGPATH_W) '$(srcdir)/autoWrapBuffer.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Tpo" "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Po"; else rm -f "$(DEPDIR)/libIO_Stuff_a-autoWrapBuffer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='autoWrapBuffer.cc' object='libIO_Stuff_a-autoWrapBuffer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libIO_Stuff_a-autoWrapBuffer.obj `if test -f 'autoWrapBuffer.cc'; then $(CYGPATH_W) 'autoWrapBuffer.cc'; else $(CYGPATH_W) '$(srcdir)/autoWrapBuffer.cc'; fi` libIO_Stuff_a-directoryManager.o: directoryManager.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libIO_Stuff_a-directoryManager.o -MD -MP -MF "$(DEPDIR)/libIO_Stuff_a-directoryManager.Tpo" -c -o libIO_Stuff_a-directoryManager.o `test -f 'directoryManager.cc' || echo '$(srcdir)/'`directoryManager.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libIO_Stuff_a-directoryManager.Tpo" "$(DEPDIR)/libIO_Stuff_a-directoryManager.Po"; else rm -f "$(DEPDIR)/libIO_Stuff_a-directoryManager.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='directoryManager.cc' object='libIO_Stuff_a-directoryManager.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libIO_Stuff_a-directoryManager.o `test -f 'directoryManager.cc' || echo '$(srcdir)/'`directoryManager.cc libIO_Stuff_a-directoryManager.obj: directoryManager.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libIO_Stuff_a-directoryManager.obj -MD -MP -MF "$(DEPDIR)/libIO_Stuff_a-directoryManager.Tpo" -c -o libIO_Stuff_a-directoryManager.obj `if test -f 'directoryManager.cc'; then $(CYGPATH_W) 'directoryManager.cc'; else $(CYGPATH_W) '$(srcdir)/directoryManager.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libIO_Stuff_a-directoryManager.Tpo" "$(DEPDIR)/libIO_Stuff_a-directoryManager.Po"; else rm -f "$(DEPDIR)/libIO_Stuff_a-directoryManager.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='directoryManager.cc' object='libIO_Stuff_a-directoryManager.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libIO_Stuff_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libIO_Stuff_a-directoryManager.obj `if test -f 'directoryManager.cc'; then $(CYGPATH_W) 'directoryManager.cc'; else $(CYGPATH_W) '$(srcdir)/directoryManager.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/IO_Stuff/autoWrapBuffer.hh0000644000147300135640000000510107666301235015074 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for streambuf with automatic line wrapping. // // The basic idea is when we see a legal place to insert a \n // we put subsequent chars into a pending buffer until we known // whether to use this place. // // Decisions on legal places are complicated by "strings", // ESC ... m sequences and backquotes. // // Decisions on whether we need to insert a \n depend on width // calculations which are complicated by tabs and ESC ... m sequences. // #ifndef _autoWrapBuf_hh_ #define _autoWrapBuf_hh_ #include class AutoWrapBuffer : public std::streambuf { NO_COPYING(AutoWrapBuffer); public: AutoWrapBuffer(streambuf* outputBuffer, int lineWidth); void setLineWidth(int lineWidth); // // Member functions we need to override from streambuf to get // hold of raw characters. // int sync(); int overflow(int ch); private: enum Options { LEFT_MARGIN = 4, RIGHT_MARGIN = 1 }; void handleChar(int ch); void handleEscapeSequenceChar(int ch); int nextTabPosition(int pos); void dumpBuffer(); void decideOnBreak(); void legalPositionToBreak(); streambuf* outputBuffer; int lineWidth; // width of output device int cursorPosition; // cursor position if we were to print pendingBuffer Bool seenBackQuote; // last char was a ` Bool seenBackSlash; // inside a "string" and last char was an unescaped // backslash Bool inString; // inside a "string" Bool inEscape; // inside an ESC sequence string pendingBuffer; int pendingWidth; // number of chars in buffer excluding \t and ESC sequences }; inline void AutoWrapBuffer::setLineWidth(int lineWidth) { AutoWrapBuffer::lineWidth = lineWidth; } inline int AutoWrapBuffer::nextTabPosition(int pos) { return (pos + 8) & ~7; } #endif Maude-2.6/src/IO_Stuff/directoryManager.cc0000644000147300135640000001432511060073462015424 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class DirectoryManager. // #include #include #include #include // utility stuff #include "macros.hh" #include "vector.hh" #include "directoryManager.hh" bool DirectoryManager::checkAccess(const string& directory, string& fileName, int mode, char const* const ext[]) { string full(directory + '/' + fileName); if (access(full.c_str(), mode) == 0) return true; if (ext != 0) { string::size_type d = fileName.rfind('.'); if (d != string::npos) { for (char const* const* p = ext; *p; p++) { // if (fileName.compare(d, string::npos, *p) == 0) if (fileName.substr(d).compare(*p) == 0) // HACK return false; // already ends in one of our extensions } } for (char const* const* p = ext; *p; p++) { if (access((full + *p).c_str(), mode) == 0) { fileName += *p; return true; } } } return false; } bool DirectoryManager::searchPath(const char* pathVar, string& directory, string& fileName, int mode, char const* const ext[]) { if (char* p = getenv(pathVar)) { string path(p); string::size_type len = path.length(); for (string::size_type start = 0; start < len;) { string::size_type c = path.find(':', start); if (c == string::npos) c = len; if (string::size_type partLen = c - start) { realPath(path.substr(start, partLen), directory); if (checkAccess(directory, fileName, mode, ext)) return true; } start = c + 1; } } return false; } void DirectoryManager::realPath(const string& path, string& resolvedPath) { string::size_type length = path.length(); if (length == 0) { resolvedPath = getCwd(); return; } // cout << "in " << path << '\n'; resolvedPath.erase(); string::size_type p = 0; switch (path[0]) { case '/': // absolute path name { p = 1; break; } case '~': // need to expand user home directory { const char* dirPath = 0; string::size_type e = path.find('/'); if (e == string::npos) e = length; if (e == 1) { // // Get users home directory. // dirPath = getenv("HOME"); if (dirPath == 0) { if (passwd* pw = getpwuid(getuid())) dirPath = pw->pw_dir; } } else { // // Get somebody elses home directory. // if (passwd* pw = getpwnam(path.substr(1, e - 1).c_str())) dirPath = pw->pw_dir; } if (dirPath != 0) { resolvedPath = dirPath; p = e + 1; break; } } // fall thru default: // relative path name { resolvedPath = getCwd(); break; } } // // Just in case a home directory or cwd ended in '/'. // string::size_type resLen = resolvedPath.length(); if (resLen > 0 && resolvedPath[resLen - 1] == '/') resolvedPath.erase(resLen - 1); // // Deal with each path component in turn. // while (p < length) { string::size_type pos = path.find('/', p); if (pos == string::npos) pos = length; string::size_type cLen = pos - p; // cout << "cLen " << cLen << '\n'; if (cLen == 0 || (cLen == 1 && path[p] == '.')) ; // ignore component else if (cLen == 2 && path[p] == '.' && path[p + 1] == '.') { string::size_type backup = resolvedPath.rfind('/'); if (backup != string::npos) resolvedPath.erase(backup); } else { resolvedPath += '/'; resolvedPath += path.substr(p, cLen); } p = pos + 1; } if (resolvedPath.empty()) resolvedPath = '/'; // cout << "out " << resolvedPath << '\n'; } void DirectoryManager::initialize() { char buffer[MAXPATHLEN]; const char* cwd = getenv("PWD"); if (cwd == 0) { cwd = getcwd(buffer, MAXPATHLEN); // really want to emulate GNU xgetcwd if (cwd == 0) cwd = "/"; } directoryStack.append(directoryNames.encode(cwd)); } bool DirectoryManager::cd(const string& directory) { if (chdir(directory.c_str()) != 0) return false; directoryStack[directoryStack.length() - 1] = directoryNames.encode(directory.c_str()); return true; } int DirectoryManager::pushd(const string& directory) { int oldLength = directoryStack.length(); if (directory.compare(".") == 0) { // // If we didn't use a temporary we would have a really subtle // memory problem since both directoryStack[] returns a // references which are might be invalidated by the append() call // before it is dereferenced. // int cwd = directoryStack[oldLength - 1]; directoryStack.append(cwd); } else { if (chdir(directory.c_str()) != 0) oldLength = UNDEFINED; else directoryStack.append(directoryNames.encode(directory.c_str())); } return oldLength; } const char* DirectoryManager::popd(int prevLength) { int top = directoryStack.length() - 1; if (prevLength > top) // HACK for safety return 0; if (prevLength == UNDEFINED) prevLength = top; if (prevLength > 0) { int code = directoryStack[prevLength - 1]; const char* dirName = directoryNames.name(code); if (code != directoryStack[top]) chdir(dirName); directoryStack.contractTo(prevLength); return dirName; } return 0; } const char* DirectoryManager::getCwd() { return directoryNames.name(directoryStack[directoryStack.length() - 1]); } Maude-2.6/src/IO_Stuff/ChangeLog0000644000147300135640000000632111060074701013362 000000000000002008-09-04 Steven Eker * directoryManager.cc (initialize): fix char constness ===================================Maude91a=========================================== 2006-10-10 Steven Eker * IO_Manager.hh (class IO_Manager): removed extraneous quantification to appease gcc 4.1 ===================================Maude88b=========================================== 2003-10-08 Steven Eker * IO_Manager.cc (getInput): rewritten to allow building without Tecla ===================================Maude82=========================================== 2003-07-28 Steven Eker * IO_Manager.cc: test HAVE_SYS_TERMIOS_H 2003-07-23 Steven Eker * autoWrapBuffer.cc (handleEscapeSequenceChar): use operator+= rather than push_back() since it seems more portable (handleChar): ditto 2003-07-21 Steven Eker * autoWrapBuffer.cc (sync): rewritten to test __GNUC__ in order to determine which sync function to call ===================================Maude81=========================================== 2003-02-26 Steven Eker * directoryManager.cc: removed #pragma * directoryManager.hh: removed #pragma * autoWrapBuffer.cc: removed #pragma (sync): updated Assert() (overflow): updated Assert() * autoWrapBuffer.hh: removed #pragma * IO_Manager.cc: removed #pragma * IO_Manager.hh: removed #pragma ===================================Maude79=========================================== 2002-11-19 Steven Eker * IO_Manager.cc (getInput): output a prompt if we are reading from stdin but not using tecla 2002-10-02 Steven Eker * IO_Manager.hh (class IO_Manager): added DEFAULT_LINES to enum Defaults * IO_Manager.cc (getInput): use setLineWidth() to set wrapOut and wrapErr line widths after each tecla input in case user resized terminal * autoWrapBuffer.hh: rewritten * autoWrapBuffer.cc: rewritten 2002-10-01 Steven Eker * autoWrapBuffer.cc (AutoWrapBuffer): lineWidth now stores true line width (breakLine): now use true lineWidth - need to subtract RIGHT_MARGIN (sync): removed hack for flushing maude prompts now that the command line prompts are handled by tecla and don't pass through C++ streams (breakLine): handle the case where the pending buffer will not fit on a new line by not inserting a \n and instead calculating where the cursor will end up after hard wrapping. (overflow): don't call breakLine() in normal case; call breakLine() in \n case (overflow): only call saveBreakPoint() after we fail to breaLine() in space case 2002-09-27 Steven Eker * directoryManager.cc: moved here from ../Mixfix * autoWrapBuffer.cc: moved here from ../Mixfix * timer.cc: moved here from ../Mixfix * IO_Manager.hh (setPrompt): take ref (setContPrompt): take ref * IO_Manager.cc (getInput): set contFlag (IO_Manager): clear contFlag (setCommandLineEditing): pass 0 to gl_trap_signal() flag arg since we won't be printing during interrupt 2002-09-26 Steven Eker * IO_Manager.cc: created * IO_Manager.hh: created Maude-2.6/src/IO_Stuff/directoryManager.hh0000644000147300135640000000306207666301235015443 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for managing current directory stack. // #ifndef _directoryManager_hh_ #define _directoryManager_hh_ #include "stringTable.hh" class DirectoryManager { public: void initialize(); bool cd(const string& directory); int pushd(const string& directory); const char* popd(int prevLength = UNDEFINED); const char* getCwd(); bool checkAccess(const string& directory, string& fileName, int mode, char const* const ext[] = 0); bool searchPath(const char* pathVar, string& directory, string& fileName, int mode, char const* const ext[] = 0); void realPath(const string& path, string& resolvedPath); private: StringTable directoryNames; Vector directoryStack; }; #endif Maude-2.6/src/IO_Stuff/IO_Manager.hh0000644000147300135640000000364110512767176014114 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for managing yucky I/O issues. // #ifndef _IO_Manager_hh_ #define _IO_Manager_hh_ struct GetLine; // to avoid sucking in the tecla header file class IO_Manager { NO_COPYING(IO_Manager); public: enum Defaults { MAX_LINE_LENGTH = 1024, MAX_HISTORY_LENGTH = 4096, DEFAULT_COLUMNS = 80, DEFAULT_LINES = 25 }; IO_Manager(); void setAutoWrap(); void setCommandLineEditing(size_t maxLineLength = MAX_LINE_LENGTH, size_t maxHistoryLength = MAX_HISTORY_LENGTH); void setPrompt(const string& newPrompt); void setContPrompt(const string& newContPrompt); void startCommand(); int getInput(char* buf, int maxSize, FILE* stream); private: GetLine* gl; const char* line; bool contFlag; string prompt; string contPrompt; AutoWrapBuffer* wrapOut; AutoWrapBuffer* wrapErr; }; inline void IO_Manager::setPrompt(const string& newPrompt) { prompt = newPrompt; } inline void IO_Manager::setContPrompt(const string& newContPrompt) { contPrompt = newContPrompt; } inline void IO_Manager::startCommand() { contFlag = false; } #endif Maude-2.6/src/IO_Stuff/Makefile.am0000644000147300135640000000037707674441174013673 00000000000000noinst_LIBRARIES = libIO_Stuff.a libIO_Stuff_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility libIO_Stuff_a_SOURCES = \ IO_Manager.cc \ autoWrapBuffer.cc \ directoryManager.cc noinst_HEADERS = \ IO_Manager.hh \ autoWrapBuffer.hh \ directoryManager.hh Maude-2.6/src/AU_Theory/0000777000147300135640000000000011500304120012041 500000000000000Maude-2.6/src/AU_Theory/AU_RhsAutomaton.hh0000644000147300135640000000353211346606307015336 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for right hand side automata in the the A, AUl, AUr and AU theories. // #ifndef _AU_RhsAutomaton_hh_ #define _AU_RhsAutomaton_hh_ #include "rhsAutomaton.hh" class AU_RhsAutomaton : public RhsAutomaton { NO_COPYING(AU_RhsAutomaton); public: AU_RhsAutomaton(AU_Symbol* symbol, int nrArgs); void remapIndices(VariableInfo& variableInfo); DagNode* construct(Substitution& matcher); void replace(DagNode* old, Substitution& matcher); void addArgument(int index); void close(int destinationIndex); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: void buildArguments(ArgVec& argArray, Substitution& matcher) const; AU_Symbol* const topSymbol; Vector arguments; int nrArguments; int destination; }; inline void AU_RhsAutomaton::addArgument(int index) { arguments.append(index); } inline void AU_RhsAutomaton::close(int destinationIndex) { destination = destinationIndex; nrArguments = arguments.size(); } #endif Maude-2.6/src/AU_Theory/AU_Term.cc0000644000147300135640000003371711346604725013621 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_Term. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "AU_Persistent.hh" #include "AU_Theory.hh" // core class definitions #include "variableTerm.hh" #include "rewritingContext.hh" #include "equation.hh" #include "symbolMap.hh" #include "termBag.hh" #include "rhsBuilder.hh" // variable class definitions #include "variableTerm.hh" // AU persistent class definitions #include "AU_DequeIter.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_DequeDagNode.hh" #include "AU_Term.hh" #include "AU_ArgumentIterator.hh" #include "AU_LhsAutomaton.hh" #include "AU_RhsAutomaton.hh" // our stuff #include "AU_LhsCompiler.cc" AU_Term::AU_Term(AU_Symbol* symbol, const Vector& arguments) : Term(symbol), argArray(arguments.length()) { int nrArgs = arguments.length(); Assert(nrArgs >= 2, "insufficient arguments"); for (int i = 0; i < nrArgs; i++) argArray[i].term = arguments[i]; } AU_Term::AU_Term(const AU_Term& original, AU_Symbol* symbol, SymbolMap* translator) : Term(symbol), argArray(original.argArray.length()) { int nrArgs = original.argArray.length(); for (int i = 0; i < nrArgs; i++) argArray[i].term = original.argArray[i].term->deepCopy(translator); } RawArgumentIterator* AU_Term::arguments() { return new AU_ArgumentIterator(argArray); } void AU_Term::deepSelfDestruct() { FOR_EACH_CONST(i, Vector, argArray) i->term->deepSelfDestruct(); delete this; } Term* AU_Term::deepCopy2(SymbolMap* translator) const { AU_Symbol* s = symbol(); if (translator != 0) { Symbol* s2 = translator->translate(s); if (s2 == 0) { int nrArgs = argArray.length(); if (nrArgs == 2) return translator->translateTerm(this); // // Tricky situtation - we have to use translateTerm() since // we are translating to a term but we have more than 2 // 2 arguments. We resolve it by creating a temporary // expanded term. // Vector args(2); args[0] = argArray[0].term; for (int i = 1; i < nrArgs; ++i) { args[1] = argArray[i].term; args[0] = new AU_Term(s, args); } Term* t = args[0]; Term* r = translator->translateTerm(t); for (int i = 1; i < nrArgs; ++i) { Term* n = safeCast(AU_Term*, t)->argArray[0].term; delete t; t = n; } return r; } s = dynamic_cast(s2); if (s == 0) { // // Another tricky situation - we are translating to a non-AU_Symbol. // Vector args(2); args[0] = argArray[0].term->deepCopy(translator); int nrArgs = argArray.length(); for (int i = 1; i < nrArgs; ++i) { args[1] = argArray[i].term->deepCopy(translator); args[0] = s2->makeTerm(args); } return args[0]; } } return new AU_Term(*this, s, translator); } Term* AU_Term::normalize(bool full, bool& changed) { changed = false; AU_Symbol* s = symbol(); int nrArgs = argArray.length(); // // Pass 1: normalize arguments and calculate number of extra arguments that // will result from flattening. // int expansion = 0; for (int i = 0; i < nrArgs; i++) { bool subtermChanged; Term* t = argArray[i].term->normalize(full, subtermChanged); if (subtermChanged) changed = true; argArray[i].term = t; if (full && t->symbol() == s) expansion += safeCast(AU_Term*, t)->argArray.length() - 1; } // // Pass 2: flatten at the top. // if (expansion > 0) { changed = true; argArray.expandBy(expansion); int p = nrArgs + expansion - 1; for (int i = nrArgs - 1; i >= 0; i--) { Assert(p >= i, "loop invariant broken"); Term* t = argArray[i].term; if (t->symbol() == s) { Vector& argArray2 = safeCast(AU_Term*, t)->argArray; for (int j = argArray2.length() - 1; j >= 0; j--) argArray[p--].term = argArray2[j].term; delete t; } else argArray[p--].term = t; } nrArgs += expansion; } // // Pass 3: remove identity elements. // Term* identity = s->getIdentity(); if (identity != 0) { Term* savedId = 0; int p = 0; for (int i = 0; i < nrArgs; i++) { Term* t = argArray[i].term; if (identity->equal(t) && idPossible(i)) { if (savedId == 0) savedId = t; else t->deepSelfDestruct(); changed = true; continue; } argArray[p].term = t; ++p; } if (p == 0) { // // All arguments were identity elements so we collapse to the saved one. // delete this; return savedId; } if (savedId != 0) savedId->deepSelfDestruct(); // don't need it if (p == 1) { // // Only one non-identity argument left so collapse to it. // Term* t = argArray[0].term; delete this; return t; } argArray.contractTo(p); nrArgs = p; } // // Pass 4: compute hash value. // unsigned int hashValue = s->getHashValue(); FOR_EACH_CONST(i, Vector, argArray) hashValue = hash(hashValue, i->term->getHashValue()); setHashValue(hashValue); return this; } int AU_Term::compareArguments(const Term* other) const { const Vector& argArray2 = safeCast(const AU_Term*, other)->argArray; int r = argArray.length() - argArray2.length(); if (r != 0) return r; Vector::const_iterator j = argArray2.begin(); Vector::const_iterator i = argArray.begin(); const Vector::const_iterator e = argArray.end(); do { r = i->term->compare(j->term); if (r != 0) return r; ++j; ++i; } while (i != e); Assert(j == argArray2.end(), "iterator problem"); return 0; } int AU_Term::compareArguments(const DagNode* other) const { int len = argArray.length(); if (safeCast(const AU_BaseDagNode*, other)->isDeque()) { const AU_DequeDagNode* d2 = safeCast(const AU_DequeDagNode*, other); int r = len - d2->nrArgs(); if (r != 0) return r; AU_DequeIter j(d2->getDeque()); Vector::const_iterator i = argArray.begin(); const Vector::const_iterator e = argArray.end(); do { r = i->term->compare(j.getDagNode()); if (r != 0) return r; j.next(); ++i; } while (i != e); Assert(!j.valid(), "iterator problem"); } else { const ArgVec& argArray2 = safeCast(const AU_DagNode*, other)->argArray; int r = len - argArray2.length(); if (r != 0) return r; ArgVec::const_iterator j = argArray2.begin(); Vector::const_iterator i = argArray.begin(); const Vector::const_iterator e = argArray.end(); do { r = i->term->compare(*j); if (r != 0) return r; ++j; ++i; } while (i != e); Assert(j == argArray2.end(), "iterator problem"); } return 0; } void AU_Term::findEagerVariables(bool atTop, NatSet& eagerVariables) const { BinarySymbol::PermuteStrategy strat = symbol()->getPermuteStrategy(); if (strat == BinarySymbol::EAGER || (strat == BinarySymbol::SEMI_EAGER && !atTop)) { FOR_EACH_CONST(i, Vector, argArray) i->term->findEagerVariables(false, eagerVariables); } } void AU_Term::markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables) { if (symbol()->getPermuteStrategy() == BinarySymbol::EAGER) { FOR_EACH_CONST(i, Vector, argArray) i->term->markEager(nrVariables, eagerVariables, problemVariables); } } DagNode* AU_Term::dagify2() { int nrArgs = argArray.length(); AU_DagNode* d = new AU_DagNode(symbol(), nrArgs); ArgVec& p = d->argArray; for (int i = 0; i < nrArgs; i++) p[i] = argArray[i].term->dagify(); return d; } void AU_Term::analyseCollapses2() { // // (1) Analyse our subterms. // int nrArgs = argArray.length(); { FOR_EACH_CONST(i, Vector, argArray) i->term->analyseCollapses(); } // // (2) Does our top symbol have an identity? // uniqueCollapseSubtermIndex = NONE; AU_Symbol* s = symbol(); if (s->getIdentity() == 0) return; // if no identity element then we can't collapse // // (3) Can we collapse? // int firstNonIdArg = NONE; for (int i = 0; i < nrArgs; i++) { Term* t = argArray[i].term; if (idPossible(i) && s->mightMatchOurIdentity(t)) continue; if (firstNonIdArg != NONE) return; // can't collapse firstNonIdArg = i; } // // (4) If so, what to? // if (firstNonIdArg != NONE) { // // Can only collapse to firstNonIdArg. // uniqueCollapseSubtermIndex = firstNonIdArg; addCollapseSymbol(argArray[firstNonIdArg].term->symbol()); addCollapseSymbols(argArray[firstNonIdArg].term->collapseSymbols()); } else { // // Can collapse to any of our arguments. // FOR_EACH_CONST(i, Vector, argArray) { Term* t = i->term; addCollapseSymbol(t->symbol()); addCollapseSymbols(t->collapseSymbols()); } } } void AU_Term::insertAbstractionVariables(VariableInfo& variableInfo) { AU_Symbol* s = symbol(); bool honorsGroundOutMatch = true; int nrArgs = argArray.length(); for (int i = 0; i < nrArgs; i++) { Tuple& t = argArray[i]; t.term->insertAbstractionVariables(variableInfo); if (!(t.term->honorsGroundOutMatch())) honorsGroundOutMatch = false; t.abstractionVariableIndex = NONE; t.collapseToOurSymbol = false; t.matchOurIdentity = false; if (dynamic_cast(t.term) == 0) { // // We don't bother checking wether we have a left identity // or a right identity because we may end up matching with // extension. // t.matchOurIdentity = s->mightMatchOurIdentity(t.term); t.collapseToOurSymbol = s->mightCollapseToOurSymbol(t.term); if (t.matchOurIdentity || t.collapseToOurSymbol) { t.abstractionVariableIndex = variableInfo.makeProtectedVariable(); honorsGroundOutMatch = false; DebugAdvisory("Introduced abstraction variable for " << t.term << " in " << this << '.'); } } } setHonorsGroundOutMatch(honorsGroundOutMatch); } void AU_Term::findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop) { if (ground()) return; if (!atTop) availableTerms.insertMatchedTerm(this, eagerContext); BinarySymbol::PermuteStrategy strat = symbol()->getPermuteStrategy(); bool argEager = eagerContext && (strat == BinarySymbol::EAGER || (strat == BinarySymbol::SEMI_EAGER && !atTop)); FOR_EACH_CONST(i, Vector, argArray) i->term->findAvailableTerms(availableTerms, argEager); } int AU_Term::compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext) { int nrArgs = argArray.length(); // // We want to minimize conflict between slots to avoid quadratic number of // conflict arcs on giant right hand sides. The heuristic we use is crude: // we sort in order of arguments by number of symbol occurences, and build // largest first. // typedef Vector > PairVec; PairVec order(nrArgs); for (int i = 0; i < nrArgs; i++) { order[i].first = - argArray[i].term->computeSize(); // larger terms to the front order[i].second = i; } sort(order.begin(), order.end()); // // Compile each argument in largest first order. // bool argEager = eagerContext && symbol()->getPermuteStrategy() == BinarySymbol::EAGER; Vector sources(nrArgs); FOR_EACH_CONST(i, PairVec, order) { int j = i->second; sources[j] = argArray[j].term->compileRhs(rhsBuilder, variableInfo, availableTerms, argEager); } // // Now add sources to automaton in original order, and flag last use // of each source for conflict arc generation. // AU_RhsAutomaton* automaton = new AU_RhsAutomaton(symbol(), nrArgs); for (int i = 0; i < nrArgs; i++) { int index = sources[i]; automaton->addArgument(index); variableInfo.useIndex(index); } // // Complete the automaton and add it to the rhs builder. // int destination = variableInfo.makeConstructionIndex(); automaton->close(destination); rhsBuilder.addRhsAutomaton(automaton); return destination; } #ifdef DUMP void AU_Term::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{AU_Term}\n"; ++indentLevel; dumpCommon(s, variableInfo, indentLevel); s << Indent(indentLevel) << "arguments:\n"; ++indentLevel; FOR_EACH_CONST(i, Vector, argArray) { const Tuple& p = *i; s << Indent(indentLevel) << "collapseToOurSymbol = " << bool(p.collapseToOurSymbol) << "\tmatchOurIdentity = " << bool(p.matchOurIdentity); if (p.abstractionVariableIndex != NONE) s << "\tabstractionVariableIndex = " << p.abstractionVariableIndex; s << '\n'; p.term->dump(s, variableInfo, indentLevel); } s << Indent(indentLevel - 2) << "End{AU_Term}\n"; } #endif Maude-2.6/src/AU_Theory/AU_DagOperations.cc0000644000147300135640000000772507666303243015452 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code to manipulate AU argument lists taking account of // all the complexities introduced by one sided identities. // bool AU_DagNode::eliminateForward(DagNode* target, int& pos, int limit) const { int last = argArray.length() - 1; // // pos may point to 1 beyond limit to indicate that target must match nothing. // Assert(pos >= 0 && limit <= last && pos <= limit + 1, "bad pos or limit"); AU_Symbol* s = symbol(); bool leftId = s->leftId(); bool rightId = s->rightId(); Term* identity = s->getIdentity(); if (target->symbol() == s) { const ArgVec args2 = getAU_DagNode(target)->argArray; int start = 0; int finish = args2.length() - 1; if (rightId) { if (!leftId && pos > 0 && identity->equal(args2[start])) ++start; // skip over leading identity in target } else { if (leftId && pos + finish <= last && identity->equal(args2[finish])) --finish; // skip over trailing identity in target } if (pos + (finish - start) > limit) return false; for (int i = start; i <= finish; i++) { if (!(args2[i]->equal(argArray[pos]))) return false; ++pos; } return true; } else { if (((pos > 0 && rightId) || (pos <= last && leftId)) && identity->equal(target)) return true; if (pos <= limit && target->equal(argArray[pos])) { ++pos; return true; } return false; } } bool AU_DagNode::eliminateBackward(DagNode* target, int& pos, int limit) const { int last = argArray.length() - 1; // // pos may point to 1 before limit to indicate that target must match nothing. // Assert(pos <= last && limit >= 0 && pos >= limit - 1, "bad pos or limit"); AU_Symbol* s = symbol(); bool leftId = s->leftId(); bool rightId = s->rightId(); Term* identity = s->getIdentity(); if (target->symbol() == s) { const ArgVec args2 = getAU_DagNode(target)->argArray; int start = 0; int finish = args2.length() - 1; if (rightId) { if (!leftId && pos - finish >= 0 && identity->equal(args2[start])) ++start; // skip over leading identity in target } else { if (leftId && pos < last && identity->equal(args2[finish])) --finish; // skip over trailing identity in target } if (pos - (finish - start) < limit) return false; for (int i = finish; i >= start; i--) { if (!(args2[i]->equal(argArray[pos]))) return false; --pos; } return true; } else { if (((pos >= 0 && rightId) || (pos < last && leftId)) && identity->equal(target)) return true; if (pos >= limit && target->equal(argArray[pos])) { --pos; return true; } return false; } } DagNode* AU_DagNode::makeFragment(int start, int nrSubterms, bool extraId) const { Assert(nrSubterms > 0, "no subterms"); if (extraId) ++nrSubterms; if (nrSubterms == 1) return argArray[start]; AU_Symbol* s = symbol(); AU_DagNode* d = new AU_DagNode(s, nrSubterms); int i = 0; if (extraId) d->argArray[s->leftId() ? --nrSubterms : i++] = s->getIdentityDag(); for (; i < nrSubterms; i++, start++) d->argArray[i] = argArray[start]; return d; } Maude-2.6/src/AU_Theory/AU_Symbol.cc0000644000147300135640000003573111457447644014165 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_Symbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "AU_Persistent.hh" #include "AU_Theory.hh" // core class definitions #include "hashConsSet.hh" // AU persistent class definitions #include "AU_DequeIter.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_DequeDagNode.hh" #include "AU_Term.hh" #include "AU_ExtensionInfo.hh" AU_Symbol::AU_Symbol(int id, const Vector& strategy, bool memoFlag, bool leftId, bool rightId, Term* identity) : AssociativeSymbol(id, strategy, memoFlag, identity), leftIdFlag(leftId), rightIdFlag(rightId), oneSidedIdFlag(leftId ^ rightId) { // // We only use the deque representaton for arguments if we // don't need to deal with the complexities of: // (1) a one sided identity // (2) a lazy or semi-eager strategy // (3) memoization // (4) rewriting at the top // // (1) is rare and (2) and (3) don't make sense without (4). // (4) can't be checked until the compileEquations() pass. // (4) might not be so rare but there is no fast deque based // matching algorithm that works with extension. // useDequeFlag = !oneSidedIdFlag && standardStrategy(); } void AU_Symbol::postOpDeclarationPass() { processIdentity(); if (leftIdFlag) leftIdentitySortCheck(); if (rightIdFlag) rightIdentitySortCheck(); } void AU_Symbol::compileEquations() { AssociativeSymbol::compileEquations(); if (!equationFree()) useDequeFlag = false; } DagNode* AU_Symbol::ruleRewrite(DagNode* subject, RewritingContext& context) { if (ruleFree()) return 0; AU_ExtensionInfo extensionInfo(getAU_DagNode(subject)); return applyRules(subject, context, &extensionInfo); } Term* AU_Symbol::makeTerm(const Vector& args) { return new AU_Term(this, args); } DagNode* AU_Symbol::makeDagNode(const Vector& args) { int nrArgs = args.length(); AU_DagNode* a = new AU_DagNode(this, nrArgs); copy(args.begin(), args.end(), a->argArray.begin()); return a; } bool AU_Symbol::rewriteAtTop(AU_DagNode* subject, RewritingContext& context) { // // We have a separate function for this to keep AU_ExtensionInfo // off of the eqRewrite() stack frame since recursion through // eqRewrite() can get very deep. // AU_ExtensionInfo extensionInfo(subject); return applyReplace(subject, context, &extensionInfo); } bool AU_Symbol::rewriteAtTopNoOwise(AU_DagNode* subject, RewritingContext& context) { // // Same idea as above. // AU_ExtensionInfo extensionInfo(subject); return applyReplaceNoOwise(subject, context, &extensionInfo); } bool AU_Symbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); if (standardStrategy()) { if (safeCast(AU_BaseDagNode*, subject)->isDeque()) { Assert(equationFree(), "deque with equations"); return false; } else { AU_DagNode* s = safeCast(AU_DagNode*, subject); if (s->isFresh()) { int nrArgs = s->argArray.length(); for (int i = 0; i < nrArgs; i++) s->argArray[i]->reduce(context); // // We always need to renormalize at the top because // shared subterms may have rewritten. // if (s->normalizeAtTop() <= AU_DagNode::DEQUED) return false; // COLLAPSED or DEQUED } // // Even we were created by an assignment we could // be equation-free and not reduced because our true // sort was not known because of a membership axiom. // if (equationFree()) return false; #ifndef NO_ASSERT // // Look for Riesco 1/18/10 bug. // for (int i = 0; i < s->argArray.length(); i++) { DagNode* d = s->argArray[i]; Assert(d->getSortIndex() != Sort::SORT_UNKNOWN, "AU_Symbol::eqRewrite(): unknown sort for AU argument " << d << " at index " << i << " in subject " << subject << " s->getNormalizationStatus() = " << s->getNormalizationStatus()); } #endif return rewriteAtTop(s, context); } } return complexStrategy(safeCast(AU_DagNode*, subject), context); } bool AU_Symbol::complexStrategy(AU_DagNode* subject, RewritingContext& context) { if (isMemoized()) { MemoTable::SourceSet from; bool result = memoStrategy(from, subject, context); memoEnter(from, subject); // // We may need to return true in the case we collapse to // a unreduced subterm. // return result; } if (subject->isFresh()) { int nrArgs = subject->argArray.length(); for (int i = 0; i < nrArgs; i++) subject->argArray[i]->computeTrueSort(context); // // If we collapse to one of our subterms which has not been reduced // we pretend that we did a rewrite so that the reduction process // continues. // if (subject->normalizeAtTop() == AU_DagNode::COLLAPSED) return !(subject->isReduced()); } if (getPermuteStrategy() == LAZY) { if (rewriteAtTop(subject, context)) return true; return false; } // // Semi-eager case. // if (rewriteAtTopNoOwise(subject, context)) return true; copyAndReduceSubterms(subject, context); if (subject->normalizeAtTop() == AU_DagNode::COLLAPSED) return false; subject->repudiateSortInfo(); // rewriteAtTopNoOwise() might have left sort behind return rewriteAtTop(subject, context); } bool AU_Symbol::memoStrategy(MemoTable::SourceSet& from, DagNode* subject, RewritingContext& context) { AU_DagNode* s = safeCast(AU_DagNode*, subject); ArgVec& args = s->argArray; PermuteStrategy strat = getPermuteStrategy(); if (strat == EAGER) { if (s->isFresh()) { int nrArgs = args.length(); for (int i = 0; i < nrArgs; i++) args[i]->reduce(context); // // We always need to renormalize at the top because // shared subterms may have rewritten. // if (s->normalizeAtTop() == AU_DagNode::COLLAPSED) return false; } } else { if (s->isFresh()) { int nrArgs = args.length(); for (int i = 0; i < nrArgs; i++) args[i]->computeTrueSort(context); // // If we collapse to one of our subterms which has not been reduced // we pretend that we did a rewrite so that the reduction process // continues. // if (s->normalizeAtTop() == AU_DagNode::COLLAPSED) return !(s->isReduced()); // the only place we might return true } if (memoRewrite(from, subject, context)) return false; if (getPermuteStrategy() == LAZY) { if (rewriteAtTop(s, context)) subject->reduce(context); return false; } // // Semi-eager case. // if (rewriteAtTopNoOwise(s, context)) { subject->reduce(context); return false; } copyAndReduceSubterms(s, context); if (s->normalizeAtTop() == AU_DagNode::COLLAPSED) return false; s->repudiateSortInfo(); // rewriteAtTopNoOwise() might have left sort behind } if (!memoRewrite(from, subject, context) && rewriteAtTop(s, context)) subject->reduce(context); return false; } void AU_Symbol::copyAndReduceSubterms(AU_DagNode* subject, RewritingContext& context) { ArgVec& args = subject->argArray; int nrArgs = args.length(); for (int i = 0; i < nrArgs; i++) args[i] = args[i]->copyAndReduce(context); } void AU_Symbol::computeBaseSort(DagNode* subject) { Assert(this == subject->symbol(), "bad symbol"); if (safeCast(AU_BaseDagNode*, subject)->isDeque()) { subject->setSortIndex(safeCast(AU_DequeDagNode*, subject)-> getDeque().computeBaseSort(this)); return; } ArgVec& args = safeCast(AU_DagNode*, subject)->argArray; if (const Sort* uniSort = uniformSort()) { // // If symbol has a uniform sort structure do a fast sort computation. // if (!(uniSort->component()->errorFree())) { // // Check we're not in the error sort. // int lastIndex = Sort::SORT_UNKNOWN; FOR_EACH_CONST(i, ArgVec, args) { int index = (*i)->getSortIndex(); if (index != lastIndex) { if (!(leq(index, uniSort))) { subject->setSortIndex(Sort::ERROR_SORT); return; } lastIndex = index; } } } subject->setSortIndex(uniSort->index()); return; } // // Standard sort calculation. // int sortIndex = Sort::SORT_UNKNOWN; FOR_EACH_CONST(i, ArgVec, args) { int t = (*i)->getSortIndex(); Assert(t != Sort::SORT_UNKNOWN, "bad sort index"); sortIndex = (sortIndex == Sort::SORT_UNKNOWN) ? t : traverse(traverse(0, sortIndex), t); } subject->setSortIndex(sortIndex); } void AU_Symbol::normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); if (safeCast(AU_BaseDagNode*, subject)->isFresh()) { // // Make sure each subterm has its true sort. // AU_DagNode* s = safeCast(AU_DagNode*, subject); ArgVec& args = s->argArray; int nrArgs = args.length(); for (int i = 0; i < nrArgs; i++) args[i]->computeTrueSort(context); // // Put subject in normal form (could collapse to a subterm). // if (s->normalizeAtTop() == AU_DagNode::COLLAPSED) return; } // // Finally compute subjects true sort. // fastComputeTrueSort(subject, context); } int AU_Symbol::calculateNrSubjectsMatched(DagNode* d, bool leftEnd, // match starts at left extreme bool rightEnd, // match end at right extreme bool& nasty) { nasty = false; Term* identity = getIdentity(); if (d->symbol() == this) { if (safeCast(AU_BaseDagNode*, d)->isDeque()) return safeCast(AU_DequeDagNode*, d)->nrArgs(); ArgVec& args = safeCast(AU_DagNode*, d)->argArray; int nrArgs = args.length(); if (oneSidedIdFlag) { if (rightIdFlag) { if (identity->equal(args[0])) { if (leftEnd) nasty = true; else --nrArgs; // identity may not match anything } } else { if (identity->equal(args[nrArgs - 1])) { if (rightEnd) nasty = true; else --nrArgs; // identity may not match anything } } } return nrArgs; } if (identity != 0 && identity->equal(d)) { if (!(oneSidedIdFlag && (rightIdFlag ? leftEnd : rightEnd))) return 0; nasty = true; } return 1; } void AU_Symbol::stackArguments(DagNode* subject, Vector& stack, int parentIndex) { if (!(getFrozen().empty())) return; if (safeCast(AU_BaseDagNode*, subject)->isDeque()) { // // Deque case. // Assert(getPermuteStrategy() == EAGER, "non eager strategy with deque"); int j = 0; for (AU_DequeIter i(safeCast(AU_DequeDagNode*, subject)->getDeque()); i.valid(); i.next(), ++j) { DagNode* d = i.getDagNode(); if (!(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, j, true)); } } else { // // ArgVec case. // bool eager = (getPermuteStrategy() == EAGER); ArgVec& args = safeCast(AU_DagNode*, subject)->argArray; int nrArgs = args.length(); for (int i = 0; i < nrArgs; i++) { DagNode* d = args[i]; if (!(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, i, eager)); } } } // // Hash cons code. // DagNode* AU_Symbol::makeCanonical(DagNode* original, HashConsSet* hcs) { if (safeCast(AU_BaseDagNode*, original)->isDeque()) { // // Never use deque form as canonical. // const AU_DequeDagNode* d = safeCast(const AU_DequeDagNode*, original); const AU_Deque& deque = d->getDeque(); AU_DagNode* n = new AU_DagNode(this, deque.length()); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); ArgVec::iterator j = n->argArray.begin(); for (AU_DequeIter i(deque); i.valid(); i.next(), ++j) *j = hcs->getCanonical(hcs->insert(i.getDagNode())); n->setProducedByAssignment(); // deque form must be theory normal return n; } const AU_DagNode* d = safeCast(const AU_DagNode*, original); int nrArgs = d->argArray.size(); for (int i = 0; i < nrArgs; i++) { DagNode* b = d->argArray[i]; DagNode* c = hcs->getCanonical(hcs->insert(b)); if (c != b) { // // Detected a non-canonical argument so need to make a new node. // AU_DagNode* n = new AU_DagNode(this, nrArgs); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); for (int j = 0; j < i; ++j) n->argArray[j] = d->argArray[j]; n->argArray[i] = c; for (++i; i < nrArgs; i++) n->argArray[i] = hcs->getCanonical(hcs->insert(d->argArray[i])); n->setProducedByAssignment(); // only theory normal dags will be hash cons'd return n; } } return original; // can use the original dag node as the canonical version } DagNode* AU_Symbol::makeCanonicalCopy(DagNode* original, HashConsSet* hcs) { // // We have a unreduced node - copy forced. // if (safeCast(AU_BaseDagNode*, original)->isDeque()) { // // Never use deque form as canonical for unreduced. // const AU_DequeDagNode* d = safeCast(const AU_DequeDagNode*, original); const AU_Deque& deque = d->getDeque(); AU_DagNode* n = new AU_DagNode(this, deque.length()); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); ArgVec::iterator j = n->argArray.begin(); for (AU_DequeIter i(deque); i.valid(); i.next(), ++j) *j = hcs->getCanonical(hcs->insert(i.getDagNode())); n->setProducedByAssignment(); // deque form must be theory normal return n; } const AU_DagNode* d = safeCast(const AU_DagNode*, original); int nrArgs = d->argArray.size(); AU_DagNode* n = new AU_DagNode(this, nrArgs); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); for (int i = 0; i < nrArgs; i++) n->argArray[i] = hcs->getCanonical(hcs->insert(d->argArray[i])); n->setProducedByAssignment(); // only theory normal dags will be hash cons'd return n; } Maude-2.6/src/AU_Theory/AU_DequeMatcher.cc0000644000147300135640000001124007666303243015245 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for A/AU matcher that works on deques. // int AU_LhsAutomaton::dequeMatch(AU_DequeDagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem) { // // We only handle lone variable case. // Assert(flexPart.length() == 1, "bad flex part length " << flexPart.length()); Assert(flexPart[0].type == VARIABLE, "flex part not a variable"); // // First match rigid part. // AU_Deque remainder(subject->getDeque()); int nrArgs = remainder.length(); if (nrArgs < wholeLowerBound || nrArgs > wholeUpperBound) return false; SubproblemAccumulator subproblems; Term* identity = topSymbol->getIdentity(); FOR_EACH_CONST(i, Vector, rigidPart) { switch (i->type) { case VARIABLE: { const TopVariable& tv = i->variable; DagNode* b = solution.value(tv.index); if (b != 0) { // // Bound variable case. // if (b->symbol() == topSymbol) return UNDECIDED; if (identity == 0 || !(identity->equal(b))) { if (tv.takeIdentity) { // // Need to redo bounds check as something that // might have taken identity used up an argument. // --nrArgs; if (nrArgs < wholeLowerBound) return false; } if (i->leftEnd) { if (b->equal(remainder.topLeft())) remainder.popLeft(); else return false; } else { if (b->equal(remainder.topRight())) remainder.popRight(); else return false; } } } else { // // Unbound non-identity unit variable case. // Assert(tv.upperBound == 1, "unbound non-unit variable in rigid part"); Assert(!(tv.takeIdentity), "unbound variable which can take identity in rigid part"); DagNode* d; if (i->leftEnd) { d = remainder.topLeft(); if (!(d->leq(tv.sort))) return false; remainder.popLeft(); } else { d = remainder.topRight(); if (!(d->leq(tv.sort))) return false; remainder.popRight(); } solution.bind(tv.index, d); } break; } case GROUND_ALIEN: { if (i->leftEnd) { if (i->groundAlien->equal(remainder.topLeft())) remainder.popLeft(); else return false; } else { if (i->groundAlien->equal(remainder.topRight())) remainder.popRight(); else return false; } break; } case NON_GROUND_ALIEN: { Subproblem* sp; if (i->leftEnd) { if (i->alienAutomaton->match(remainder.topLeft(), solution, sp)) remainder.popLeft(); else return false; } else { if (i->alienAutomaton->match(remainder.topRight(), solution, sp)) remainder.popRight(); else return false; } subproblems.add(sp); break; } } } // // Now deal with flex part. // Assert(remainder.length() >= flexLowerBound, "lower bound problem"); if (remainder.length() > flexUpperBound) return false; DagNode* d; switch (remainder.length()) { case 0: { Assert(identity != 0, "no identity"); d = topSymbol->getIdentityDag(); break; } case 1: { d = remainder.topLeft(); break; } default: { d = new AU_DequeDagNode(topSymbol, remainder); break; } } TopVariable& tv = flexPart[0].variable; DagNode* b = solution.value(tv.index); if (b == 0) { Subproblem* sp; if (tv.abstracted != 0) { if (!(tv.abstracted->match(d, solution, sp))) return false; } else { if (!(d->checkSort(tv.sort, sp))) return false; if (subject->isReduced() && d->getSortIndex() != Sort::SORT_UNKNOWN) d->setReduced(); solution.bind(tv.index, d); } subproblems.add(sp); } else { if (!(b->equal(d))) return false; } returnedSubproblem = subproblems.extractSubproblem(); return true; } Maude-2.6/src/AU_Theory/AU_BaseDagNode.hh0000644000147300135640000000512011351020665014772 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Base class for DAG nodes in the A, AU, AUl and theories. // #ifndef _AU_BaseDagNode_hh_ #define _AU_BaseDagNode_hh_ #include "dagNode.hh" class AU_BaseDagNode : public DagNode { NO_COPYING(AU_BaseDagNode); public: enum NormalizationStatus { // // Default: no guarantees. // FRESH = 0, // // Node was produced by an assignment in AU matcher: // (a) all arguments are reduced up to strategy of our symbol // (this only holds if it was true of subject before matching); // (b) all arguments have their true sort; and // (c) argument list in theory normal form. // ASSIGNMENT = 1, // // As above but arguments are stored in a deque (AU_DequeNode) // rather than in an ArgVec (AU_DagNode). // DEQUE = 2 }; AU_BaseDagNode(AU_Symbol* symbol); AU_Symbol* symbol() const; NormalizationStatus getNormalizationStatus() const; void setNormalizationStatus(NormalizationStatus status); bool isDeque() const; bool isFresh() const; bool isProducedByAssignment() const; }; inline AU_BaseDagNode::AU_BaseDagNode(AU_Symbol* symbol) : DagNode(symbol) { } inline AU_Symbol* AU_BaseDagNode::symbol() const { return safeCast(AU_Symbol*, DagNode::symbol()); } inline AU_BaseDagNode::NormalizationStatus AU_BaseDagNode::getNormalizationStatus() const { return static_cast(getTheoryByte()); } inline bool AU_BaseDagNode::isDeque() const { return getTheoryByte() == DEQUE; } inline bool AU_BaseDagNode::isFresh() const { return getTheoryByte() == FRESH; } inline bool AU_BaseDagNode::isProducedByAssignment() const { return getTheoryByte() == ASSIGNMENT; } inline void AU_BaseDagNode::setNormalizationStatus(NormalizationStatus status) { setTheoryByte(status); } #endif Maude-2.6/src/AU_Theory/AU_Theory.hh0000644000147300135640000000235207666303243014166 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for AU theory classes. // #ifndef _AU_Theory_hh_ #define _AU_Theory_hh_ class AU_Symbol; class AU_Term; class AU_ArgumentIterator; class AU_BaseDagNode; class AU_DagNode; class AU_DequeDagNode; class AU_DagArgumentIterator; class AU_DequeDagArgumentIterator; class AU_LhsAutomaton; class AU_RhsAutomaton; class AU_Layer; class AU_Subproblem; class AU_ExtensionInfo; #endif Maude-2.6/src/AU_Theory/AU_DequeDagArgumentIterator.hh0000644000147300135640000000265507666303243017616 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for argument iterator for AU deque dag nodes. // #ifndef _AU_DequeDagArgumentIterator_hh_ #define _AU_DequeDagArgumentIterator_hh_ #include "rawDagArgumentIterator.hh" #include "AU_DequeIter.hh" class AU_DequeDagArgumentIterator : public RawDagArgumentIterator { NO_COPYING(AU_DequeDagArgumentIterator); public: AU_DequeDagArgumentIterator(const AU_Deque& deque); bool valid() const; DagNode* argument() const; void next(); private: AU_DequeIter iter; }; inline AU_DequeDagArgumentIterator::AU_DequeDagArgumentIterator(const AU_Deque& deque) : iter(deque) { } #endif Maude-2.6/src/AU_Theory/AU_LhsCompiler.cc0000644000147300135640000003723711347774227015142 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation of match compilation for A, AUl, AUr and AU theories. // struct AU_Term::CP_Sequence { Vector sequence; // true = take left term, false = take right term NatSet bound; int cardinality; int firstFlex; }; local_inline bool AU_Term::unitVariable(VariableTerm* vt, int index) const { if (vt == 0) return false; AU_Symbol* s = symbol(); Sort* vs = vt->getSort(); // // A unit variable has a bound of one imposed by its sort and it cannot take an // identity either because a suitable left/right identity doesn't exist or // its sort is too low. // return (s->sortBound(vs) == 1 && !(idPossible(index) && s->takeIdentity(vs))); } void AU_Term::analyseConstraintPropagation(NatSet& boundUniquely) const { CP_Sequence bestSequence; findConstraintPropagationSequence(boundUniquely, bestSequence); boundUniquely = bestSequence.bound; // deep copy if (bestSequence.sequence.length() == argArray.length() - 1) { AU_Symbol* s = symbol(); // // Lone variable or abstracted term in flex part. We // can only guarentee unique binding if our top symbol // does not have a one sided identity. // if (!(s->oneSidedId())) argArray[bestSequence.firstFlex].term->analyseConstraintPropagation(boundUniquely); } } LhsAutomaton* AU_Term::compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely) { AU_Symbol* s = symbol(); bool oneSidedIdentity = s->oneSidedId(); LhsAutomaton* uniqueCollapseAutomaton = 0; if (uniqueCollapseSubtermIndex != NONE) { // // Maybe we should add the variable(s) which will be bound to identity // to this local bound uniquely. // NatSet local(boundUniquely); bool spl; uniqueCollapseAutomaton = argArray[uniqueCollapseSubtermIndex].term-> compileLhs(matchAtTop, variableInfo, local, spl); } AU_LhsAutomaton* a = new AU_LhsAutomaton(s, matchAtTop, !(collapseSymbols().empty()), uniqueCollapseAutomaton, variableInfo.getNrProtectedVariables()); subproblemLikely = false; int leftPos = 0; int rightPos = argArray.length() - 1; if (!matchAtTop) { // // Build rigid part. // CP_Sequence bestSequence; findConstraintPropagationSequence(boundUniquely, bestSequence); int nrRigid = bestSequence.sequence.length(); for (int i = 0; i < nrRigid; i++) { bool leftEnd = bestSequence.sequence[i]; int j = leftEnd ? leftPos++ : rightPos--; Term* t = argArray[j].term; VariableTerm* v = dynamic_cast(t); if (v != 0) { a->addRigidVariable(v, leftEnd, idPossible(j)); boundUniquely.insert(v->getIndex()); } else if (t->ground()) a->addRigidGroundAlien(t, leftEnd); else { bool spl; LhsAutomaton* subAutomaton = t->compileLhs(false, variableInfo, boundUniquely, spl); a->addRigidNonGroundAlien(subAutomaton, leftEnd); subproblemLikely = subproblemLikely || spl; } } Assert(boundUniquely == bestSequence.bound, "bound clash"); // // Build flex part (special cases). // int nrFlex = rightPos - leftPos + 1; if (nrFlex == 0) { a->complete(AU_LhsAutomaton::GROUND_OUT); return a; } if (nrFlex == 1 && !oneSidedIdentity) { Assert(!matchAtTop, "shouldn't match at top"); Tuple& t = argArray[leftPos]; if (t.abstractionVariableIndex == NONE) { VariableTerm* vt = dynamic_cast(t.term); a->addFlexVariable(vt, UNDEFINED, idPossible(leftPos)); boundUniquely.insert(vt->getIndex()); a->complete((s->sortStructure(vt->getSort()) == AssociativeSymbol::PURE_SORT) ? AU_LhsAutomaton::FAST_LONE_VARIABLE : AU_LhsAutomaton::LONE_VARIABLE); } else { bool matchOurIdentity = t.matchOurIdentity && idPossible(leftPos); Assert(t.collapseToOurSymbol || matchOurIdentity, "should not use abstraction variable"); bool spl; a->addFlexAbstractionVariable (t.abstractionVariableIndex, t.term->getComponent()->sort(Sort::ERROR_SORT), t.collapseToOurSymbol ? UNBOUNDED : 1, matchOurIdentity, false, t.term->compileLhs(false, variableInfo, boundUniquely, spl)); subproblemLikely = subproblemLikely || spl; a->complete(AU_LhsAutomaton::LONE_VARIABLE); } return a; } } // // Build flex part (general case). // // Greedy matcher: // (1) does not check to see if matched portion is in error sort; // (2) cannot handle the intricacies involved in one sided identity theories; // (3) does not check that enough has been matched if extension present. // bool greedy = !oneSidedIdentity && (!matchAtTop || collapseSymbols().empty()); int fixedLengthBlockStart = NONE; for (int i = leftPos; i <= rightPos; i++) { Tuple& t = argArray[i]; greedy = greedy && t.abstractionVariableIndex == NONE && t.term->greedySafe(variableInfo, boundUniquely); // // Check if thing we match will be of fixed size. // bool fixedSize = (t.abstractionVariableIndex == NONE); VariableTerm* vt = dynamic_cast(t.term); if (vt != 0) { Sort* vs = vt->getSort(); bool ip = idPossible(i); bool ti = s->takeIdentity(vs); bool awkward = matchAtTop && !ip && ti; greedy = greedy && !awkward; if (((matchAtTop || ip) && ti) || s->sortBound(vs) > 1) { fixedSize = false; greedy = greedy && (boundUniquely.contains(vt->getIndex()) || s->sortStructure(vs) >= AssociativeSymbol::LIMIT_SORT); } } // // If not fixed size, see if we ended a fixed size block; then add // flex variable or flex abstraction variable. Otherwise see if we need // to start a fixed length block. // if (!fixedSize) { if (fixedLengthBlockStart != NONE) { bool spl; addFixedLengthBlock(a, fixedLengthBlockStart, i - fixedLengthBlockStart, variableInfo, boundUniquely, spl); greedy = greedy && !spl; fixedLengthBlockStart = NONE; } bool ip = idPossible(i); if (t.abstractionVariableIndex == NONE) a->addFlexVariable(vt, UNDEFINED, ip); else { bool matchOurIdentity = ip && t.matchOurIdentity; bool awkward = matchAtTop && !ip && t.matchOurIdentity; Assert(t.collapseToOurSymbol || matchOurIdentity || awkward, "should not use abstraction variable"); NatSet local(boundUniquely); bool spl; a->addFlexAbstractionVariable (t.abstractionVariableIndex, t.term->getComponent()->sort(Sort::ERROR_SORT), t.collapseToOurSymbol ? UNBOUNDED : 1, matchOurIdentity, awkward, t.term->compileLhs(false, variableInfo, local, spl)); } } else { if (fixedLengthBlockStart == NONE) fixedLengthBlockStart = i; } } // // Handle any remaining fixed length block. // if (fixedLengthBlockStart != NONE) { Assert(matchAtTop, "ended flex part with fixed length block"); bool spl; addFixedLengthBlock(a, fixedLengthBlockStart, argArray.length() - fixedLengthBlockStart, variableInfo, boundUniquely, spl); greedy = greedy && !spl; } // // Finish up by decideding on a match strategy. // if (!greedy) subproblemLikely = true; a->complete(greedy ? AU_LhsAutomaton::GREEDY : AU_LhsAutomaton::FULL); return a; } void AU_Term::addFixedLengthBlock(AU_LhsAutomaton* a, int blockStart, int blockLength, const VariableInfo& variableInfo, const NatSet& boundUniquely, bool& subproblemLikely) { // // For each possible shift factor sh from 1 to blockLength - 1 we // find the index of the rightmost pattern p such that if the p matches // some subject s (possibly with a subproblem that may or not be soluble), // the pattern q that is sh places to the left of p will fail early // on s, thus ruling out a shift of sh during matching. // Vector largestIndexThatFails(blockLength); for (int shift = 1; shift < blockLength; shift++) { largestIndexThatFails[shift] = -1; // default; shift is never ruled out for (int i = blockLength - 1; i >= shift; i--) { int b = blockStart + i; Term* p = argArray[b].term; // assume p matched subject Term* q = argArray[b - shift].term; // q will get p's subject after a shift if (q->earlyMatchFailOnInstanceOf(p)) { largestIndexThatFails[shift] = i; break; } } } // // For each pattern p we find the smallest shift that is not ruled out // when a match for that pattern fails and matches for all the patterns // to the right of it succeed (modulo a possible subproblem). // subproblemLikely = false; for (int i = 0; i < blockLength; i++) { int b = blockStart + i; Term* p = argArray[b].term; int shift = 1; for (; shift < blockLength; shift++) { // // A shift can be ruled out because a match to the right // of p; // if (i < largestIndexThatFails[shift]) continue; // // Or because the p is more general than the pattern // that will get it's subject after the shift. Here we need // to be careful because variables bound by an external agency // can invalidate subsumption. We rely on the convention that // the external agency adds any variables that it might bind // to the set of condition variables. // if (i >= shift && p->occursBelow().disjoint(variableInfo.getConditionVariables()) && p->subsumes(argArray[b - shift].term, true)) continue; else break; } VariableTerm* v = dynamic_cast(p); if (v != 0) a->addFlexVariable(v, shift, false); else if (p->ground()) a->addFlexGroundAlien(p, shift); else { NatSet local(boundUniquely); bool spl; LhsAutomaton* subAutomaton = p->compileLhs(false, variableInfo, local, spl); a->addFlexNonGroundAlien(subAutomaton, shift); subproblemLikely = subproblemLikely || spl; } } } void AU_Term::findConstraintPropagationSequence(const NatSet& boundUniquely, CP_Sequence& bestSequence) const { DebugAdvisory("toplevel findConstraintPropagationSequence() - array length = " << argArray.length() << " subterm = " << this); Vector currentSequence; bestSequence.cardinality = -1; findConstraintPropagationSequence(currentSequence, boundUniquely, 0, argArray.length() - 1, bestSequence); } void AU_Term::findConstraintPropagationSequence(const Vector& currentSequence, const NatSet& boundUniquely, int leftPos, int rightPos, CP_Sequence& bestSequence) const { if (leftPos <= rightPos) { // // Try to grow search tree. // // (1) If left or right term is not abstracted and grounds out // match it next and don't consider other possibilities. // const Tuple& lt = argArray[leftPos]; bool leftBad = lt.collapseToOurSymbol || (lt.matchOurIdentity && idPossible(leftPos)); if (!leftBad && boundUniquely.contains(lt.term->occursBelow())) { DebugAdvisory("lower level findConstraintPropagationSequence() - ground out left " << leftPos); Vector newSequence(currentSequence); newSequence.append(true); findConstraintPropagationSequence(newSequence, boundUniquely, leftPos + 1, rightPos, bestSequence); return; } const Tuple& rt = argArray[rightPos]; bool rightBad = (leftPos == rightPos) || rt.collapseToOurSymbol || (rt.matchOurIdentity && idPossible(rightPos)); if (!rightBad && boundUniquely.contains(rt.term->occursBelow())) { DebugAdvisory("lower level findConstraintPropagationSequence() - ground out right " << rightPos); Vector newSequence(currentSequence); newSequence.append(false); findConstraintPropagationSequence(newSequence, boundUniquely, leftPos, rightPos - 1, bestSequence); return; } // // (2) If left or right term is a variable of unit sort which cannot take // identity match it next and don't consider other possibilities. // VariableTerm* ltVar = dynamic_cast(lt.term); if (unitVariable(ltVar, leftPos)) { DebugAdvisory("lower level findConstraintPropagationSequence() - unit var left " << leftPos); Vector newSequence(currentSequence); newSequence.append(true); NatSet newBound(boundUniquely); newBound.insert(ltVar->getIndex()); findConstraintPropagationSequence(newSequence, newBound, leftPos + 1, rightPos, bestSequence); return; } VariableTerm* rtVar = dynamic_cast(rt.term); if (leftPos < rightPos && unitVariable(rtVar, rightPos)) { DebugAdvisory("lower level findConstraintPropagationSequence() - unit var right " << rightPos); Vector newSequence(currentSequence); newSequence.append(false); NatSet newBound(boundUniquely); newBound.insert(rtVar->getIndex()); findConstraintPropagationSequence(newSequence, newBound, leftPos, rightPos - 1, bestSequence); return; } // // If left or right term is a non-abstracted alien then consider // matching it next but also consider other possibilities. // bool growth = false; if (!leftBad && ltVar == 0) { DebugAdvisory("lower level findConstraintPropagationSequence() - alien left " << leftPos); Vector newSequence(currentSequence); newSequence.append(true); NatSet newBound(boundUniquely); lt.term->analyseConstraintPropagation(newBound); findConstraintPropagationSequence(newSequence, newBound, leftPos + 1, rightPos, bestSequence); growth = true; } if (bestSequence.sequence.length() >= argArray.length() - 1) { // // All arguments or all arguments but one have a forced match (with the left over argument taking what is left). // There will be no branching at match time, so considering an alternative order is a waste of time. // DebugAdvisory("lower level findConstraintPropagationSequence() - aborting right branch"); return; } if (!rightBad && rtVar == 0) { DebugAdvisory("lower level findConstraintPropagationSequence() - alien right " << rightPos); Vector newSequence(currentSequence); newSequence.append(false); NatSet newBound(boundUniquely); rt.term->analyseConstraintPropagation(newBound); findConstraintPropagationSequence(newSequence, newBound, leftPos, rightPos - 1, bestSequence); growth = true; } if (growth) return; } int n = boundUniquely.cardinality(); if (n > bestSequence.cardinality || (n == bestSequence.cardinality && currentSequence.length() > bestSequence.sequence.length())) { bestSequence.sequence = currentSequence; // deep copy bestSequence.bound = boundUniquely; // deep copy bestSequence.cardinality = n; bestSequence.firstFlex = leftPos <= rightPos ? leftPos : NONE; } } Maude-2.6/src/AU_Theory/AU_Matcher.cc0000644000147300135640000003272511350012626014257 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for common parts of A/AU matcher. // bool AU_LhsAutomaton::match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { if (subject->symbol() != topSymbol) { if (collapsePossible) return collapseMatch(subject, solution, returnedSubproblem, extensionInfo); return false; } Assert(matchAtTop == (extensionInfo != 0), "matchAtTop disagreement"); if (safeCast(AU_BaseDagNode*, subject)->isDeque()) { AU_DequeDagNode* t = safeCast(AU_DequeDagNode*, subject); if (matchStrategy == LONE_VARIABLE || matchStrategy == FAST_LONE_VARIABLE) { int r = dequeMatch(t, solution, returnedSubproblem); if (r == true || r == false) return r; } (void) AU_DequeDagNode::dequeToArgVec(t); } AU_DagNode* s = safeCast(AU_DagNode*, subject); int nrArgs = s->argArray.length(); if (nrArgs < wholeLowerBound || nrArgs > wholeUpperBound) return false; leftPos = 0; rightPos = nrArgs - 1; flexLeftPos = 0; flexRightPos = flexPart.length() - 1; SubproblemAccumulator subproblems; AU_ExtensionInfo* e = safeCast(AU_ExtensionInfo*, extensionInfo); if (e == 0) { if (!matchRigidPart(s, solution, subproblems) || (flexPart.length() != 0 && !checkForRigidEnds(s, solution, subproblems))) return false; int flexRemaining = flexRightPos - flexLeftPos + 1; if (flexRemaining == 0) { DebugAdvisoryCheck(matchStrategy == GROUND_OUT, "match strategy changed from " << matchStrategy << " to GROUND_OUT at match time (top symbol = \"" << topSymbol << "\")"); if (rightPos - leftPos + 1 != 0) return false; goto success; } if (flexRemaining == 1 && !(topSymbol->oneSidedId())) { DebugAdvisoryCheck(matchStrategy == LONE_VARIABLE || matchStrategy == FAST_LONE_VARIABLE, "match strategy changed from " << matchStrategy << " to LONE_VARIABLE at match time (top symbol = \"" << topSymbol << "\")"); Subproblem* sp; if (!forcedLoneVariableCase(s, solution, sp)) return false; subproblems.add(sp); goto success; } } Assert(matchStrategy != GROUND_OUT && matchStrategy != LONE_VARIABLE && matchStrategy != FAST_LONE_VARIABLE, "bad strategy"); determineRigidBlocks(solution); if (matchStrategy == GREEDY) { int r = greedyMatch(s, solution, e); if (r == false) return false; if (r == true) goto success; } if (!fullMatch(s, solution, subproblems, e)) return false; success: returnedSubproblem = subproblems.extractSubproblem(); return true; } bool AU_LhsAutomaton::matchRigidPart(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems) { ArgVec& args = subject->argArray; FOR_EACH_CONST(i, Vector, rigidPart) { switch (i->type) { case VARIABLE: { const TopVariable& tv = i->variable; DagNode* b = solution.value(tv.index); if (b != 0) { // // Bound variable case. // if (i->leftEnd) { if (!(subject->eliminateForward(b, leftPos, rightPos - flexLowerBound))) return false; } else { if (!(subject->eliminateBackward(b, rightPos, leftPos + flexLowerBound))) return false; } } else { // // Unbound non-identity unit variable case. // Assert(tv.upperBound == 1, "unbound non-unit variable in rigid part"); Assert(!(tv.takeIdentity), "unbound variable which can take identity in rigid part"); if (rightPos - leftPos < flexLowerBound) return false; DagNode* d = args[i->leftEnd ? leftPos++ : rightPos--]; if (!(d->leq(tv.sort))) return false; solution.bind(tv.index, d); } break; } case GROUND_ALIEN: { if (rightPos - leftPos < flexLowerBound || !(i->groundAlien->equal(args[i->leftEnd ? leftPos++ : rightPos--]))) return false; break; } case NON_GROUND_ALIEN: { Subproblem* sp; if (rightPos - leftPos < flexLowerBound || !(i->alienAutomaton-> match(args[i->leftEnd ? leftPos++ : rightPos--], solution, sp))) return false; subproblems.add(sp); break; } } } return rightPos - leftPos + 1 <= flexUpperBound; } bool AU_LhsAutomaton::checkForRigidEnds(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems) { int mustLeave = flexLowerBound; bool leftStalled = false; bool rightStalled = false; for(;;) { switch(checkLeftEnd(subject, solution, subproblems, mustLeave, rightStalled)) { case false: return false; case true: { if (flexLeftPos++ == flexRightPos) return true; break; } case STALLED: { if (rightStalled) return true; leftStalled = true; break; } } switch(checkRightEnd(subject, solution, subproblems, mustLeave, leftStalled)) { case false: return false; case true: { if (flexLeftPos == flexRightPos--) return true; break; } case STALLED: { if (leftStalled) return true; rightStalled = true; break; } } } } int AU_LhsAutomaton::checkLeftEnd(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems, int& mustLeave, bool& rightStalled) { Subterm& f = flexPart[flexLeftPos]; switch (f.type) { case VARIABLE: { TopVariable& tv = f.variable; DagNode* b = solution.value(tv.index); if (b != 0) { if (!tv.takeIdentity) --mustLeave; return subject->eliminateForward(b, leftPos, rightPos - mustLeave); } else if (tv.upperBound == 1 && !(tv.takeIdentity)) { if (rightPos - leftPos < --mustLeave) return false; DagNode* d = subject->argArray[leftPos++]; if (!(d->leq(tv.sort))) return false; solution.bind(tv.index, d); break; } return STALLED; } case GROUND_ALIEN: { return rightPos - leftPos >= --mustLeave && f.groundAlien->equal(subject->argArray[leftPos++]); } case NON_GROUND_ALIEN: { Subproblem* sp; if (rightPos - leftPos < --mustLeave || !(f.alienAutomaton->match(subject->argArray[leftPos++], solution, sp))) return false; subproblems.add(sp); rightStalled = false; // we may have bound variable stalling right end break; } } return true; } int AU_LhsAutomaton::checkRightEnd(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems, int& mustLeave, bool& leftStalled) { Subterm& f = flexPart[flexRightPos]; switch (f.type) { case VARIABLE: { TopVariable& tv = f.variable; DagNode* b = solution.value(tv.index); if (b != 0) { if (!tv.takeIdentity) --mustLeave; return subject->eliminateBackward(b, rightPos, leftPos + mustLeave); } else if (tv.upperBound == 1 && !(tv.takeIdentity)) { if (rightPos - leftPos < --mustLeave) return false; DagNode* d = subject->argArray[rightPos--]; if (!(d->leq(tv.sort))) return false; solution.bind(tv.index, d); break; } return STALLED; } case GROUND_ALIEN: { return rightPos - leftPos >= --mustLeave && f.groundAlien->equal(subject->argArray[rightPos--]); } case NON_GROUND_ALIEN: { Subproblem* sp; if (rightPos - leftPos < --mustLeave || !(f.alienAutomaton->match(subject->argArray[rightPos--], solution, sp))) return false; leftStalled = false; // we may have bound variable stalling left end subproblems.add(sp); break; } } return true; } bool AU_LhsAutomaton::forcedLoneVariableCase(AU_DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem) { Assert(flexPart[flexLeftPos].type == VARIABLE, "lone variable is not a variable"); returnedSubproblem = 0; ArgVec& args = subject->argArray; int nrSubjectsRemaining = rightPos - leftPos + 1; TopVariable& loneVariable = flexPart[flexLeftPos].variable; Assert(solution.value(loneVariable.index) == 0, "lone variable bound"); if (nrSubjectsRemaining == 0) { if (!(loneVariable.takeIdentity)) return false; DagNode* d = topSymbol->getIdentityDag(); solution.bind(loneVariable.index, d); return (loneVariable.abstracted == 0) ? true : loneVariable.abstracted->match(d, solution, returnedSubproblem); } else if (nrSubjectsRemaining == 1) { DagNode* d = args[leftPos]; solution.bind(loneVariable.index, d); return (loneVariable.abstracted == 0) ? (d->leq(loneVariable.sort)) : loneVariable.abstracted->match(d, solution, returnedSubproblem); } else if (matchStrategy != FAST_LONE_VARIABLE) { AU_DagNode* d = new AU_DagNode(topSymbol, nrSubjectsRemaining); int pos = 0; for (int i = leftPos; i <= rightPos; i++) d->argArray[pos++] = args[i]; Assert(pos == nrSubjectsRemaining, "inconsistant number of subterms"); solution.bind(loneVariable.index, d); if (loneVariable.abstracted != 0) return loneVariable.abstracted->match(d, solution, returnedSubproblem); if (d->checkSort(loneVariable.sort, returnedSubproblem)) { d->setProducedByAssignment(); if (subject->isReduced() && d->getSortIndex() != Sort::SORT_UNKNOWN) d->setReduced(); return true; } } else { AU_DagNode* d = new AU_DagNode(topSymbol, nrSubjectsRemaining); int lastIndex = Sort::SORT_UNKNOWN; const Sort* cs = loneVariable.sort; ArgVec::iterator j = d->argArray.begin(); const ArgVec::const_iterator e = args.begin() + rightPos + 1; for (ArgVec::const_iterator i = args.begin() + leftPos; i != e; ++i, ++j) { DagNode* sd = *i; int index = sd->getSortIndex(); Assert(index != Sort::SORT_UNKNOWN, "bad sort"); if (index != lastIndex) { if (!(leq(index, cs))) return false; lastIndex = index; } *j = sd; } Assert(j == d->argArray.end(), "iterator problem"); d->setProducedByAssignment(); if (subject->isReduced() && topSymbol->sortConstraintFree()) { topSymbol->computeBaseSort(d); d->setReduced(); } solution.bind(loneVariable.index, d); return true; } return false; } void AU_LhsAutomaton::determineRigidBlocks(Substitution& solution) { RigidBlock r; r.start = NONE; r.nrSubjectsForUs = 0; r.nrSubjectsToLeave = 0; r.firstMatch = NONE; // to avoid compiler warning rigidBlocks.clear(); nrSubjectsUsed = 0; int lastFlexPart = flexPart.length() - 1; int skip; for (int i = flexLeftPos; i <= flexRightPos; i += skip) { Subterm& f = flexPart[i]; skip = f.blockLength; if (skip == NOT_FIXED) { skip = 1; f.variable.nastyBinding = NONE; DagNode* d = solution.value(f.variable.index); if (d == 0) { // // Unbound variable terminates current rigid block (if there is one). // We treat variables with nasty bindings as being unbound // since we can't be sure how many subjects they will match. // if (r.start != NONE) { r.end = i - 1; rigidBlocks.append(r); r.start = NONE; r.nrSubjectsForUs = 0; r.nrSubjectsToLeave = 0; } if (!(f.variable.takeIdentity)) { ++r.nrSubjectsToLeave; // for this unbound variable ++nrSubjectsUsed; } } else { bool nasty; int n = topSymbol-> calculateNrSubjectsMatched(d, i == 0, i == lastFlexPart, nasty); nrSubjectsUsed += n; if (nasty) { DebugAdvisoryCheck(false, "nasty binding of " << d << " to variable with index " << f.variable.index << " detected in match phase"); Assert(matchAtTop, "can't have nasty binding without extension"); // // Unbound variable terminates current rigid block (if there is one). // We treat variables with nasty bindings as being unbound // since we can't be sure how many subjects they will match. // if (r.start != NONE) { r.end = i - 1; rigidBlocks.append(r); r.start = NONE; r.nrSubjectsForUs = 0; r.nrSubjectsToLeave = 0; } r.nrSubjectsToLeave += n; f.variable.nastyBinding = n; } else { r.nrSubjectsForUs += n; if (r.start == NONE) r.start = i; } } } else { r.nrSubjectsForUs += skip; nrSubjectsUsed += skip; if (r.start == NONE) r.start = i; } } // // End of flex part terminates current rigid block (if there is one). // if (r.start != NONE) { Assert(matchAtTop, "missing extension"); r.end = flexRightPos; rigidBlocks.append(r); nrSubjectsForRightVars = 0; } else nrSubjectsForRightVars = r.nrSubjectsToLeave; } Maude-2.6/src/AU_Theory/AU_Layer.hh0000644000147300135640000000633707666303243013777 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for a layer of nodes in an AU_Subproblem. // #ifndef _AU_Layer_hh_ #define _AU_Layer_hh_ #include "sequencePartition.hh" class AU_Layer { public: AU_Layer(); ~AU_Layer(); void initialize(AU_DagNode* subjectDag); void initializeFirst(int first, AU_ExtensionInfo* extension); void initializeLast(int last, AU_ExtensionInfo* extension); void addTopVariable(int index, int lowerBound, int upperBound, Sort* sort); void addNode(LocalBinding* difference, Subproblem* subproblem, int firstSubterm, int lastSubterm); void link(AU_Layer& nextLayer); void reset(); bool solvePatterns(bool findFirst, RewritingContext& solution, AU_Layer& nextLayer); bool solveVariables(bool findFirst, RewritingContext& solution); private: struct TopVariable { int index; int lowerBound; int upperBound; Sort* sort; // // For solve-time use // Bool boundByUs; Bool extraId; }; struct Node { LocalBinding* difference; Subproblem* subproblem; int firstSubterm; int lastSubterm; int downTarget; }; bool solvePatterns2(bool findFirst, RewritingContext& solution); SequencePartition* buildPartition(const Substitution& solution); bool solvePartition(bool findFirst); bool bindVariables(RewritingContext& solution); void unbindVariables(RewritingContext& solution); const AU_DagNode* subject; int lastSubjectSubterm; // index of last subterm in subject Bool oneSidedId; // true if subject has a one sided identity Bool leftId; // true if subject has left identity only Bool leftExtend; // have left extension before variable block Bool rightExtend; // have right extension after variable block int totalLowerBound; // sum of lowerBounds for prevVariables int totalUpperBound; // sum of upperBounds for prevVariables + extension AU_ExtensionInfo* extensionInfo; // for layers with leftExtend/rightExtend only Vector prevVariables; // variable block before rigid block Vector nodes; // nodes for a rigid blocks possible matchings // // For solve-time use // int selectedNode; // currently selected node int firstSubterm; // first subject subterm for variables int lastSubterm; // last subject subterm for variables SequencePartition* partition; // partitioning of subterms amongst variables }; inline void AU_Layer::reset() { selectedNode = 0; } #endif Maude-2.6/src/AU_Theory/AU_Term.hh0000644000147300135640000000725610272231377013626 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for terms in the A, AUl, AUr and AU theories. // #ifndef _AU_Term_hh_ #define _AU_Term_hh_ #include "term.hh" #include "variable.hh" #include "AU_Symbol.hh" class AU_Term : public Term { NO_COPYING(AU_Term); public: AU_Term(AU_Symbol* symbol, const Vector& arguments); // // Functions required by theory interface. // RawArgumentIterator* arguments(); void deepSelfDestruct(); Term* deepCopy2(SymbolMap* translator) const; Term* normalize(bool full, bool& changed); int compareArguments(const Term* other) const; int compareArguments(const DagNode* other) const; void findEagerVariables(bool atTop, NatSet& eagerVariables) const; void analyseConstraintPropagation(NatSet& boundUniquely) const; void analyseCollapses2(); void insertAbstractionVariables(VariableInfo& variableInfo); LhsAutomaton* compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely); void markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables); DagNode* dagify2(); void findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop); int compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif // // Functions particular to AU_Term. // AU_Symbol* symbol() const; bool idPossible(int index) const; private: struct Tuple { Term* term; short abstractionVariableIndex; // if subterm could enter our theory // we abstract it Bool collapseToOurSymbol; // 1st possible reason for variable abstraction Bool matchOurIdentity; // 2nd possible reason for variable abstraction }; struct CP_Sequence; AU_Term(const AU_Term& original, AU_Symbol* symbol, SymbolMap* translator); bool unitVariable(VariableTerm* vt, int index) const; void findConstraintPropagationSequence(const NatSet& boundUniquely, CP_Sequence& bestSequence) const; void findConstraintPropagationSequence(const Vector& currentSequence, const NatSet& boundUniquely, int leftPos, int rightPos, CP_Sequence& bestSequence) const; void addFixedLengthBlock(AU_LhsAutomaton* a, int blockStart, int blockEnd, const VariableInfo& variableInfo, const NatSet& boundUniquely, bool& subproblemLikely); Vector argArray; int uniqueCollapseSubtermIndex; friend class AU_ArgumentIterator; }; inline AU_Symbol* AU_Term::symbol() const { return safeCast(AU_Symbol*, Term::symbol()); } inline bool AU_Term::idPossible(int index) const { return (index > 0 && symbol()->rightId()) || (index < argArray.length() - 1 && symbol()->leftId()); } #endif Maude-2.6/src/AU_Theory/AU_ArgumentIterator.cc0000644000147300135640000000270107666303243016174 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_ArgumentIterator. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // AU theory class definitions #include "AU_ArgumentIterator.hh" bool AU_ArgumentIterator::valid() const { return position < argArray.length(); } Term* AU_ArgumentIterator::argument() const { Assert(position < argArray.length(), "no args left"); return argArray[position].term; } void AU_ArgumentIterator::next() { Assert(position < argArray.length(), "no args left"); ++position; } Maude-2.6/src/AU_Theory/AU_Layer.cc0000644000147300135640000002527307666303243013765 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_Layer. // // utility stuff #include "macros.hh" #include "vector.hh" #include "sequencePartition.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // interface class definitions #include "symbol.hh" #include "term.hh" #include "subproblem.hh" // core class definitions #include "rewritingContext.hh" #include "localBinding.hh" // AU theory class definitions #include "AU_Symbol.hh" // HACK #undef assert #include "AU_DagNode.hh" #include "AU_ExtensionInfo.hh" #include "AU_Layer.hh" AU_Layer::AU_Layer() { leftExtend = false; rightExtend = false; totalLowerBound = 0; totalUpperBound = 0; partition = 0; } AU_Layer::~AU_Layer() { int nrNodes = nodes.length(); for (int i = 0; i < nrNodes; i++) { Node& n = nodes[i]; delete n.difference; delete n.subproblem; } delete partition; } void AU_Layer::initialize(AU_DagNode* subjectDag) { subject = subjectDag; lastSubjectSubterm = subjectDag->argArray.length() - 1; AU_Symbol* s = subjectDag->symbol(); oneSidedId = s->oneSidedId(); leftId = s->leftId(); } void AU_Layer::initializeFirst(int first, AU_ExtensionInfo* extension) { firstSubterm = first; if (extension != 0) { extensionInfo = extension; leftExtend = true; totalUpperBound = UNBOUNDED; } } void AU_Layer::initializeLast(int last, AU_ExtensionInfo* extension) { lastSubterm = last; if (extension != 0) { extensionInfo = extension; rightExtend = true; totalUpperBound = UNBOUNDED; } } void AU_Layer::addTopVariable(int index, int lowerBound, int upperBound, Sort* sort) { int nrVariables = prevVariables.length(); prevVariables.expandBy(1); TopVariable& tv = prevVariables[nrVariables]; tv.index = index; tv.lowerBound = lowerBound; tv.upperBound = upperBound; tv.sort = sort; totalLowerBound += lowerBound; totalUpperBound = uplus(totalUpperBound, upperBound); } void AU_Layer::addNode(LocalBinding* difference, Subproblem* subproblem, int firstSubterm, int lastSubterm) { int nrNodes = nodes.length(); nodes.expandBy(1); Node& n = nodes[nrNodes]; n.difference = difference; n.subproblem = subproblem; n.firstSubterm = firstSubterm; n.lastSubterm = lastSubterm; n.downTarget = UNDEFINED; } void AU_Layer::link(AU_Layer& nextLayer) { int nrNodes = nodes.length(); int j = 0; int nextStart = nextLayer.nodes[j].firstSubterm - nextLayer.totalLowerBound; for (int i = 0; i < nrNodes; i++) { int lastSubterm = nodes[i].lastSubterm; while (nextStart <= lastSubterm) { ++j; Assert(j < nextLayer.nodes.length(), "could not find a valid target for node " << i); nextStart = nextLayer.nodes[j].firstSubterm - nextLayer.totalLowerBound; } nodes[i].downTarget = j; } } bool AU_Layer::solvePatterns(bool findFirst, RewritingContext& solution, AU_Layer& nextLayer) { if (solvePatterns2(findFirst, solution)) { Node& n = nodes[selectedNode]; lastSubterm = n.firstSubterm - 1; nextLayer.firstSubterm = n.lastSubterm + 1; nextLayer.selectedNode = n.downTarget; return true; } return false; } bool AU_Layer::solvePatterns2(bool findFirst, RewritingContext& solution) { int nrNodes = nodes.length(); for(; selectedNode < nrNodes; selectedNode++) { Node& n = nodes[selectedNode]; if (findFirst) { int d = n.firstSubterm - firstSubterm; Assert(d >= totalLowerBound, "insufficient subterms for previous variables"); if (d > totalUpperBound) break; if (n.difference != 0 && !(n.difference->assert(solution))) continue; } if (n.subproblem == 0) { if (findFirst) return true; } else { if (n.subproblem->solve(findFirst, solution)) return true; } if (n.difference != 0) n.difference->retract(solution); findFirst = true; } return false; } bool AU_Layer::solveVariables(bool findFirst, RewritingContext& solution) { if (findFirst) partition = buildPartition(solution); while (solvePartition(findFirst)) { if (bindVariables(solution)) return true; MemoryCell::okToCollectGarbage(); // to avoid build up of failed solutions findFirst = false; } unbindVariables(solution); delete partition; partition = 0; return false; } bool AU_Layer::solvePartition(bool findFirst) { if (oneSidedId) { int nrVariables = prevVariables.length(); if (!findFirst) { // // See if we can change existing solution by messing with extra // identities. // int nrVariables = prevVariables.length(); for (int i = nrVariables - 1; i >= 0; i--) { TopVariable& tv = prevVariables[i]; if (tv.boundByUs && !(tv.extraId)) { int start = firstSubterm + partition->start(i + leftExtend); int end = firstSubterm + partition->end(i + leftExtend); int nrSubterms = end - start + 1; if (nrSubterms > 0 && nrSubterms < tv.upperBound && (leftId ? (end < lastSubjectSubterm) : (start > 0))) { tv.extraId = true; for (i++; i < nrVariables; i++) { TopVariable& v = prevVariables[i]; if (v.boundByUs) v.extraId = false; } return true; } } } } for (int i = 0; i < nrVariables; i++) { TopVariable& tv = prevVariables[i]; if (tv.boundByUs) tv.extraId = false; } } return partition->solve(); } SequencePartition* AU_Layer::buildPartition(const Substitution& solution) { AU_Symbol* s = subject->symbol(); int nrVariables = prevVariables.length(); int nrParts = nrVariables + leftExtend + rightExtend; Assert(nrParts > 0, "no parts"); SequencePartition* p = new SequencePartition(lastSubterm - firstSubterm + 1, nrParts); if (leftExtend) p->insertPart(0, UNBOUNDED); for (int i = 0; i < nrVariables; i++) { TopVariable& v = prevVariables[i]; int min = v.lowerBound; int max = v.upperBound; DagNode* d = solution.value(v.index); if (d != 0) { v.boundByUs = false; bool leftExtreme = (i == 0 && firstSubterm == 0); bool rightExtreme = (i == nrVariables - 1 && lastSubterm == lastSubjectSubterm); bool nasty; min = max = s->calculateNrSubjectsMatched(d, leftExtreme, rightExtreme, nasty); DebugAdvisoryCheck(!nasty, "nasty binding of " << d << " to variable with index " << v.index << " detected in solve phase"); if (nasty && (leftId ? rightExtend : leftExtend)) { // // Because extension may take extreme end, matching one // less subterm is possible. // --min; } } else { v.boundByUs = true; // // Check for early occurrence of same variable in this block. // for (int j = 0; j < i; j++) { if (prevVariables[j].index == v.index) { v.boundByUs = false; break; } } } p->insertPart(min, max); } if (rightExtend) p->insertPart(0, UNBOUNDED); return p; } bool AU_Layer::bindVariables(RewritingContext& solution) { bool buildReducedNodes = subject->isReduced(); AU_Symbol* topSymbol = subject->symbol(); int nrVariables = prevVariables.length(); for (int i = 0; i < nrVariables; i++) { int start = firstSubterm + partition->start(i + leftExtend); int end = firstSubterm + partition->end(i + leftExtend); TopVariable& tv = prevVariables[i]; if (tv.boundByUs) { int nrSubterms = end - start + 1; if (nrSubterms == 0) { if (oneSidedId) { if (leftId ? (end == lastSubjectSubterm) : (start == 0)) return false; // can't assign one sided identity } solution.bind(tv.index, topSymbol->getIdentityDag()); } else { DagNode* d = subject->makeFragment(start, nrSubterms, oneSidedId && prevVariables[i].extraId); if (!(d->checkSort(tv.sort, solution))) return false; if (d->symbol() == topSymbol) { // // makeFragment() will have produced an AU_DagNode* // safeCast(AU_DagNode*, d)->setProducedByAssignment(); if (buildReducedNodes && d->getSortIndex() != Sort::SORT_UNKNOWN) d->setReduced(); } solution.bind(tv.index, d); } } else { DagNode* d = solution.value(tv.index); Assert(d != 0, "variable should be bound"); if (!(subject->eliminateForward(d, start, end) && start == end + 1)) return false; } } if (leftExtend) { if (!leftId) extensionInfo->setExtraIdentity(false); Assert(firstSubterm == 0, "non zero firstSubterm in left extension case"); int first = partition->end(0) + 1; extensionInfo->setFirstMatched(first); if (oneSidedId && !leftId && first != 0 && nrVariables > 0) { int nrMatched = partition->end(1) - first + 1; DagNode* d = solution.value(prevVariables[0].index); if (nrMatched == 0 || (d->symbol() == topSymbol && static_cast(d)->argArray.length() > nrMatched)) // FIX extensionInfo->setExtraIdentity(true); } } if (rightExtend) { if (leftId) extensionInfo->setExtraIdentity(false); int last = firstSubterm + partition->start(nrVariables + leftExtend) - 1; extensionInfo->setLastMatched(last); if (oneSidedId && leftId && last != lastSubjectSubterm && nrVariables > 0) { int nrMatched = partition->start(nrVariables + leftExtend) - partition->start(nrVariables - 1 + leftExtend); DagNode* d = solution.value(prevVariables[0].index); if (nrMatched == 0 || (d->symbol() == topSymbol && static_cast(d)->argArray.length() > nrMatched)) // FIX extensionInfo->setExtraIdentity(true); } } return true; } void AU_Layer::unbindVariables(RewritingContext& solution) { int nrVariables = prevVariables.length(); for (int i = 0; i < nrVariables; i++) { TopVariable& v = prevVariables[i]; if (v.boundByUs) solution.bind(v.index, 0); } } Maude-2.6/src/AU_Theory/AU_DequeDagArgumentIterator.cc0000644000147300135640000000265407666303243017603 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_DequeDagArgumentIterator. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Persistent.hh" // AU theory class definitions #include "AU_DequeDagArgumentIterator.hh" bool AU_DequeDagArgumentIterator::valid() const { return iter.valid(); } DagNode* AU_DequeDagArgumentIterator::argument() const { Assert(valid(), "no args left"); return iter.getDagNode(); } void AU_DequeDagArgumentIterator::next() { Assert(valid(), "no args left"); iter.next(); } Maude-2.6/src/AU_Theory/Makefile.in0000644000147300135640000012177711500303153014046 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/AU_Theory DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libAU_Theory_a_AR = $(AR) $(ARFLAGS) libAU_Theory_a_LIBADD = am_libAU_Theory_a_OBJECTS = libAU_Theory_a-AU_Symbol.$(OBJEXT) \ libAU_Theory_a-AU_DagNode.$(OBJEXT) \ libAU_Theory_a-AU_DequeDagNode.$(OBJEXT) \ libAU_Theory_a-AU_Term.$(OBJEXT) \ libAU_Theory_a-AU_DagArgumentIterator.$(OBJEXT) \ libAU_Theory_a-AU_DequeDagArgumentIterator.$(OBJEXT) \ libAU_Theory_a-AU_ExtensionInfo.$(OBJEXT) \ libAU_Theory_a-AU_RhsAutomaton.$(OBJEXT) \ libAU_Theory_a-AU_LhsAutomaton.$(OBJEXT) \ libAU_Theory_a-AU_ArgumentIterator.$(OBJEXT) \ libAU_Theory_a-AU_Layer.$(OBJEXT) \ libAU_Theory_a-AU_Subproblem.$(OBJEXT) libAU_Theory_a_OBJECTS = $(am_libAU_Theory_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libAU_Theory_a_SOURCES) DIST_SOURCES = $(libAU_Theory_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libAU_Theory.a libAU_Theory_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/AU_Persistent \ -I$(top_srcdir)/src/FullCompiler libAU_Theory_a_SOURCES = \ AU_Symbol.cc \ AU_DagNode.cc \ AU_DequeDagNode.cc \ AU_Term.cc \ AU_DagArgumentIterator.cc \ AU_DequeDagArgumentIterator.cc \ AU_ExtensionInfo.cc \ AU_RhsAutomaton.cc \ AU_LhsAutomaton.cc \ AU_ArgumentIterator.cc \ AU_Layer.cc \ AU_Subproblem.cc EXTRA_DIST = \ AU_DagOperations.cc \ AU_Normalize.cc \ AU_LhsCompiler.cc \ AU_Matcher.cc \ AU_CollapseMatcher.cc \ AU_FullMatcher.cc \ AU_GreedyMatcher.cc \ AU_DequeMatcher.cc \ ChangeLog.A_Theory noinst_HEADERS = \ AU_ArgumentIterator.hh \ AU_BaseDagNode.hh \ AU_DagArgumentIterator.hh \ AU_DagNode.hh \ AU_DequeDagArgumentIterator.hh \ AU_DequeDagNode.hh \ AU_ExtensionInfo.hh \ AU_Layer.hh \ AU_LhsAutomaton.hh \ AU_RhsAutomaton.hh \ AU_Subproblem.hh \ AU_Symbol.hh \ AU_Term.hh \ AU_Theory.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/AU_Theory/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/AU_Theory/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libAU_Theory.a: $(libAU_Theory_a_OBJECTS) $(libAU_Theory_a_DEPENDENCIES) -rm -f libAU_Theory.a $(libAU_Theory_a_AR) libAU_Theory.a $(libAU_Theory_a_OBJECTS) $(libAU_Theory_a_LIBADD) $(RANLIB) libAU_Theory.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_DagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_Layer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_Symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libAU_Theory_a-AU_Term.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libAU_Theory_a-AU_Symbol.o: AU_Symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Symbol.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Tpo" -c -o libAU_Theory_a-AU_Symbol.o `test -f 'AU_Symbol.cc' || echo '$(srcdir)/'`AU_Symbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Symbol.cc' object='libAU_Theory_a-AU_Symbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Symbol.o `test -f 'AU_Symbol.cc' || echo '$(srcdir)/'`AU_Symbol.cc libAU_Theory_a-AU_Symbol.obj: AU_Symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Symbol.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Tpo" -c -o libAU_Theory_a-AU_Symbol.obj `if test -f 'AU_Symbol.cc'; then $(CYGPATH_W) 'AU_Symbol.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Symbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Symbol.cc' object='libAU_Theory_a-AU_Symbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Symbol.obj `if test -f 'AU_Symbol.cc'; then $(CYGPATH_W) 'AU_Symbol.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Symbol.cc'; fi` libAU_Theory_a-AU_DagNode.o: AU_DagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DagNode.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Tpo" -c -o libAU_Theory_a-AU_DagNode.o `test -f 'AU_DagNode.cc' || echo '$(srcdir)/'`AU_DagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DagNode.cc' object='libAU_Theory_a-AU_DagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DagNode.o `test -f 'AU_DagNode.cc' || echo '$(srcdir)/'`AU_DagNode.cc libAU_Theory_a-AU_DagNode.obj: AU_DagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DagNode.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Tpo" -c -o libAU_Theory_a-AU_DagNode.obj `if test -f 'AU_DagNode.cc'; then $(CYGPATH_W) 'AU_DagNode.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DagNode.cc' object='libAU_Theory_a-AU_DagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DagNode.obj `if test -f 'AU_DagNode.cc'; then $(CYGPATH_W) 'AU_DagNode.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DagNode.cc'; fi` libAU_Theory_a-AU_DequeDagNode.o: AU_DequeDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DequeDagNode.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Tpo" -c -o libAU_Theory_a-AU_DequeDagNode.o `test -f 'AU_DequeDagNode.cc' || echo '$(srcdir)/'`AU_DequeDagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DequeDagNode.cc' object='libAU_Theory_a-AU_DequeDagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DequeDagNode.o `test -f 'AU_DequeDagNode.cc' || echo '$(srcdir)/'`AU_DequeDagNode.cc libAU_Theory_a-AU_DequeDagNode.obj: AU_DequeDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DequeDagNode.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Tpo" -c -o libAU_Theory_a-AU_DequeDagNode.obj `if test -f 'AU_DequeDagNode.cc'; then $(CYGPATH_W) 'AU_DequeDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DequeDagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DequeDagNode.cc' object='libAU_Theory_a-AU_DequeDagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DequeDagNode.obj `if test -f 'AU_DequeDagNode.cc'; then $(CYGPATH_W) 'AU_DequeDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DequeDagNode.cc'; fi` libAU_Theory_a-AU_Term.o: AU_Term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Term.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Term.Tpo" -c -o libAU_Theory_a-AU_Term.o `test -f 'AU_Term.cc' || echo '$(srcdir)/'`AU_Term.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Term.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Term.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Term.cc' object='libAU_Theory_a-AU_Term.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Term.o `test -f 'AU_Term.cc' || echo '$(srcdir)/'`AU_Term.cc libAU_Theory_a-AU_Term.obj: AU_Term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Term.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Term.Tpo" -c -o libAU_Theory_a-AU_Term.obj `if test -f 'AU_Term.cc'; then $(CYGPATH_W) 'AU_Term.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Term.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Term.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Term.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Term.cc' object='libAU_Theory_a-AU_Term.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Term.obj `if test -f 'AU_Term.cc'; then $(CYGPATH_W) 'AU_Term.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Term.cc'; fi` libAU_Theory_a-AU_DagArgumentIterator.o: AU_DagArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DagArgumentIterator.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Tpo" -c -o libAU_Theory_a-AU_DagArgumentIterator.o `test -f 'AU_DagArgumentIterator.cc' || echo '$(srcdir)/'`AU_DagArgumentIterator.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DagArgumentIterator.cc' object='libAU_Theory_a-AU_DagArgumentIterator.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DagArgumentIterator.o `test -f 'AU_DagArgumentIterator.cc' || echo '$(srcdir)/'`AU_DagArgumentIterator.cc libAU_Theory_a-AU_DagArgumentIterator.obj: AU_DagArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DagArgumentIterator.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Tpo" -c -o libAU_Theory_a-AU_DagArgumentIterator.obj `if test -f 'AU_DagArgumentIterator.cc'; then $(CYGPATH_W) 'AU_DagArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DagArgumentIterator.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DagArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DagArgumentIterator.cc' object='libAU_Theory_a-AU_DagArgumentIterator.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DagArgumentIterator.obj `if test -f 'AU_DagArgumentIterator.cc'; then $(CYGPATH_W) 'AU_DagArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DagArgumentIterator.cc'; fi` libAU_Theory_a-AU_DequeDagArgumentIterator.o: AU_DequeDagArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DequeDagArgumentIterator.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Tpo" -c -o libAU_Theory_a-AU_DequeDagArgumentIterator.o `test -f 'AU_DequeDagArgumentIterator.cc' || echo '$(srcdir)/'`AU_DequeDagArgumentIterator.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DequeDagArgumentIterator.cc' object='libAU_Theory_a-AU_DequeDagArgumentIterator.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DequeDagArgumentIterator.o `test -f 'AU_DequeDagArgumentIterator.cc' || echo '$(srcdir)/'`AU_DequeDagArgumentIterator.cc libAU_Theory_a-AU_DequeDagArgumentIterator.obj: AU_DequeDagArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_DequeDagArgumentIterator.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Tpo" -c -o libAU_Theory_a-AU_DequeDagArgumentIterator.obj `if test -f 'AU_DequeDagArgumentIterator.cc'; then $(CYGPATH_W) 'AU_DequeDagArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DequeDagArgumentIterator.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_DequeDagArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_DequeDagArgumentIterator.cc' object='libAU_Theory_a-AU_DequeDagArgumentIterator.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_DequeDagArgumentIterator.obj `if test -f 'AU_DequeDagArgumentIterator.cc'; then $(CYGPATH_W) 'AU_DequeDagArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/AU_DequeDagArgumentIterator.cc'; fi` libAU_Theory_a-AU_ExtensionInfo.o: AU_ExtensionInfo.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_ExtensionInfo.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Tpo" -c -o libAU_Theory_a-AU_ExtensionInfo.o `test -f 'AU_ExtensionInfo.cc' || echo '$(srcdir)/'`AU_ExtensionInfo.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_ExtensionInfo.cc' object='libAU_Theory_a-AU_ExtensionInfo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_ExtensionInfo.o `test -f 'AU_ExtensionInfo.cc' || echo '$(srcdir)/'`AU_ExtensionInfo.cc libAU_Theory_a-AU_ExtensionInfo.obj: AU_ExtensionInfo.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_ExtensionInfo.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Tpo" -c -o libAU_Theory_a-AU_ExtensionInfo.obj `if test -f 'AU_ExtensionInfo.cc'; then $(CYGPATH_W) 'AU_ExtensionInfo.cc'; else $(CYGPATH_W) '$(srcdir)/AU_ExtensionInfo.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_ExtensionInfo.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_ExtensionInfo.cc' object='libAU_Theory_a-AU_ExtensionInfo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_ExtensionInfo.obj `if test -f 'AU_ExtensionInfo.cc'; then $(CYGPATH_W) 'AU_ExtensionInfo.cc'; else $(CYGPATH_W) '$(srcdir)/AU_ExtensionInfo.cc'; fi` libAU_Theory_a-AU_RhsAutomaton.o: AU_RhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_RhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Tpo" -c -o libAU_Theory_a-AU_RhsAutomaton.o `test -f 'AU_RhsAutomaton.cc' || echo '$(srcdir)/'`AU_RhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_RhsAutomaton.cc' object='libAU_Theory_a-AU_RhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_RhsAutomaton.o `test -f 'AU_RhsAutomaton.cc' || echo '$(srcdir)/'`AU_RhsAutomaton.cc libAU_Theory_a-AU_RhsAutomaton.obj: AU_RhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_RhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Tpo" -c -o libAU_Theory_a-AU_RhsAutomaton.obj `if test -f 'AU_RhsAutomaton.cc'; then $(CYGPATH_W) 'AU_RhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/AU_RhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_RhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_RhsAutomaton.cc' object='libAU_Theory_a-AU_RhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_RhsAutomaton.obj `if test -f 'AU_RhsAutomaton.cc'; then $(CYGPATH_W) 'AU_RhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/AU_RhsAutomaton.cc'; fi` libAU_Theory_a-AU_LhsAutomaton.o: AU_LhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_LhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Tpo" -c -o libAU_Theory_a-AU_LhsAutomaton.o `test -f 'AU_LhsAutomaton.cc' || echo '$(srcdir)/'`AU_LhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_LhsAutomaton.cc' object='libAU_Theory_a-AU_LhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_LhsAutomaton.o `test -f 'AU_LhsAutomaton.cc' || echo '$(srcdir)/'`AU_LhsAutomaton.cc libAU_Theory_a-AU_LhsAutomaton.obj: AU_LhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_LhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Tpo" -c -o libAU_Theory_a-AU_LhsAutomaton.obj `if test -f 'AU_LhsAutomaton.cc'; then $(CYGPATH_W) 'AU_LhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/AU_LhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_LhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_LhsAutomaton.cc' object='libAU_Theory_a-AU_LhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_LhsAutomaton.obj `if test -f 'AU_LhsAutomaton.cc'; then $(CYGPATH_W) 'AU_LhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/AU_LhsAutomaton.cc'; fi` libAU_Theory_a-AU_ArgumentIterator.o: AU_ArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_ArgumentIterator.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Tpo" -c -o libAU_Theory_a-AU_ArgumentIterator.o `test -f 'AU_ArgumentIterator.cc' || echo '$(srcdir)/'`AU_ArgumentIterator.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_ArgumentIterator.cc' object='libAU_Theory_a-AU_ArgumentIterator.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_ArgumentIterator.o `test -f 'AU_ArgumentIterator.cc' || echo '$(srcdir)/'`AU_ArgumentIterator.cc libAU_Theory_a-AU_ArgumentIterator.obj: AU_ArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_ArgumentIterator.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Tpo" -c -o libAU_Theory_a-AU_ArgumentIterator.obj `if test -f 'AU_ArgumentIterator.cc'; then $(CYGPATH_W) 'AU_ArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/AU_ArgumentIterator.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_ArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_ArgumentIterator.cc' object='libAU_Theory_a-AU_ArgumentIterator.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_ArgumentIterator.obj `if test -f 'AU_ArgumentIterator.cc'; then $(CYGPATH_W) 'AU_ArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/AU_ArgumentIterator.cc'; fi` libAU_Theory_a-AU_Layer.o: AU_Layer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Layer.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Layer.Tpo" -c -o libAU_Theory_a-AU_Layer.o `test -f 'AU_Layer.cc' || echo '$(srcdir)/'`AU_Layer.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Layer.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Layer.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Layer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Layer.cc' object='libAU_Theory_a-AU_Layer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Layer.o `test -f 'AU_Layer.cc' || echo '$(srcdir)/'`AU_Layer.cc libAU_Theory_a-AU_Layer.obj: AU_Layer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Layer.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Layer.Tpo" -c -o libAU_Theory_a-AU_Layer.obj `if test -f 'AU_Layer.cc'; then $(CYGPATH_W) 'AU_Layer.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Layer.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Layer.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Layer.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Layer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Layer.cc' object='libAU_Theory_a-AU_Layer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Layer.obj `if test -f 'AU_Layer.cc'; then $(CYGPATH_W) 'AU_Layer.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Layer.cc'; fi` libAU_Theory_a-AU_Subproblem.o: AU_Subproblem.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Subproblem.o -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Tpo" -c -o libAU_Theory_a-AU_Subproblem.o `test -f 'AU_Subproblem.cc' || echo '$(srcdir)/'`AU_Subproblem.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Subproblem.cc' object='libAU_Theory_a-AU_Subproblem.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Subproblem.o `test -f 'AU_Subproblem.cc' || echo '$(srcdir)/'`AU_Subproblem.cc libAU_Theory_a-AU_Subproblem.obj: AU_Subproblem.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAU_Theory_a-AU_Subproblem.obj -MD -MP -MF "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Tpo" -c -o libAU_Theory_a-AU_Subproblem.obj `if test -f 'AU_Subproblem.cc'; then $(CYGPATH_W) 'AU_Subproblem.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Subproblem.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Tpo" "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Po"; else rm -f "$(DEPDIR)/libAU_Theory_a-AU_Subproblem.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AU_Subproblem.cc' object='libAU_Theory_a-AU_Subproblem.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAU_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAU_Theory_a-AU_Subproblem.obj `if test -f 'AU_Subproblem.cc'; then $(CYGPATH_W) 'AU_Subproblem.cc'; else $(CYGPATH_W) '$(srcdir)/AU_Subproblem.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/AU_Theory/AU_LhsAutomaton.cc0000644000147300135640000002425707666303243015330 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_LhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "AU_Persistent.hh" #include "AU_Theory.hh" // interface class definitions #include "associativeSymbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "variableSymbol.hh" #include "variableTerm.hh" #include "variableInfo.hh" #include "subproblemSequence.hh" #include "subproblemDisjunction.hh" #include "subproblemAccumulator.hh" #include "disjunctiveSubproblemAccumulator.hh" #include "substitution.hh" #include "localBinding.hh" #include "variableAbstractionSubproblem.hh" #include "equalitySubproblem.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_DequeDagNode.hh" #include "AU_LhsAutomaton.hh" #include "AU_Subproblem.hh" #include "AU_ExtensionInfo.hh" // our stuff #include "AU_DequeMatcher.cc" #include "AU_GreedyMatcher.cc" #include "AU_Matcher.cc" #include "AU_CollapseMatcher.cc" #include "AU_FullMatcher.cc" AU_LhsAutomaton::AU_LhsAutomaton(AU_Symbol* symbol, bool matchAtTop, bool collapsePossible, LhsAutomaton* uniqueCollapseAutomaton, int nrVariables) : topSymbol(symbol), matchAtTop(matchAtTop), collapsePossible(collapsePossible), uniqueCollapseAutomaton(uniqueCollapseAutomaton), local(nrVariables), scratch(nrVariables) { wholeLowerBound = 0; wholeUpperBound = matchAtTop ? UNBOUNDED : 0; flexLowerBound = 0; flexUpperBound = matchAtTop ? UNBOUNDED : 0; } AU_LhsAutomaton::~AU_LhsAutomaton() { delete uniqueCollapseAutomaton; int nrRigid = rigidPart.length(); for (int i = 0; i < nrRigid; i++) { Subterm& r = rigidPart[i]; if (r.type == NON_GROUND_ALIEN) delete r.alienAutomaton; } int nrFlex = flexPart.length(); for (int i = 0; i < nrFlex; i++) { Subterm& f = flexPart[i]; if (f.type == VARIABLE) delete f.variable.abstracted; else if (f.type == NON_GROUND_ALIEN) delete f.alienAutomaton; } } void AU_LhsAutomaton::updateWholeBounds(int min, int max) { wholeLowerBound += min; wholeUpperBound = uplus(wholeUpperBound, max); } void AU_LhsAutomaton::updateFlexBounds(int min, int max) { flexLowerBound += min; flexUpperBound = uplus(flexUpperBound, max); } void AU_LhsAutomaton::addRigidVariable(const VariableTerm* variable, bool leftEnd, bool idPossible) { Sort* s = variable->getSort(); int upperBound = topSymbol->sortBound(s); bool takeIdentity = idPossible && topSymbol->takeIdentity(s); updateWholeBounds(takeIdentity ? 0 : 1, upperBound); int nrRigid = rigidPart.length(); rigidPart.expandBy(1); Subterm& r = rigidPart[nrRigid]; r.type = VARIABLE; r.leftEnd = leftEnd; r.variable.index = variable->getIndex(); r.variable.sort = s; r.variable.upperBound = upperBound; r.variable.takeIdentity = takeIdentity; r.variable.awkward = false; r.variable.abstracted = 0; } void AU_LhsAutomaton::addRigidGroundAlien(Term* alien, bool leftEnd) { updateWholeBounds(1, 1); int nrRigid = rigidPart.length(); rigidPart.expandBy(1); Subterm& r = rigidPart[nrRigid]; r.type = GROUND_ALIEN; r.leftEnd = leftEnd; r.groundAlien = alien; } void AU_LhsAutomaton::addRigidNonGroundAlien(LhsAutomaton* automaton, bool leftEnd) { updateWholeBounds(1, 1); int nrRigid = rigidPart.length(); rigidPart.expandBy(1); Subterm& r = rigidPart[nrRigid]; r.type = NON_GROUND_ALIEN; r.leftEnd = leftEnd; r.alienAutomaton = automaton; } void AU_LhsAutomaton::addFlexVariable(const VariableTerm* variable, int shiftFactor, bool idPossible) { Sort* s = variable->getSort(); int upperBound = topSymbol->sortBound(s); bool takeIdentity = idPossible && topSymbol->takeIdentity(s); int lowerBound = takeIdentity ? 0 : 1; updateWholeBounds(lowerBound, upperBound); updateFlexBounds(lowerBound, upperBound); int nrFlex = flexPart.length(); flexPart.expandBy(1); Subterm& f = flexPart[nrFlex]; f.type = VARIABLE; f.shiftFactor = shiftFactor; f.variable.index = variable->getIndex(); f.variable.sort = s; f.variable.upperBound = upperBound; f.variable.takeIdentity = takeIdentity; f.variable.awkward = matchAtTop && !idPossible && topSymbol->takeIdentity(s); f.variable.abstracted = 0; } void AU_LhsAutomaton::addFlexAbstractionVariable(int index, Sort* sort, int upperBound, bool takeIdentity, bool awkward, LhsAutomaton* abstracted) { int lowerBound = takeIdentity ? 0 : 1; updateWholeBounds(lowerBound, upperBound); updateFlexBounds(lowerBound, upperBound); int nrFlex = flexPart.length(); flexPart.expandBy(1); Subterm& f = flexPart[nrFlex]; f.type = VARIABLE; f.shiftFactor = UNDEFINED; f.variable.index = index; f.variable.sort = sort; f.variable.upperBound = upperBound; f.variable.takeIdentity = takeIdentity; f.variable.awkward = awkward; f.variable.abstracted = abstracted; } void AU_LhsAutomaton::addFlexGroundAlien(Term* alien, int shiftFactor) { updateWholeBounds(1, 1); updateFlexBounds(1, 1); int nrFlex = flexPart.length(); flexPart.expandBy(1); Subterm& f = flexPart[nrFlex]; f.type = GROUND_ALIEN; f.shiftFactor = shiftFactor; f.groundAlien = alien; } void AU_LhsAutomaton::addFlexNonGroundAlien(LhsAutomaton* automaton, int shiftFactor) { updateWholeBounds(1, 1); updateFlexBounds(1, 1); int nrFlex = flexPart.length(); flexPart.expandBy(1); Subterm& f = flexPart[nrFlex]; f.type = NON_GROUND_ALIEN; f.shiftFactor = shiftFactor; f.alienAutomaton = automaton; } void AU_LhsAutomaton::complete(MatchStrategy strategy) { int nrFixed = 0; for(int i = flexPart.length() - 1; i >= 0; i--) { Subterm& f = flexPart[i]; if (f.shiftFactor < 0) { f.blockLength = NOT_FIXED; nrFixed = 0; } else f.blockLength = ++nrFixed; } matchStrategy = strategy; } #ifdef DUMP void AU_LhsAutomaton::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{AU_LhsAutomaton}\n"; ++indentLevel; s << Indent(indentLevel) << "topSymbol = \"" << topSymbol << "\"\tmatchAtTop = " << matchAtTop << "\tcollapsePossible = " << collapsePossible << "\tmatchStrategy = " << matchStrategy << '\n'; if (uniqueCollapseAutomaton != 0) { s << Indent(indentLevel) << "uniqueCollapseAutomaton =\n"; uniqueCollapseAutomaton->dump(s, variableInfo, indentLevel + 1); } s << Indent(indentLevel) << "wholeLowerBound = " << wholeLowerBound << "\twholeUpperBound = " << wholeUpperBound << '\n'; s << Indent(indentLevel) << "flexLowerBound = " << flexLowerBound << "\tflexUpperBound = " << flexUpperBound << '\n'; s << Indent(indentLevel) << "rigidPart:\n"; ++indentLevel; for (int i = 0; i < rigidPart.length(); i++) { Subterm& r = rigidPart[i]; s << Indent(indentLevel) << "type = " << r.type << "\tleftEnd = " << r.leftEnd; switch (r.type) { case VARIABLE: { s << "\tindex = " << r.variable.index << " \"" << variableInfo.index2Variable(r.variable.index) << "\"\n"; s << Indent(indentLevel) << "sort = " << r.variable.sort << "\tupperBound = " << r.variable.upperBound << "\ttakeIdentity = " << r.variable.takeIdentity << '\n'; break; } case GROUND_ALIEN: { s << "\tgroundAlien = " << r.groundAlien << '\n'; break; } case NON_GROUND_ALIEN: { s << "\talienAutomaton =\n"; r.alienAutomaton->dump(s, variableInfo, indentLevel + 1); break; } } } s << Indent(indentLevel - 1) << "flex part:\n"; for (int i = 0; i < flexPart.length(); i++) { Subterm& f = flexPart[i]; s << Indent(indentLevel) << "type = " << f.type << "\tshiftFactor = " << f.shiftFactor << "\tblockLength = " << f.blockLength; switch (f.type) { case VARIABLE: { s << "\tindex = " << f.variable.index; if (f.variable.abstracted == 0) s << " \"" << variableInfo.index2Variable(f.variable.index) << '"'; s << '\n' << Indent(indentLevel) << "sort = " << f.variable.sort << "\tupperBound = " << f.variable.upperBound << "\ttakeIdentity = " << bool(f.variable.takeIdentity) << "\tawkward = " << bool(f.variable.awkward) << '\n'; if (f.variable.abstracted != 0) { s << Indent(indentLevel) << "abstracted = " << '\n'; f.variable.abstracted->dump(s, variableInfo, indentLevel + 1); } break; } case GROUND_ALIEN: { s << "\tgroundAlien = " << f.groundAlien << '\n'; break; } case NON_GROUND_ALIEN: { s << "\talienAutomaton =\n"; f.alienAutomaton->dump(s, variableInfo, indentLevel + 1); break; } } } s << Indent(indentLevel - 2) << "End{AU_LhsAutomaton}\n"; } ostream& operator<<(ostream& s, AU_LhsAutomaton::MatchStrategy strategy) { static const char* const names[] = {"GROUND_OUT", "LONE_VARIABLE", "FAST_LONE_VARIABLE", "GREEDY", "FULL"}; s << names[strategy]; return s; } ostream& operator<<(ostream& s, AU_LhsAutomaton::SubtermType type) { static const char* const names[] = {"VARIABLE", "GROUND_ALIEN", "NON_GROUND_ALIEN"}; s << names[type]; return s; } #endif Maude-2.6/src/AU_Theory/AU_FullMatcher.cc0000644000147300135640000001772711347776403015127 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for full A/AU matcher flex part. // bool AU_LhsAutomaton::fullMatch(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems, AU_ExtensionInfo* extensionInfo) { AU_Subproblem* subproblem = buildLeftmostPath(subject, solution, extensionInfo); if (subproblem == 0) return false; subproblems.add(subproblem); addVariableBlocks(solution, subproblem, subproblems); addRemainingPaths(subject, solution, subproblem); subproblem->complete(); if (extensionInfo != 0) extensionInfo->setValidAfterMatch(false); return true; } void AU_LhsAutomaton::addVariableBlocks(Substitution& solution, AU_Subproblem* subproblem, SubproblemAccumulator& subproblems) { int nrVariables = solution.nrFragileBindings(); int layerNr = 0; bool rigidEncountered = false; int skip; for (int i = flexLeftPos; i <= flexRightPos; i += skip) { Subterm& f = flexPart[i]; skip = f.blockLength; if (skip == NOT_FIXED) { skip = 1; TopVariable& tv = f.variable; int index = tv.index; DagNode* d = solution.value(index); if (d == 0) { if (rigidEncountered) { rigidEncountered = false; ++layerNr; } subproblem->addTopVariable(layerNr, index, tv.takeIdentity || tv.awkward ? 0 : 1, tv.upperBound, tv.sort); if (tv.abstracted != 0) { subproblems.add (new VariableAbstractionSubproblem(tv.abstracted, index, nrVariables)); } continue; } else if (tv.nastyBinding != NONE) { if (rigidEncountered) { rigidEncountered = false; ++layerNr; } subproblem->addTopVariable(layerNr, index, tv.nastyBinding - 1, tv.nastyBinding, tv.sort); continue; } } rigidEncountered = true; } } bool AU_LhsAutomaton::fullMatchRigidBlock(AU_DagNode* subject, Substitution& solution, RigidBlock& block, int minShift, int maxShift, int& matchShift, Subproblem*& subproblem) { Assert(minShift <= maxShift, "bad shift range"); Assert(block.start <= block.end, "bad block range"); int shiftFactor; for (int i = minShift; i <= maxShift; i += shiftFactor) { local.copy(solution); // make a local copy for matching at shift i if (fullMatchRigidBlock2(subject, block, i, subproblem, shiftFactor)) { matchShift = i; return true; } } return false; } bool AU_LhsAutomaton::fullMatchRigidBlock2(AU_DagNode* subject, RigidBlock& block, int nextSubject, Subproblem*& subproblem, int& shiftFactor) { ArgVec& args = subject->argArray; SubproblemAccumulator subproblems; shiftFactor = 1; // default shift increment int skip; for (int i = block.start; i <= block.end; i += skip) { Subterm& f = flexPart[i]; skip = f.blockLength; if (skip == NOT_FIXED) { DagNode* d = local.value(f.variable.index); Assert(d != 0, "unbound variable in rigid block"); if (!(subject->eliminateForward(d, nextSubject, rightPos))) // better limit? return false; skip = 1; } else { int sf; int t = fullMatchFixedLengthBlock(args, i, nextSubject, subproblems, sf); if (sf > shiftFactor) shiftFactor = sf; if (!t) return false; nextSubject += skip; } } subproblem = subproblems.extractSubproblem(); return true; } bool AU_LhsAutomaton::fullMatchFixedLengthBlock(ArgVec& args, int blockStart, int attemptedShift, SubproblemAccumulator& subproblems, int& shiftFactor) { // // could we merge this with greedyMatchFixedLengthBlock()? // pass subproblems as a pointer and have it 0 for greedy // // for (int i = flexPart[blockStart].blockLength - 1; i >= 0; i--) { Subterm& f = flexPart[blockStart + i]; DagNode* d = args[attemptedShift + i]; Assert(d->getSortIndex() != Sort::SORT_UNKNOWN, "unknown sort for AU argument " << d << " at index " << attemptedShift + i << " topSymbol = " << topSymbol << " blockStart = " << blockStart); shiftFactor = f.shiftFactor; switch (f.type) { case VARIABLE: { Assert(f.variable.upperBound == 1 && !f.variable.takeIdentity, "non-unit variable in fixed length block"); DagNode* v = local.value(f.variable.index); if (v == 0) { if (d->leq(f.variable.sort)) local.bind(f.variable.index, d); else return false; } else { Assert(v->symbol() != topSymbol, "illegal binding to unit variable"); if (!(v->equal(d))) return false; } break; } case GROUND_ALIEN: { if (!(f.groundAlien->equal(d))) return false; break; } case NON_GROUND_ALIEN: { Subproblem* sp; if (!(f.alienAutomaton->match(d, local, sp))) return false; subproblems.add(sp); break; } } } return true; } AU_Subproblem* AU_LhsAutomaton::buildLeftmostPath(AU_DagNode* subject, Substitution& solution, AU_ExtensionInfo* extensionInfo) { int nrRigid = rigidBlocks.length(); Assert(extensionInfo != 0 || nrRigid == 0 || (rigidBlocks[0].start > flexLeftPos && rigidBlocks[nrRigid - 1].end < flexRightPos), "missing unbound variable(s)"); int spare = rightPos - leftPos + 1 - nrSubjectsUsed; if (spare < 0) return 0; int nextSubject = leftPos; AU_Subproblem* subproblem = new AU_Subproblem(subject, leftPos, rightPos, nrRigid + 1, extensionInfo); for (int i = 0; i < nrRigid; i++) { RigidBlock& r = rigidBlocks[i]; int min = nextSubject + r.nrSubjectsToLeave; int max = min + spare; int matchShift; Subproblem* sp; if (!fullMatchRigidBlock(subject, solution, r, min, max, matchShift, sp)) { delete subproblem; return 0; } r.firstMatch = matchShift; nextSubject = matchShift + r.nrSubjectsForUs; spare -= matchShift - min; subproblem->addNode(i, local - solution, sp, matchShift, nextSubject - 1); } return subproblem; } void AU_LhsAutomaton::addRemainingPaths(AU_DagNode* subject, Substitution& solution, AU_Subproblem* subproblem) { int firstUnusable = rightPos + 1 - nrSubjectsForRightVars; for (int i = rigidBlocks.length() - 1; i >= 0; i--) { RigidBlock& r = rigidBlocks[i]; int max = firstUnusable - r.nrSubjectsForUs; int min = r.firstMatch + 1; firstUnusable = r.firstMatch; while (max >= min) { int matchShift; Subproblem* sp; if (fullMatchRigidBlock(subject, solution, r, min, max, matchShift, sp)) { subproblem->addNode(i, local - solution, sp, matchShift, matchShift + r.nrSubjectsForUs - 1); firstUnusable = matchShift; min = matchShift + 1; } else break; } firstUnusable -= r.nrSubjectsToLeave; } } Maude-2.6/src/AU_Theory/AU_DequeDagNode.hh0000644000147300135640000000527610714453503015202 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for A and AU dag nodes based on persistent deques. // #ifndef _AU_DequeDagNode_hh_ #define _AU_DequeDagNode_hh_ #include "AU_BaseDagNode.hh" #include "AU_Deque.hh" class AU_DequeDagNode : public AU_BaseDagNode { NO_COPYING(AU_DequeDagNode); public: AU_DequeDagNode(AU_Symbol* symbol, const AU_Deque& original); // // Functions required by theory interface. // RawDagArgumentIterator* arguments(); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); DagNode* copyWithReplacement(int argIndex, DagNode* replacement); DagNode* copyWithReplacement(Vector& redexStack, int first, int last); void stackArguments(Vector& stack, int parentIndex, bool respectFrozen); // // Functions required to handle extension information. // ExtensionInfo* makeExtensionInfo(); // // Interface for narrowing. // // This is needed to remove any deque nodes from dag being narrowed since // unification and narrowing functionality doesn't support them. // bool indexVariables2(NarrowingVariableInfo& indices, int baseIndex); // // Functions particular to AU_DequeDagNode. // int nrArgs() const; const AU_Deque& getDeque() const; static AU_DagNode* dequeToArgVec(AU_DequeDagNode* original); private: // // Functions required by theory interface. // DagNode* markArguments(); DagNode* copyEagerUptoReduced2(); void clearCopyPointers2(); AU_Deque deque; }; inline AU_DequeDagNode::AU_DequeDagNode(AU_Symbol* symbol, const AU_Deque& original) : AU_BaseDagNode(symbol), deque(original) { setNormalizationStatus(DEQUE); } inline int AU_DequeDagNode::nrArgs() const { return deque.length(); } inline const AU_Deque& AU_DequeDagNode::getDeque() const { return deque; } #endif Maude-2.6/src/AU_Theory/AU_CollapseMatcher.cc0000644000147300135640000002406611104704362015743 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for matching where AU top symbol collapses. // bool AU_LhsAutomaton::uniqueCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { // // Because one subterm cannot take the identity element we can only // collapse to that subterm. // Every other subterm will be a variable that can take identity. For a // match to be possible it either must be already bound to identity or is // now bound to identity. // Term* identity = topSymbol->getIdentity(); int rigidLength = rigidPart.length(); for (int i = 0; i < rigidLength; i++) { Subterm& r = rigidPart[i]; if (r.type == VARIABLE && r.variable.takeIdentity) { int index = r.variable.index; DagNode* d = solution.value(index); if (d == 0) { // // The only way an unbound variable that can take // identity can be in the rigid part is if it is // supposed to be bound by the unique subterm we will // collapse to. We need to bind it to identity to ensure // we don't produce a false match by binding it to // something else. // solution.bind(index, topSymbol->getIdentityDag()); } else { if(!(identity->equal(d))) return false; } Assert(!r.variable.abstracted, "abstraction varible in rigid part"); } } SubproblemAccumulator subproblems; int flexLength = flexPart.length(); for (int i = 0; i < flexLength; i++) { Subterm& f = flexPart[i]; if (f.type == VARIABLE && f.variable.takeIdentity) { // // BUG: If f is an awkward variable or awkward abstraction variable // then it could be our uniqueCollapseSubterm even though // f.variable.takeIdentity is true. Need to find a clean way of // handling awkward variables. // // 11/6/08: This probably isn't a bug since awkward variables no longer get // their takeIdentity flags set to true. // int index = f.variable.index; DagNode* d = solution.value(index); if (d == 0) solution.bind(index, topSymbol->getIdentityDag()); else { if(!(identity->equal(d))) return false; } if (f.variable.abstracted != 0) { Subproblem* subproblem; if(!(f.variable.abstracted->match(solution.value(index), solution, subproblem))) return false; subproblems.add(subproblem); } } } Subproblem* subproblem; if (!(uniqueCollapseAutomaton->match(subject,solution, subproblem, extensionInfo))) return false; subproblems.add(subproblem); returnedSubproblem = subproblems.extractSubproblem(); return true; } void AU_LhsAutomaton::bindUnboundVariablesToIdentity(Substitution& solution, int exception) { int nrFlexVariables = flexPart.length(); for (int i = 0; i < nrFlexVariables; i++) { Assert(flexPart[i].type == VARIABLE && flexPart[i].variable.takeIdentity, "non variable in multiway collapse"); if (i != exception) { int index = flexPart[i].variable.index; if (solution.value(index) == 0) solution.bind(index, topSymbol->getIdentityDag()); } } } bool AU_LhsAutomaton::multiwayCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { Term* identity = topSymbol->getIdentity(); int matchingVariable = NONE; bool rigidMatchingVariable = false; int rigidLength = rigidPart.length(); for (int i = 0; i < rigidLength; i++) { Assert(rigidPart[i].type == VARIABLE, "non variable in multiway collapse"); TopVariable& tv = rigidPart[i].variable; Assert(tv.takeIdentity, "variable can't take identity"); DagNode* d = solution.value(tv.index); Assert(d != 0, "unbound variable that can take identity in rigid part"); if (!(identity->equal(d))) { if (matchingVariable != NONE) // repeated variable fails 2nd time around return false; matchingVariable = i; rigidMatchingVariable = true; } } int lastViableVariable = NONE; int nrViableVariables = 0; int nrFlexVariables = flexPart.length(); for (int i = 0; i < nrFlexVariables; i++) { Assert(flexPart[i].type == VARIABLE, "non variable in multiway collapse"); TopVariable& tv = flexPart[i].variable; Assert(tv.takeIdentity, "variable can't take identity"); DagNode* d = solution.value(tv.index); if (d != 0) { if (!(identity->equal(d))) { if (matchingVariable != NONE) // repeated variable fails 2nd time around return false; matchingVariable = i; } } else { // // If variable is repeated under AU symbol then we will have // nrViableVariables >= 2 and we will get failure when we try to // match repeated variable against non-identity because it // will already be bound to identity by other instance. Somewhat // inefficient especially if alien extension is involved but // this is a rare case. // lastViableVariable = i; ++nrViableVariables; } } if (matchingVariable != NONE) { // // Exactly one variable was bound to something other than our identity. // TopVariable& mv = rigidMatchingVariable ? rigidPart[matchingVariable].variable : flexPart[matchingVariable].variable; bool r = subject->matchVariable(mv.index, mv.sort, matchAtTop, solution, returnedSubproblem, extensionInfo); if (r) bindUnboundVariablesToIdentity(solution, NONE); return r; } // // At this point all variables are either: // (a) bound to our identity; or // (b) unbound. // if (identity->equal(subject)) { // // Subject is our identity; we must still deal with alien extension. // returnedSubproblem = 0; bindUnboundVariablesToIdentity(solution, NONE); if (extensionInfo != 0) { extensionInfo->setValidAfterMatch(true); extensionInfo->setMatchedWhole(true); } return true; } if (nrViableVariables == 0) { // // All variables are bound to our identity and the subject is not // our identity. We can succeed only if we have entension and the // subject contains our identity. // if (extensionInfo == 0) return false; TopVariable& tv = flexPart[0].variable; // pick any since they are all bound to identity Assert(identity->equal(solution.value(tv.index)), "should be identity"); return subject->matchVariable(tv.index, tv.sort, matchAtTop, solution, returnedSubproblem, extensionInfo); } if (nrViableVariables == 1) { // // All variables except one are bound to our identity and the // subject is not our identity. The last viable variable must match // the subject (with extension if present). // This case need to make good on our constraint propagation // guarantee when we have no extension. // TopVariable& vv = flexPart[lastViableVariable].variable; return subject->matchVariable(vv.index, vv.sort, matchAtTop, solution, returnedSubproblem, extensionInfo); } // // General case: multiple unbound variable instances that can take identity. // Any bound variables are already bound to identity. // DisjunctiveSubproblemAccumulator alternatives(solution); for (int i = 0; i < nrFlexVariables; i++) { TopVariable& tv = flexPart[i].variable; if (solution.value(tv.index) == 0) { local.copy(solution); bindUnboundVariablesToIdentity(local, i); Subproblem* subproblem; if (subject->matchVariable(tv.index, tv.sort, matchAtTop, local, subproblem, extensionInfo)) { if (!(alternatives.empty()) && extensionInfo != 0) { // // Need to exclude the case where subject = id + ext and // we match our chosen variable against our identity // in all but the first branch to avoid duplicate solutions. // SubproblemAccumulator subproblems; subproblems.add(subproblem); subproblems.add(new EqualitySubproblem(identity, tv.index, false)); subproblem = subproblems.extractSubproblem(); } alternatives.addOption(local, subproblem, extensionInfo); continue; } } } return alternatives.extract(solution, returnedSubproblem, extensionInfo); } bool AU_LhsAutomaton::collapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { if (uniqueCollapseAutomaton != 0) return uniqueCollapseMatch(subject, solution, returnedSubproblem, extensionInfo); Subproblem* subproblem; if (!multiwayCollapseMatch(subject, solution, subproblem, extensionInfo)) return false; SubproblemAccumulator subproblems; subproblems.add(subproblem); int nrVariables = solution.nrFragileBindings(); int nrFlexVariables = flexPart.length(); for (int i = 0; i < nrFlexVariables; i++) { Assert(flexPart[i].type == VARIABLE, "non variable in multiway collapse"); TopVariable& tv = flexPart[i].variable; if (tv.abstracted != 0) { subproblems.add(new VariableAbstractionSubproblem(tv.abstracted, tv.index, nrVariables)); } } returnedSubproblem = subproblems.extractSubproblem(); return true; } Maude-2.6/src/AU_Theory/AU_DagArgumentIterator.cc0000644000147300135640000000277007666303243016616 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_DagArgumentIterator. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // A theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_DagArgumentIterator.hh" bool AU_DagArgumentIterator::valid() const { return position < argArray.length(); } DagNode* AU_DagArgumentIterator::argument() const { Assert(position < argArray.length(), "no args left"); return argArray[position]; } void AU_DagArgumentIterator::next() { Assert(position < argArray.length(), "no args left"); ++position; } Maude-2.6/src/AU_Theory/AU_GreedyMatcher.cc0000644000147300135640000002525310205443043015414 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for greedy A/AU matcher flex part. // int AU_LhsAutomaton::greedyMatch(AU_DagNode* subject, Substitution& solution, AU_ExtensionInfo* extensionInfo) { local.copy(solution); int t = greedyMatchBlocks(subject, extensionInfo); if (t != true) return t; solution.copy(local); greedyBindVariables(subject, solution); if (extensionInfo != 0) { extensionInfo->setExtraIdentity(false); extensionInfo->setValidAfterMatch(true); Assert(extensionInfo->bigEnough(), "didn't match enough of subject"); } return true; } void AU_LhsAutomaton::greedyBindVariables(AU_DagNode* subject, Substitution& solution) { bool buildReducedNodes = subject->isReduced() && topSymbol->sortConstraintFree(); int skip; for (int i = flexLeftPos; i <= flexRightPos; i += skip) { Subterm& f = flexPart[i]; skip = f.blockLength; if (skip == NOT_FIXED) { skip = 1; TopVariable& tv = f.variable; int index = tv.index; DagNode* d = solution.value(index); if (d == 0) { int nrSubjects = tv.lastSubject - tv.firstSubject + 1; Assert(nrSubjects >= 0, "-ve number of subjects " << nrSubjects); if (nrSubjects == 0) solution.bind(index, topSymbol->getIdentityDag()); else if (nrSubjects == 1) solution.bind(index, subject->argArray[tv.firstSubject]); else { AU_DagNode* n = new AU_DagNode(topSymbol, nrSubjects); for (int j = 0; j < nrSubjects; j++) n->argArray[j] = subject->argArray[tv.firstSubject + j]; n->setProducedByAssignment(); if (buildReducedNodes) { topSymbol->computeBaseSort(n); n->setReduced(); } solution.bind(index, n); } } } } } int AU_LhsAutomaton::greedyMatchRigidBlock(AU_DagNode* subject, RigidBlock& block, int minShift, int maxShift, int& matchShift) { Assert(minShift <= maxShift, "bad shift range"); Assert(block.start <= block.end, "bad block range"); int shiftFactor; for (int i = minShift; i <= maxShift; i += shiftFactor) { scratch.copy(local); // make a scratch copy for matching at shift i int t = greedyMatchRigidBlock2(subject, block, i, shiftFactor); if (t == UNDECIDED) return UNDECIDED; if (t == true) { matchShift = i; local.copy(scratch); return true; } } return false; } int AU_LhsAutomaton::greedyMatchRigidBlock2(AU_DagNode* subject, RigidBlock& block, int nextSubject, int& shiftFactor) { ArgVec& args = subject->argArray; shiftFactor = 1; // default shift increment int skip; for (int i = block.start; i <= block.end; i += skip) { Subterm& f = flexPart[i]; skip = f.blockLength; if (skip == NOT_FIXED) { DagNode* d = scratch.value(f.variable.index); Assert(d != 0, "unbound variable in rigid block"); if (!(subject->eliminateForward(d, nextSubject, rightPos))) // better limit? return false; skip = 1; } else { int sf; int t = greedyMatchFixedLengthBlock(args, i, nextSubject, sf); if (sf > shiftFactor) shiftFactor = sf; if (t != true) return t; nextSubject += skip; } } return true; } int AU_LhsAutomaton::greedyMatchFixedLengthBlock(ArgVec& args, int blockStart, int attemptedShift, int& shiftFactor) { for (int i = flexPart[blockStart].blockLength - 1; i >= 0; i--) { Subterm& f = flexPart[blockStart + i]; DagNode* d = args[attemptedShift + i]; shiftFactor = f.shiftFactor; switch (f.type) { case VARIABLE: { Assert(f.variable.upperBound == 1 && !f.variable.takeIdentity, "non-unit variable in fixed length block"); DagNode* v = scratch.value(f.variable.index); if (v == 0) { if (d->leq(f.variable.sort)) scratch.bind(f.variable.index, d); else return false; } else { Assert(v->symbol() != topSymbol, "illegal binding to unit variable"); if (!(v->equal(d))) return false; } break; } case GROUND_ALIEN: { if (!(f.groundAlien->equal(d))) return false; break; } case NON_GROUND_ALIEN: { Subproblem* sp; if (!(f.alienAutomaton->match(d, scratch, sp))) return false; if (sp != 0) { delete sp; return UNDECIDED; } break; } } } return true; } int AU_LhsAutomaton::greedyMatchBlocks(AU_DagNode* subject, AU_ExtensionInfo* extensionInfo) { int nrRigid = rigidBlocks.length(); Assert(extensionInfo != 0 || nrRigid == 0 || (rigidBlocks[0].start > flexLeftPos && rigidBlocks[nrRigid - 1].end < flexRightPos), "missing unbound variable(s)"); int spare = rightPos - leftPos + 1 - nrSubjectsUsed; if (spare < 0) return false; int varStart = flexLeftPos; int nextSubject = leftPos; for (int i = 0; i < nrRigid; i++) { // // First match rigid block. // RigidBlock& r = rigidBlocks[i]; int min = nextSubject + r.nrSubjectsToLeave; int max = min + spare; int matchShift; int t = greedyMatchRigidBlock(subject, r, min, max, matchShift); if (t != true) return t; int surplus = matchShift - min; // // Now match preceeding variable block. // bool b = greedyMatchVariableBlock(subject->argArray, varStart, r.start - varStart, nextSubject, matchShift - nextSubject, surplus, i == 0 && extensionInfo != 0, false, extensionInfo); if (!b) return UNDECIDED; r.firstMatch = matchShift; spare -= surplus; varStart = r.end + 1; nextSubject = matchShift + r.nrSubjectsForUs; } // // Match last variable block. // int nrSubjectsRemaining = rightPos - nextSubject + 1; bool b = greedyMatchVariableBlock(subject->argArray, varStart, flexRightPos - varStart + 1, nextSubject, nrSubjectsRemaining, nrSubjectsRemaining - nrSubjectsForRightVars, extensionInfo != 0 && nrRigid == 0, extensionInfo != 0, extensionInfo); return b ? int(true) : UNDECIDED; } bool AU_LhsAutomaton::greedyMatchVariableBlock(ArgVec& args, int blockStart, int blockLength, int firstSubject, int nrSubjects, int spare, bool leftExtend, bool rightExtend, AU_ExtensionInfo* extensionInfo) { // // Handle pathological case where we have to match no subjects. // if (nrSubjects == 0) { for (int i = 0; i < blockLength; i++) { TopVariable& tv = flexPart[blockStart + i].variable; if (tv.takeIdentity) { tv.firstSubject = firstSubject; // take nothing tv.lastSubject = firstSubject - 1; //DebugAdvisory("1 tv.firstSubject " << tv.firstSubject); } else return false; } if (leftExtend) extensionInfo->setFirstMatched(0); else if (rightExtend) extensionInfo->setLastMatched(args.length() - 1); return true; } // // Normal case. // int pos = firstSubject; for (int i = 0; i < blockLength; i++) { TopVariable& tv = flexPart[blockStart + i].variable; if (tv.takeIdentity) { if (spare == 0 || !(args[pos]->leq(tv.sort))) { tv.firstSubject = pos; // take nothing tv.lastSubject = pos - 1; //DebugAdvisory("2 tv.firstSubject " << tv.firstSubject); } else { if (leftExtend) { // // Now we have committed to giving a subterm (rather than // an identity) to a variable we can no longer give subterms // to the left extension. // extensionInfo->setFirstMatched(pos); leftExtend = false; } tv.firstSubject = tv.lastSubject = pos++; // take first available --spare; //DebugAdvisory("3 tv.firstSubject " << tv.firstSubject); } } else { for (; !(args[pos]->leq(tv.sort)); pos++, spare--) { // // Can't assign current subterm to current variable so // we must find a way to dispose of it. // if (spare == 0) return false; // can't afford to dispose of it so fail if (!leftExtend) { if (i == 0) return false; TopVariable& pv = flexPart[blockStart + i - 1].variable; if (args[pos]->leq(pv.sort)) pv.lastSubject = pos; else return false; // previous variable cannot take it so fail } } if (leftExtend) { // // Now we have committed to giving a subterm (rather than // an identity) to a variable we can no longer give subterms // to the left extension. // extensionInfo->setFirstMatched(pos); leftExtend = false; } tv.firstSubject = tv.lastSubject = pos++; //DebugAdvisory("4 tv.firstSubject " << tv.firstSubject); } } if (leftExtend) { // // Left extension gets the whole thing. // Assert(!rightExtend, "whole subject in extension should not happen in greedy match"); DebugAdvisoryCheck(blockLength == 0, "worst case scenario for AU greedy match"); extensionInfo->setFirstMatched(firstSubject + nrSubjects); return true; } if (blockLength > 0) { // // Try to assign spare subterms to last variable // TopVariable& lv = flexPart[blockStart + blockLength - 1].variable; for (; spare > 0; spare--, pos++) { Assert(pos < firstSubject + nrSubjects, "pos overrun"); if (!(args[pos]->leq(lv.sort))) { if (rightExtend) break; else return false; } } lv.lastSubject = pos - 1; } if (rightExtend) extensionInfo->setLastMatched(pos - 1); return true; } Maude-2.6/src/AU_Theory/AU_LhsAutomaton.hh0000644000147300135640000002321407666303243015332 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for left hand side automata in the A, AUl, AUr and AU theories. // #ifndef _AU_LhsAutomaton_hh_ #define _AU_LhsAutomaton_hh_ #include "lhsAutomaton.hh" class AU_LhsAutomaton : public LhsAutomaton { NO_COPYING(AU_LhsAutomaton); public: enum MatchStrategy { // // Ground out case: no extension and no flex part; everything is in // the rigid part. // GROUND_OUT, // // Lone variable case: no extension and flex part consists of a single // variable that is forced to match whatever is left after the rigid part // has been matched. // LONE_VARIABLE, // // Fast lone variable case: as above but variable has a PURE_SORT // and is not an abstraction variable. // FAST_LONE_VARIABLE, // // Greedy case: In the flex part, the intersection of each subterm's variables // with union of its context variables and the condition variables contains // only variables guaranteed to be bound once the rigid part has been matched. // None of the subautomata for the flex part are likely to return subproblems and // each variable in the subterm that is not guaranteed to be bound has either a // LIMIT_SORT or a PURE_SORT or has upperBound = 1. // GREEDY, // // Full case: if other cases don't apply; build a DAG which provides a // compact representation of the possibly exponential number of matching // possibilities and pass it back as a subproblem. // FULL }; // // Operations to build an AU_LhsAutomaton // AU_LhsAutomaton(AU_Symbol* symbol, bool matchAtTop, bool collapsePossible, LhsAutomaton* uniqueCollapseAutomaton, int nrVariables); ~AU_LhsAutomaton(); void addRigidVariable(const VariableTerm* variable, bool leftEnd, bool idPossible); void addRigidGroundAlien(Term* alien, bool leftEnd); void addRigidNonGroundAlien(LhsAutomaton* automaton, bool leftEnd); void addFlexVariable(const VariableTerm* variable, int shiftFactor, bool idPossible); void addFlexAbstractionVariable(int index, Sort* sort, int upperBound, bool takeIdentity, bool awkward, LhsAutomaton* abstracted); void addFlexGroundAlien(Term* alien, int shiftFactor); void addFlexNonGroundAlien(LhsAutomaton* automaton, int shiftFactor); void complete(MatchStrategy strategy); // // Standard LhsAutomaton operations // bool match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: enum SubtermType { VARIABLE, GROUND_ALIEN, NON_GROUND_ALIEN }; enum Special { STALLED = -1, NOT_FIXED = -1 }; struct TopVariable { short index; Bool takeIdentity; // take identity instead of piece of subject (always) Bool awkward; // take identity instead of piece of subject (special) Sort* sort; int upperBound; LhsAutomaton* abstracted; // automaton for abstracted term // // Data storage for full match time use, flex part only // int nastyBinding; // if >= 0, minimum number of subterms // that binding might match // // Data storage for greedy match time use, flex part only // int firstSubject; int lastSubject; }; struct Subterm { SubtermType type; int shiftFactor; // for flex part only union { bool leftEnd; // for rigid part only int blockLength; // for flex part only; +ve for fixed start, -1 for variable }; union { TopVariable variable; Term* groundAlien; LhsAutomaton* alienAutomaton; }; }; // // Rigid blocks within the flex part are only determined at match time // since they depend on what variables are bound. // struct RigidBlock { int start; // index into flexPart int end; // index into flexPart int nrSubjectsForUs; // needed because value of bound variable may be in our theory int nrSubjectsToLeave; // for preceeding variables int firstMatch; // first matching shift for this rigid block }; void updateWholeBounds(int min, int max); void updateFlexBounds(int min, int max); // // First rigid part matcher and preprocessing code. // bool matchRigidPart(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems); bool checkForRigidEnds(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems); int checkLeftEnd(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems, int& mustLeave, bool& rightStalled); int checkRightEnd(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems, int& mustLeave, bool& leftStalled); bool forcedLoneVariableCase(AU_DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem); void determineRigidBlocks(Substitution& solution); // // Greedy Matcher. // int greedyMatch(AU_DagNode* subject, Substitution& solution, AU_ExtensionInfo* extensionInfo); void greedyBindVariables(AU_DagNode* subject, Substitution& solution); int greedyMatchRigidBlock(AU_DagNode* subject, RigidBlock& block, int minShift, int maxShift, int& matchShift); int greedyMatchRigidBlock2(AU_DagNode* subject, RigidBlock& block, int nextSubject, int& shiftFactor); int greedyMatchFixedLengthBlock(ArgVec& args, int blockStart, int attemptedShift, int& shiftFactor); int greedyMatchBlocks(AU_DagNode* subject, AU_ExtensionInfo* extensionInfo); bool greedyMatchVariableBlock(ArgVec& args, int blockStart, int blockLength, int firstSubject, int nrSubjects, int spare, bool leftExtend, bool rightExtend, AU_ExtensionInfo* extensionInfo); // // Full Matcher. // void addVariableBlocks(Substitution& solution, AU_Subproblem* subproblem, SubproblemAccumulator& subproblems); bool fullMatchRigidBlock(AU_DagNode* subject, Substitution& solution, RigidBlock& block, int minShift, int maxShift, int& matchShift, Subproblem*& subproblem); bool fullMatchRigidBlock2(AU_DagNode* subject, RigidBlock& block, int nextSubject, Subproblem*& subproblem, int& shiftFactor); bool fullMatchFixedLengthBlock(ArgVec& args, int blockStart, int attemptedShift, SubproblemAccumulator& subproblems, int& shiftFactor); AU_Subproblem* buildLeftmostPath(AU_DagNode* subject, Substitution& solution, AU_ExtensionInfo* extensionInfo); void addRemainingPaths(AU_DagNode* subject, Substitution& solution, AU_Subproblem* subproblem); bool fullMatch(AU_DagNode* subject, Substitution& solution, SubproblemAccumulator& subproblems, AU_ExtensionInfo* extensionInfo); // // Collapse matcher. // bool collapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); bool uniqueCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); bool multiwayCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); void bindUnboundVariablesToIdentity(Substitution& solution, int exception); int dequeMatch(AU_DequeDagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem); AU_Symbol* const topSymbol; const bool matchAtTop; const bool collapsePossible; LhsAutomaton* const uniqueCollapseAutomaton; MatchStrategy matchStrategy; int wholeLowerBound; int wholeUpperBound; int flexLowerBound; int flexUpperBound; Vector rigidPart; Vector flexPart; // // Data storage for match-time use. // // Left and right limits of subject not matched by rigid part. // int leftPos; int rightPos; // // Left and right limits of flex part not used up. // int flexLeftPos; int flexRightPos; // // Rigid blocks within flex part determined by examining variable // bindings at match time. // Vector rigidBlocks; // // Minimum number of subjects needed for flex part. // int nrSubjectsUsed; // // Minimum number of subjects needed for variables to the right of // last rigid block. // int nrSubjectsForRightVars; // // Throw away substitutions for exploring match space. // Substitution local; Substitution scratch; friend ostream& operator<<(ostream& s, SubtermType type); }; #ifdef DUMP ostream& operator<<(ostream& s, AU_LhsAutomaton::MatchStrategy strategy); ostream& operator<<(ostream& s, AU_LhsAutomaton::SubtermType type); #endif #endif Maude-2.6/src/AU_Theory/AU_DagArgumentIterator.hh0000644000147300135640000000262107666303243016623 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for argument iterator for AU dag nodes. // #ifndef _AU_DagArgumentIterator_hh_ #define _AU_DagArgumentIterator_hh_ #include "rawDagArgumentIterator.hh" class AU_DagArgumentIterator : public RawDagArgumentIterator { public: AU_DagArgumentIterator(const ArgVec& arguments); bool valid() const; DagNode* argument() const; void next(); private: const ArgVec& argArray; int position; }; inline AU_DagArgumentIterator::AU_DagArgumentIterator(const ArgVec& arguments) : argArray(arguments) { position = 0; } #endif Maude-2.6/src/AU_Theory/AU_Normalize.cc0000644000147300135640000001427111062345614014636 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Normalization for AU_DagNodes. // bool AU_DagNode::disappear(AU_Symbol* s, ArgVec::const_iterator i) { return (s->rightId() && i != argArray.begin()) || (s->leftId() && i + 1 != argArray.end()); } AU_DagNode::NormalizationResult AU_DagNode::normalizeAtTop(bool dumb) { AU_Symbol* s = symbol(); Term* identity = s->getIdentity(); int expansion = 0; int nrIdentities = 0; int maxDeque = 0; ArgVec::const_iterator maxDequeIter; // gcc gives uninitialized warning // // First examine the argument list looking for either our top symbol // or our identity. // { FOR_EACH_CONST(i, ArgVec, argArray) { DagNode* d = *i; if (d->symbol() == s) { if (safeCast(AU_BaseDagNode*, d)->isDeque()) { // // Since we have at least one deque we won't use // expansion and therefore don't waste time // updating it. // int nrArgs = safeCast(AU_DequeDagNode*, d)->nrArgs(); if (nrArgs > maxDeque) { maxDeque = nrArgs; maxDequeIter = i; } } else expansion += safeCast(AU_DagNode*, d)->argArray.length() - 1; } else if (identity != 0 && identity->equal(d) && disappear(s, i)) ++nrIdentities; } } // // Now deal efficiently with all the special cases. // if (maxDeque > 0) { // // We had at least 1 deque in argument list. We push // all the remaining arguments onto the largest such // deque. We never deal with one sided identities in this // case. // AU_Deque flat(safeCast(AU_DequeDagNode*, *maxDequeIter)->getDeque()); { // // Push stuff on the left of the largest deque. // const ArgVec::const_iterator b = argArray.begin(); for (ArgVec::const_iterator i = maxDequeIter; i != b;) { --i; DagNode* d = *i; if (d->symbol() == s) { if (safeCast(AU_BaseDagNode*, d)->isDeque()) flat.pushLeft(safeCast(AU_DequeDagNode*, d)->getDeque()); else flat.pushLeft(safeCast(AU_DagNode*, d)->argArray); } else if (!(nrIdentities > 0 && identity->equal(d))) flat.pushLeft(d); } } { // // Push stuff on the right of the largest deque. // const ArgVec::const_iterator e = argArray.end(); for (ArgVec::const_iterator i = maxDequeIter + 1; i != e; ++i) { DagNode* d = *i; if (d->symbol() == s) { if (safeCast(AU_BaseDagNode*, d)->isDeque()) flat.pushRight(safeCast(AU_DequeDagNode*, d)->getDeque()); else flat.pushRight(safeCast(AU_DagNode*, d)->argArray); } else if (!(nrIdentities > 0 && identity->equal(d))) flat.pushRight(d); } } (void) new (this) AU_DequeDagNode(symbol(), flat); Assert(!dumb, "shouldn't be here if we're in dumb mode"); MemoryCell::okToCollectGarbage(); // needed because of pathological nesting return DEQUED; } if (expansion == 0) { // // No flattening. // if (nrIdentities != 0) { // // But have to remove identities. // int p = 0; FOR_EACH_CONST(i, ArgVec, argArray) { DagNode* d = *i; if (!(identity->equal(d) && disappear(s, i))) argArray[p++] = d; } if (p < 2) { // // Eliminating identity causes AU dag node to collapse to its // remaining argument or 1st argument of all arguments were // identity. // DagNode* remaining = (s->getPermuteStrategy() == BinarySymbol::EAGER) ? argArray[0] : argArray[0]->copyReducible(); remaining->overwriteWithClone(this); return COLLAPSED; } argArray.contractTo(p); } return NORMAL; } // // We need to flatten. // int nrArgs = argArray.length(); if (nrIdentities == 0) { // // No identities: in place flattening. // argArray.expandBy(expansion); int p = nrArgs + expansion - 1; for (int i = nrArgs - 1; i >= 0; i--) { Assert(p >= i, "loop invarient failed"); DagNode* d = argArray[i]; if (d->symbol() == s) { ArgVec& argArray2 = safeCast(AU_DagNode*, d)->argArray; for (int j = argArray2.length() - 1; j >= 0; j--) argArray[p--] = argArray2[j]; } else argArray[p--] = argArray[i]; } Assert(p == -1, "bad argArray length"); } else { // // Identities: flatten into auxiliary buffer. // ArgVec buffer(nrArgs + expansion - nrIdentities); int p = 0; FOR_EACH_CONST(i, ArgVec, argArray) { DagNode* d = *i; if (d->symbol() == s) { ArgVec& argArray2 = safeCast(AU_DagNode*, d)->argArray; FOR_EACH_CONST(j, ArgVec, argArray2) buffer[p++] = *j; } else if (!(identity->equal(d) && disappear(s, i))) buffer[p++] = d; } Assert(p == nrArgs + expansion - nrIdentities, "bad buffer size"); argArray.swap(buffer); } // // If we're in dumb mode then there may be a lot of partially built // instantiated dags lying around that are vunerable to garbage collection. // if (!dumb) MemoryCell::okToCollectGarbage(); // needed because of pathological nesting // // This is the one place where deques can come into existence. // if (!dumb && s->useDeque()) { AU_Deque flat(argArray); (void) new (this) AU_DequeDagNode(symbol(), flat); return DEQUED; } return FLATTENED; } Maude-2.6/src/AU_Theory/AU_DagNode.cc0000644000147300135640000002327711450755770014216 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_DagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // interface class definitions #include "term.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_DequeDagNode.hh" #include "AU_DagArgumentIterator.hh" #include "AU_ExtensionInfo.hh" #include "AU_Subproblem.hh" // our stuff #include "AU_Normalize.cc" #include "AU_DagOperations.cc" AU_DagNode* getAU_DagNode(DagNode* d) { if (safeCast(AU_BaseDagNode*, d)->isDeque()) return AU_DequeDagNode::dequeToArgVec(safeCast(AU_DequeDagNode*, d)); return safeCast(AU_DagNode*, d); } RawDagArgumentIterator* AU_DagNode::arguments() { return new AU_DagArgumentIterator(argArray); } size_t AU_DagNode::getHashValue() { size_t hashValue = symbol()->getHashValue(); FOR_EACH_CONST(i, ArgVec, argArray) hashValue = hash(hashValue, (*i)->getHashValue()); return hashValue; } int AU_DagNode::compareArguments(const DagNode* other) const { if (safeCast(const AU_BaseDagNode*, other)->isDeque()) return - safeCast(const AU_DequeDagNode*, other)->compare(this); const ArgVec& argArray2 = safeCast(const AU_DagNode*, other)->argArray; int r = argArray.length() - argArray2.length(); if (r != 0) return r; ArgVec::const_iterator j = argArray2.begin(); FOR_EACH_CONST(i, ArgVec, argArray) { int r = (*i)->compare(*j); if (r != 0) return r; ++j; } Assert(j == argArray2.end(), "iterator problem"); return 0; } DagNode* AU_DagNode::markArguments() { Assert(argArray.length() > 0, "no arguments"); argArray.evacuate(); // // We avoid recursing on the first subterm that shares our symbol. // Symbol* s = symbol(); DagNode* r = 0; FOR_EACH_CONST(i, ArgVec, argArray) { DagNode* d = *i; if (r == 0 && d->symbol() == s) r = d; else d->mark(); } return r; } DagNode* AU_DagNode::copyEagerUptoReduced2() { int nrArgs = argArray.length(); AU_Symbol* s = symbol(); AU_DagNode* n = new AU_DagNode(s, nrArgs); if (s->getPermuteStrategy() == BinarySymbol::EAGER) { for (int i = 0; i < nrArgs; i++) n->argArray[i] = argArray[i]->copyEagerUptoReduced(); } else copy(argArray.begin(), argArray.end(), n->argArray.begin()); return n; } void AU_DagNode::clearCopyPointers2() { FOR_EACH_CONST(i, ArgVec, argArray) (*i)->clearCopyPointers(); } void AU_DagNode::overwriteWithClone(DagNode* old) { AU_DagNode* d = new(old) AU_DagNode(symbol(), argArray.length()); d->copySetRewritingFlags(this); d->setNormalizationStatus(getNormalizationStatus()); d->setSortIndex(getSortIndex()); copy(argArray.begin(), argArray.end(), d->argArray.begin()); } DagNode* AU_DagNode::makeClone() { int nrArgs = argArray.length(); AU_DagNode* d = new AU_DagNode(symbol(), nrArgs); d->copySetRewritingFlags(this); d->setNormalizationStatus(getNormalizationStatus()); d->setSortIndex(getSortIndex()); copy(argArray.begin(), argArray.end(), d->argArray.begin()); return d; } DagNode* AU_DagNode::copyWithReplacement(int argIndex, DagNode* replacement) { int nrArgs = argArray.length(); AU_DagNode* n = new AU_DagNode(symbol(), nrArgs); ArgVec& args2 = n->argArray; for (int i = 0; i < nrArgs; i++) args2[i] = (i == argIndex) ? replacement : argArray[i]; return n; } DagNode* AU_DagNode::copyWithReplacement(Vector& redexStack, int first, int last) { int nrArgs = argArray.length(); AU_DagNode* n = new AU_DagNode(symbol(), nrArgs); ArgVec& args = n->argArray; int nextReplacementIndex = redexStack[first].argIndex(); for (int i = 0; i < nrArgs; i++) { if (i == nextReplacementIndex) { args[i] = redexStack[first].node(); ++first; nextReplacementIndex = (first <= last) ? redexStack[first].argIndex() : NONE; } else args[i] = argArray[i]; } return n; } void AU_DagNode::stackArguments(Vector& stack, int parentIndex, bool respectFrozen) { if (respectFrozen && !(symbol()->getFrozen().empty())) return; int nrArgs = argArray.length(); for (int i = 0; i < nrArgs; i++) { DagNode* d = argArray[i]; if (!(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, i)); } } void AU_DagNode::partialReplace(DagNode* replacement, ExtensionInfo* extensionInfo) { AU_ExtensionInfo* e = safeCast(AU_ExtensionInfo*, extensionInfo); int first = e->firstMatched(); int last = e->lastMatched(); argArray[first++] = replacement; int nrArgs = argArray.length(); for (last++; last < nrArgs; last++) argArray[first++] = argArray[last]; argArray.contractTo(first); repudiateSortInfo(); // probably not set but be safe if (isProducedByAssignment()) // we _were_ in theory normal form { if (replacement->symbol() == symbol() || // replacement is in our theory -> we are no longer in theory normal form !(replacement->isReduced())) // replacement is not reduced -> we are no longer in theory normal form setNormalizationStatus(FRESH); } } DagNode* AU_DagNode::partialConstruct(DagNode* replacement, ExtensionInfo* extensionInfo) { AU_ExtensionInfo* e = safeCast(AU_ExtensionInfo*, extensionInfo); int first = e->firstMatched(); int last = e->lastMatched(); int nrArgs = argArray.length(); AU_DagNode* n = new AU_DagNode(symbol(), nrArgs + first - last); ArgVec& args2 = n->argArray; for (int i = 0; i < first; i++) args2[i] = argArray[i]; args2[first++] = replacement; for (last++; last < nrArgs; last++) args2[first++] = argArray[last]; return n; } ExtensionInfo* AU_DagNode::makeExtensionInfo() { return new AU_ExtensionInfo(this); } bool AU_DagNode::matchVariableWithExtension(int index, const Sort* sort, Substitution& /* solution */, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { // // This code could be much more sophisticated: in particular we could look for // the variable having too smaller sort and return false; the subject having // total subterm multiplicity of 2 and return unique solution. // AU_ExtensionInfo* e = safeCast(AU_ExtensionInfo*, extensionInfo); AU_Subproblem* subproblem = new AU_Subproblem(this, 0, argArray.length() - 1, 1, e); int min = symbol()->oneSidedId() ? 1 : 2; subproblem->addTopVariable(0, index, min, UNBOUNDED, const_cast(sort)); // HACK subproblem->complete(); returnedSubproblem = subproblem; extensionInfo->setValidAfterMatch(false); return true; } // // Unification code. // DagNode* AU_DagNode::instantiate2(const Substitution& substitution) { AU_Symbol* s = symbol(); int nrArgs = argArray.length(); for (int i = 0; i < nrArgs; ++i) { if (DagNode* n = argArray[i]->instantiate(substitution)) { // // Argument changed under instantiation - need to make a new // dagnode. // bool ground = true; AU_DagNode* d = new AU_DagNode(s, nrArgs); // // Copy the arguments we already looked at. // for (int j = 0; j < i; ++j) { if (!(argArray[j]->isGround())) ground = false; d->argArray[j] = argArray[j]; } // // Handle current argument. // d->argArray[i] = n; if (!(n->isGround())) ground = false; // // Handle remaining arguments. // for (++i; i < nrArgs; ++i) { DagNode* a = argArray[i]; if (DagNode* n = a->instantiate(substitution)) a = n; if (!(a->isGround())) ground = false; d->argArray[i] = a; } // // Normalize the new dagnode. We pass the dumb flag as true to prevent deque // formation. If it doesn't collapse and all its arguments are ground we // compute its base sort, and set ground flag. // if (d->normalizeAtTop(true) != COLLAPSED && ground) { s->computeBaseSort(d); d->setGround(); } Assert(d->isDeque() == false, "Oops we got a deque! " << d); return d; } } return 0; // unchanged } // // Narrowing code. // bool AU_DagNode::indexVariables2(NarrowingVariableInfo& indices, int baseIndex) { int nrArgs = argArray.length(); bool ground = true; for (int i = 0; i < nrArgs; i++) { if (!(argArray[i]->indexVariables(indices, baseIndex))) ground = false; } return ground; } DagNode* AU_DagNode::instantiateWithReplacement(const Substitution& substitution, int argIndex, DagNode* newDag) { int nrArgs = argArray.length(); AU_DagNode* n = new AU_DagNode(symbol(), nrArgs); ArgVec& args2 = n->argArray; for (int i = 0; i < nrArgs; i++) { DagNode* d; if (i == argIndex) d = newDag; else { d = argArray[i]; if (DagNode* c = d->instantiate(substitution)) // changed under substitutition d = c; } args2[i] = d; } return n; } Maude-2.6/src/AU_Theory/AU_ExtensionInfo.cc0000644000147300135640000000423307666303243015472 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_ExtensionInfo. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // A theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_ExtensionInfo.hh" DagNode* AU_ExtensionInfo::buildMatchedPortion() const { if (matchedWhole()) return subject; int nrSubterms = last - first + 1; Assert(nrSubterms + extraIdentityFlag >= 2, "at least 2 subterms must be matched"); return subject->makeFragment(first, nrSubterms, extraIdentityFlag); } ExtensionInfo* AU_ExtensionInfo::makeClone() const { AU_ExtensionInfo* e = new AU_ExtensionInfo(subject); e->setValidAfterMatch(validAfterMatch()); bool whole = matchedWhole(); e->setMatchedWhole(whole); if (!whole) { e->first = first; e->last = last; e->extraIdentityFlag = extraIdentityFlag; } return e; } void AU_ExtensionInfo::copy(ExtensionInfo* extensionInfo) { AU_ExtensionInfo* e = safeCast(AU_ExtensionInfo*, extensionInfo); setValidAfterMatch(e->validAfterMatch()); bool whole = e->matchedWhole(); setMatchedWhole(whole); subject = e->subject; if (!whole) { first = e->first; last = e->last; extraIdentityFlag = e->extraIdentityFlag; } } Maude-2.6/src/AU_Theory/AU_ArgumentIterator.hh0000644000147300135640000000263007666303243016207 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for argument iterator for AU terms. // #ifndef _AU_ArgumentIterator_hh_ #define _AU_ArgumentIterator_hh_ #include "rawArgumentIterator.hh" #include "AU_Term.hh" class AU_ArgumentIterator : public RawArgumentIterator { public: AU_ArgumentIterator(const Vector& arguments); bool valid() const; Term* argument() const; void next(); private: const Vector& argArray; int position; }; inline AU_ArgumentIterator::AU_ArgumentIterator(const Vector& arguments) : argArray(arguments) { position = 0; } #endif Maude-2.6/src/AU_Theory/AU_DagNode.hh0000644000147300135640000001075011350310400014170 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for DAG nodes in the A, AUl, AUr and AU theories. // #ifndef _AU_DagNode_hh_ #define _AU_DagNode_hh_ #include "AU_BaseDagNode.hh" #include "argVec.hh" class AU_DagNode : public AU_BaseDagNode { NO_COPYING(AU_DagNode); public: AU_DagNode(AU_Symbol* symbol, int size); // // Functions required by theory interface. // RawDagArgumentIterator* arguments(); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); DagNode* copyWithReplacement(int argIndex, DagNode* replacement); DagNode* copyWithReplacement(Vector& redexStack, int first, int last); void stackArguments(Vector& stack, int parentIndex, bool respectFrozen); // // Functions required to handle extension information. // bool matchVariableWithExtension(int index, const Sort* sort, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); void partialReplace(DagNode* replacement, ExtensionInfo* extensionInfo); DagNode* partialConstruct(DagNode* replacement, ExtensionInfo* extensionInfo); ExtensionInfo* makeExtensionInfo(); // // Although we currently don't support unification or narrowing in AU nodes // we still need some functionality from the unification and narrowing interfaces // to allow narrowing to happen below us or in a sibling branch. // // Unification member functions. // DagNode* instantiate2(const Substitution& substitution); // // Interface for narrowing. // bool indexVariables2(NarrowingVariableInfo& indices, int baseIndex); DagNode* instantiateWithReplacement(const Substitution& substitution, int argIndex, DagNode* newDag); // // Functions particular to AU_DagNode. // void setProducedByAssignment(); private: enum NormalizationResult { COLLAPSED, DEQUED, NORMAL, FLATTENED }; // // Functions required by theory interface. // DagNode* markArguments(); DagNode* copyEagerUptoReduced2(); void clearCopyPointers2(); // // Functions particular to AU_DagNode. // bool disappear(AU_Symbol* s, ArgVec::const_iterator i); NormalizationResult normalizeAtTop(bool dumb = false); bool eliminateForward(DagNode* target, int& pos, int limit) const; bool eliminateBackward(DagNode* target, int& pos, int limit) const; DagNode* makeFragment(int start, int nrSubterms, bool extraId) const; ArgVec argArray; friend class AU_Symbol; // to reduce subterms prior to rewriting friend class AU_Term; // for term->DAG conversion & comparison friend class AU_LhsAutomaton; // for matching DAG subject friend class AU_RhsAutomaton; // for constructing replacement DAG friend class AU_Layer; // for constructing substitution friend class AU_Subproblem; // for constructing substitution friend class AU_ExtensionInfo; // for constructing matched portion friend class AU_DequeDagNode; // for conversion & comparison }; AU_DagNode* getAU_DagNode(DagNode* dagNode); inline AU_DagNode::AU_DagNode(AU_Symbol* symbol, int size) : AU_BaseDagNode(symbol), argArray(size) { setNormalizationStatus(FRESH); } inline void AU_DagNode::setProducedByAssignment() { setNormalizationStatus(ASSIGNMENT); #ifndef NO_ASSERT // // Look for Riesco 1/18/10 bug. // for (int i = 0; i < argArray.length(); ++i) { DagNode* d = argArray[i]; Assert(d->getSortIndex() != Sort::SORT_UNKNOWN, "AU_DagNode::setProducedByAssignment(): unknown sort for AU argument " << d << " at index " << i << " in subject " << this); } #endif } #endif Maude-2.6/src/AU_Theory/AU_Subproblem.hh0000644000147300135640000000457507666303243015037 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for subproblems in the the A, AUl, AUr and AU theories. // They consist of a directed acyclic graph and a set of sequence // partitioning problems. // #ifndef _AU_Subproblem_hh_ #define _AU_Subproblem_hh_ #include "subproblem.hh" #include "AU_Layer.hh" class AU_Subproblem : public Subproblem { public: AU_Subproblem(AU_DagNode* subject, int firstSubterm, int lastSubterm, int nrBlockPairs, AU_ExtensionInfo* extensionInfo); bool solve(bool findFirst, RewritingContext& solution); void addTopVariable(int layerNr, int index, int lowerBound, int upperBound, Sort* sort); void addNode(int layerNr, LocalBinding* difference, Subproblem* subproblem, int firstSubterm, int lastSubterm); void complete(); private: bool solvePatterns(bool findFirst, RewritingContext& solution); bool solveVariables(bool findFirst, RewritingContext& solution); AU_ExtensionInfo* const extensionInfo; // extension information object to be filled in Vector layers; // layers of directed acyclic graph }; inline void AU_Subproblem::addTopVariable(int layerNr, int index, int lowerBound, int upperBound, Sort* sort) { layers[layerNr].addTopVariable(index, lowerBound, upperBound, sort); } inline void AU_Subproblem::addNode(int layerNr, LocalBinding* difference, Subproblem* subproblem, int firstSubterm, int lastSubterm) { layers[layerNr].addNode(difference, subproblem, firstSubterm, lastSubterm); } #endif Maude-2.6/src/AU_Theory/ChangeLog0000644000147300135640000020533311457440426013562 000000000000002010-10-19 Steven Eker * AU_Symbol.cc (AU_Symbol::makeCanonicalCopyEagerUptoReduced): becomes makeCanonicalCopy() with change of semantics * AU_Symbol.hh (class AU_Symbol): makeCanonicalCopyEagerUptoReduced() -> makeCanonicalCopy() ===================================Maude95a=========================================== 2010-09-29 Steven Eker * AU_Symbol.cc (AU_Symbol::makeCanonicalCopyEagerUptoReduced): simplified now that we only deal with unreduced dag nodes; use getCanonicalCopyEagerUptoReduced() * AU_Symbol.hh (class AU_Symbol): added decl for makeCanonicalCopyEagerUptoReduced() * AU_Symbol.cc (AU_Symbol::makeCanonicalCopyEagerUptoReduced): added ===================================Maude95=========================================== 2010-03-17 Steven Eker * AU_DagNode.hh (AU_DagNode::setProducedByAssignment): clean up check for bug below * AU_BaseDagNode.hh (AU_BaseDagNode::isProducedByAssignment): added * AU_DagNode.cc (AU_DagNode::partialReplace): fix nasty bug where we had are normlization status set to ASSIGNMENT but replacement violated the guarantees offered by this status 2010-03-16 Steven Eker * AU_DagNode.cc (AU_DagNode::overwriteWithClone) (AU_DagNode::makeClone): use setNormalizationStatus()/getNormalizationStatus() instead of setTheoryByte()/getTheoryByte() * AU_Symbol.cc (AU_Symbol::makeCanonical): don't call setProducedByAssignment() until we have filled out arguements (AU_Symbol::makeCanonical): ditto * AU_Matcher.cc (AU_LhsAutomaton::forcedLoneVariableCase): don't call setProducedByAssignment() until we have filled out arguements * AU_Symbol.cc (AU_Symbol::eqRewrite): added look to check for Riesco 1/18/10 buga * AU_FullMatcher.cc (AU_LhsAutomaton::fullMatchFixedLengthBlock): added Assert() to check for argument with missing sort information 2010-03-12 Steven Eker * AU_RhsAutomaton.cc (AU_RhsAutomaton::replace) (AU_RhsAutomaton::construct): use nrArguments (AU_RhsAutomaton::buildArguments): use nrArguments * AU_RhsAutomaton.hh (class AU_RhsAutomaton): added data member nrArguments (AU_RhsAutomaton::close): set nrArguments * AU_RhsAutomaton.cc (AU_RhsAutomaton::buildArguments): rewrite to use iterators; made local_inline * AU_Term.cc (AU_Term::compileRhs2): rewritten to compile/build largest arguments first - this fixes a potential compilation performance issue ===================================Maude93=========================================== 2009-12-22 Steven Eker * AU_Symbol.hh (class AU_Symbol): added decl for makeCanonical() * AU_Symbol.cc (makeCanonical): added ===================================Maude92b=========================================== 2009-11-04 Steven Eker * AU_LhsCompiler.cc (findConstraintPropagationSequence): added DebugAdvisory()'s to both versions to try and locate serious performance bug (findConstraintPropagationSequence): added an optimization where we don't bother looking at the right alien if we forced all or all but one arguments using the left alien (unitVariable): added comment ===================================Maude92a=========================================== 2008-11-06 Steven Eker * AU_Term.cc (normalize): fix a nasty bug where we were collapsing to a subterm that had already been self destructed in the all identity case ===================================Maude91d=========================================== 2008-09-11 Steven Eker * AU_Matcher.cc (determineRigidBlocks): initialized firstMatch field to avoid compiler warning ===================================Maude91a=========================================== 2007-11-20 Steven Eker * AU_Term.cc (normalize): fix memory leak by calling deepSelfDestruct() on removed identities 2007-11-15 Steven Eker * AU_Normalize.cc (normalizeAtTop): don't allow garbage collection when we're in dumb mode 2007-11-09 Steven Eker * AU_DagNode.cc (instantiate2): pass dumb=true to normalizeAtTop(); call setGround() * AU_DagNode.hh (class AU_DagNode): updated decl for normalizeAtTop() with dumb flag defaulting to false * AU_Normalize.cc (normalizeAtTop): take dumb flag; only use deques when dumb flag is false 2007-11-07 Steven Eker * AU_DagNode.cc (instantiateWithReplacement): fix bug where we were making a cyclic dag * AU_DequeDagNode.hh (class AU_DequeDagNode): added decl for indexVariables2() * AU_DequeDagNode.cc (indexVariables2): added 2007-11-05 Steven Eker * AU_DagNode.cc (copyEagerUptoReduced2): remove unneeded cast (indexVariables2, instantiateWithReplacement): added * AU_DagNode.hh (class AU_DagNode): added declarations for instantiate2(), indexVariables2(), instantiateWithReplacement() ===================================Maude89h=========================================== 2006-09-26 Steven Eker * AU_CollapseMatcher.cc (uniqueCollapseMatch): we have to bind an unbound variable that can take identity in the rigid part otherwise it could be bound to something other than identity later on (we know it will be bound later on because it is in the rigid part). 2006-09-25 Steven Eker * AU_CollapseMatcher.cc (uniqueCollapseMatch): handle the case where a variable that can take identity ends up in the rigid part because we expect it to be bound by some other term in the rigid part 2005-07-28 Steven Eker * AU_Term.cc (deepCopy2): rewritten to handle translation to non-AU_Symbol * AU_Term.hh (class AU_Term): updated decl for SymbolMap* version of ctor * AU_Term.cc (AU_Term): SymbolMap* version: require symbol to be an AU_Symbol 2005-07-01 Steven Eker * AU_Term.hh (class AU_Term): updated decls for deepCopy2() and SymbolMap* version of ctor * AU_Term.cc (deepCopy2): rewritten (AU_Term): rewritten ===================================Maude86b=========================================== 2005-02-18 Steven Eker * AU_GreedyMatcher.cc (greedyMatchVariableBlock): commented out 4 DebugAdvisory()s ===================================Maude86=========================================== 2003-08-29 Steven Eker * AU_Symbol.hh (class AU_Symbol): added decl for rewriteAtTopNoOwise() * AU_Symbol.cc (rewriteAtTopNoOwise): added (complexStrategy): rewritten using rewriteAtTopNoOwise() (memoStrategy): rewritten using rewriteAtTopNoOwise() ===================================Maude82=========================================== 2003-05-28 Steven Eker * AU_Layer.cc (solveVariables): use MemoryCell::okToCollectGarbage() ===================================Maude80b=========================================== 2003-05-01 Steven Eker * AU_Matcher.cc (determineRigidBlocks): use clear() * AU_DequeDagNode.cc (overwriteWithClone): use copySetRewritingFlags() (makeClone): use copySetRewritingFlags() * AU_DagNode.cc (overwriteWithClone): use copySetRewritingFlags() (makeClone): use copySetRewritingFlags() 2003-04-30 Steven Eker * AU_LhsCompiler.cc (addFixedLengthBlock): fixed (invisible) bug where we had the earlyMatchFailOnInstanceOf() the wrong way around (addFixedLengthBlock): rewrote shift calculation inner loop to make it more understandable (addFixedLengthBlock): rewrote shift calculation inner loop to fix bug where the metalevel binds a variable that invalidates the subsumption and we end up with too big of a shift * AU_Layer.cc (bindVariables): use safeCast() on result of makeFragment() * AU_Matcher.cc (match): use safeCast() 2003-04-29 Steven Eker * AU_GreedyMatcher.cc (greedyMatchVariableBlock): fix bug in the case where a variable has to take the identity by setting it to [pos, pos-1] rather than [pos+1, pos]; this is important since last variable in bloack can have its lastSubject set to pos-1 in the code that assigns spare subterms * AU_Symbol.cc (calculateNrSubjectsMatched): fixed bug where we weren't handling the case that d points to a AU_DequeDagNode; use safeCast() * AU_GreedyMatcher.cc (greedyBindVariables): added Assert() to catch -ve number of subjects assigned to a variable * AU_LhsAutomaton.hh (class AU_LhsAutomaton): deleted decl for calculateNrSubjectsMatched() * AU_DequeMatcher.cc (dequeMatch): fixed bug wherewe weren't checking that there was enough arguments before handling a variable bound to an alien (dequeMatch): changed way of keeping track of bounds 2003-04-28 Steven Eker * AU_Symbol.cc (stackArguments): handle deque case properly rather than converting to AU_DagNode (normalizeAndComputeTrueSort): only do arg sort computations and normalizeAtTop() if the subject is fresh (computeBaseSort): rewritten using FOR_EACH_CONST() * AU_DequeDagNode.cc (stackArguments): fixed bug where we weren't initializing j * AU_Term.cc (deepSelfDestruct): use FOR_EACH_CONST() (normalize): use FOR_EACH_CONST() (findEagerVariables): use FOR_EACH_CONST() (markEagerArguments): use FOR_EACH_CONST() (analyseCollapses2): use FOR_EACH_CONST() (2 places) (dump): use FOR_EACH_CONST() (findAvailableTerms): use FOR_EACH_CONST() (compileRhs2): use FOR_EACH_CONST() (2 places) * AU_ExtensionInfo.cc (copy): use safeCast() * AU_DagNode.cc (partialReplace): use safeCast() (partialConstruct): use safeCast() (matchVariableWithExtension): use safeCast() * AU_Term.cc (normalize): use safeCast() (2 places) 2003-04-25 Steven Eker * AU_Symbol.cc (complexStrategy): simplified using rewriteAtTop() (complexStrategy): simplified using rewriteAtTop() * AU_Symbol.hh (class AU_Symbol): updated decl for complexStrategy() * AU_Symbol.cc (makeDagNode): use STL copy() (eqRewrite): need to check for equationFree() even in assignment case because reduce flag may not have be set because sort was not known because of an mb. (ruleRewrite): check for ruleFree() (AU_Symbol): set useDequeFlag only if we have standardStrategy() (eqRewrite): safeCast() to AU_DagNode* in the complexStrategy() case * AU_DagNode.cc (overwriteWithClone): use STL copy() (makeClone): use STL copy() (copyEagerUptoReduced2): use STL copy() 2003-04-24 Steven Eker * AU_Term.hh (symbol): use safeCast() * AU_DagNode.hh (class AU_DagNode): added decl for disappear() * AU_Normalize.cc (normalizeAtTop): rewritten (disappear): added * AU_BaseDagNode.cc: deleted * AU_DagNode.hh (class AU_DagNode): class AU_BaseDagNode no longer a friend * AU_BaseDagNode.cc (makeExtensionInfo): deleted (getSize): deleted * AU_BaseDagNode.hh (class AU_BaseDagNode): deleted decls for makeExtensionInfo() and getSize() * AU_DequeDagNode.cc (matchVariableWithExtension): deleted (makeExtensionInfo): added * AU_DequeDagNode.hh (class AU_DequeDagNode): added decl for makeExtensionInfo(); deleted decl for matchVariableWithExtension() * AU_Matcher.cc (matchRigidPart): use FOR_EACH_CONST * AU_DagNode.cc (overwriteWithClone): fixed bug where we weren't incrementing j (makeClone): fix symmetric bug 2003-04-23 Steven Eker * AU_DequeDagNode.cc (getHashValue): implemented properly * AU_Normalize.cc (normalizeAtTop): use AU_Deque ctor * AU_Symbol.hh (class AU_Symbol): added decl for rewriteAtTop() * AU_Symbol.cc (rewriteAtTop): added (eqRewrite): use rewriteAtTop(); assume deque form never needs to be rewritten * AU_Normalize.cc (normalizeAtTop): use useDeque() * AU_DagNode.cc (getHashValue): use FOR_EACH_CONST() (compareArguments): use FOR_EACH_CONST() (clearCopyPointers2): use FOR_EACH_CONST() (overwriteWithClone): use FOR_EACH_CONST() (makeClone): use FOR_EACH_CONST() * AU_DagNode.hh (setProducedByAssignment): use setNormalizationStatus() (producedByAssignment): deleted (nrArgs): deleted (getArgument): deleted (AU_BaseDagNode): use setNormalizationStatus() * AU_Symbol.hh (class AU_Symbol): added decl for compileEquations() * AU_Symbol.cc (AU_Symbol): init useDequeFlag (compileEquations): added * AU_Symbol.hh (class AU_Symbol): added data member useDequeFlag (useDeque): added * AU_DagNode.cc (markArguments): rewritten to avoid recursing on the first arg that shares our symbol 2003-04-22 Steven Eker * AU_DequeMatcher.cc (dequeMatch): fixed bug where we weren't assigning to returnedSubproblem in the success case 2003-04-21 Steven Eker * AU_DagOperations.cc (eliminateBackward): first arg no longer const (eliminateForward): first arg no longer const * AU_DagNode.hh (class AU_DagNode): updated decls for eliminateForward() and eliminateBackward() * AU_DequeMatcher.cc: created * AU_Normalize.cc (normalizeAtTop): use safeCast() (2 places) * AU_DagOperations.cc (eliminateForward): use getAU_DagNode() rather than static_cast - fixes a bug (eliminateBackward): ditto * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added decl for dequeMatch() * AU_Matcher.cc (match): handle deque form via dequeMatch() * AU_Normalize.cc (normalizeAtTop): only convert to deque form if symbol is equationFree() * AU_Symbol.hh (class AU_Symbol): added decl for complexStrategy() * AU_Symbol.cc (complexStrategy): added (memoStrategy): use isFresh() (memoStrategy): check for DEQUED (eqRewrite): rewritten to handle deque case * AU_BaseDagNode.hh (isFresh): added 2003-04-18 Steven Eker * AU_DequeDagNode.cc (dequeToArgVec): fixed buf where we weren't preserving sort index and reduced flag * AU_Normalize.cc (normalizeAtTop): fixed bug where we were setting e to argArray.begin() 2003-04-17 Steven Eker * AU_Symbol.cc (computeBaseSort): fixed bug where we were falling into AU_DagNode* case * AU_Normalize.cc (normalizeAtTop): temporary hack to force everything into deque form for testing * AU_DequeDagNode.hh (AU_DequeDagNode): initialize deque with copy ctor rather than assignment 2003-04-16 Steven Eker * AU_Normalize.cc: created * AU_DequeDagNode.hh (AU_DequeDagNode): take AU_Deque arg * AU_DequeDagNode.cc (makeClone): use new ctor * AU_DagNode.hh (class AU_DagNode): added DEQUED to enum NormalizationResult 2003-04-15 Steven Eker * AU_Symbol.cc (ruleRewrite): use getAU_DagNode() (eqRewrite): use getAU_DagNode() (memoStrategy): use getAU_DagNode() (computeBaseSort): handle AU_DequeDagNode; use safeCast() (normalizeAndComputeTrueSort): use getAU_DagNode() (stackArguments): use getAU_DagNode() * AU_Matcher.cc (match): use getAU_DagNode() * AU_DagNode.cc (copyEagerUptoReduced2): use safeCast() * AU_Term.cc (compareArguments): code cleaning * AU_DequeDagNode.cc (compareArguments): code cleaning * AU_BaseDagNode.cc (makeExtensionInfo): use getAU_DagNode() (getSize): handle ACU_TreeDagNode * AU_DagNode.hh: added decl for getAU_DagNode() * AU_DagNode.cc (getAU_DagNode): added 2003-04-14 Steven Eker * AU_DequeDagNode.cc (arguments): use AU_DequeDagArgumentIterator() * AU_Theory.hh: added class AU_DequeDagArgumentIterator * AU_DequeDagArgumentIterator.cc: created * AU_DequeDagArgumentIterator.hh: created * AU_DequeDagNode.hh (getDeque): added * AU_Term.cc (compareArguments): (Term* version) use iterators; use new ordering (compareArguments): (DagNode* version) use iterators; use new ordering; handle AU_DequeDagNodes * AU_DagNode.cc (compareArguments): check for deque; use new ordering * AU_Theory.hh: added class AU_BaseDagNode and class AU_DequeDagNode * AU_DagNode.hh (class AU_DagNode): made AU_DequeDagNode a friend * AU_DequeDagNode.hh: created * AU_DequeDagNode.cc: created 2003-04-11 Steven Eker * AU_DagNode.hh (symbol): deleted (producedByAssignment): sue new theory byte semantics (setProducedByAssignment): use new theory byte semantics (class AU_DagNode): derive from AU_BaseDagNode (AU_BaseDagNode): call AU_BaseDagNode(); use new theory byte semantics * AU_BaseDagNode.hh (_AU_BaseDagNode_hh_): created * AU_DagNode.hh (class AU_DagNode): delete decl for ~AU_DagNode() * AU_DagNode.cc (~AU_DagNode): deleted ===================================Maude80=========================================== 2003-03-28 Steven Eker * AU_Symbol.cc (computeBaseSort): fixed bug: we can't rely on producedByAssignment() to know that we're not in the error sort in the uniform sort case, since now we can have variables and assignments at the kind level; instead we check for the uniform sorts component being errorFree() 2003-02-25 Steven Eker * AU_Layer.cc (buildPartition): updated DebugAdvisoryCheck() (bindVariables): updated Assert()s * AU_Term.cc: removed #pragma (Term): updated Assert() (normalize): updated Assert() (insertAbstractionVariables): DebugAdvisoryCheck() -> DebugAdvisory() * AU_Term.hh: removed #pragma * AU_Symbol.cc: removed #pragma (eqRewrite): updated Assert() (computeBaseSort): updated Assert()s (normalizeAndComputeTrueSort): updated Assert() * AU_Symbol.hh: removed #pragma * AU_Subproblem.cc: removed #pragma (AU_Subproblem): updated Assert() * AU_Subproblem.hh: removed #pragma * AU_RhsAutomaton.cc: removed #pragma * AU_RhsAutomaton.hh: removed #pragma * AU_Matcher.cc (match): updated Assert()s, DebugAdvisoryCheck()s (matchRigidPart): updated Assert()s (forcedLoneVariableCase): updated Assert()s (determineRigidBlocks): updated Assert()s, DebugAdvisoryCheck() * AU_LhsCompiler.cc (compileLhs2): updated Assert()s * AU_LhsAutomaton.cc: removed #pragma * AU_LhsAutomaton.hh: removed #pragma * AU_Layer.cc: removed #pragma (link): updated Assert() (solvePatterns2): updated Assert() (buildPartition): updated Assert() * AU_Layer.hh: removed #pragma * AU_GreedyMatcher.cc (greedyMatch): updated Assert() (greedyMatchRigidBlock): updated Assert()s (greedyMatchRigidBlock2): updated Assert() (greedyMatchFixedLengthBlock): updated Assert()s (greedyMatchBlocks): updated Assert() (greedyMatchVariableBlock): updated Asserts(), DebugAdvisoryCheck() * AU_FullMatcher.cc (fullMatchRigidBlock): updated Assert()s (fullMatchRigidBlock2): updated Assert() (fullMatchFixedLengthBlock): updated Assert()s (buildLeftmostPath): updated Assert() * AU_ExtensionInfo.cc: removed #pragma (buildMatchedPortion): updated Assert() * AU_ExtensionInfo.hh: removed #pragma * AU_DagOperations.cc (eliminateForward): updated Assert() (eliminateBackward): updated Assert() (makeFragment): updated Assert() * AU_DagNode.cc: removed #pragma (compareArguments): updated Assert() (markArguments): updated Assert() (normalizeAtTop): updated Assert()s * AU_DagNode.hh: removed #pragma * AU_DagArgumentIterator.cc: removed #pragma (argument): updated Assert() (next): updated Assert() * AU_DagArgumentIterator.hh: removed #pragma * AU_CollapseMatcher.cc (uniqueCollapseMatch): updated Assert() (bindUnboundVariablesToIdentity): updated Assert() (multiwayCollapseMatch): updated Assert()s (collapseMatch): updated Assert() * AU_ArgumentIterator.cc: removed #pragma (argument): updated Assert() (next): updated Assert() * AU_ArgumentIterator.hh: removed #pragma ===================================Maude79=========================================== 2003-01-31 Steven Eker * AU_Term.cc (analyseCollapses): becomes analyseCollapses2() * AU_Term.hh (class AU_Term): analyseCollapses() -> analyseCollapses2() 2002-11-20 Steven Eker * AU_Matcher.cc (forcedLoneVariableCase): replaced rawBasePointer() calls with iterators 2002-11-18 Steven Eker * AU_DagNode.cc (compareArguments): use const_iterators in place of CONST_ARG_VEC_HACK()s (markArguments): use const_iterators in place of CONST_ARG_VEC_HACK()s 2002-10-16 Steven Eker * AU_Symbol.hh (class AU_Symbol): postInterSymbolPass() -> postOpDeclarationPass() * AU_Symbol.cc (postInterSymbolPass): becomes postOpDeclarationPass() since sort tables arem't computed at postInterSymbolPass time 2002-10-04 Steven Eker * AU_DagNode.hh (class AU_DagNode): updated decl for complex version of copyWithReplacement() * AU_DagNode.cc (copyWithReplacement): complex version: deal with case where only some args are stacked * AU_Symbol.cc (stackArguments): don't stack any args in frozen case; otherwise only stack arguments that are not unstackable 2002-10-03 Steven Eker * AU_DagNode.hh (class AU_DagNode): updated decl for stackArguments() * AU_DagNode.cc (stackArguments): handle respectFrozen arg ===================================Maude76================================================== 2002-08-02 Steven Eker * AU_Term.cc (compileRhs2): added code to flag last use of each source 2002-07-24 Steven Eker * AU_LhsCompiler.cc (addFixedLengthBlock): updated call to subsumes(); this does not fix the potential bug 2002-07-22 Steven Eker * AU_LhsCompiler.cc (addFixedLengthBlock): added comment about a possible bug ===================================Maude74================================================== 2002-03-29 Steven Eker * AU_LhsAutomaton.hh (class AU_LhsAutomaton): fixed return type for greedyMatchFixedLengthBlock() decl * AU_GreedyMatcher.cc (greedyMatchFixedLengthBlock): fixed a really nasty bug where we are declared as returning bool but occasionally need to return UNDECIDED (= -1). When this happens we end up returning true, without binding variables/returning subproblems; return type becomes int ===================================Maude71a================================================== 2002-03-11 Steven Eker * AU_Term.cc: deleted explicit template instantiation * AU_Subproblem.cc: deleted explicit template instantiation * AU_LhsAutomaton.cc: deleted explicit template instantiations * AU_Layer.cc: deleted explicit template instantiations ===================================Maude71================================================== 2002-01-29 Steven Eker * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added friend decl for SubtermType << function ===================================Maude70================================================== 2001-12-10 Steven Eker * AU_Term.hh (class AU_Term): make class AU_ArgumentIterator a friend ===================================Maude69================================================== 2001-04-03 Steven Eker * AU_DagNode.cc (copyWithReplacement): added (Vector version) * AU_DagNode.hh (class AU_DagNode): added decl for Vector version of copyWithReplacement() ===================================Engine66================================================== 2001-03-08 Steven Eker * AU_Symbol.hh (class AU_Symbol): added decl for stackArguments() * AU_Symbol.cc (stackArguments): added ===================================Engine65================================================== 2001-01-26 Steven Eker * AU_DagNode.hh (class AU_DagNode): updated markArguments() decl and made it private * AU_DagNode.cc (markArguments): rewritten with new semantics ===================================Engine64================================================== 2000-08-04 Steven Eker * AU_DagNode.cc (matchVariableWithExtension): don't pass inErrorSort to AU_Subproblem() * AU_Subproblem.cc (AU_Subproblem): don't handle inErrorSort arg (solveVariables): don't check inErrorSort * AU_Subproblem.hh (class AU_Subproblem): ctor no longer takes inErrorSort arg; deleted inErrorSort data member * AU_LhsCompiler.cc (compileLhs2): don't pass inErrorSort arg to AU_LhsAutomaton(); don't use it to determine greediness either * AU_FullMatcher.cc (buildLeftmostPath): don't pass inErrorSort arg to AU_Subproblem() * AU_LhsAutomaton.cc (AU_LhsAutomaton): don't handle inErrorSort arg (dump): don't dump inErrorSort * AU_LhsAutomaton.hh (class AU_LhsAutomaton): ctor decl no longer takes inErrorSort arg (class AU_LhsAutomaton): deleted inErrorSort data member 2000-08-02 Steven Eker * AU_Symbol.cc (eqRewrite): greatly simplified now that we no longer treat last strategy zero specially when term is in the error sort (memoStrategy): ditto 2000-07-31 Steven Eker * AU_Symbol.cc (computeBaseSort): don't handle union sorts ===================================Engine61================================================== 2000-07-28 Steven Eker * AU_RhsAutomaton.cc (remapIndices): added * AU_RhsAutomaton.hh (class AU_RhsAutomaton): added decl for remapIndices() 2000-07-26 Steven Eker * AU_LhsCompiler.cc (compileLhs2): use getNrProtectedVariables() instead of nrVariables() * AU_Term.cc (compileRhs2): use makeConstructionIndex() instead of allocateIndex() (insertAbstractionVariables): use makeProtectedVariable() instead of makeAbstractionVariable() 2000-07-25 Steven Eker * AU_Term.cc (findAvailableTerms): don't insert ground terms into availableTerms since we can't do left->right sharing on them * AU_RhsAutomaton.cc (construct): don't call buildAliens() (replace): don't call buildAliens() (dump): don't call RhsAutomaton::dump() * AU_Term.hh (class AU_Term): delete decl for compileRhs() * AU_Term.cc (compileRhs): deleted ===================================Engine60================================================== 2000-07-18 Steven Eker * AU_RhsAutomaton.hh (class AU_RhsAutomaton): removed extraneous decl for dump() 2000-07-11 Steven Eker * AU_Term.cc (findAvailableTerms): added (compileRhs2): added * AU_Term.hh (class AU_Term): added decls for findAvailableTerms() and compileRhs2() ===================================Engine59================================================== 2000-07-05 Steven Eker * AU_LhsCompiler.cc (compileLhs): becomes compileLhs2() * AU_Term.hh (class AU_Term): compileLhs() -> compileLhs2() 2000-06-26 Steven Eker * AU_LhsCompiler.cc (compileLhs): index() -> getIndex() (findConstraintPropagationSequence): index() -> getIndex() (unitVariable): lookupSort() -> getSort() (compileLhs): lookupSort() -> getSort() * AU_LhsAutomaton.cc (addRigidVariable): index() -> getIndex() (addRigidVariable): lookupSort() -> getSort() (addFlexVariable): lookupSort() -> getSort() (addFlexVariable): index() -> getIndex() * AU_Term.cc (compileRhs): modifiedIndex() -> getModifiedIndex() ===================================Engine58================================================== 2000-03-17 Steven Eker * AU_Term.cc (dump): ifdef'd * AU_Term.hh (class AU_Term): use NO_COPYING() macro; ifdef'd dump() decl * AU_RhsAutomaton.cc (dump): ifdef'd * AU_RhsAutomaton.hh (class AU_RhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decl * AU_LhsAutomaton.cc (dump): ifdef'd * AU_LhsAutomaton.hh (class AU_LhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decl * AU_Symbol.cc (eqRewrite): AdvisoryCheck() -> IssueAdvisory() (memoStrategy): AdvisoryCheck() -> IssueAdvisory() 2000-03-14 Steven Eker * AU_Layer.cc (solveVariables): call DagNode::okToCollectGarbage() after every failed call to bindVariables() to prevent build up of failed solutions ===================================Engine56================================================== 1999-11-03 Steven Eker * AU_Symbol.hh (class AU_Symbol): added decl for memoStrategy() * AU_Symbol.cc (eqRewrite): call memoStrategy() (memoStrategy): added 1999-10-29 Steven Eker * AU_Symbol.cc (AU_Symbol): use new AssociativeSymbol conventions ===================================Engine53================================================== 1999-10-26 Steven Eker * AU_LhsCompiler.cc (compileLhs): VariableTerm::dynamicCast() -> dynamic_cast() (*3) (addFixedLengthBlock): VariableTerm::dynamicCast() -> dynamic_cast() (findConstraintPropagationSequence): VariableTerm::dynamicCast() -> dynamic_cast() (*2) * AU_Term.cc (compileRhs): VariableTerm::dynamicCast() -> dynamic_cast() (insertAbstractionVariables): VariableTerm::dynamicCast() -> dynamic_cast() * AU_Symbol.cc (AU_Symbol): aded memoFlag arg * AU_Symbol.hh (class AU_Symbol): added memoFlag arg to ctor decl 1999-10-19 Steven Eker * AU_DagNode.hh (class AU_DagNode): added decl for getHashValue() * AU_DagNode.cc (getHashValue): added ===================================Engine52================================================== 1999-08-05 Steven Eker * AU_LhsAutomaton.cc (updateWholeBounds): plus() -> uplus() (updateFlexBounds): plus() -> uplus() * AU_Layer.cc (addTopVariable): plus() -> uplus() ===================================Engine51================================================== 1999-06-01 Steven Eker * AU_DagNode.cc (compareArguments): SPEED_HACK replaced by CONST_ARG_VEC_HACKs (markArguments): added CONST_ARG_VEC_HACK; turned for() loop into do while since we always have at least 2 arguments 1999-05-13 Steven Eker * AU_DagNode.cc (overwriteWithClone): copy theory byte (makeClone): copy theory byte 1999-05-12 Steven Eker * AU_Symbol.hh (class AU_Symbol): computeTrueSort() -> normalizeAndComputeTrueSort() * AU_Symbol.cc (computeTrueSort): become normalizeAndComputeTrueSort (normalizeAndComputeTrueSort): use fastComputeTrueSort() ===================================Engine49================================================== 1999-04-21 Steven Eker * AU_Term.cc (normalize): handle all identity case - fixing long standing bug ===================================Engine48================================================== ===================================Maude 1.0.2 released======================================= ===================================Maude 1.0.1 released======================================= 1999-03-02 Steven Eker * AU_Matcher.cc (forcedLoneVariableCase): fixed nasty bug in FAST_LONE_VARIABLE case where we were using wrong index var for destination * AU_LhsCompiler.cc (compileLhs): added code to generate fast lone variable case * AU_LhsAutomaton.cc (operator<<): added FAST_LONE_VARIABLE case * AU_Matcher.cc (forcedLoneVariableCase): added FAST_LONE_VARIABLE case (match): add FAST_LONE_VARIABLE to DebugAdvisoryCheck() and Assert() * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added FAST_LONE_VARIABLE to MatchStrategy * AU_LhsAutomaton.cc (addRigidVariable): don't init structure field (addFlexVariable): don't init structure field (addFlexAbstractionVariable): don't init structure field (dump): don't print structure field (2 places) * AU_LhsAutomaton.hh (class AU_LhsAutomaton): deleted structure field from struct TopVariablesince in's not used - we decide at compile time whether we can use greedy algorithm based on sort structures. make index field a short so we can share space with flags and avoid hole with attendent purify warnings. 1999-02-27 Steven Eker * AU_DagNode.cc (normalizeAtTop): fixed bug in identity test (2 places) 1999-02-26 Steven Eker * AU_DagNode.cc (normalizeAtTop): need to be able to collect garbage in identity + expansion case (normalizeAtTop): added Assert to check buffer size in expansion + identities case * AU_Symbol.cc (eqRewrite): use new normalizeAtTop() semantics and return value (4 places) (computeTrueSort): use new normalizeAtTop() semantics and return value * AU_DagNode.hh (class AU_DagNode): added enum NormalizationResult (class AU_DagNode): updated decl for normalizeAtTop(); deleted decl for eliminateIdentity() * AU_DagNode.cc (normalizeAtTop): now do identity elimination (eliminateIdentity): deleted ===================================VectorExperiment========================================== Fri Nov 6 16:18:30 1998 Steven Eker * AU_Term.cc (deepCopy): -> deepCopy2() * AU_Term.hh (class AU_Term): deepCopy() -> deepCopy2() ===================================Engine43================================================== Thu Oct 8 14:00:28 1998 Steven Eker * AU_DagOperations.cc (eliminateForward): removed const_cast and added const * AU_Term.cc (compareArguments): (Term* version) added const_cast (compareArguments): (DagNode* version) added const_cast (compareArguments): removed const_cast and added const * AU_DagNode.cc (matchVariableWithExtension): static_cast -> const_cast * AU_DagOperations.cc (eliminateForward): inserted const_cast (eliminateBackward): inserted const_cast ===================================Engine41================================================== Wed Sep 23 09:50:26 1998 Steven Eker * AU_Symbol.cc (computeBaseSort): implemented lastIndex heuristic for uniSort case Fri Sep 18 14:21:32 1998 Steven Eker * AU_Symbol.cc (computeBaseSort): rewritten using setSortIndex(), lookupSortIndex(), traverse() and DagNode::leq() * AU_DagNode.cc (overwriteWithClone): use setSortIndex() (makeClone): use setSortIndex() * AU_Matcher.cc (matchRigidPart): use DagNode::leq() (checkLeftEnd): use DagNode::leq() (checkRightEnd): use DagNode::leq() (forcedLoneVariableCase): use DagNode::leq() * AU_GreedyMatcher.cc (greedyMatchFixedLengthBlock): use DagNode::leq() (greedyMatchVariableBlock): use DagNode::leq() (4 places) * AU_FullMatcher.cc (fullMatchFixedLengthBlock): use DagNode::leq() Fri Sep 11 18:11:19 1998 Steven Eker * AU_Matcher.cc (forcedLoneVariableCase): use new checkSort() convention * AU_Layer.cc (bindVariables): use new checkSort() convention * AU_Symbol.cc (computeBaseSort): use <=(DagNode*,Sort&) * AU_Matcher.cc (matchRigidPart): use <=(DagNode*,Sort&) (checkLeftEnd): use <=(DagNode*,Sort&) (checkRightEnd): use <=(DagNode*,Sort&) (forcedLoneVariableCase): use <=(DagNode*,Sort&) * AU_GreedyMatcher.cc (greedyMatchFixedLengthBlock): use <=(DagNode*,Sort&) (greedyMatchVariableBlock): use <=(DagNode*,Sort&) (4 places) * AU_FullMatcher.cc (fullMatchFixedLengthBlock): use <=(DagNode*,Sort&) ===================================Engine40================================================== Mon Jul 20 19:51:03 1998 Steven Eker * AU_Term.cc (AU_Term): new ctor added * AU_Term.hh (class AU_Term): added decls for deepCopy() and new ctor ===================================Engine39================================================== Wed Jun 10 14:31:27 1998 Steven Eker * AU_Term.cc (normalize): don't use earlyGetIdentity() * AU_Symbol.hh (class AU_Symbol): changed compileOpDeclarations() decl to postInterSymbolPass() * AU_Symbol.cc (compileOpDeclarations): changed to postInterSymbolPass() * AU_Term.hh (class AU_Term): updated normalize() decl * AU_Term.cc: IntSet -> NatSet (normalize): compute and set changed flag * AU_LhsCompiler.cc: IntSet -> NatSet * AU_Term.hh: IntSet -> NatSet ===================================Engine38================================================== Wed Jun 3 16:34:14 1998 Steven Eker * AU_Term.cc (normalize): use earlyGetIdentity() Fri Feb 20 17:31:47 1998 Steven Eker * AU_DagNode.cc (stackArguments): only stack arguments that are not flagged as unstackable ===================================Engine36================================================== Mon Feb 16 16:21:14 1998 Steven Eker * AU_LhsAutomaton.cc (AU_LhsAutomaton): fixed bug where we were deleting rigid part 2nd time instead of flex part Thu Feb 12 11:53:39 1998 Steven Eker * AU_FullMatcher.cc (determineRigidBlocks): moved to AU_Matcher.cc as this is now called only in match() * AU_LhsAutomaton.cc (~AU_LhsAutomaton): added * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added decl for ~AU_LhsAutomaton() * AU_Term.cc (normalize): compare() == 0 changed to equal() * AU_Symbol.cc (calculateNrSubjectsMatched): compare() == 0 changed to equal() (3 places) * AU_Matcher.cc (matchRigidPart): compare() != 0 changed to !equal() (checkLeftEnd): compare() == 0 changed to equal() (checkRightEnd): compare() == 0 changed to equal() * AU_GreedyMatcher.cc (greedyMatchFixedLengthBlock): compare() != 0 changed to !equal() (2 places) * AU_FullMatcher.cc (fullMatchFixedLengthBlock): compare() != 0 changed to !equal() (2 places) * AU_DagOperations.cc (eliminateForward): compare() == 0 changed to equal() (4 places) (eliminateForward): compare() != 0 changed to !equal() * AU_DagNode.cc (eliminateIdentity): compare() == 0 changed to equal() * AU_CollapseMatcher.cc (uniqueCollapseMatch): compare() != 0 changed to !equal() (2 places) (multiwayCollapseMatch): compare() != 0 changed to !equal() (2 places) (multiwayCollapseMatch): compare() == 0 changed to equal() (2 places) Wed Feb 11 16:58:12 1998 Steven Eker * AU_GreedyMatcher.cc (greedyMatchFixedLengthBlock): need to call delete sp if we get a subproblem in the NON_GROUND_ALIEN case. This was a serious memory leak bug. * AU_FullMatcher.cc (buildLeftmostPath): use delete rather than calling deepSelfDestruct() * AU_Layer.cc (AU_Layer): use delete rather than calling deepSelfDestruct() * AU_Subproblem.hh (class AU_Subproblem): deleted decl for deepSelfDestruct() * AU_Subproblem.cc (deepSelfDestruct): deleted Tue Feb 10 15:24:31 1998 Steven Eker * AU_GreedyMatcher.cc (greedyMatch): don't call determineRigidBlocks() * AU_FullMatcher.cc (fullMatch): don't call determineRigidBlocks() * AU_Matcher.cc (match): call determineRigidBlocks() =============================Engine35======================================================== Fri Feb 6 11:40:28 1998 Steven Eker * AU_LhsCompiler.cc (compileLhs): avoid using greedy strategy if with are matching at top and we can collapse since greedy matcher does not ensure that enough has been matched if matching with extension. This is implicitly ensured if we cannot collapse. * AU_GreedyMatcher.cc (greedyMatchFixedLengthBlock): use scratch, not local for matching (greedyMatchRigidBlock): copy scratch back into local after success * AU_LhsAutomaton.hh (class AU_LhsAutomaton): updated greedy matcher function decls * AU_GreedyMatcher.cc (greedyMatchBlocks): if we have no rigid blocks, last and only variable can have both left and right extension (greedyMatchVariableBlock): major rewrite to handle subtleties introduced by extension Thu Feb 5 15:10:01 1998 Steven Eker * AU_GreedyMatcher.cc: created Wed Feb 4 17:59:13 1998 Steven Eker * AU_Layer.hh (class AU_Layer): added data member lastSubjectSubterm (class AU_Layer): deleted decl for computeAssignment() (class AU_Layer): updated decl for solvePartition() * AU_Layer.cc (bindVariables): no need to compute lastSubjectSubterm anymore (bindVariables): reorganization of loop; call to computeAssignment eliminated (computeAssignment): deleted (buildPartition): no need to compute lastSubjectSubterm anymore (solvePartition): removed lastSubjectSubterm arg (solvePartition): reorganized extraId calculations; now check that what a variable is already given by partition is strictly below its upperBound brefore considering it as a candidate for getting an extra identity (solveVariables): don't pass lastSubjectSubterm to solvePartition(); don't compute lastSubjectSubterm (link): simplified inner loop (initialize): initialize lastSubjectSubterm (AU_Layer): don't bother initializing oneSidedId and leftId as these will be initialized in initialize() Tue Feb 3 18:42:21 1998 Steven Eker * AU_Layer.hh (class AU_Layer): deleted decl for flagOneSidedId() (class AU_Layer): added decl for initialize() * AU_Layer.cc (flagOneSidedId): deleted * AU_Subproblem.hh (class AU_Subproblem): deleted data member subject * AU_Subproblem.cc (solveVariables): don't pass subject to AU_Layer::solveVariables() (AU_Subproblem): call AU_Layer::initialize() (complete): don't call AU_Layer::flagOneSidedId() (AU_Subproblem): don't initialize subject * AU_Layer.cc (bindVariables): don't pass subject to computeAssignment() (solveVariables): don't pass subject to bindVariables() or buildPartition() * AU_Layer.hh (class AU_Layer): update decls for solveVariables(), buildPartition(), bindVariables() and computeAssignment() * AU_Layer.cc (solveVariables): removed subject arg (buildPartition): removed subject arg (bindVariables): removed subject arg (computeAssignment): removed subject arg * AU_Layer.hh (class AU_Layer): added data member subject; reorganized data members * AU_Layer.cc (initialize): added Mon Feb 2 11:39:27 1998 Steven Eker * AU_Subproblem.cc (AU_Subproblem): don't initialize firstSubterm and lastSubterm * AU_Subproblem.hh (class AU_Subproblem): deleted data members firstSubterm and lastSubterm as they are never used one they have been copied into appropriate layers Fri Jan 30 11:36:21 1998 Steven Eker * AU_Layer.hh (firstSubtermMatched): deleted (lastSubtermMatched): deleted (class AU_Layer): deleted decls for firstSubtermMatched() and lastSubtermMatched() * AU_Subproblem.hh (class AU_Subproblem): deleted decl for fillOutExtensionInfo() * AU_Subproblem.cc (fillOutExtensionInfo): deleted * AU_DagNode.hh (class AU_DagNode): deleted decls for eliminateSubject() and checkArguments() * AU_DagNode.cc (checkArguments): deleted (eliminateSubject): deleted * AU_Layer.cc (bindVariables): deal with leftExtend/rightExtend correctly when nrVariables == 0 (bindVariables): in right extend case it need not be that firstSubterm == 0 * AU_Subproblem.cc (solveVariables): use bigEnough() and buildMatchedPortion() rather than callingfillOutExtensionInfo() * AU_ExtensionInfo.hh (bigEnough): added (class AU_ExtensionInfo): added decl for bigEnough() (setLastMatched): call setMatchedWhole(); * AU_Layer.cc (bindVariables): set left, right and extraIdentity extensionInfo * AU_Subproblem.cc (AU_Subproblem): pass extensionInfo to initializeFirst() and initializeLast() * AU_Layer.hh (class AU_Layer): updated initializeFirst() and initializeLast() decls * AU_Layer.cc (initializeFirst): set extensionInfo if needed (initializeFirst): set extensionInfo if needed * AU_Layer.hh (class AU_Layer): added data member extensionInfo * AU_DagOperations.cc (makeFragment): fixed initialization bug; greatly simplified * AU_ExtensionInfo.cc (buildMatchedPortion): greatly simplified and bug removed by using DagNode::makeFragment() * AU_Layer.cc (computeAssignment): use DagNode::makeFragment() * AU_DagNode.hh (class AU_DagNode): added decl for makeFragment() * AU_DagOperations.cc (makeFragment): added Thu Jan 29 10:17:25 1998 Steven Eker * AU_FullMatcher.cc (determineRigidBlocks): rewritten to fix horrible bug where we were incrementing r.nrSubjectsToLeave before finishing current block so we were in effect incrementing nrSubjectsToLeave for wrong block * AU_Layer.cc (computeAssignment): fixed bug that aflicted left id case * AU_Layer.hh (class AU_Layer): flagOneSidedId() decl updated * AU_Layer.cc (flagOneSidedId): name clash problem; leftId arg changed to leftIdFlag * AU_Subproblem.cc (complete): nrLayers, not nrPatternLayers for loop inserting oneSidedId info * AU_FullMatcher.cc (addVariableBlocks): awkward variables get a lower bound of 0 rather than 1 * AU_Layer.cc (bindVariables): rewritten using DagNode::eliminateForward() (computeAssignment): handle extra id case (bindVariables): deal with the case where variable can take one sided identity because it is at the wrong extreme end (solvePartition): fixed i++ instead of i-- bug * AU_Layer.hh (class AU_Layer): updated solvePartition() decl * AU_Layer.cc (solvePartition): take lastSubjectSubterm arg; use this to help determine if a variable can take an extra identity in the one sided identity case. Wed Jan 28 11:32:50 1998 Steven Eker * AU_Layer.cc (buildPartition): rewritten to take account of nasty bindings; no longer return 0 under any circumstances (solveVariables): don't bother checking for 0 partition (buildPartition): added DebugAdvisoryCheck for nast binding * AU_Layer.hh (class AU_Layer): added decl for solvePartition() (class AU_Layer): added decl for flagOneSidedId() * AU_LhsAutomaton.hh (class AU_LhsAutomaton): deleted decl for calculateNrSubjectsMatched() * AU_FullMatcher.cc (determineRigidBlocks): use AU_Symbol::calculateNrSubjectsMatched() (calculateNrSubjectsMatched): deleted * AU_Symbol.hh (class AU_Symbol): added decl for calculateNrSubjectsMatched() * AU_Symbol.cc (calculateNrSubjectsMatched): added * AU_Subproblem.cc (complete): call link() rather than complete (complete): call flagOneSidedId() * AU_Layer.cc (complete): renamed to link() (flagOneSidedId): added (AU_Layer): clear oneSidedId and leftId * AU_Layer.hh (class AU_Layer): added data members oneSidedId and leftId; (class AU_Layer): complete renamed to link() * AU_Layer.cc (solvePartition): added (solvePartition): added to handle extra identities (solveVariables): use solvePartition() * AU_Layer.hh (class AU_Layer): added extraId field to TopVariable * AU_ExtensionInfo.cc (buildMatchedPortion): simplified using oneSidedId() Tue Jan 27 11:01:55 1998 Steven Eker * AU_FullMatcher.cc (addVariableBlocks): use NOT_FIXED (determineRigidBlocks): use NOT_FIXED (fullMatchRigidBlock2): use NOT_FIXED (buildLeftmostPath): removed comment on nextSubject update since nasty binding will now never occur rigid block * AU_LhsAutomaton.cc (complete): use NOT_FIXED * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added Special value NOT_FIXED = -1 * AU_FullMatcher.cc (addVariableBlocks): missing continue in nasty case added (determineRigidBlocks): Assert() that if we have a nasty binding we must have extension. (determineRigidBlocks): rewritten; make sure that in nasty case we incresse r.nrSubjectsToLeave rather than r.nrSubjectsForUs (calculateNrSubjectsMatched): return max # of subject we could match in the nasty case instead of min (addVariableBlocks): adjusted as f.variable.nastyBinding now holds max rather than min * AU_LhsAutomaton.hh (class AU_LhsAutomaton): updated calculateNrSubjectsMatched() decl * AU_FullMatcher.cc (determineRigidBlocks): handle variables with nasty binding by treating them as if they are unbound. (determineRigidBlocks): added DebugAdvisoryCheck()s for nasty bindings (calculateNrSubjectsMatched): pass back nasty flag; DebugAdvisoryCheck()s removed (addVariableBlocks): handle variables with nasty bindings * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added nastyBinding field to struct TopVariable * AU_FullMatcher.cc (calculateNrSubjectsMatched): added DebugAdvisoryCheck()s for nasty bindings; now decrement nrArgs in this case Mon Jan 26 18:07:45 1998 Steven Eker * AU_FullMatcher.cc (determineRigidBlocks): assert that if last rigid block is terminated by end of (unused) flex part rather than by an unbound variable then we must have extension Fri Jan 23 18:20:51 1998 Steven Eker * AU_FullMatcher.cc (buildLeftmostPath): added Assert to check that there are unbound variable(s) before first rigid block and after last rigid block if there is no extension. (buildLeftmostPath): removed code for special case where flex part consists of a single rigid block (and no extension) since this case can no longer occur (buildLeftmostPath): removed code for adjusting min and max shifts where ther was no extension and no unbound variables before first rigid block or after last rigid block since these cases can no longer occur (addRemainingPaths): removed code for case where these are no unbound variables to the left of 1st rigid block (and no extension) since this case can no longer occur (fullMatchRigidBlock2): use eliminateForward() in place of eliminateSubject(); rather aribitrarily pass limit = rightPos to avoid triggering eliminateForward() precondition Assert() - may be we should be smarter? Thu Jan 22 11:03:55 1998 Steven Eker * AU_FullMatcher.cc (calculateNrSubjectsMatched): added (determineRigidBlocks): rewritten using calculateNrSubjectsMatched() Wed Jan 21 11:05:37 1998 Steven Eker * AU_Matcher.cc (match): added DebugAdvisoryCheck()s for match time match strategy changes (matchRigidPart): fixed compare() == 0 bug (should have been !=) * AU_FullMatcher.cc (addVariableBlocks): use flexLeftPos and flexRightPos to determine to section of flex part to be examined for variables (determineRigidBlocks): use flexLeftPos and flexRightPos to determine to section of flex part to be examined for rigid blocks and end of last rigid block if we don't end in a non-rigid variable (buildLeftmostPath): use flexRightPos rather than last Tue Jan 20 11:24:48 1998 Steven Eker * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added enum Special with single constant STALLED * AU_Matcher.cc (checkLeftEnd): added (checkRightEnd): added (checkForRigidEnds): complete rewritten yet again, this time using checkLeftEnd() and checkRightEnd() to eliminate a rats nest of gotos * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added data members flexLeftPos and flexRightPos * AU_Matcher.cc (match): added code to check nrArgs against whole bounds (match): Only call matchRigidPart in no extension case; tidied no extension case (matchRigidPart): removed code that checked nrArgs against whole bounds (checkForRigidEnds): heavily rewritten with stalled flags and new exit conditions for loop Mon Jan 19 10:58:34 1998 Steven Eker * AU_Matcher.cc (matchRigidPart): tidied up; nrSubtermsRemaining deleted (match): now call checkForRigidEnds() in lone variable case just in case lone variable is bound. (matchRigidPart): more tidying (forcedLoneVariableCase): assert that lone variable is unbound; lone variable bound case code deleted as this case will now be caught by checkForRigidEnds() and transformed into ground out case. * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added decl for checkForRigidEnds(); deleted decl for matchRigidSubterm() * AU_Matcher.cc (match): rewritten; we now try to force ends of flex part if there is no extension (forcedLoneVariableCase): use flexPart[flexLeftPos] rather than flexPart[0]; no longer assert that flex part has length 1 (matchRigidPart): restored old version as there is not going to be enough overlap with checkForRigidInFlex() to make it worth pulling common parts into another function (checkForRigidInFlex): added (match): completely rewritten to use checkForRigidEnds() (checkForRigidInFlex): renamed to checkForRigidEnds() (matchRigidSubterm): deleted * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added decl for matchRigidSubterm(); deleted decl for boundsChecks() * AU_Matcher.cc (matchRigidSubterm): added (matchRigidPart): rewrittem using matchRigidSubterm Fri Jan 16 16:23:14 1998 Steven Eker * AU_Term.cc (insertAbstractionVariables): changed AdvisoryCheck() to DebugAdvisoryCheck() * AU_Subproblem.cc (fillOutExtensionInfo): call setExtraIdentity(false) as a temporary hack * AU_LhsCompiler.cc (compileLhs): use oneSidedId() (analyseConstraintPropagation): use oneSidedId() * AU_DagNode.cc (matchVariableWithExtension): use oneSidedId() * AU_Symbol.cc (AU_Symbol): initialize oneSidedIdFlag * AU_Symbol.hh (oneSidedId): added (class AU_Symbol): added data member oneSidedIdFlag and decl for oneSidedId() * AU_DagNode.cc (partialReplace): removed Assert that we don't replace a single arg (partialConstruct): removed Assert that we don't replace a single arg (matchVariableWithExtension): allow variable to match just one thing if we have a one sided identity * AU_ExtensionInfo.cc (makeClone): copy extraIdentityFlag (copy): copy extraIdentityFlag (buildMatchedPortion): handle extra identity case * AU_ExtensionInfo.hh (setExtraIdentity): added (class AU_ExtensionInfo): added data member extraIdentityFlag and decl for setExtraIdentity() Tue Jan 13 10:57:17 1998 Steven Eker * AU_LhsCompiler.cc (compileLhs): don't employ greedy or lone variable strategies if we have a one sided identity (analyseConstraintPropagation): don't propagate constraints on a lone variable if we have a one sided identity * AU_DagOperations.cc (eliminateForward): fixed bugs where we were not testing compare result against 0 (eliminateBackward): fixed symmtric bugs * AU_Matcher.cc (matchRigidPart): rewrote bound variable case using eliminateForward() and eliminateBackward() Mon Jan 12 17:44:19 1998 Steven Eker * AU_DagNode.hh (class AU_DagNode): added decls for eliminateForward() and eliminateBackward() * AU_DagOperations.cc (eliminateForward): added; the idea is that this function will match a target (typically avariable binding) against our dag node from a given position taking into to account the following possibilities: (a) the target might be our identity (b) the target might have our top symbol (c) the target might have our top symbol and have our identity underneath it (in first or last position). This pathogical case arises if we have a one sided identity. (eliminateBackward): added; symmetric to eliminateForward() for use in matchinging the rigid part. Fri Jan 9 11:13:19 1998 Steven Eker * AU_LhsAutomaton.cc (dump): use bool() to make takeIdentity and awkward flags print correctly * AU_Layer.cc (buildPartition): handle case where variable is bound to identity (may be by previous subproblem). Thu Jan 8 11:03:26 1998 Steven Eker * AU_Subproblem.cc (fillOutExtensionInfo): rewritten; only check matched portion if pattern ws in the error sort. * AU_Layer.cc (bindVariables): don't return out of loop with anything other than false otherwise we may return a solution with unbound variables Wed Jan 7 15:25:37 1998 Steven Eker * AU_FullMatcher.cc (fullMatchRigidBlock2): implemented (fullMatchFixedLengthBlock): implemented (fullMatch): need to call AU_Subproblem::complete() after subproblem has all the nodes added to do downTarget calculations * AU_DagNode.cc (eliminateSubject): handle the possibility that the target may be our identity * AU_FullMatcher.cc (addRemainingPaths): implemented * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added data member nrSubjectsForRightVars * AU_FullMatcher.cc (determineRigidBlocks): treat awkward variables bound to identity as if they were bound to an alien (buildLeftmostPath): implemented (determineRigidBlocks): calculate nrSubjectsForRightVars Fri Jan 2 14:30:02 1998 Steven Eker * AU_LhsCompiler.cc (compileLhs): chnaged code to reflect new conventions for addFlexVariable() and addRigidVariable() regarding awkward variables * AU_LhsAutomaton.hh (class AU_LhsAutomaton): updated addFlexAbstractionVariable() decl * AU_LhsAutomaton.cc (addRigidVariable): set awkward = false (addFlexVariable): set awkward flag correctly (dump): print awkward flag (addFlexAbstractionVariable): take awkward arg and set awkward flag * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added awkward flag to struct TopVariable * AU_CollapseMatcher.cc (uniqueCollapseMatch): deal with rigid part since it is NOT the case that the rigid part need be empty for collapse to occur. (multiwayCollapseMatch): deal with rigid part; in particular the case where we have a matching variable in the rigid part. nrTopVariables replaced by nrFlexVariables throughout file. (bindUnboundVariablesToIdentity): assert that variables in flex part can take identity. (multiwayCollapseMatch): changed many comments to reflect that repeated variables are not a problem and that they are handled correctly implicity though in some cases inefficiently. Removed some commented out code related to repeated variables Wed Dec 24 14:26:24 1997 Steven Eker * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added decls for uniqueCollapseMatch() and multiwayCollapseMatch() * AU_CollapseMatcher.cc: created * AU_FullMatcher.cc (determineRigidBlocks): take identity into account when calculating number of subjects used up by variable and rigid blocks. * AU_LhsAutomaton.hh (class AU_LhsAutomaton): struct RigidBlock now has nrSubjectsForUs rather than nrExtraSubjects since bound variable may be bound to our identity * AU_FullMatcher.cc (fullMatch): need to add our AU_Subproblem to subproblems before we let addVariableBlocks() add variable abstraction subproblems * AU_LhsAutomaton.hh (class AU_LhsAutomaton): updated decl for addVariableBlocks() * AU_FullMatcher.cc: created * AU_LhsAutomaton.cc (dump): dump uniqueCollapseAutomaton if it exists * AU_LhsCompiler.cc (compileLhs): make uniqueCollapseAutomaton if needed * AU_LhsAutomaton.cc (AU_LhsAutomaton): added uniqueCollapseAutomaton arg * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added data member uniqueCollapseAutomaton (class AU_LhsAutomaton): added uniqueCollapseAutomaton arg to ctor decl Tue Dec 23 10:58:30 1997 Steven Eker * AU_LhsAutomaton.cc (addFlexAbstractionVariable): removed shiftFactor arg (dump): don't try to print name of an abstraction variable * AU_LhsAutomaton.hh (class AU_LhsAutomaton): removed shiftFactor arg from addFlexAbstractionVariable() decl * AU_LhsCompiler.cc (compileLhs): when we add a flex variable in the general case we have to pass idPossible = true if matchAtTop because of extension. (compileLhs): don't pass shiftFactor to addFlexAbstractionVariable() since this will always be UNDEFINED (2 places). (addFixedLengthBlock): always pass idPossible = false to addFlexVariable() variable in fixed part can never take identity. * AU_Term.hh (class AU_Term): updated unitVariable() decl * AU_LhsCompiler.cc (compileLhs): handle flex lengths of 0 and 1 specially. (compileLhs): use greedySafe() (compileLhs): added Asserts (findConstraintPropagationSequence): code cleaning (compileLhs): code cleaning (unitVariable): removed matchAtTop argument and simplified; made local_inline (findConstraintPropagationSequence): don't pass matchAtTop argument to unitVariable() (compileLhs): rewritten; now explicity look for awkward variables; Mon Dec 22 14:40:40 1997 Steven Eker * AU_LhsCompiler.cc (compileLhs): handle identity/variable abstraction in flex part. * AU_Term.hh (class AU_Term): added decl for unitVariable() * AU_LhsCompiler.cc (unitVariable): added (findConstraintPropagationSequence): simplified using unitVariable() Fri Dec 19 10:18:25 1997 Steven Eker * AU_Term.hh (idPossible): made const (class AU_Term): updated decl for idPossible() * AU_LhsCompiler.cc (compileLhs): simplfied using idPossible() (2 places) (addFixedLengthBlock): simplfied using idPossible() (findConstraintPropagationSequence): rewritten do deal with abstracted aliens and variables that can take identity * AU_Term.cc (normalize): use idPossible() (analyseCollapses): use idPossible() (analyseCollapses): simplified * AU_Term.hh (idPossible): added (class AU_Term): added decl for idPossible() * AU_LhsCompiler.cc (compileLhs): pass idPossible args to addRigidVariable() and addFlexVariable() (addFixedLengthBlock): pass idPossible args to addFlexVariable() * AU_LhsAutomaton.hh (class AU_LhsAutomaton): updated decls for addRigidVariable() and addFlexVariable() * AU_LhsAutomaton.cc (addRigidVariable): added idPossible arg so that we can rule out left end variable taking id if left id missing and similarly with right (addFlexVariable): added idPossible arg Thu Dec 18 11:32:31 1997 Steven Eker * AU_LhsCompiler.cc (compileLhs): pass collapsePossible flag to AU_LhsAutomaton (compileLhs): inErrorSort implies not greedy * AU_LhsAutomaton.cc (dump): updated * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added decl for addFlexAbstractionVariable() * AU_LhsAutomaton.cc (AU_LhsAutomaton): take collapsePossible arg (addRigidVariable): deal with variables that may take identity; clear abstracted pointer. (addFlexVariable): deal with variables that may take identity; clear abstracted pointer. (addFlexAbstractionVariable): added * AU_LhsAutomaton.hh (class AU_LhsAutomaton): added collapsePossible arg to ctor * AU_LhsCompiler.cc: created (analyseConstraintPropagation): handle the case where flex part conatins a lone abstracted term * AU_Term.cc (normalize): handle collapse case Sun Dec 14 15:28:05 1997 Steven Eker * AU_Layer.cc (bindVariables): handle the case where a variable is already bound to our identity. * AU_Subproblem.cc (solvePatterns): use AU_Layer::reset() * AU_Layer.hh (reset): added (class AU_Layer): added reset() decl (class AU_Layer): class AU_Subproblem is no longer a friend * AU_Subproblem.cc (AU_Subproblem): use initializeFirst() and initializeLast() * AU_Layer.hh (class AU_Layer): added decls for initializeFirst() and initializeLast() * AU_Layer.cc (initializeFirst): added (initializeLast): added * AU_Subproblem.cc (fillOutExtensionInfo): use firstSubtermMatched() and lastSubtermMatched(); * AU_Layer.hh (lastSubtermMatched): added (firstSubtermMatched): added (class AU_Subproblem): added decls Sat Dec 13 17:03:07 1997 Steven Eker * AU_DagNode.cc (matchVariableWithExtension): pass Sort* rather than SortCode to addTopVariable(); (matchVariableWithExtension): call complete(); * AU_Subproblem.hh (class AU_Subproblem): added decl for fillOutExtensionInfo() * AU_Subproblem.cc (fillOutExtensionInfo): added (solveVariables): simplify using fillOutExtensionInfo() Fri Dec 12 16:49:13 1997 Steven Eker * AU_Subproblem.cc (solveVariables): check to see if matched portion in error sort (solveVariables): check to see if matched portion is too small (less than two terms). This is possible because pattern could be variable or parts of big pattern could match take identity. * AU_Subproblem.hh (class AU_Subproblem): added decl for complete() * AU_Subproblem.cc (complete): added (addNode): deleted * AU_Subproblem.hh (addNode): added * AU_Layer.cc (solvePatterns2): use Assert(d >= totalLowerBound) rather than Assert(d >= prevVariables.length()) since some variables may be able to take identity and may not need any subterm (addTopVariable): update totalLowerBound (AU_Layer): initialize totalLowerBound * AU_Layer.hh (class AU_Layer): added decls for addTopVariable(), addNode(), complete() (class AU_Layer): added data member totalLowerBound * AU_Layer.cc (addNode): added (complete): added * AU_Subproblem.hh (class AU_Subproblem): deleted ~AU_Subproblem() decl * AU_Subproblem.cc (~AU_Subproblem): deleted (addTopVariable): deleted * AU_Subproblem.hh (addTopVariable): added (class AU_Subproblem): updated addTopVariable() decl * AU_Layer.cc (addTopVariable): added Thu Dec 11 18:08:35 1997 Steven Eker * AU_DagNode.hh (class AU_DagNode): AU_Layer replaces AU_Subproblem as a friend (class AU_DagNode): checkArguments() 1st arg made const * AU_Layer.cc: heavily rewritten to handle identity case Wed Dec 10 11:12:56 1997 Steven Eker * AU_Layer.cc: created * AU_Layer.hh (class AU_Layer): created * AU_Subproblem.hh (class AU_Subproblem): redesigned using AU_Layer * AU_Subproblem.cc: created * AU_DagNode.hh (class AU_DagNode): target arg of checkArguments() should be a reference * AU_DagNode.cc (checkArguments): added Tue Dec 9 16:07:04 1997 Steven Eker * AU_DagNode.hh (class AU_DagNode): added checkArguments() decl * AU_Matcher.cc (forcedLoneVariableCase): heavily rewritten * AU_LhsAutomaton.hh (class AU_LhsAutomaton): deleted boundsChecks() decl (class AU_LhsAutomaton): added collapseMatch() decl * AU_Matcher.cc: created (boundsChecks): deleted (match): heavily rewritten (matchRigidPart): heavily rewritten; removed several bugs inherited from A_Theory version Mon Dec 8 10:59:23 1997 Steven Eker * AU_Term.cc (dump): added (analyseCollapses): added (normalize): make sure we contract argArray after deleting identity elements (insertAbstractionVariables): added * AU_Term.hh (class AU_Term): added decls for analyseCollapses() insertAbstractionVariables(), and dump() * AU_Term.cc: created (normalize): fixed serious bug that was hand over from A_Term: we use wrong argArray length for computing hash value. * AU_ArgumentIterator.hh (class AU_ArgumentIterator): use AU_Term::tuple (AU_ArgumentIterator): use AU_Term::tuple * AU_ArgumentIterator.cc (argument): use AU_Term::tuple * AU_Term.hh (class AU_Term): added struct Tuple, argArray becomes Vector Sun Dec 7 15:02:26 1997 Steven Eker * AU_DagNode.cc (overwriteWithClone): don't put symbol() in local Symbol* variable (makeClone): don't put symbol() in local Symbol* variable * AU_DagNode.hh (class AU_DagNode): ctor takes AU_Symbol* rather than Symbol* * AU_RhsAutomaton.cc: created * AU_RhsAutomaton.hh (class AU_RhsAutomaton): created * AU_ArgumentIterator.cc: created * AU_Subproblem.hh (class AU_Subproblem): created * AU_ArgumentIterator.hh (class AU_ArgumentIterator): created Fri Dec 5 10:46:19 1997 Steven Eker * AU_Term.hh (class AU_Term): created * AU_ExtensionInfo.cc: created * AU_ExtensionInfo.hh (class AU_ExtensionInfo): created * AU_DagArgumentIterator.cc: created * AU_DagNode.hh (symbol): added * AU_DagArgumentIterator.hh (class AU_DagArgumentIterator): created * AU_Theory.hh: created * AU_DagNode.cc: created * AU_Symbol.cc (eqRewrite): rewritten along the lines of ACU_Symbol::eqRewrite() (computeBaseSort): use producedByAssignment() optimization in uniform sort case * AU_DagNode.hh (class AU_DagNode): created * AU_Symbol.cc (computeBaseSort): use local static sortIndexBuffer in place of utilityBuffer deleted utilityBuffer * AU_Symbol.hh (class AU_Symbol): deleted utilityBuffer decl * AU_Symbol.cc: created * AU_Symbol.hh (class AU_Symbol): created Maude-2.6/src/AU_Theory/AU_RhsAutomaton.cc0000644000147300135640000000563211346606672015334 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_RhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // core class definitions #include "substitution.hh" #include "variableInfo.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_RhsAutomaton.hh" AU_RhsAutomaton::AU_RhsAutomaton(AU_Symbol* symbol, int nrArgs) : topSymbol(symbol), arguments(0, nrArgs) { } void AU_RhsAutomaton::remapIndices(VariableInfo& variableInfo) { destination = variableInfo.remapIndex(destination); int nrArgs = arguments.length(); for (int i = 0; i < nrArgs; i++) arguments[i] = variableInfo.remapIndex(arguments[i]); } local_inline void AU_RhsAutomaton::buildArguments(ArgVec& argArray, Substitution& matcher) const { Vector::const_iterator j = arguments.begin(); const Vector::const_iterator e = j + nrArguments; Assert(nrArguments > 0, "no args"); ArgVec::iterator i = argArray.begin(); do { *i = matcher.value(*j); ++i; ++j; } while (j != e); Assert(i == argArray.end(), "iterator inconsistent"); } DagNode* AU_RhsAutomaton::construct(Substitution& matcher) { AU_DagNode* n = new AU_DagNode(topSymbol, nrArguments); buildArguments(n->argArray, matcher); matcher.bind(destination, n); return n; } void AU_RhsAutomaton::replace(DagNode* old, Substitution& matcher) { buildArguments((new(old) AU_DagNode(topSymbol, nrArguments))->argArray, matcher); } #ifdef DUMP void AU_RhsAutomaton::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{AU_RhsAutomaton}\n"; ++indentLevel; s << Indent(indentLevel) << "[" << destination << "] <= " << topSymbol << '('; int nrArgs = arguments.length(); for (int i = 0; i < nrArgs; i++) { s << '[' << arguments[i] << "]"; if (i + 1 < nrArgs) s << ", "; } s << ")\n"; s << Indent(indentLevel - 1) << "End{AU_RhsAutomaton}\n"; } #endif Maude-2.6/src/AU_Theory/AU_DequeDagNode.cc0000644000147300135640000001155610714455500015165 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_DequeDagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Persistent.hh" #include "AU_Theory.hh" // interface class definitions #include "term.hh" // AU persistent class definitions #include "AU_DequeIter.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_DequeDagNode.hh" #include "AU_DequeDagArgumentIterator.hh" #include "AU_ExtensionInfo.hh" RawDagArgumentIterator* AU_DequeDagNode::arguments() { return new AU_DequeDagArgumentIterator(deque); } size_t AU_DequeDagNode::getHashValue() { size_t hashValue = symbol()->getHashValue(); for (AU_DequeIter i(deque); i.valid(); i.next()) hashValue = hash(hashValue, i.getDagNode()->getHashValue()); return hashValue; } int AU_DequeDagNode::compareArguments(const DagNode* other) const { if (safeCast(const AU_BaseDagNode*, other)->isDeque()) { const AU_DequeDagNode* d2 = safeCast(const AU_DequeDagNode*, other); int r = deque.length() - d2->deque.length(); if (r != 0) return r; AU_DequeIter i(deque); AU_DequeIter j(d2->deque); do { int r = (i.getDagNode())->compare(j.getDagNode()); if (r != 0) return r; i.next(); j.next(); } while (i.valid()); Assert(!j.valid(), "iterator problem"); } else { const ArgVec& argArray2 = safeCast(const AU_DagNode*, other)->argArray; int r = deque.length() - argArray2.length(); if (r != 0) return r; AU_DequeIter i(deque); ArgVec::const_iterator j = argArray2.begin(); do { int r = (i.getDagNode())->compare(*j); if (r != 0) return r; i.next(); ++j; } while (i.valid()); Assert(j == argArray2.end(), "iterator problem"); } return 0; } DagNode* AU_DequeDagNode::markArguments() { deque.mark(); return 0; } DagNode* AU_DequeDagNode::copyEagerUptoReduced2() { return dequeToArgVec(this)->copyEagerUptoReduced2(); } void AU_DequeDagNode::clearCopyPointers2() { CantHappen("Should not be copying on AU_DequeDagNode"); } void AU_DequeDagNode::overwriteWithClone(DagNode* old) { AU_DequeDagNode* d = new(old) AU_DequeDagNode(symbol(), deque); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); } DagNode* AU_DequeDagNode::makeClone() { AU_DequeDagNode* d = new AU_DequeDagNode(symbol(), deque); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); return d; } DagNode* AU_DequeDagNode::copyWithReplacement(int argIndex, DagNode* replacement) { return dequeToArgVec(this)->copyWithReplacement(argIndex, replacement); // HACK } DagNode* AU_DequeDagNode::copyWithReplacement(Vector& redexStack, int first, int last) { return dequeToArgVec(this)->copyWithReplacement(redexStack, first, last); } void AU_DequeDagNode::stackArguments(Vector& stack, int parentIndex, bool respectFrozen) { if (respectFrozen && !(symbol()->getFrozen().empty())) return; int j = 0; for (AU_DequeIter i(deque); i.valid(); i.next(), ++j) { DagNode* d = i.getDagNode(); if (!(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, j)); } } ExtensionInfo* AU_DequeDagNode::makeExtensionInfo() { return new AU_ExtensionInfo(dequeToArgVec(this)); } AU_DagNode* AU_DequeDagNode::dequeToArgVec(AU_DequeDagNode* original) { AU_Symbol* s = original->symbol(); AU_Deque c = original->deque; // deep copy int sortIndex = original->getSortIndex(); bool redFlag = original->isReduced(); AU_DagNode* d = new(original) AU_DagNode(s, c.length()); c.copyToArgVec(d->argArray); d->setSortIndex(sortIndex); if (redFlag) d->setReduced(); return d; } // // Narrowing code. // bool AU_DequeDagNode::indexVariables2(NarrowingVariableInfo& indices, int baseIndex) { // // Just revert to argvec ACU representation and use its code. // return dequeToArgVec(this)->indexVariables2(indices, baseIndex); } Maude-2.6/src/AU_Theory/ChangeLog.A_Theory0000644000147300135640000006055407741124414015274 00000000000000Fri Dec 5 11:25:01 1997 Steven Eker * A_Symbol.cc (finalizeSortInfo): deleted * A_Symbol.hh (class A_Symbol): deleted finalizeSortInfo() decl Thu Dec 4 12:54:26 1997 Steven Eker * A_Symbol.cc (A_Symbol): deleted inert arg * A_Symbol.hh (class A_Symbol): deleted inert arg from ctor decl Tue Dec 2 16:41:48 1997 Steven Eker * A_Symbol.cc (copyAndReduceSubterms): use DagNode::copyAndReduce() Mon Dec 1 12:11:25 1997 Steven Eker * A_Symbol.cc (eqRewrite): use getPermuteStrategy() * A_GreedyMatcher.cc (greedyMatchVariableBlock): PermuteSymbol -> AssociativeSymbol (*3) * A_DagNode.cc (copyEagerUptoReduced2): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol * A_LhsCompiler.cc (compileLhs): PermuteSymbol -> AssociativeSymbol * A_Term.cc (findEagerVariables): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol (*3) (markEagerArguments): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol * A_LhsAutomaton.hh (class A_LhsAutomaton): PermuteSymbol -> AssociativeSymbol * A_Symbol.cc (A_Symbol): PermuteSymbol -> AssociativeSymbol (eqRewrite): remove PermuteSymbol context (*3) * A_Symbol.hh (class A_Symbol): PermuteSymbol -> AssociativeSymbol Tue Nov 25 11:58:40 1997 Steven Eker * A_RhsAutomaton.cc (buildAliens): deleted (dump): implemented * A_RhsAutomaton.hh (class A_RhsAutomaton): updated dump() decl; deleted addAlien(), buildAliens() decls; deleted aliens data member (addAlien): deleted * A_LhsAutomaton.cc (dump): updated * A_LhsAutomaton.hh (class A_LhsAutomaton): updated dump() decl ===============================Engine33=================================================== Tue Nov 11 17:04:26 1997 Steven Eker * A_LhsAutomaton.cc (forcedLoneVariableCase): fixed long standing bug; in lone variable bound case if b->symbol() != topSymbol then we need to check for nrSubjects != 1 to return false and not nrSubjects == 1 ===============================Engine31=================================================== Wed Oct 29 15:35:35 1997 Steven Eker * A_Subproblem.cc (solveVariableBlocks): setWholeFlag() -> setMatchedWhole() * A_DagNode.cc (matchVariableWithExtension): call setValidAfterMatch(false) * A_GreedyMatcher.cc (greedyMatch): setWholeFlag() -> setMatchedWhole() (7 places) (greedyMatch): call setValidAfterMatch(true) if there is extension info * A_FullMatcher.cc (fullMatch): call setValidAfterMatch(false) if there is extension information * A_LhsAutomaton.cc (match): move matchAtTop == (extensionInfo != 0) assertion to after check of top symbol since caller need not know that we can't collapse and could fail to pass us extensionInfo if subject was in a theory without extension. * A_ExtensionInfo.cc (copy): use setValidAfterMatch(), validAfterMatch() and setMatchedWhole() (makeClone): use setValidAfterMatch(), validAfterMatch() and setMatchedWhole() Mon Oct 27 11:54:51 1997 Steven Eker * A_ExtensionInfo.cc (makeClone): added (copy): added * A_ExtensionInfo.hh (class A_ExtensionInfo): added decls for makeClone() and copy() (class A_ExtensionInfo): subject made non const in order to do copy Fri Oct 24 14:59:25 1997 Steven Eker * A_Symbol.cc (ruleRewrite): use new A_ExtensionInfo ctor (eqRewrite): use new A_ExtensionInfo ctor (3 places) * A_DagNode.cc (makeExtensionInfo): use new A_ExtensionInfo ctor * A_DagNode.hh (class A_DagNode): class A_ExtensionInfo is now a friend * A_Theory.cc: deleted * A_ExtensionInfo.cc: created * A_ExtensionInfo.hh (class A_ExtensionInfo): added data member subject and decls for explicit ctor and buildMatchedPortion() (A_ExtensionInfo): added Tue Oct 21 12:32:51 1997 Steven Eker * A_Term.cc (dagify2): switched to new convention * A_Term.hh (class A_Term): switched dagify2() decl to new convention Wed Oct 15 16:12:36 1997 Steven Eker * A_LhsCompiler.cc (compileLhs): use VariableTerm::dynamicCast() (2 places) (addFixedLengthBlock): use VariableTerm::dynamicCast() (findConstraintPropagationSequence): use VariableTerm::dynamicCast() (2 places) * A_Term.cc (compileRhs): use VariableTerm::dynamicCast() * A_Symbol.cc (A_Symbol): rewritten for new symbol conventions * A_Symbol.hh (class A_Symbol): removed constructor arg from ctor Fri Oct 10 18:42:16 1997 Steven Eker * A_LhsAutomaton.hh (class A_LhsAutomaton): VariableIndex -> VariableInfo * A_LhsAutomaton.cc (dump): VariableIndex -> VariableInfo (dump): index2Symbol() -> index2Variable() ===============================Engine30=================================================== Tue Oct 7 15:38:16 1997 Steven Eker * A_Symbol.cc (makeDagNode): added * A_Symbol.hh (class A_Symbol): added decl for makeDagNode() Fri Oct 3 19:35:02 1997 Steven Eker * A_Term.cc (compileRhs): DataSet -> TermSet (dagify2): DataSet -> TermSet * A_Term.hh (class A_Term): DataSet -> TermSet ===============================Engine29=================================================== Thu Oct 2 18:01:02 1997 Steven Eker * A_Term.hh (class A_Term): updated compileRhs() decl * A_Term.cc (compileRhs): adapted to use DataSet& compiled Tue Sep 30 12:39:29 1997 Steven Eker * A_Term.hh (class A_Term): dagify() decl chaged to dagify2() * A_Term.cc (normalize): now calculate hash value (dagify2): adapted from dagify() Thu Sep 25 16:49:08 1997 Steven Eker * A_Symbol.hh (class A_Symbol): deleted decl for specificRewrite() * A_Symbol.cc (specificRewrite): deleted ===============================Engine28=================================================== Tue Aug 19 12:37:48 1997 Steven Eker * A_DagNode.hh (getArgument): added (nrArgs): added (class A_DagNode): added nrArgs() and getArgument() decls as fast theory specific interface to argument list for code outside the A_Theory that is A_Theory aware (maybe classes derived from A_Symbol). Fri Jul 25 18:02:05 1997 Steven Eker * A_DagNode.cc (partialReplace): removed Assert(getSortIndex() == Sort::SORT_UNKNOWN, cerr << "shouldn't have valid sort"); since if node was original created by matcher it may well have valid sort Thu Jul 24 11:39:15 1997 Steven Eker * A_Symbol.cc (eqRewrite): added normalizeAtTop() calls after sort computation for LAZY and SEMI_EAGER cases; this fixes a bug introduced by just-in-time normalization Wed Jul 23 11:46:25 1997 Steven Eker * A_DagNode.cc (partialReplace): added call to repudiateSortInfo() * A_Term.cc (normalize): added full flag; only do flattening if full flag true * A_Term.hh (class A_Term): added full flag to normalize() Mon Jul 21 11:27:59 1997 Steven Eker * A_Symbol.cc (computeTrueSort): do normalization * A_DagNode.cc (partialReplace): simplified; no longer normalize (partialConstruct): simplified; no longer normalize (copyWithReplacement): simplified; no longer normalize (partialReplace): put in Assert to ensure we don't have a valid sort * A_RhsAutomaton.hh (class A_RhsAutomaton): updated buildAliens() decl * A_RhsAutomaton.cc (buildAliens): simplified; no longer do flattening calcs (buildArguments): simplified; no longer flatten (replace): simplified (construct): simplified ===============================Engine26b=================================================== Tue Jul 15 15:42:42 1997 Steven Eker * A_Symbol.cc (A_Symbol): added inert arg (eqRewrite): changed inert() call to equationFree() * A_Symbol.hh (class A_Symbol): added inert arg to ctor ================================Engine26==================================================== Fri Jun 27 16:13:40 1997 Steven Eker * A_DagNode.hh (class A_DagNode): copyEagerUptoReduced2() and clearCopyPointers2() made private * A_Symbol.cc (copyAndReduceSubterms): copyEagerUptoReduced() and clearCopyPointers() replaced by copyReducible() Wed Jun 25 15:16:51 1997 Steven Eker * A_Symbol.cc: added #include "variable.hh" Tue Jun 24 16:22:21 1997 Steven Eker * A_LhsAutomaton.hh (class A_LhsAutomaton): Variable* -> VariableTerm* for addRigidVariable() and addFlexVariable() decls * A_LhsAutomaton.cc (addRigidVariable): use VariableTerm* (addFlexVariable): use VariableTerm* * A_LhsCompiler.cc (analyseConstraintPropagation): use VariableTerm::downCast() (compileLhs): use VariableTerm::downCast() (addFixedLengthBlock): use VariableTerm::downCast() (findConstraintPropagationSequence): use VariableTerm::downCast() * A_Term.cc: added #include "variableTerm.hh" (compileRhs): use VariableTerm::downCast() Thu Jun 19 10:38:43 1997 Steven Eker * A_Symbol.cc: deleted #include "unionFind.hh" Tue Jun 17 16:55:43 1997 Steven Eker * A_Symbol.hh (class A_Symbol): deleted decl for compileOpDeclarations() * A_Symbol.cc (compileOpDeclarations): deleted * A_Symbol.hh (class A_Symbol): added decl for finalizeSortInfo() * A_Symbol.cc (finalizeSortInfo): added Fri Jun 6 18:44:49 1997 Steven Eker * A_DagNode.hh (class A_DagNode): matchVariableWithExtension() decl added * A_Symbol.hh (class A_Symbol): matchVariableWithExtension() decl deleted * A_DagNode.cc (matchVariableWithExtension): added * A_Symbol.cc (matchVariableWithExtension): deleted Thu Jun 5 11:55:09 1997 Steven Eker * A_DagNode.cc (copyEagerUptoReduced2): adapted from old copyEagerUptoReduced() (clearCopyPointers2): adapted from old clearCopyPointers() * A_DagNode.hh (class A_DagNode): decls for clearCopyPointers() and copyEagerUptoReduced() changed * A_Subproblem.hh (class A_Subproblem): updated computeAssignment() decl * A_Subproblem.cc (bindVariables): use checkSort() to check the sort of DagNode returned from computeAssignment(); don't pass context to computeAssignment() (computeAssignment): deleted context arg; don't compute sort of newly created DagNode * A_Symbol.cc (A_Symbol): don't pass stable arg to PermuteSymbol() ==============================Engine24==================================== Wed May 14 15:43:13 1997 Steven Eker * A_Symbol.cc (eqRewrite): changed comment on repudiate call now that inErrorSort() can leave sort info behind Tue May 13 10:41:19 1997 Steven Eker * Makefile: make libA_Theory.a instead of libAC_Theory.a * A_LhsAutomaton.cc (forcedLoneVariableCase): use DagNode::checkProblem() to simplify code Commented out "sortCheckSubproblem.hh" Thu Apr 10 16:19:35 1997 Steven Eker * A_LhsAutomaton.cc (forcedLoneVariableCase): must repudiateSort() in the case where the base sort is not small enough and the top symbol is not sort constraint free as the base sort we calculated may not be the true sort and will inhibit the calculation of the true sort during the solution of the sort check subprblem. Fri Mar 28 16:55:19 1997 Steven Eker * A_DagNode.cc (makeExtensionInfo): added * A_DagNode.hh (class A_DagNode): added decl for makeExtensionInfo() Thu Jan 9 15:45:25 1997 Steven Eker * A_DagNode.cc (overwriteWithClone): fixed serious bug where we were copying sort of overwritten node rather than overwriting node Tue Jan 7 11:39:30 1997 Steven Eker * A_Symbol.cc (eqRewrite): fixed bug in lazy case where we were computing a base sort and then returning with out repudiating it if it was not the error sort. Use new inerrorSort() function. (eqRewrite): removed superfluous repudiateSortInfo() from semi-eager case. (eqRewrite): replaced calls to repudiateSortInfo() since applyReplace() may compute true sort which may then have been invalidated by rewriting below Tue Dec 24 18:04:23 1996 Steven Eker * A_LhsAutomaton.cc (forcedLoneVariableCase): rewritten to use computeBaseSort() and sortConstraintFree() * A_Subproblem.cc (computeAssignment): computeSortWhilePreservingContext() -> computeTrueSortWhilePreservingContext() * A_Symbol.cc (eqRewrite): adapted from rewrite(); use computeTrueSort() and computeBaseSort() (computeTrueSort): adapted from computeSort() (computeBaseSort): adapted from findBaseSort() * A_Symbol.hh (class A_Symbol): computeSort() replaced by computeBaseSort() and computeTrueSort(); findBaseSort() deleted (class A_Symbol): rewrite() -> eqRewrite() Thu Dec 19 14:17:24 1996 Steven Eker * A_DagNode.cc (makeClone): copy sort information to avoid recomputation Thu Dec 12 17:49:03 1996 Steven Eker * A_DagNode.cc (overwriteWithClone): copy sort information; this is needed so then when we rewrite with a collapse equation we do not lose sort infomation with the possibility of infinite looping on foreign sort constraints Wed Dec 11 11:55:43 1996 Steven Eker * A_Symbol.cc (findBaseSort): sortConstraintFree() used in place of obsolete test (2 places) Mon Dec 9 14:40:21 1996 Steven Eker * A_Symbol.cc (computeSort): modified to use new constrainToSmallerSort() convections Mon Dec 2 11:07:58 1996 Steven Eker * A_Subproblem.cc (addTopVariable): put bounds args in the correct order! * A_Symbol.cc (rewrite): use inert() rather then checking for equations because there may be foreign equations * A_FullMatcher.cc (addVariableBlocks): updated addTopVariable() call * A_Subproblem.cc (buildPartition): make use of lowerBound in TopVariable struct (addTopVariable): store lowerBound * A_Subproblem.hh (class A_Subproblem): added lowerBound to TopVariable struct Wed Nov 27 17:10:12 1996 Steven Eker * A_Symbol.cc (matchVariableWithExtension): implemented * A_Symbol.hh (class A_Symbol): matchVariableWithExtension() added Mon Nov 25 19:01:59 1996 Steven Eker * A_Symbol.cc (A_Symbol): added constructor arg Thu Nov 14 18:07:59 1996 Steven Eker * A_DagNode.cc (makeClone): added Tue Oct 29 17:05:54 1996 Steven Eker * A_Symbol.cc (rewrite): updates to nrArgs removed as nrArgs is not used afterwards; Assert checking that sort is invalid after applyReduce() in semi-eager case removed since applyReduce() may have good reasons for computing and storing the subjects sorts (e.g. a lhs that parses to the error sort or a foreign lhs that is (or collapses to) a variable). Tue Oct 15 17:48:41 1996 Steven Eker * A_RhsAutomaton.cc (dump): added indentLevel arg * A_LhsAutomaton.cc (dump): rewritten to handle indentation Fri Oct 11 16:44:55 1996 Steven Eker * A_Symbol.cc (partialConstruct): deleted (partialReplace): deleted * A_DagNode.cc (partialReplace): added (partialConstruct): added Wed Oct 2 19:01:26 1996 Steven Eker * A_DagNode.cc (normalizeAtTop): added call to DagNode::okToCollectGarbage() Tue Oct 1 14:22:11 1996 Steven Eker * A_DagNode.cc (normalizeAtTop): removed trackStorage() call * A_Symbol.cc (partialReplace): removed trackStorage() call * A_DagNode.cc (markArguments): call to evacuate() added * A_DagNode.hh (A_DagNode): removed trackStorage() call * A_DagNode.cc (A_DagNode): removed trackStorage() call * A_Term.cc: Vector -> ArgVec * A_Symbol.cc: Vector -> ArgVec * A_Subproblem.cc: Vector -> ArgVec * A_RhsAutomaton.cc: Vector -> ArgVec * A_LhsAutomaton.cc: Vector -> ArgVec * A_GreedyMatcher.cc: Vector -> ArgVec * A_FullMatcher.cc: Vector -> ArgVec * A_DagNode.cc: Vector -> ArgVec * A_RhsAutomaton.hh (class A_RhsAutomaton): Vector -> ArgVec * A_DagNode.hh (class A_DagNode): Vector -> ArgVec * A_LhsAutomaton.hh (class A_LhsAutomaton): Vector -> ArgVec * A_DagArgumentIterator.hh (class A_DagArgumentIterator): Vector -> ArgVec Wed Sep 25 14:21:39 1996 Steven Eker * A_DagNode.cc (stackArguments): added (copyWithReplacement): added * A_Symbol.cc (ruleRewrite): added (specificRewrite): added (partialConstruct): added Tue Sep 24 14:41:39 1996 Steven Eker * A_Subproblem.cc (addNode): remember last blockPair has dummy pattern part with no targets; so we have to change test to blockNr + 1 < blockPairs.length() - 1 * A_FullMatcher.cc (buildLeftmostPath): deal with cases where first rigid block has no (unbound) variables to the left of it, last rigid block has no (unbound) variables to the right of it, and single rigid block has no (unbound) variables either side of it (addRemainingPaths): implemented * A_Subproblem.cc (bindVariables): Asserts regarding part length replaced by if statements that return false: non-linear variable blocks can cause bound variable to have wrong length part (bindVariables): fix index: i -> j * A_Subproblem.hh (class A_Subproblem): deleted boundVariablesOK() decl * A_Subproblem.cc (bindVariables): major rewrite; now does the work of boundVariablesOK() as well (buildPartition): set boundByUs flag correctly in non-linear variable block case (solveVariableBlock): removed unbindVariables() temp fix Mon Sep 23 17:50:22 1996 Steven Eker * A_Subproblem.cc (solvePatternBlock): Assert condition should be >= instead of > (deepSelfDestruct): don't deepSelfDestruct() null subproblem (solveVariableBlock): big mess regarding bound and unbound variables in different involacations on same subproblem; temp fix is to unbind variables at start of non-first invocation (solvePatternBlocks): need to initialize selectedNode first first blockPair correctly * A_FullMatcher.cc (buildLeftmostPath): nrRigid + 1 block pairs in subproblem (buildLeftmostPath): formula for nextSubject fixed Fri Sep 20 16:11:55 1996 Steven Eker * A_Subproblem.cc: finally compiled after much rewriting (addNode): added (addTopVariable): added Fri Sep 13 18:29:49 1996 Steven Eker * A_FullMatcher.cc (determineRigidBlocks): calculate rigid blocks in new way Thu Sep 12 18:24:34 1996 Steven Eker * A_Subproblem.hh (class A_Subproblem): added BlockPair struct to try to simplify VariableBlock/RigidBlock handling Wed Sep 11 19:24:04 1996 Steven Eker * A_LhsAutomaton.hh (class A_LhsAutomaton): added struct RigidBlock plus match-time storage for rigidBlocks Thu Aug 29 12:13:34 1996 Steven Eker * A_Subproblem.hh (class A_Subproblem): have at most two edges exits from each node; a down edge and a right edge. Tue Aug 6 15:58:22 1996 Steven Eker * A_LhsCompiler.cc (findConstraintPropagationSequence): matchAtTop arg removed from calls to analyseConstraintPropagation() * A_Term.hh (class A_Term): boundAbove arg removed from addFixedLengthBlock() * A_LhsCompiler.cc: created by extracting match compilation code form A_Term.cc (analyseConstraintPropagation): matchAtTop arg removed (compileLhs): boundAbove arg and code with updated it and passed it deleted (addFixedLengthBlock): boundAbove arg and code with updated it and passed it deleted * A_Term.hh (class A_Term): matchAtTop arg removed from analyseConstraintPropagation(); boundAbove arg removed from compileLhs() Wed Jul 31 17:37:28 1996 Steven Eker * A_Symbol.cc (makeTerm): added Fri Jul 26 16:49:46 1996 Steven Eker * A_GreedyMatcher.cc (greedyMatch): set extension whole flag correctly (greedyMatch): need to update spare in the case that we enf the main loop with a rigid block still to process * A_Term.cc (compileLhs): call addFixedLengthBlock() with boundAbove, boundUniquely the right way around (compileLhs): allow flex part to end with fixed length block if we have extension (compileLhs): need to compile fixed length block that ends the flex part if we have extension * A_GreedyMatcher.cc (greedyMatch): heavily revised; now store "spare" rather than "rigidBlockSubjectsNeeded" (greedyMatchVariableBlock): calculate spare correctly Thu Jul 25 11:13:37 1996 Steven Eker * A_GreedyMatcher.cc (greedyMatchFixedLengthBlock): no longer do substitution copying; pass back shift factor rather than next shift; code simplified (greedyMatchRigidBlock): do substitution copying (greedyMatch): heavily revised; variableBlockLength no longer needed * A_LhsAutomaton.cc (complete): code corrected to do blockLengths for fixed length in _flex_ part (not rigid part!) Wed Jul 24 16:44:37 1996 Steven Eker * A_LhsAutomaton.cc (dump): rewritten (complete): added code to fill in blockLength for each rigid subterm * A_Subproblem.cc: created * A_Subproblem.hh (class A_Subproblem): created Mon Jul 22 10:44:25 1996 Steven Eker * A_DagNode.cc (eliminateSubject): rewritten, now only eliminates target from fixed position (eliminateSubject): rewritten; now only examines single position Sat Jul 20 18:02:24 1996 Steven Eker * A_LhsAutomaton.hh (class A_LhsAutomaton): maxMatchable field in struct Subterm deleted * A_GreedyMatcher.cc (greedyMatchVariableBlock): extensionInfo parameter deleted (greedyMatch): rewritten yet again; now group bound variables with fixed length blocks to make rigid blocks which are matched as whoel units Fri Jul 19 10:34:55 1996 Steven Eker * A_GreedyMatcher.cc (greedyMatchVariableBlock): rewritten from scratch (greedyMatch): heavily rewritten * A_LhsAutomaton.cc: split off greedy matcher into A_GreedyMatcher.cc Thu Jul 18 14:28:16 1996 Steven Eker * A_Term.cc (addFixedLengthBlock): added * A_Term.hh (symbol): added * A_Term.cc (findConstraintPropagationSequence): when two sequences bind the same number of variables uniquely; choose the longer sequenece. Store the position of the first flex arg in bestSequence structure so we can propagate it easily in the lone variable case (analyseConstraintPropagation): add lone variable in flex part to those variables that we guarantee to bind uniquely Tue Jul 16 19:13:08 1996 Steven Eker * A_LhsAutomaton.cc (greedyMatchVariableBlock): rewritten Mon Jul 15 16:31:25 1996 Steven Eker * A_LhsAutomaton.cc (greedyMatchFixedLengthBlock2): renamed from matchFixedLengthBlock() Thu Jul 11 10:42:29 1996 Steven Eker * A_LhsAutomaton.cc (updateWholeBounds): use plus() to simplify (updateFlexBounds): use plus() to simplify * A_ExtensionInfo.hh (setMatched): deleted (setFirstMatched): added (setLastMatched): added * A_DagNode.cc (eliminateSubject): added * A_LhsAutomaton.cc (nextMatchForFixedLengthBlock): added (matchFixedLengthBlock): added (compareArgArrays): added Tue Jul 9 17:20:35 1996 Steven Eker * A_Symbol.cc (findBaseSort): added code to use uniform sort structure if it exists Sat Jul 6 17:24:21 1996 Steven Eker * A_Symbol.cc (partialReplace): dded code to track storage during expansion * A_DagNode.cc (normalizeAtTop): added code to track storage during expansion Fri Jul 5 17:46:56 1996 Steven Eker * A_LhsAutomaton.cc (A_LhsAutomaton): fixed flex bound initilaization problem * A_Term.cc (findConstraintPropagationSequence): added Wed Jul 3 11:41:32 1996 Steven Eker * A_Term.cc (compileLhs): crude implementation (analyseConstraintPropagation): implemented * A_LhsAutomaton.cc (updateWholeBounds): added (updateFlexBounds): added (addRigidVariable): added (addFlexVariable): added (addRigidGroundAlien): added (addRigidNonGroundAlien): added (addFlexGroundAlien): added (addFlexNonGroundAlien): added (complete): added Tue Jul 2 16:06:28 1996 Steven Eker * A_LhsAutomaton.cc (forcedLoneVariableCase): completed Sat Jun 29 15:31:14 1996 Steven Eker * A_LhsAutomaton.cc (matchRigidPart): added Maude-2.6/src/AU_Theory/AU_ExtensionInfo.hh0000644000147300135640000000433607666303243015510 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to record what part of an AU theory dag node was matched. // #ifndef _AU_ExtensionInfo_hh_ #define _AU_ExtensionInfo_hh_ #include "extensionInfo.hh" class AU_ExtensionInfo : public ExtensionInfo { public: AU_ExtensionInfo(AU_DagNode* subject); DagNode* buildMatchedPortion() const; ExtensionInfo* makeClone() const; void copy(ExtensionInfo* extensionInfo); void setFirstMatched(int firstMatched); void setLastMatched(int lastMatched); void setExtraIdentity(bool flag); int firstMatched() const; int lastMatched() const; bool bigEnough() const; private: AU_DagNode* subject; int first; int last; bool extraIdentityFlag; // portion matched contains an identity not present in subject. }; inline AU_ExtensionInfo::AU_ExtensionInfo(AU_DagNode* subject) : subject(subject) { } inline void AU_ExtensionInfo::setFirstMatched(int firstMatched) { first = firstMatched; } inline void AU_ExtensionInfo::setLastMatched(int lastMatched) { last = lastMatched; setMatchedWhole(first == 0 && last == subject->argArray.length() - 1); } inline void AU_ExtensionInfo::setExtraIdentity(bool flag) { extraIdentityFlag = flag; } inline int AU_ExtensionInfo::firstMatched() const { return first; } inline int AU_ExtensionInfo::lastMatched() const { return last; } inline bool AU_ExtensionInfo::bigEnough() const { return last - first + 1 + extraIdentityFlag >= 2; } #endif Maude-2.6/src/AU_Theory/AU_Symbol.hh0000644000147300135640000000633611457440007014160 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols belonging to the A, AUl, AUr and AU theories. // #ifndef _AU_Symbol_hh_ #define _AU_Symbol_hh_ #include "associativeSymbol.hh" class AU_Symbol : public AssociativeSymbol { public: AU_Symbol(int id, const Vector& strategy, bool memoFlag, bool leftId = false, bool rightId = false, Term* identity = 0); // // Member functions required by theory interface. // Term* makeTerm(const Vector& args); DagNode* makeDagNode(const Vector& args); void computeBaseSort(DagNode* subject); void normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context); bool eqRewrite(DagNode* subject, RewritingContext& context); DagNode* ruleRewrite(DagNode* subject, RewritingContext& context); void stackArguments(DagNode* subject, Vector& stack, int parentIndex); // // Member functions overiding default handling. // void postOpDeclarationPass(); void compileEquations(); // // Member functions particular to AU_Symbol. // bool leftId() const; bool rightId() const; bool oneSidedId() const; bool useDeque() const; int calculateNrSubjectsMatched(DagNode* d, bool leftEnd, // match starts at left extreme bool rightEnd, // match end at right extreme bool& nasty); // // Hash cons stuff. // DagNode* makeCanonical(DagNode* original, HashConsSet* hcs); DagNode* makeCanonicalCopy(DagNode* original, HashConsSet* hcs); private: bool rewriteAtTop(AU_DagNode* subject, RewritingContext& context); bool rewriteAtTopNoOwise(AU_DagNode* subject, RewritingContext& context); bool complexStrategy(AU_DagNode* subject, RewritingContext& context); bool memoStrategy(MemoTable::SourceSet& from, DagNode* subject, RewritingContext& context); void copyAndReduceSubterms(AU_DagNode* subject, RewritingContext& context); const Bool leftIdFlag; const Bool rightIdFlag; const Bool oneSidedIdFlag; // // Deque represention of arguments can be used if there is no // one-sided identity, no fancy strategy and there are no equations // at the top. // Bool useDequeFlag; }; inline bool AU_Symbol::leftId() const { return leftIdFlag; } inline bool AU_Symbol::rightId() const { return rightIdFlag; } inline bool AU_Symbol::oneSidedId() const { return oneSidedIdFlag; } inline bool AU_Symbol::useDeque() const { return useDequeFlag; } #endif Maude-2.6/src/AU_Theory/AU_Subproblem.cc0000644000147300135640000000672407666303243015023 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class AU_Subproblem. // // utility stuff #include "macros.hh" #include "vector.hh" #include "sequencePartition.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "AU_Theory.hh" // interface class definitions #include "symbol.hh" // core class definitions #include "rewritingContext.hh" #include "localBinding.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" #include "AU_ExtensionInfo.hh" #include "AU_Subproblem.hh" AU_Subproblem::AU_Subproblem(AU_DagNode* subject, int firstSubterm, int lastSubterm, int nrLayers, AU_ExtensionInfo* extensionInfo) : extensionInfo(extensionInfo), layers(nrLayers) { Assert(extensionInfo == 0 || (firstSubterm == 0 && lastSubterm == subject->argArray.length() - 1), "extension disagreement"); for (int i = 0; i < nrLayers; i++) layers[i].initialize(subject); layers[0].initializeFirst(firstSubterm, extensionInfo); layers[nrLayers - 1].initializeLast(lastSubterm, extensionInfo); } void AU_Subproblem::complete() { int nrPatternLayers = layers.length() - 1; // last layer has no patterns for (int i = 1; i < nrPatternLayers; i++) layers[i - 1].link(layers[i]); } bool AU_Subproblem::solve(bool findFirst, RewritingContext& solution) { if (!findFirst && solveVariables(false, solution)) return true; for (;;) { if (!solvePatterns(findFirst, solution)) return false; if (solveVariables(true, solution)) return true; findFirst = false; } } bool AU_Subproblem::solvePatterns(bool findFirst, RewritingContext& solution) { int nrPatternLayers = layers.length() - 1; // last layer has no patterns if (nrPatternLayers == 0) return findFirst; int i = findFirst ? 0 : nrPatternLayers - 1; if (findFirst) layers[0].reset(); for(;;) { findFirst = layers[i].solvePatterns(findFirst, solution, layers[i + 1]); if (findFirst) { if (++i == nrPatternLayers) break; } else { if (--i < 0) break; } } return findFirst; } bool AU_Subproblem::solveVariables(bool findFirst, RewritingContext& solution) { int nrVariableLayers = layers.length(); int i = findFirst ? 0 : nrVariableLayers - 1; for(;;) { findFirst = layers[i].solveVariables(findFirst, solution); if (findFirst) { if (++i == nrVariableLayers) { if (extensionInfo == 0 ||extensionInfo->bigEnough()) return true; --i; findFirst = false; } } else { if (--i < 0) break; } } return false; } Maude-2.6/src/AU_Theory/Makefile.am0000644000147300135640000000205207741124444014035 00000000000000noinst_LIBRARIES = libAU_Theory.a libAU_Theory_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/AU_Persistent \ -I$(top_srcdir)/src/FullCompiler libAU_Theory_a_SOURCES = \ AU_Symbol.cc \ AU_DagNode.cc \ AU_DequeDagNode.cc \ AU_Term.cc \ AU_DagArgumentIterator.cc \ AU_DequeDagArgumentIterator.cc \ AU_ExtensionInfo.cc \ AU_RhsAutomaton.cc \ AU_LhsAutomaton.cc \ AU_ArgumentIterator.cc \ AU_Layer.cc \ AU_Subproblem.cc EXTRA_DIST = \ AU_DagOperations.cc \ AU_Normalize.cc \ AU_LhsCompiler.cc \ AU_Matcher.cc \ AU_CollapseMatcher.cc \ AU_FullMatcher.cc \ AU_GreedyMatcher.cc \ AU_DequeMatcher.cc \ ChangeLog.A_Theory noinst_HEADERS = \ AU_ArgumentIterator.hh \ AU_BaseDagNode.hh \ AU_DagArgumentIterator.hh \ AU_DagNode.hh \ AU_DequeDagArgumentIterator.hh \ AU_DequeDagNode.hh \ AU_ExtensionInfo.hh \ AU_Layer.hh \ AU_LhsAutomaton.hh \ AU_RhsAutomaton.hh \ AU_Subproblem.hh \ AU_Symbol.hh \ AU_Term.hh \ AU_Theory.hh Maude-2.6/src/Makefile.in0000644000147300135640000003355211500303155012202 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = \ 3rdParty \ Utility \ Temporal \ Interface \ Core \ Variable \ NA_Theory \ ACU_Persistent \ ACU_Theory \ AU_Persistent \ AU_Theory \ CUI_Theory \ S_Theory \ FreeTheory \ Higher \ BuiltIn \ IO_Stuff \ ObjectSystem \ Meta \ FullCompiler \ MSCP10 \ StrategyLanguage \ Mixfix \ Main all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/Main/0000777000147300135640000000000011500304123011071 500000000000000Maude-2.6/src/Main/prelude.maude0000644000147300135640000024767111433337020013512 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 1997-2009 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Maude interpreter standard prelude. *** Version 2.5. *** *** Some of the overall structure is taken from the OBJ3 *** interpreter standard prelude. *** set include BOOL off . fmod TRUTH-VALUE is sort Bool . op true : -> Bool [ctor special (id-hook SystemTrue)] . op false : -> Bool [ctor special (id-hook SystemFalse)] . endfm fmod BOOL-OPS is protecting TRUTH-VALUE . op _and_ : Bool Bool -> Bool [assoc comm prec 55] . op _or_ : Bool Bool -> Bool [assoc comm prec 59] . op _xor_ : Bool Bool -> Bool [assoc comm prec 57] . op not_ : Bool -> Bool [prec 53] . op _implies_ : Bool Bool -> Bool [gather (e E) prec 61] . vars A B C : Bool . eq true and A = A . eq false and A = false . eq A and A = A . eq false xor A = A . eq A xor A = false . eq A and (B xor C) = A and B xor A and C . eq not A = A xor true . eq A or B = A and B xor A xor B . eq A implies B = not(A xor A and B) . endfm fmod TRUTH is protecting TRUTH-VALUE . op if_then_else_fi : Bool Universal Universal -> Universal [poly (2 3 0) special (id-hook BranchSymbol term-hook 1 (true) term-hook 2 (false))] . op _==_ : Universal Universal -> Bool [prec 51 poly (1 2) special (id-hook EqualitySymbol term-hook equalTerm (true) term-hook notEqualTerm (false))] . op _=/=_ : Universal Universal -> Bool [prec 51 poly (1 2) special (id-hook EqualitySymbol term-hook equalTerm (false) term-hook notEqualTerm (true))] . endfm fmod BOOL is protecting BOOL-OPS . protecting TRUTH . endfm fmod EXT-BOOL is protecting BOOL . op _and-then_ : Bool Bool -> Bool [strat (1 0) gather (e E) prec 55] . op _or-else_ : Bool Bool -> Bool [strat (1 0) gather (e E) prec 59] . var B : [Bool] . eq true and-then B = B . eq false and-then B = false . eq true or-else B = true . eq false or-else B = B . endfm *** *** Builtin data types. *** fmod NAT is protecting BOOL . sorts Zero NzNat Nat . subsort Zero NzNat < Nat . op 0 : -> Zero [ctor] . op s_ : Nat -> NzNat [ctor iter special (id-hook SuccSymbol term-hook zeroTerm (0))] . op _+_ : NzNat Nat -> NzNat [assoc comm prec 33 special (id-hook ACU_NumberOpSymbol (+) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _+_ : Nat Nat -> Nat [ditto] . op sd : Nat Nat -> Nat [comm special (id-hook CUI_NumberOpSymbol (sd) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _*_ : NzNat NzNat -> NzNat [assoc comm prec 31 special (id-hook ACU_NumberOpSymbol (*) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _*_ : Nat Nat -> Nat [ditto] . op _quo_ : Nat NzNat -> Nat [prec 31 gather (E e) special (id-hook NumberOpSymbol (quo) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _rem_ : Nat NzNat -> Nat [prec 31 gather (E e) special (id-hook NumberOpSymbol (rem) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _^_ : Nat Nat -> Nat [prec 29 gather (E e) special (id-hook NumberOpSymbol (^) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _^_ : NzNat Nat -> NzNat [ditto] . op modExp : Nat Nat NzNat ~> Nat [special (id-hook NumberOpSymbol (modExp) op-hook succSymbol (s_ : Nat ~> NzNat))] . op gcd : NzNat Nat -> NzNat [assoc comm special (id-hook ACU_NumberOpSymbol (gcd) op-hook succSymbol (s_ : Nat ~> NzNat))] . op gcd : Nat Nat -> Nat [ditto] . op lcm : NzNat NzNat -> NzNat [assoc comm special (id-hook ACU_NumberOpSymbol (lcm) op-hook succSymbol (s_ : Nat ~> NzNat))] . op lcm : Nat Nat -> Nat [ditto] . op min : NzNat NzNat -> NzNat [assoc comm special (id-hook ACU_NumberOpSymbol (min) op-hook succSymbol (s_ : Nat ~> NzNat))] . op min : Nat Nat -> Nat [ditto] . op max : NzNat Nat -> NzNat [assoc comm special (id-hook ACU_NumberOpSymbol (max) op-hook succSymbol (s_ : Nat ~> NzNat))] . op max : Nat Nat -> Nat [ditto] . op _xor_ : Nat Nat -> Nat [assoc comm prec 55 special (id-hook ACU_NumberOpSymbol (xor) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _&_ : Nat Nat -> Nat [assoc comm prec 53 special (id-hook ACU_NumberOpSymbol (&) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _|_ : NzNat Nat -> NzNat [assoc comm prec 57 special (id-hook ACU_NumberOpSymbol (|) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _|_ : Nat Nat -> Nat [ditto] . op _>>_ : Nat Nat -> Nat [prec 35 gather (E e) special (id-hook NumberOpSymbol (>>) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _<<_ : Nat Nat -> Nat [prec 35 gather (E e) special (id-hook NumberOpSymbol (<<) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _<_ : Nat Nat -> Bool [prec 37 special (id-hook NumberOpSymbol (<) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook trueTerm (true) term-hook falseTerm (false))] . op _<=_ : Nat Nat -> Bool [prec 37 special (id-hook NumberOpSymbol (<=) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>_ : Nat Nat -> Bool [prec 37 special (id-hook NumberOpSymbol (>) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>=_ : Nat Nat -> Bool [prec 37 special (id-hook NumberOpSymbol (>=) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook trueTerm (true) term-hook falseTerm (false))] . op _divides_ : NzNat Nat -> Bool [prec 51 special (id-hook NumberOpSymbol (divides) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook trueTerm (true) term-hook falseTerm (false))] . endfm fmod INT is protecting NAT . sorts NzInt Int . subsorts NzNat < NzInt Nat < Int . op -_ : NzNat -> NzInt [ctor special (id-hook MinusSymbol op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op -_ : NzInt -> NzInt [ditto] . op -_ : Int -> Int [ditto] . op _+_ : Int Int -> Int [assoc comm prec 33 special (id-hook ACU_NumberOpSymbol (+) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _-_ : Int Int -> Int [prec 33 gather (E e) special (id-hook NumberOpSymbol (-) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _*_ : NzInt NzInt -> NzInt [assoc comm prec 31 special (id-hook ACU_NumberOpSymbol (*) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _*_ : Int Int -> Int [ditto] . op _quo_ : Int NzInt -> Int [prec 31 gather (E e) special (id-hook NumberOpSymbol (quo) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _rem_ : Int NzInt -> Int [prec 31 gather (E e) special (id-hook NumberOpSymbol (rem) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _^_ : Int Nat -> Int [prec 29 gather (E e) special (id-hook NumberOpSymbol (^) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _^_ : NzInt Nat -> NzInt [ditto] . op abs : NzInt -> NzNat [special (id-hook NumberOpSymbol (abs) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op abs : Int -> Nat [ditto] . op gcd : NzInt Int -> NzNat [assoc comm special (id-hook ACU_NumberOpSymbol (gcd) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op gcd : Int Int -> Nat [ditto] . op lcm : NzInt NzInt -> NzNat [assoc comm special (id-hook ACU_NumberOpSymbol (lcm) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op lcm : Int Int -> Nat [ditto] . op min : NzInt NzInt -> NzInt [assoc comm special (id-hook ACU_NumberOpSymbol (min) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op min : Int Int -> Int [ditto] . op max : NzInt NzInt -> NzInt [assoc comm special (id-hook ACU_NumberOpSymbol (max) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op max : Int Int -> Int [ditto] . op max : NzNat Int -> NzNat [ditto] . op max : Nat Int -> Nat [ditto] . op ~_ : Int -> Int [special (id-hook NumberOpSymbol (~) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _xor_ : Int Int -> Int [assoc comm prec 55 special (id-hook ACU_NumberOpSymbol (xor) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _&_ : Nat Int -> Nat [assoc comm prec 53 special (id-hook ACU_NumberOpSymbol (&) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _&_ : Int Int -> Int [ditto] . op _|_ : NzInt Int -> NzInt [assoc comm prec 57 special (id-hook ACU_NumberOpSymbol (|) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _|_ : Int Int -> Int [ditto] . op _>>_ : Int Nat -> Int [prec 35 gather (E e) special (id-hook NumberOpSymbol (>>) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _<<_ : Int Nat -> Int [prec 35 gather (E e) special (id-hook NumberOpSymbol (<<) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . op _<_ : Int Int -> Bool [prec 37 special (id-hook NumberOpSymbol (<) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) term-hook trueTerm (true) term-hook falseTerm (false))] . op _<=_ : Int Int -> Bool [prec 37 special (id-hook NumberOpSymbol (<=) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>_ : Int Int -> Bool [prec 37 special (id-hook NumberOpSymbol (>) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>=_ : Int Int -> Bool [prec 37 special (id-hook NumberOpSymbol (>=) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) term-hook trueTerm (true) term-hook falseTerm (false))] . op _divides_ : NzInt Int -> Bool [prec 51 special (id-hook NumberOpSymbol (divides) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) term-hook trueTerm (true) term-hook falseTerm (false))] . endfm fmod RAT is protecting INT . sorts PosRat NzRat Rat . subsorts NzInt < NzRat Int < Rat . subsorts NzNat < PosRat < NzRat . op _/_ : NzInt NzNat -> NzRat [ctor prec 31 gather (E e) special (id-hook DivisionSymbol op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int))] . var I J : NzInt . var N M : NzNat . var K : Int . var Z : Nat . var Q : NzRat . var R : Rat . op _/_ : NzNat NzNat -> PosRat [ctor ditto] . op _/_ : PosRat PosRat -> PosRat [ditto] . op _/_ : NzRat NzRat -> NzRat [ditto] . op _/_ : Rat NzRat -> Rat [ditto] . eq 0 / Q = 0 . eq I / - N = - I / N . eq (I / N) / (J / M) = (I * M) / (J * N) . eq (I / N) / J = I / (J * N) . eq I / (J / M) = (I * M) / J . op -_ : NzRat -> NzRat [ditto] . op -_ : Rat -> Rat [ditto] . eq - (I / N) = - I / N . op _+_ : PosRat PosRat -> PosRat [ditto] . op _+_ : PosRat Nat -> PosRat [ditto] . op _+_ : Rat Rat -> Rat [ditto] . eq I / N + J / M = (I * M + J * N) / (N * M) . eq I / N + K = (I + K * N) / N . op _-_ : Rat Rat -> Rat [ditto] . eq I / N - J / M = (I * M - J * N) / (N * M) . eq I / N - K = (I - K * N) / N . eq K - J / M = (K * M - J ) / M . op _*_ : PosRat PosRat -> PosRat [ditto] . op _*_ : NzRat NzRat -> NzRat [ditto] . op _*_ : Rat Rat -> Rat [ditto] . eq Q * 0 = 0 . eq (I / N) * (J / M) = (I * J) / (N * M). eq (I / N) * K = (I * K) / N . op _quo_ : PosRat PosRat -> Nat [ditto] . op _quo_ : Rat NzRat -> Int [ditto] . eq (I / N) quo Q = I quo (N * Q) . eq K quo (J / M) = (K * M) quo J . op _rem_ : Rat NzRat -> Rat [ditto] . eq (I / N) rem (J / M) = ((I * M) rem (J * N)) / (N * M) . eq K rem (J / M) = ((K * M) rem J) / M . eq (I / N) rem J = (I rem (J * N)) / N . op _^_ : PosRat Nat -> PosRat [ditto] . op _^_ : NzRat Nat -> NzRat [ditto] . op _^_ : Rat Nat -> Rat [ditto] . eq (I / N) ^ Z = (I ^ Z) / (N ^ Z) . op abs : NzRat -> PosRat [ditto] . op abs : Rat -> Rat [ditto] . eq abs(I / N) = abs(I) / N . op gcd : NzRat Rat -> PosRat [ditto] . op gcd : Rat Rat -> Rat [ditto] . eq gcd(I / N, R) = gcd(I, N * R) / N . op lcm : NzRat NzRat -> PosRat [ditto] . op lcm : Rat Rat -> Rat [ditto] . eq lcm(I / N, R) = lcm(I, N * R) / N . op min : PosRat PosRat -> PosRat [ditto] . op min : NzRat NzRat -> NzRat [ditto] . op min : Rat Rat -> Rat [ditto] . eq min(I / N, R) = min(I, N * R) / N . op max : PosRat Rat -> PosRat [ditto] . op max : NzRat NzRat -> NzRat [ditto] . op max : Rat Rat -> Rat [ditto] . eq max(I / N, R) = max(I, N * R) / N . op _<_ : Rat Rat -> Bool [ditto] . eq (I / N) < (J / M) = (I * M) < (J * N) . eq (I / N) < K = I < (K * N) . eq K < (J / M) = (K * M) < J . op _<=_ : Rat Rat -> Bool [ditto] . eq (I / N) <= (J / M) = (I * M) <= (J * N) . eq (I / N) <= K = I <= (K * N) . eq K <= (J / M) = (K * M) <= J . op _>_ : Rat Rat -> Bool [ditto] . eq (I / N) > (J / M) = (I * M) > (J * N) . eq (I / N) > K = I > (K * N) . eq K > (J / M) = (K * M) > J . op _>=_ : Rat Rat -> Bool [ditto] . eq (I / N) >= (J / M) = (I * M) >= (J * N) . eq (I / N) >= K = I >= (K * N) . eq K >= (J / M) = (K * M) >= J . op _divides_ : NzRat Rat -> Bool [ditto] . eq (I / N) divides K = I divides N * K . eq Q divides (J / M) = Q * M divides J . op trunc : PosRat -> Nat . op trunc : Rat -> Int . eq trunc(K) = K . eq trunc(I / N) = I quo N . op frac : Rat -> Rat . eq frac(K) = 0 . eq frac(I / N) = (I rem N) / N . op floor : PosRat -> Nat . op floor : Rat -> Int . op ceiling : PosRat -> NzNat . op ceiling : Rat -> Int . eq floor(K) = K . eq ceiling(K) = K . eq floor(N / M) = N quo M . eq ceiling(N / M) = ((N + M) - 1) quo M . eq floor(- N / M) = - ceiling(N / M) . eq ceiling(- N / M) = - floor(N / M) . endfm fmod FLOAT is protecting BOOL . sorts FiniteFloat Float . subsort FiniteFloat < Float . *** pseudo constructor for the set of double precision floats op : -> FiniteFloat [special (id-hook FloatSymbol)] . op : -> Float [ditto] . op -_ : Float -> Float [prec 15 special (id-hook FloatOpSymbol (-) op-hook floatSymbol ( : ~> Float))] . op -_ : FiniteFloat -> FiniteFloat [ditto] . op _+_ : Float Float -> Float [prec 33 gather (E e) special (id-hook FloatOpSymbol (+) op-hook floatSymbol ( : ~> Float))] . op _-_ : Float Float -> Float [prec 33 gather (E e) special (id-hook FloatOpSymbol (-) op-hook floatSymbol ( : ~> Float))] . op _*_ : Float Float -> Float [prec 31 gather (E e) special (id-hook FloatOpSymbol (*) op-hook floatSymbol ( : ~> Float))] . op _/_ : Float Float ~> Float [prec 31 gather (E e) special (id-hook FloatOpSymbol (/) op-hook floatSymbol ( : ~> Float))] . op _rem_ : Float Float ~> Float [prec 31 gather (E e) special (id-hook FloatOpSymbol (rem) op-hook floatSymbol ( : ~> Float))] . op _^_ : Float Float ~> Float [prec 29 gather (E e) special (id-hook FloatOpSymbol (^) op-hook floatSymbol ( : ~> Float))] . op abs : Float -> Float [special (id-hook FloatOpSymbol (abs) op-hook floatSymbol ( : ~> Float))] . op abs : FiniteFloat -> FiniteFloat [ditto] . op floor : Float -> Float [special (id-hook FloatOpSymbol (floor) op-hook floatSymbol ( : ~> Float))] . op ceiling : Float -> Float [special (id-hook FloatOpSymbol (ceiling) op-hook floatSymbol ( : ~> Float))] . op min : Float Float -> Float [special (id-hook FloatOpSymbol (min) op-hook floatSymbol ( : ~> Float))] . op max : Float Float -> Float [special (id-hook FloatOpSymbol (max) op-hook floatSymbol ( : ~> Float))] . op sqrt : Float ~> Float [special (id-hook FloatOpSymbol (sqrt) op-hook floatSymbol ( : ~> Float))] . op exp : Float -> Float [special (id-hook FloatOpSymbol (exp) op-hook floatSymbol ( : ~> Float))] . op log : Float ~> Float [special (id-hook FloatOpSymbol (log) op-hook floatSymbol ( : ~> Float))] . op sin : Float -> Float [special (id-hook FloatOpSymbol (sin) op-hook floatSymbol ( : ~> Float))] . op cos : Float -> Float [special (id-hook FloatOpSymbol (cos) op-hook floatSymbol ( : ~> Float))] . op tan : Float -> Float [special (id-hook FloatOpSymbol (tan) op-hook floatSymbol ( : ~> Float))] . op asin : Float ~> Float [special (id-hook FloatOpSymbol (asin) op-hook floatSymbol ( : ~> Float))] . op acos : Float ~> Float [special (id-hook FloatOpSymbol (acos) op-hook floatSymbol ( : ~> Float))] . op atan : Float -> Float [special (id-hook FloatOpSymbol (atan) op-hook floatSymbol ( : ~> Float))] . op atan : Float Float -> Float [special (id-hook FloatOpSymbol (atan) op-hook floatSymbol ( : ~> Float))] . op _<_ : Float Float -> Bool [prec 51 special (id-hook FloatOpSymbol (<) op-hook floatSymbol ( : ~> Float) term-hook trueTerm (true) term-hook falseTerm (false))] . op _<=_ : Float Float -> Bool [prec 51 special (id-hook FloatOpSymbol (<=) op-hook floatSymbol ( : ~> Float) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>_ : Float Float -> Bool [prec 51 special (id-hook FloatOpSymbol (>) op-hook floatSymbol ( : ~> Float) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>=_ : Float Float -> Bool [prec 51 special (id-hook FloatOpSymbol (>=) op-hook floatSymbol ( : ~> Float) term-hook trueTerm (true) term-hook falseTerm (false))] . op pi : -> FiniteFloat . eq pi = 3.1415926535897931 . op _=[_]_ : Float FiniteFloat Float -> Bool [prec 51 format (d d d d d s d)] . var X Y : Float . var Z : FiniteFloat . eq X =[Z] Y = abs(X - Y) < Z . endfm fmod STRING is protecting NAT . sorts String Char FindResult . subsort Char < String . subsort Nat < FindResult . *** pseudo constructor for the infinite set of strings op : -> Char [special (id-hook StringSymbol)] . op : -> String [ditto] . op notFound : -> FindResult [ctor] . op ascii : Char -> Nat [special (id-hook StringOpSymbol (ascii) op-hook stringSymbol ( : ~> Char) op-hook succSymbol (s_ : Nat ~> NzNat))] . op char : Nat ~> Char [special (id-hook StringOpSymbol (char) op-hook stringSymbol ( : ~> Char) op-hook succSymbol (s_ : Nat ~> NzNat))] . op _+_ : String String -> String [prec 33 gather (E e) special (id-hook StringOpSymbol (+) op-hook stringSymbol ( : ~> String))] . op length : String -> Nat [special (id-hook StringOpSymbol (length) op-hook stringSymbol ( : ~> String) op-hook succSymbol (s_ : Nat ~> NzNat))] . op substr : String Nat Nat -> String [special (id-hook StringOpSymbol (substr) op-hook stringSymbol ( : ~> String) op-hook succSymbol (s_ : Nat ~> NzNat))] . op find : String String Nat -> FindResult [special (id-hook StringOpSymbol (find) op-hook stringSymbol ( : ~> String) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook notFoundTerm (notFound))] . op rfind : String String Nat -> FindResult [special (id-hook StringOpSymbol (rfind) op-hook stringSymbol ( : ~> String) op-hook succSymbol (s_ : Nat ~> NzNat) term-hook notFoundTerm (notFound))] . op _<_ : String String -> Bool [prec 37 special (id-hook StringOpSymbol (<) op-hook stringSymbol ( : ~> String) term-hook trueTerm (true) term-hook falseTerm (false))] . op _<=_ : String String -> Bool [prec 37 special (id-hook StringOpSymbol (<=) op-hook stringSymbol ( : ~> String) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>_ : String String -> Bool [prec 37 special (id-hook StringOpSymbol (>) op-hook stringSymbol ( : ~> String) term-hook trueTerm (true) term-hook falseTerm (false))] . op _>=_ : String String -> Bool [prec 37 special (id-hook StringOpSymbol (>=) op-hook stringSymbol ( : ~> String) term-hook trueTerm (true) term-hook falseTerm (false))] . endfm fmod CONVERSION is protecting RAT . protecting FLOAT . protecting STRING . sort DecFloat . op <_,_,_> : Int String Int -> DecFloat [ctor] . op float : Rat -> Float [special (id-hook FloatOpSymbol (float) op-hook floatSymbol ( : ~> Float) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) op-hook divisionSymbol (_/_ : NzInt NzNat ~> NzRat))] . op rat : FiniteFloat -> Rat [special (id-hook FloatOpSymbol (rat) op-hook floatSymbol ( : ~> Float) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) op-hook divisionSymbol (_/_ : NzInt NzNat ~> NzRat))] . op string : Rat NzNat ~> String [special (id-hook StringOpSymbol (string) op-hook stringSymbol ( : ~> String) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) op-hook divisionSymbol (_/_ : NzInt NzNat ~> NzRat))] . op rat : String NzNat ~> Rat [special (id-hook StringOpSymbol (rat) op-hook stringSymbol ( : ~> String) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) op-hook divisionSymbol (_/_ : NzInt NzNat ~> NzRat))] . op string : Float -> String [special (id-hook StringOpSymbol (string) op-hook stringSymbol ( : ~> String) op-hook floatSymbol ( : ~> Float))] . op float : String ~> Float [special (id-hook StringOpSymbol (float) op-hook stringSymbol ( : ~> String) op-hook floatSymbol ( : ~> Float))] . op decFloat : Float Nat -> DecFloat [special (id-hook StringOpSymbol (decFloat) op-hook stringSymbol ( : ~> String) op-hook floatSymbol ( : ~> Float) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) op-hook decFloatSymbol (<_,_,_> : Int String Int ~> DecFloat))] . endfm fmod RANDOM is protecting NAT . op random : Nat -> Nat [special (id-hook RandomOpSymbol op-hook succSymbol (s_ : Nat ~> NzNat))] . endfm fmod QID is protecting STRING . sort Qid . *** pseudo constructor for the infinite set of quoted identifiers op : -> Qid [special (id-hook QuotedIdentifierSymbol)] . op string : Qid -> String [special (id-hook QuotedIdentifierOpSymbol (string) op-hook quotedIdentifierSymbol ( : ~> Qid) op-hook stringSymbol ( : ~> String))] . op qid : String ~> Qid [special (id-hook QuotedIdentifierOpSymbol (qid) op-hook quotedIdentifierSymbol ( : ~> Qid) op-hook stringSymbol ( : ~> String))] . endfm *** *** Standard theories and views. *** fth TRIV is sort Elt . endfth view TRIV from TRIV to TRIV is endv view Bool from TRIV to BOOL is sort Elt to Bool . endv view Nat from TRIV to NAT is sort Elt to Nat . endv view Int from TRIV to INT is sort Elt to Int . endv view Rat from TRIV to RAT is sort Elt to Rat . endv view Float from TRIV to FLOAT is sort Elt to Float . endv view String from TRIV to STRING is sort Elt to String . endv view Qid from TRIV to QID is sort Elt to Qid . endv fth STRICT-WEAK-ORDER is protecting BOOL . including TRIV . op _<_ : Elt Elt -> Bool . vars X Y Z : Elt . ceq X < Z = true if X < Y /\ Y < Z [nonexec label transitive] . eq X < X = false [nonexec label irreflexive] . ceq X < Y or Y < X or Y < Z or Z < Y = true if X < Z or Z < X [nonexec label incomparability-transitive] . endfth view STRICT-WEAK-ORDER from TRIV to STRICT-WEAK-ORDER is endv fth STRICT-TOTAL-ORDER is inc STRICT-WEAK-ORDER . vars X Y : Elt . ceq X = Y if X < Y = false /\ Y < X = false [nonexec label total] . endfth view STRICT-TOTAL-ORDER from STRICT-WEAK-ORDER to STRICT-TOTAL-ORDER is endv view Nat< from STRICT-TOTAL-ORDER to NAT is sort Elt to Nat . endv view Int< from STRICT-TOTAL-ORDER to INT is sort Elt to Int . endv view Rat< from STRICT-TOTAL-ORDER to RAT is sort Elt to Rat . endv view Float< from STRICT-TOTAL-ORDER to FLOAT is sort Elt to Float . endv view String< from STRICT-TOTAL-ORDER to STRING is sort Elt to String . endv fth TOTAL-PREORDER is protecting BOOL . including TRIV . op _<=_ : Elt Elt -> Bool . vars X Y Z : Elt . eq X <= X = true [nonexec label reflexive] . ceq X <= Z = true if X <= Y /\ Y <= Z [nonexec label transitive] . eq X <= Y or Y <= X = true [nonexec label total] . endfth view TOTAL-PREORDER from TRIV to TOTAL-PREORDER is endv fth TOTAL-ORDER is inc TOTAL-PREORDER . vars X Y : Elt . ceq X = Y if X <= Y /\ Y <= X [nonexec label antisymmetric] . endfth view TOTAL-ORDER from TOTAL-PREORDER to TOTAL-ORDER is endv view Nat<= from TOTAL-ORDER to NAT is sort Elt to Nat . endv view Int<= from TOTAL-ORDER to INT is sort Elt to Int . endv view Rat<= from TOTAL-ORDER to RAT is sort Elt to Rat . endv view Float<= from TOTAL-ORDER to FLOAT is sort Elt to Float . endv view String<= from TOTAL-ORDER to STRING is sort Elt to String . endv fth DEFAULT is including TRIV . op 0 : -> Elt . endfth view DEFAULT from TRIV to DEFAULT is endv view Nat0 from DEFAULT to NAT is sort Elt to Nat . endv view Int0 from DEFAULT to INT is sort Elt to Int . endv view Rat0 from DEFAULT to RAT is sort Elt to Rat . endv view Float0 from DEFAULT to FLOAT is sort Elt to Float . op 0 to term 0.0 . endv view String0 from DEFAULT to STRING is sort Elt to String . op 0 to term "" . endv view Qid0 from DEFAULT to QID is sort Elt to Qid . op 0 to term ' . endv *** *** Container data types defined in Maude. *** fmod LIST{X :: TRIV} is protecting NAT . sorts NeList{X} List{X} . subsort X$Elt < NeList{X} < List{X} . op nil : -> List{X} [ctor] . op __ : List{X} List{X} -> List{X} [ctor assoc id: nil prec 25] . op __ : NeList{X} List{X} -> NeList{X} [ctor ditto] . op __ : List{X} NeList{X} -> NeList{X} [ctor ditto] . var E E' : X$Elt . vars A L : List{X} . var C : Nat . op append : List{X} List{X} -> List{X} . op append : NeList{X} List{X} -> NeList{X} . op append : List{X} NeList{X} -> NeList{X} . eq append(A, L) = A L . op head : NeList{X} -> X$Elt . eq head(E L) = E . op tail : NeList{X} -> List{X} . eq tail(E L) = L . op last : NeList{X} -> X$Elt . eq last(L E) = E . op front : NeList{X} -> List{X} . eq front(L E) = L . op occurs : X$Elt List{X} -> Bool . eq occurs(E, nil) = false . eq occurs(E, E' L) = if E == E' then true else occurs(E, L) fi . op reverse : List{X} -> List{X} . op reverse : NeList{X} -> NeList{X} . eq reverse(L) = $reverse(L, nil) . op $reverse : List{X} List{X} -> List{X} . eq $reverse(nil, A) = A . eq $reverse(E L, A) = $reverse(L, E A). op size : List{X} -> Nat . op size : NeList{X} -> NzNat . eq size(L) = $size(L, 0) . op $size : List{X} Nat -> Nat . eq $size(nil, C) = C . eq $size(E L, C) = $size(L, C + 1) . endfm fmod WEAKLY-SORTABLE-LIST{X :: STRICT-WEAK-ORDER} is protecting LIST{STRICT-WEAK-ORDER}{X} * (sort NeList{STRICT-WEAK-ORDER}{X} to NeList{X}, sort List{STRICT-WEAK-ORDER}{X} to List{X}) . sort $Split{X} . vars E E' : X$Elt . vars A A' L L' : List{X} . var N : NeList{X} . op sort : List{X} -> List{X} . op sort : NeList{X} -> NeList{X} . eq sort(nil) = nil . eq sort(E) = E . eq sort(E N) = $sort($split(E N, nil, nil)) . op $sort : $Split{X} -> List{X} . eq $sort($split(nil, L, L')) = $merge(sort(L), sort(L'), nil) . op $split : List{X} List{X} List{X} -> $Split{X} [ctor] . eq $split(E, A, A') = $split(nil, A E, A') . eq $split(E L E', A, A') = $split(L, A E, E' A') . op merge : List{X} List{X} -> List{X} . op merge : NeList{X} List{X} -> NeList{X} . op merge : List{X} NeList{X} -> NeList{X} . eq merge(L, L') = $merge(L, L', nil) . op $merge : List{X} List{X} List{X} -> List{X} . eq $merge(L, nil, A) = A L . eq $merge(nil, L, A) = A L . eq $merge(E L, E' L', A) = if E' < E then $merge(E L, L', A E') else $merge(L, E' L', A E) fi . endfm fmod SORTABLE-LIST{X :: STRICT-TOTAL-ORDER} is protecting WEAKLY-SORTABLE-LIST{STRICT-TOTAL-ORDER}{X} * (sort NeList{STRICT-TOTAL-ORDER}{X} to NeList{X}, sort List{STRICT-TOTAL-ORDER}{X} to List{X}) . endfm fmod WEAKLY-SORTABLE-LIST'{X :: TOTAL-PREORDER} is protecting LIST{TOTAL-PREORDER}{X} * (sort NeList{TOTAL-PREORDER}{X} to NeList{X}, sort List{TOTAL-PREORDER}{X} to List{X}) . sort $Split{X} . vars E E' : X$Elt . vars A A' L L' : List{X} . var N : NeList{X} . op sort : List{X} -> List{X} . op sort : NeList{X} -> NeList{X} . eq sort(nil) = nil . eq sort(E) = E . eq sort(E N) = $sort($split(E N, nil, nil)) . op $sort : $Split{X} -> List{X} . eq $sort($split(nil, L, L')) = $merge(sort(L), sort(L'), nil) . op $split : List{X} List{X} List{X} -> $Split{X} [ctor] . eq $split(E, A, A') = $split(nil, A E, A') . eq $split(E L E', A, A') = $split(L, A E, E' A') . op merge : List{X} List{X} -> List{X} . op merge : NeList{X} List{X} -> NeList{X} . op merge : List{X} NeList{X} -> NeList{X} . eq merge(L, L') = $merge(L, L', nil) . op $merge : List{X} List{X} List{X} -> List{X} . eq $merge(L, nil, A) = A L . eq $merge(nil, L, A) = A L . eq $merge(E L, E' L', A) = if E <= E' then $merge(L, E' L', A E) else $merge(E L, L', A E') fi . endfm fmod SORTABLE-LIST'{X :: TOTAL-ORDER} is protecting WEAKLY-SORTABLE-LIST'{TOTAL-ORDER}{X} * (sort NeList{TOTAL-ORDER}{X} to NeList{X}, sort List{TOTAL-ORDER}{X} to List{X}) . endfm fmod SET{X :: TRIV} is protecting EXT-BOOL . protecting NAT . sorts NeSet{X} Set{X} . subsort X$Elt < NeSet{X} < Set{X} . op empty : -> Set{X} [ctor] . op _,_ : Set{X} Set{X} -> Set{X} [ctor assoc comm id: empty prec 121 format (d r os d)] . op _,_ : NeSet{X} Set{X} -> NeSet{X} [ctor ditto] . var E : X$Elt . var N : NeSet{X} . vars A S S' : Set{X} . var C : Nat . eq N, N = N . op insert : X$Elt Set{X} -> Set{X} . eq insert(E, S) = E, S . op delete : X$Elt Set{X} -> Set{X} . eq delete(E, (E, S)) = delete(E, S) . eq delete(E, S) = S [owise] . op _in_ : X$Elt Set{X} -> Bool . eq E in (E, S) = true . eq E in S = false [owise] . op |_| : Set{X} -> Nat . op |_| : NeSet{X} -> NzNat . eq | S | = $card(S, 0) . op $card : Set{X} Nat -> Nat . eq $card(empty, C) = C . eq $card((N, N, S), C) = $card((N, S), C) . eq $card((E, S), C) = $card(S, C + 1) [owise] . op union : Set{X} Set{X} -> Set{X} . op union : NeSet{X} Set{X} -> NeSet{X} . op union : Set{X} NeSet{X} -> NeSet{X} . eq union(S, S') = S, S' . op intersection : Set{X} Set{X} -> Set{X} . eq intersection(S, empty) = empty . eq intersection(S, N) = $intersect(S, N, empty) . op $intersect : Set{X} Set{X} Set{X} -> Set{X} . eq $intersect(empty, S', A) = A . eq $intersect((E, S), S', A) = $intersect(S, S', if E in S' then E, A else A fi) . op _\_ : Set{X} Set{X} -> Set{X} [gather (E e)]. eq S \ empty = S . eq S \ N = $diff(S, N, empty) . op $diff : Set{X} Set{X} Set{X} -> Set{X} . eq $diff(empty, S', A) = A . eq $diff((E, S), S', A) = $diff(S, S', if E in S' then A else E, A fi) . op _subset_ : Set{X} Set{X} -> Bool . eq empty subset S' = true . eq (E, S) subset S' = E in S' and-then S subset S' . op _psubset_ : Set{X} Set{X} -> Bool . eq S psubset S' = S =/= S' and-then S subset S' . endfm fmod LIST-AND-SET{X :: TRIV} is protecting LIST{X} . protecting SET{X} . var E : X$Elt . vars A L : List{X} . var S : Set{X} . op makeSet : List{X} -> Set{X} . op makeSet : NeList{X} -> NeSet{X} . eq makeSet(L) = $makeSet(L, empty) . op $makeSet : List{X} Set{X} -> Set{X} . op $makeSet : NeList{X} Set{X} -> NeSet{X} . op $makeSet : List{X} NeSet{X} -> NeSet{X} . eq $makeSet(nil, S) = S . eq $makeSet(E L, S) = $makeSet(L, (E, S)) . op filter : List{X} Set{X} -> List{X} . eq filter(L, S) = $filter(L, S, nil) . op $filter : List{X} Set{X} List{X} -> List{X} . eq $filter(nil, S, A) = A . eq $filter(E L, S, A) = $filter(L, S, if E in S then A E else A fi) . op filterOut : List{X} Set{X} -> List{X} . eq filterOut(L, S) = $filterOut(L, S, nil) . op $filterOut : List{X} Set{X} List{X} -> List{X} . eq $filterOut(nil, S, A) = A . eq $filterOut(E L, S, A) = $filterOut(L, S, if E in S then A else A E fi) . endfm fmod SORTABLE-LIST-AND-SET{X :: STRICT-TOTAL-ORDER} is protecting SORTABLE-LIST{X} . *** *** This double renaming is needed for correct sharing of a renamed *** copy of LIST since Core Maude does not evaluate the composition *** of renamings but applies them sequentially. *** protecting LIST-AND-SET{STRICT-WEAK-ORDER}{STRICT-TOTAL-ORDER}{X} * (sort NeList{STRICT-WEAK-ORDER}{STRICT-TOTAL-ORDER}{X} to NeList{STRICT-TOTAL-ORDER}{X}, sort List{STRICT-WEAK-ORDER}{STRICT-TOTAL-ORDER}{X} to List{STRICT-TOTAL-ORDER}{X}) * (sort NeList{STRICT-TOTAL-ORDER}{X} to NeList{X}, sort List{STRICT-TOTAL-ORDER}{X} to List{X}, sort NeSet{STRICT-WEAK-ORDER}{STRICT-TOTAL-ORDER}{X} to NeSet{X}, sort Set{STRICT-WEAK-ORDER}{STRICT-TOTAL-ORDER}{X} to Set{X}) . var E : X$Elt . var L : List{X} . var S : Set{X} . op makeList : Set{X} -> List{X} . op makeList : NeSet{X} -> NeList{X} . eq makeList(S) = $makeList(S, nil) . op $makeList : Set{X} List{X} -> List{X} . op $makeList : NeSet{X} List{X} -> NeList{X} . op $makeList : Set{X} NeList{X} -> NeList{X} . eq $makeList(empty, L) = sort(L) . eq $makeList((E, E, S), L) = $makeList((E, S), L) . eq $makeList((E, S), L) = $makeList(S, E L) [owise] . endfm fmod SORTABLE-LIST-AND-SET'{X :: TOTAL-ORDER} is protecting SORTABLE-LIST'{X} . *** *** This double renaming is needed for the same reasons as above. *** protecting LIST-AND-SET{TOTAL-PREORDER}{TOTAL-ORDER}{X} * (sort NeList{TOTAL-PREORDER}{TOTAL-ORDER}{X} to NeList{TOTAL-ORDER}{X}, sort List{TOTAL-PREORDER}{TOTAL-ORDER}{X} to List{TOTAL-ORDER}{X}) * (sort NeList{TOTAL-ORDER}{X} to NeList{X}, sort List{TOTAL-ORDER}{X} to List{X}, sort NeSet{TOTAL-PREORDER}{TOTAL-ORDER}{X} to NeSet{X}, sort Set{TOTAL-PREORDER}{TOTAL-ORDER}{X} to Set{X}) . var E : X$Elt . var L : List{X} . var S : Set{X} . op makeList : Set{X} -> List{X} . op makeList : NeSet{X} -> NeList{X} . eq makeList(S) = $makeList(S, nil) . op $makeList : Set{X} List{X} -> List{X} . op $makeList : NeSet{X} List{X} -> NeList{X} . op $makeList : Set{X} NeList{X} -> NeList{X} . eq $makeList(empty, L) = sort(L) . eq $makeList((E, E, S), L) = $makeList((E, S), L) . eq $makeList((E, S), L) = $makeList(S, E L) [owise] . endfm fmod LIST*{X :: TRIV} is protecting NAT . sorts Item{X} PreList{X} NeList{X} List{X} . subsort X$Elt List{X} < Item{X} < PreList{X} . subsort NeList{X} < List{X} . op __ : PreList{X} PreList{X} -> PreList{X} [ctor assoc prec 25] . op [_] : PreList{X} -> NeList{X} [ctor] . op [] : -> List{X} [ctor] . vars A P : PreList{X} . var L : List{X} . var E E' : Item{X} . var C : Nat . op append : List{X} List{X} -> List{X} . op append : NeList{X} List{X} -> NeList{X} . op append : List{X} NeList{X} -> NeList{X} . eq append([], L) = L . eq append(L, []) = L . eq append([P], [A]) = [P A] . op head : NeList{X} -> Item{X} . eq head([E]) = E . eq head([E P]) = E . op tail : NeList{X} -> List{X} . eq tail([E]) = [] . eq tail([E P]) = [P] . op last : NeList{X} -> Item{X} . eq last([E]) = E . eq last([P E]) = E . op front : NeList{X} -> List{X} . eq front([E]) = [] . eq front([P E]) = [P] . op occurs : Item{X} List{X} -> Bool . eq occurs(E, []) = false . eq occurs(E, [E']) = (E == E') . eq occurs(E, [E' P]) = if E == E' then true else occurs(E, [P]) fi . op reverse : List{X} -> List{X} . op reverse : NeList{X} -> NeList{X} . eq reverse([]) = [] . eq reverse([E]) = [E] . eq reverse([E P]) = [$reverse(P, E)] . op $reverse : PreList{X} PreList{X} -> PreList{X} . eq $reverse(E, A) = E A . eq $reverse(E P, A) = $reverse(P, E A). op size : List{X} -> Nat . op size : NeList{X} -> NzNat . eq size([]) = 0 . eq size([P]) = $size(P, 0) . op $size : PreList{X} Nat -> NzNat . eq $size(E, C) = C + 1 . eq $size(E P, C) = $size(P, C + 1) . endfm fmod SET*{X :: TRIV} is protecting EXT-BOOL . protecting NAT . sorts Element{X} PreSet{X} NeSet{X} Set{X} . subsort X$Elt Set{X} < Element{X} < PreSet{X} . subsort NeSet{X} < Set{X} . op _,_ : PreSet{X} PreSet{X} -> PreSet{X} [ctor assoc comm prec 121 format (d r os d)] . op {_} : PreSet{X} -> NeSet{X} [ctor] . op {} : -> Set{X} [ctor] . vars P Q : PreSet{X} . vars A S : Set{X} . var E : Element{X} . var N : NeSet{X} . var C : Nat . eq {P, P} = {P} . eq {P, P, Q} = {P, Q} . op insert : Element{X} Set{X} -> Set{X} . eq insert(E, {}) = {E} . eq insert(E, {P}) = {E, P} . op delete : Element{X} Set{X} -> Set{X} . eq delete(E, {E}) = {} . eq delete(E, {E, P}) = delete(E, {P}) . eq delete(E, S) = S [owise] . op _in_ : Element{X} Set{X} -> Bool . eq E in {E} = true . eq E in {E, P} = true . eq E in S = false [owise] . op |_| : Set{X} -> Nat . op |_| : NeSet{X} -> NzNat . eq | {} | = 0 . eq | {P} | = $card(P, 0) . op $card : PreSet{X} Nat -> Nat . eq $card(E, C) = C + 1 . eq $card((N, N, P), C) = $card((N, P), C) . eq $card((E, P), C) = $card(P, C + 1) [owise] . op union : Set{X} Set{X} -> Set{X} . op union : NeSet{X} Set{X} -> NeSet{X} . op union : Set{X} NeSet{X} -> NeSet{X} . eq union({}, S) = S . eq union(S, {}) = S . eq union({P}, {Q}) = {P, Q} . op intersection : Set{X} Set{X} -> Set{X} . eq intersection({}, S) = {} . eq intersection(S, {}) = {} . eq intersection({P}, N) = $intersect(P, N, {}) . op $intersect : PreSet{X} Set{X} Set{X} -> Set{X} . eq $intersect(E, S, A) = if E in S then insert(E, A) else A fi . eq $intersect((E, P), S, A) = $intersect(P, S, $intersect(E, S, A)) . op _\_ : Set{X} Set{X} -> Set{X} [gather (E e)] . eq {} \ S = {} . eq S \ {} = S . eq {P} \ N = $diff(P, N, {}) . op $diff : PreSet{X} Set{X} Set{X} -> Set{X} . eq $diff(E, S, A) = if E in S then A else insert(E, A) fi . eq $diff((E, P), S, A) = $diff(P, S, $diff(E, S, A)) . op 2^_ : Set{X} -> Set{X} . eq 2^{} = {{}} . eq 2^{E} = {{}, {E}} . eq 2^{E, P} = union(2^{P}, $augment(2^{P}, E, {})) . op $augment : NeSet{X} Element{X} Set{X} -> Set{X} . eq $augment({S}, E, A) = insert(insert(E, S), A) . eq $augment({S, P}, E, A) = $augment({P}, E, $augment({S}, E, A)) . op _subset_ : Set{X} Set{X} -> Bool . eq {} subset S = true . eq {E} subset S = E in S . eq {E, P} subset S = E in S and-then {P} subset S . op _psubset_ : Set{X} Set{X} -> Bool . eq A psubset S = A =/= S and-then A subset S . endfm fmod MAP{X :: TRIV, Y :: TRIV} is protecting BOOL . sorts Entry{X,Y} Map{X,Y} . subsort Entry{X,Y} < Map{X,Y} . op _|->_ : X$Elt Y$Elt -> Entry{X,Y} [ctor] . op empty : -> Map{X,Y} [ctor] . op _,_ : Map{X,Y} Map{X,Y} -> Map{X,Y} [ctor assoc comm id: empty prec 121 format (d r os d)] . op undefined : -> [Y$Elt] [ctor] . var D : X$Elt . vars R R' : Y$Elt . var M : Map{X,Y} . op insert : X$Elt Y$Elt Map{X,Y} -> Map{X,Y} . eq insert(D, R, (M, D |-> R')) = if $hasMapping(M, D) then insert(D, R, M) else (M, D |-> R) fi . eq insert(D, R, M) = (M, D |-> R) [owise] . op _[_] : Map{X,Y} X$Elt -> [Y$Elt] [prec 23] . eq (M, D |-> R)[D] = if $hasMapping(M, D) then undefined else R fi . eq M[D] = undefined [owise] . op $hasMapping : Map{X,Y} X$Elt -> Bool . eq $hasMapping((M, D |-> R), D) = true . eq $hasMapping(M, D) = false [owise] . endfm fmod ARRAY{X :: TRIV, Y :: DEFAULT} is protecting BOOL . sorts Entry{X,Y} Array{X,Y} . subsort Entry{X,Y} < Array{X,Y} . op _|->_ : X$Elt Y$Elt -> Entry{X,Y} [ctor] . op empty : -> Array{X,Y} [ctor] . op _;_ : Array{X,Y} Array{X,Y} -> Array{X,Y} [ctor assoc comm id: empty prec 71 format (d r os d)] . var D : X$Elt . vars R R' : Y$Elt . var A : Array{X,Y} . op insert : X$Elt Y$Elt Array{X,Y} -> Array{X,Y} . eq insert(D, R, (A ; D |-> R')) = if $hasMapping(A, D) then insert(D, R, A) else if R == 0 then A else (A ; D |-> R) fi fi . eq insert(D, R, A) = if R == 0 then A else (A ; D |-> R) fi [owise] . op _[_] : Array{X,Y} X$Elt -> Y$Elt [prec 23] . eq (A ; D |-> R)[D] = if $hasMapping(A, D) then 0 else R fi . eq A[D] = 0 [owise] . op $hasMapping : Array{X,Y} X$Elt -> Bool . eq $hasMapping((A ; D |-> R), D) = true . eq $hasMapping(A, D) = false [owise] . endfm *** *** Container instantiations on builtin data types needed by the metalevel. *** fmod NAT-LIST is protecting LIST{Nat} * (sort NeList{Nat} to NeNatList, sort List{Nat} to NatList) . endfm fmod QID-LIST is protecting LIST{Qid} * (sort NeList{Qid} to NeQidList, sort List{Qid} to QidList) . endfm fmod QID-SET is protecting SET{Qid} * (sort NeSet{Qid} to NeQidSet, sort Set{Qid} to QidSet) . endfm *** *** The metalevel. *** fmod META-TERM is protecting QID . *** types sorts Sort Kind Type . subsorts Sort Kind < Type < Qid . op : -> Sort [special (id-hook QuotedIdentifierSymbol (sortQid))] . op : -> Kind [special (id-hook QuotedIdentifierSymbol (kindQid))] . *** terms sorts Constant Variable TermQid GroundTerm Term NeGroundTermList GroundTermList NeTermList TermList . subsorts Constant Variable < TermQid < Qid Term . subsorts Constant < GroundTerm < Term NeGroundTermList < NeTermList . subsorts NeGroundTermList < NeTermList GroundTermList < TermList . op : -> Constant [special (id-hook QuotedIdentifierSymbol (constantQid))] . op : -> Variable [special (id-hook QuotedIdentifierSymbol (variableQid))] . op empty : -> GroundTermList [ctor] . op _,_ : NeGroundTermList GroundTermList -> NeGroundTermList [ctor assoc id: empty gather (e E) prec 121] . op _,_ : GroundTermList NeGroundTermList -> NeGroundTermList [ctor ditto] . op _,_ : GroundTermList GroundTermList -> GroundTermList [ctor ditto] . op _,_ : NeTermList TermList -> NeTermList [ctor ditto] . op _,_ : TermList NeTermList -> NeTermList [ctor ditto] . op _,_ : TermList TermList -> TermList [ctor ditto] . op _[_] : Qid NeGroundTermList -> GroundTerm [ctor] . op _[_] : Qid NeTermList -> Term [ctor] . *** extraction of names and types op getName : Constant -> Qid . op getType : Constant -> Type . var C : Constant . eq getName(C) = qid(substr(string(C), 0, rfind(string(C), ".", length(string(C))))) . eq getType(C) = qid(substr(string(C), rfind(string(C), ".", length(string(C))) + 1, length(string(C)))) . op getName : Variable -> Qid . op getType : Variable -> Type . var V : Variable . eq getName(V) = qid(substr(string(V), 0, rfind(string(V), ":", length(string(V))))) . eq getType(V) = qid(substr(string(V), rfind(string(V), ":", length(string(V))) + 1, length(string(V)))) . *** substitutions sorts Assignment Substitution . subsort Assignment < Substitution . op _<-_ : Variable Term -> Assignment [ctor prec 63 format (nt d d d)] . op none : -> Substitution [ctor] . op _;_ : Substitution Substitution -> Substitution [ctor assoc comm id: none prec 65] . eq A:Assignment ; A:Assignment = A:Assignment . *** contexts (terms with a single hole) sorts Context NeCTermList GTermList . subsort Context < NeCTermList < GTermList . subsorts TermList < GTermList . op [] : -> Context [ctor] . op _,_ : TermList NeCTermList -> NeCTermList [ctor ditto] . op _,_ : NeCTermList TermList -> NeCTermList [ctor ditto] . op _,_ : GTermList GTermList -> GTermList [ctor ditto] . op _[_] : Qid NeCTermList -> Context [ctor] . endfm fmod META-MODULE is protecting META-TERM . protecting NAT-LIST . protecting QID-LIST . protecting QID-SET * (op empty to none, op _,_ to _;_ [prec 43]) . *** subsort declarations sorts SubsortDecl SubsortDeclSet . subsort SubsortDecl < SubsortDeclSet . op subsort_<_. : Sort Sort -> SubsortDecl [ctor] . op none : -> SubsortDeclSet [ctor] . op __ : SubsortDeclSet SubsortDeclSet -> SubsortDeclSet [ctor assoc comm id: none format (d ni d)] . eq S:SubsortDecl S:SubsortDecl = S:SubsortDecl . *** sort, kind and type sets sorts EmptyTypeSet NeSortSet NeKindSet NeTypeSet SortSet KindSet TypeSet . subsort EmptyTypeSet < SortSet KindSet < TypeSet < QidSet . subsort Sort < NeSortSet < SortSet . subsort Kind < NeKindSet < KindSet . subsort Type NeSortSet NeKindSet < NeTypeSet < TypeSet NeQidSet . op none : -> EmptyTypeSet [ctor] . op _;_ : TypeSet TypeSet -> TypeSet [ctor ditto] . op _;_ : NeTypeSet TypeSet -> NeTypeSet [ctor ditto] . op _;_ : SortSet SortSet -> SortSet [ctor ditto] . op _;_ : NeSortSet SortSet -> NeSortSet [ctor ditto] . op _;_ : KindSet KindSet -> KindSet [ctor ditto] . op _;_ : NeKindSet KindSet -> NeKindSet [ctor ditto] . op _;_ : EmptyTypeSet EmptyTypeSet -> EmptyTypeSet [ctor ditto] . *** type lists sort NeTypeList TypeList . subsorts Type < NeTypeList < TypeList < QidList . subsorts NeTypeList < NeQidList . op nil : -> TypeList [ctor] . op __ : TypeList TypeList -> TypeList [ctor ditto] . op __ : NeTypeList TypeList -> NeTypeList [ctor ditto] . op __ : TypeList NeTypeList -> NeTypeList [ctor ditto] . eq T:TypeList ; T:TypeList = T:TypeList . *** sets of type lists sort TypeListSet . subsort TypeList TypeSet < TypeListSet . op _;_ : TypeListSet TypeListSet -> TypeListSet [ctor ditto] . *** attribute sets sorts Attr AttrSet . subsort Attr < AttrSet . op none : -> AttrSet [ctor] . op __ : AttrSet AttrSet -> AttrSet [ctor assoc comm id: none] . eq A:Attr A:Attr = A:Attr . *** renamings sorts Renaming RenamingSet . subsort Renaming < RenamingSet . op sort_to_ : Qid Qid -> Renaming [ctor] . op op_to_[_] : Qid Qid AttrSet -> Renaming [ctor format (d d d d s d d d)] . op op_:_->_to_[_] : Qid TypeList Type Qid AttrSet -> Renaming [ctor format (d d d d d d d d s d d d)] . op label_to_ : Qid Qid -> Renaming [ctor] . op _,_ : RenamingSet RenamingSet -> RenamingSet [ctor assoc comm prec 43 format (d d ni d)] . *** parameter lists sort EmptyCommaList NeParameterList ParameterList . subsorts Sort < NeParameterList < ParameterList . subsort EmptyCommaList < GroundTermList ParameterList . op empty : -> EmptyCommaList [ctor] . op _,_ : ParameterList ParameterList -> ParameterList [ctor ditto] . op _,_ : NeParameterList ParameterList -> NeParameterList [ctor ditto] . op _,_ : ParameterList NeParameterList -> NeParameterList [ctor ditto] . op _,_ : EmptyCommaList EmptyCommaList -> EmptyCommaList [ctor ditto] . *** module expressions sort ModuleExpression . subsort Qid < ModuleExpression . op _+_ : ModuleExpression ModuleExpression -> ModuleExpression [ctor assoc comm] . op _*(_) : ModuleExpression RenamingSet -> ModuleExpression [ctor prec 39 format (d d s n++i n--i d)] . op _{_} : ModuleExpression ParameterList -> ModuleExpression [ctor prec 37]. *** parameter declarations sorts ParameterDecl NeParameterDeclList ParameterDeclList . subsorts ParameterDecl < NeParameterDeclList < ParameterDeclList . op _::_ : Sort ModuleExpression -> ParameterDecl . op nil : -> ParameterDeclList [ctor] . op _,_ : ParameterDeclList ParameterDeclList -> ParameterDeclList [ctor assoc id: nil prec 121] . op _,_ : NeParameterDeclList ParameterDeclList -> NeParameterDeclList [ctor ditto] . op _,_ : ParameterDeclList NeParameterDeclList -> NeParameterDeclList [ctor ditto] . *** importations sorts Import ImportList . subsort Import < ImportList . op protecting_. : ModuleExpression -> Import [ctor] . op extending_. : ModuleExpression -> Import [ctor] . op including_. : ModuleExpression -> Import [ctor] . op nil : -> ImportList [ctor] . op __ : ImportList ImportList -> ImportList [ctor assoc id: nil format (d ni d)] . *** hooks sorts Hook NeHookList HookList . subsort Hook < NeHookList < HookList . op id-hook : Qid QidList -> Hook [ctor format (nssss d)] . op op-hook : Qid Qid QidList Qid -> Hook [ctor format (nssss d)] . op term-hook : Qid Term -> Hook [ctor format (nssss d)] . op nil : -> HookList [ctor] . op __ : HookList HookList -> HookList [ctor assoc id: nil] . op __ : NeHookList HookList -> NeHookList [ctor ditto] . op __ : HookList NeHookList -> NeHookList [ctor ditto] . *** operator attributes op assoc : -> Attr [ctor] . op comm : -> Attr [ctor] . op idem : -> Attr [ctor] . op iter : -> Attr [ctor] . op id : Term -> Attr [ctor] . op left-id : Term -> Attr [ctor] . op right-id : Term -> Attr [ctor] . op strat : NeNatList -> Attr [ctor] . op memo : -> Attr [ctor] . op prec : Nat -> Attr [ctor] . op gather : QidList -> Attr [ctor] . op format : QidList -> Attr [ctor] . op ctor : -> Attr [ctor] . op config : -> Attr [ctor] . op object : -> Attr [ctor] . op msg : -> Attr [ctor] . op frozen : NeNatList -> Attr [ctor] . op poly : NeNatList -> Attr [ctor] . op special : NeHookList -> Attr [ctor] . *** statement attributes op label : Qid -> Attr [ctor] . op metadata : String -> Attr [ctor] . op owise : -> Attr [ctor] . op nonexec : -> Attr [ctor] . op print : QidList -> Attr [ctor] . *** operator declarations sorts OpDecl OpDeclSet . subsort OpDecl < OpDeclSet . op (op_:_->_[_].) : Qid TypeList Type AttrSet -> OpDecl [ctor format (d d d d d d s d d s d)] . op none : -> OpDeclSet [ctor] . op __ : OpDeclSet OpDeclSet -> OpDeclSet [ctor assoc comm id: none format (d ni d)] . eq O:OpDecl O:OpDecl = O:OpDecl . *** conditions sorts EqCondition Condition . subsort EqCondition < Condition . op nil : -> EqCondition [ctor] . op _=_ : Term Term -> EqCondition [ctor prec 71] . op _:_ : Term Sort -> EqCondition [ctor prec 71] . op _:=_ : Term Term -> EqCondition [ctor prec 71] . op _=>_ : Term Term -> Condition [ctor prec 71] . op _/\_ : EqCondition EqCondition -> EqCondition [ctor assoc id: nil prec 73] . op _/\_ : Condition Condition -> Condition [ctor assoc id: nil prec 73] . *** membership axioms sorts MembAx MembAxSet . subsort MembAx < MembAxSet . op mb_:_[_]. : Term Sort AttrSet -> MembAx [ctor format (d d d d s d d s d)] . op cmb_:_if_[_]. : Term Sort EqCondition AttrSet -> MembAx [ctor format (d d d d d d s d d s d)] . op none : -> MembAxSet [ctor] . op __ : MembAxSet MembAxSet -> MembAxSet [ctor assoc comm id: none format (d ni d)] . eq M:MembAx M:MembAx = M:MembAx . *** equations sorts Equation EquationSet . subsort Equation < EquationSet . op eq_=_[_]. : Term Term AttrSet -> Equation [ctor format (d d d d s d d s d)] . op ceq_=_if_[_]. : Term Term EqCondition AttrSet -> Equation [ctor format (d d d d d d s d d s d)] . op none : -> EquationSet [ctor] . op __ : EquationSet EquationSet -> EquationSet [ctor assoc comm id: none format (d ni d)] . eq E:Equation E:Equation = E:Equation . *** rules sorts Rule RuleSet . subsort Rule < RuleSet . op rl_=>_[_]. : Term Term AttrSet -> Rule [ctor format (d d d d s d d s d)] . op crl_=>_if_[_]. : Term Term Condition AttrSet -> Rule [ctor format (d d d d d d s d d s d)] . op none : -> RuleSet [ctor] . op __ : RuleSet RuleSet -> RuleSet [ctor assoc comm id: none format (d ni d)] . eq R:Rule R:Rule = R:Rule . *** modules sorts FModule SModule FTheory STheory Module . subsorts FModule < SModule < Module . subsorts FTheory < STheory < Module . sort Header . subsort Qid < Header . op _{_} : Qid ParameterDeclList -> Header [ctor] . op fmod_is_sorts_.____endfm : Header ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet -> FModule [ctor gather (& & & & & & &) format (d d s n++i ni d d ni ni ni ni n--i d)] . op mod_is_sorts_._____endm : Header ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet RuleSet -> SModule [ctor gather (& & & & & & & &) format (d d s n++i ni d d ni ni ni ni ni n--i d)] . op fth_is_sorts_.____endfth : Qid ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet -> FTheory [ctor gather (& & & & & & &) format (d d d n++i ni d d ni ni ni ni n--i d)] . op th_is_sorts_._____endth : Qid ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet RuleSet -> STheory [ctor gather (& & & & & & & &) format (d d d n++i ni d d ni ni ni ni ni n--i d)] . op [_] : Qid -> Module . eq [Q:Qid] = (th Q:Qid is including Q:Qid . sorts none . none none none none none endth) . *** projection functions var Q : Qid . var PDL : ParameterDeclList . var H : Header . var M : Module . var IL : ImportList . var SS : SortSet . var SSDS : SubsortDeclSet . var OPDS : OpDeclSet . var MAS : MembAxSet . var EQS : EquationSet . var RLS : RuleSet . op getName : Module -> Qid . eq getName(fmod Q is IL sorts SS . SSDS OPDS MAS EQS endfm) = Q . eq getName(mod Q is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = Q . eq getName(fmod Q{PDL} is IL sorts SS . SSDS OPDS MAS EQS endfm) = Q . eq getName(mod Q{PDL} is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = Q . eq getName(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = Q . eq getName(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = Q . op getImports : Module -> ImportList . eq getImports(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = IL . eq getImports(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = IL . eq getImports(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = IL . eq getImports(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = IL . op getSorts : Module -> SortSet . eq getSorts(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = SS . eq getSorts(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = SS . eq getSorts(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = SS . eq getSorts(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = SS . op getSubsorts : Module -> SubsortDeclSet . eq getSubsorts(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = SSDS . eq getSubsorts(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = SSDS . eq getSubsorts(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = SSDS . eq getSubsorts(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = SSDS . op getOps : Module -> OpDeclSet . eq getOps(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = OPDS . eq getOps(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = OPDS . eq getOps(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = OPDS . eq getOps(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = OPDS . op getMbs : Module -> MembAxSet . eq getMbs(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = MAS . eq getMbs(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = MAS . eq getMbs(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = MAS . eq getMbs(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = MAS . op getEqs : Module -> EquationSet . eq getEqs(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = EQS . eq getEqs(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = EQS . eq getEqs(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = EQS . eq getEqs(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = EQS . op getRls : Module -> RuleSet . eq getRls(fmod H is IL sorts SS . SSDS OPDS MAS EQS endfm) = none . eq getRls(mod H is IL sorts SS . SSDS OPDS MAS EQS RLS endm) = RLS . eq getRls(fth Q is IL sorts SS . SSDS OPDS MAS EQS endfth) = none . eq getRls(th Q is IL sorts SS . SSDS OPDS MAS EQS RLS endth) = RLS . endfm fmod META-VIEW is protecting META-MODULE . *** sort mappings sorts SortMapping SortMappingSet . subsort SortMapping < SortMappingSet . op sort_to_. : Sort Sort -> SortMapping [ctor] . op none : -> SortMappingSet [ctor] . op __ : SortMappingSet SortMappingSet -> SortMappingSet [ctor assoc comm id: none format (d ni d)] . eq S:SortMapping S:SortMapping = S:SortMapping . *** operator mappings sorts OpMapping OpMappingSet . subsort OpMapping < OpMappingSet . op (op_to_.) : Qid Qid -> OpMapping [ctor] . op (op_:_->_to_.) : Qid TypeList Type Qid -> OpMapping [ctor] . op (op_to term_.) : Term Term -> OpMapping [ctor] . op none : -> OpMappingSet [ctor] . op __ : OpMappingSet OpMappingSet -> OpMappingSet [ctor assoc comm id: none format (d ni d)] . eq O:OpMapping O:OpMapping = O:OpMapping . sort View . op view_from_to_is__endv : Header ModuleExpression ModuleExpression SortMappingSet OpMappingSet -> View [ctor gather (& & & & &) format (d d d d d d d n++i ni n--i d)] . *** projection functions var Q : Qid . vars ME ME' : ModuleExpression . var SMS : SortMappingSet . var OMS : OpMappingSet . op getName : View -> Qid . eq getName(view Q from ME to ME' is SMS OMS endv) = Q . op getFrom : View -> ModuleExpression . eq getFrom(view Q from ME to ME' is SMS OMS endv) = ME . op getTo : View -> ModuleExpression . eq getTo(view Q from ME to ME' is SMS OMS endv) = ME' . op getSortMappings : View -> SortMappingSet . eq getSortMappings(view Q from ME to ME' is SMS OMS endv) = SMS . op getOpMappings : View -> OpMappingSet . eq getOpMappings(view Q from ME to ME' is SMS OMS endv) = OMS . endfm fmod META-LEVEL is protecting META-VIEW . *** bounds sort Bound . subsort Nat < Bound . op unbounded : -> Bound [ctor] . *** argument values sort Type? . subsort Type < Type? . op anyType : -> Type? [ctor] . *** options for metaPrettyPrint() sorts PrintOption PrintOptionSet . subsort PrintOption < PrintOptionSet . ops mixfix with-parens flat format number rat : -> PrintOption [ctor] . op none : -> PrintOptionSet [ctor] . op __ : PrintOptionSet PrintOptionSet -> PrintOptionSet [ctor assoc comm id: none] . *** unification problems sorts UnificandPair UnificationProblem . subsort UnificandPair < UnificationProblem . op _=?_ : Term Term -> UnificandPair [ctor prec 71] . op _/\_ : UnificationProblem UnificationProblem -> UnificationProblem [ctor assoc comm prec 73] . *** success results sorts ResultPair ResultTriple Result4Tuple MatchPair TraceStep Trace UnificationPair UnificationTriple . subsort TraceStep < Trace . op {_,_} : Term Type -> ResultPair [ctor] . op {_,_,_} : Term Type Substitution -> ResultTriple [ctor] . op {_,_,_,_} : Term Type Substitution Context -> Result4Tuple [ctor] . op {_,_} : Substitution Context -> MatchPair [ctor] . op {_,_} : Substitution Nat -> UnificationPair [ctor] . op {_,_,_} : Substitution Substitution Nat -> UnificationTriple [ctor] . op {_,_,_} : Term Type Rule -> TraceStep [ctor] . op nil : -> Trace [ctor] . op __ : Trace Trace -> Trace [ctor assoc id: nil format (d n d)] . *** failure results sorts ResultPair? ResultTriple? Result4Tuple? MatchPair? Substitution? Trace? UnificationPair? UnificationTriple? . subsort ResultPair < ResultPair? . subsort ResultTriple < ResultTriple? . subsort Result4Tuple < Result4Tuple? . subsort MatchPair < MatchPair? . subsort UnificationPair < UnificationPair? . subsort UnificationTriple < UnificationTriple? . subsort Substitution < Substitution? . subsort Trace < Trace? . op noParse : Nat -> ResultPair? [ctor] . op ambiguity : ResultPair ResultPair -> ResultPair? [ctor] . op failure : -> ResultPair? [ctor] . op failure : -> ResultTriple? [ctor] . op failure : -> Result4Tuple? [ctor] . op noUnifier : -> UnificationPair? [ctor] . op noUnifier : -> UnificationTriple? [ctor] . op noMatch : -> Substitution? [ctor] . op noMatch : -> MatchPair? [ctor] . op failure : -> Trace? [ctor] . *** projection functions op getTerm : ResultPair -> Term . eq getTerm({T:Term, T:Type}) = T:Term . op getType : ResultPair -> Type . eq getType({T:Term, T:Type}) = T:Type . op getTerm : ResultTriple -> Term . eq getTerm({T:Term, T:Type, S:Substitution}) = T:Term . op getType : ResultTriple -> Type . eq getType({T:Term, T:Type, S:Substitution}) = T:Type . op getSubstitution : ResultTriple -> Substitution . eq getSubstitution({T:Term, T:Type, S:Substitution}) = S:Substitution . op getTerm : Result4Tuple -> Term . eq getTerm({T:Term, T:Type, S:Substitution, C:Context}) = T:Term . op getType : Result4Tuple -> Type . eq getType({T:Term, T:Type, S:Substitution, C:Context}) = T:Type . op getSubstitution : Result4Tuple -> Substitution . eq getSubstitution({T:Term, T:Type, S:Substitution, C:Context}) = S:Substitution . op getContext : Result4Tuple -> Context . eq getContext({T:Term, T:Type, S:Substitution, C:Context}) = C:Context . op getSubstitution : MatchPair -> Substitution . eq getSubstitution({S:Substitution, C:Context}) = S:Substitution . op getContext : MatchPair -> Context . eq getContext({S:Substitution, C:Context}) = C:Context . *** descent functions op metaReduce : Module Term ~> ResultPair [special ( id-hook MetaLevelOpSymbol (metaReduce) op-hook qidSymbol ( : ~> Qid) op-hook metaTermSymbol (_[_] : Qid NeTermList ~> Term) op-hook metaArgSymbol (_,_ : NeTermList NeTermList ~> NeTermList) op-hook assignmentSymbol (_<-_ : Qid Term ~> Assignment) op-hook substitutionSymbol (_;_ : Substitution Substitution ~> Substitution) op-hook emptySubstitutionSymbol (none : ~> Substitution) op-hook holeSymbol ([] : ~> Context) op-hook headerSymbol (_{_} : Qid ParameterDeclList ~> Header) op-hook parameterDeclSymbol (_::_ : Sort ModuleExpression ~> ParameterDecl) op-hook parameterDeclListSymbol (_,_ : ParameterDeclList ParameterDeclList ~> ParameterDeclList) op-hook emptyAttrSetSymbol (none : ~> AttrSet) op-hook attrSetSymbol (__ : AttrSet AttrSet ~> AttrSet) op-hook sortRenamingSymbol (sort_to_ : Qid Qid ~> Renaming) op-hook opRenamingSymbol (op_to_[_] : Qid Qid AttrSet ~> Renaming) op-hook opRenamingSymbol2 (op_:_->_to_[_] : Qid TypeList Type Qid AttrSet ~> Renaming) op-hook labelRenamingSymbol (label_to_ : Qid Qid ~> Renaming) op-hook renamingSetSymbol (_,_ : RenamingSet RenamingSet ~> RenamingSet) op-hook sumSymbol (_+_ : ModuleExpression ModuleExpression ~> ModuleExpression) op-hook renamingSymbol (_*(_) : ModuleExpression RenamingSet ~> ModuleExpression) op-hook instantiationSymbol (_{_} : ModuleExpression ParameterList ~> ModuleExpression) op-hook protectingSymbol (protecting_. : ModuleExpression ~> Import) op-hook extendingSymbol (extending_. : ModuleExpression ~> Import) op-hook includingSymbol (including_. : ModuleExpression ~> Import) op-hook nilImportListSymbol (nil : ~> ImportList) op-hook importListSymbol (__ : ImportList ImportList ~> ImportList) op-hook emptySortSetSymbol (none : ~> SortSet) op-hook sortSetSymbol (_;_ : SortSet SortSet ~> SortSet) op-hook subsortSymbol (subsort_<_. : Sort Sort ~> SubsortDecl) op-hook emptySubsortDeclSetSymbol (none : ~> SubsortDeclSet) op-hook subsortDeclSetSymbol (__ : SubsortDeclSet SubsortDeclSet ~> SubsortDeclSet) op-hook nilQidListSymbol (nil : ~> QidList) op-hook qidListSymbol (__ : QidList QidList ~> QidList) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook natListSymbol (__ : NeNatList NeNatList ~> NeNatList) op-hook unboundedSymbol (unbounded : ~> Bound) op-hook stringSymbol ( : ~> String) op-hook idHookSymbol (id-hook : Qid QidList ~> Hook) op-hook opHookSymbol (op-hook : Qid Qid QidList Qid ~> Hook) op-hook termHookSymbol (term-hook : Qid Term ~> Hook) op-hook hookListSymbol (__ : HookList HookList ~> HookList) op-hook assocSymbol (assoc : ~> Attr) op-hook commSymbol (comm : ~> Attr) op-hook idemSymbol (idem : ~> Attr) op-hook iterSymbol (iter : ~> Attr) op-hook idSymbol (id : Term ~> Attr) op-hook leftIdSymbol (left-id : Term ~> Attr) op-hook rightIdSymbol (right-id : Term ~> Attr) op-hook stratSymbol (strat : NeNatList ~> Attr) op-hook memoSymbol (memo : ~> Attr) op-hook precSymbol (prec : Nat ~> Attr) op-hook gatherSymbol (gather : QidList ~> Attr) op-hook formatSymbol (format : QidList ~> Attr) op-hook ctorSymbol (ctor : ~> Attr) op-hook frozenSymbol (frozen : NeNatList ~> Attr) op-hook polySymbol (poly : NeNatList ~> Attr) op-hook configSymbol (config : ~> Attr) op-hook objectSymbol (object : ~> Attr) op-hook msgSymbol (msg : ~> Attr) op-hook specialSymbol (special : NeHookList ~> Attr) op-hook labelSymbol (label : Qid ~> Attr) op-hook metadataSymbol (metadata : String ~> Attr) op-hook owiseSymbol (owise : ~> Attr) op-hook nonexecSymbol (nonexec : ~> Attr) op-hook printSymbol (print : QidList ~> Attr) op-hook opDeclSymbol (op_:_->_[_]. : Qid TypeList Type AttrSet ~> OpDecl) op-hook emptyOpDeclSetSymbol (none : ~> OpDeclSet) op-hook opDeclSetSymbol (__ : OpDeclSet OpDeclSet ~> OpDeclSet) op-hook noConditionSymbol (nil : ~> EqCondition) op-hook equalityConditionSymbol (_=_ : Term Term ~> EqCondition) op-hook sortTestConditionSymbol (_:_ : Term Sort ~> EqCondition) op-hook matchConditionSymbol (_:=_ : Term Term ~> EqCondition) op-hook rewriteConditionSymbol (_=>_ : Term Term ~> Condition) op-hook conjunctionSymbol (_/\_ : Condition Condition ~> Condition) op-hook mbSymbol (mb_:_[_]. : Term Sort AttrSet ~> MembAx) op-hook cmbSymbol (cmb_:_if_[_]. : Term Sort EqCondition AttrSet ~> MembAx) op-hook emptyMembAxSetSymbol (none : ~> MembAxSet) op-hook membAxSetSymbol (__ : MembAxSet MembAxSet ~> MembAxSet) op-hook eqSymbol (eq_=_[_]. : Term Term AttrSet ~> Equation) op-hook ceqSymbol (ceq_=_if_[_]. : Term Term EqCondition AttrSet ~> Equation) op-hook emptyEquationSetSymbol (none : ~> EquationSet) op-hook equationSetSymbol (__ : EquationSet EquationSet ~> EquationSet) op-hook rlSymbol (rl_=>_[_]. : Term Term AttrSet ~> Rule) op-hook crlSymbol (crl_=>_if_[_]. : Term Term Condition AttrSet ~> Rule) op-hook emptyRuleSetSymbol (none : ~> RuleSet) op-hook ruleSetSymbol (__ : RuleSet RuleSet ~> RuleSet) op-hook fmodSymbol (fmod_is_sorts_.____endfm : Qid ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet ~> FModule) op-hook fthSymbol (fth_is_sorts_.____endfth : Qid ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet ~> FModule) op-hook modSymbol (mod_is_sorts_._____endm : Qid ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet RuleSet ~> Module) op-hook thSymbol (th_is_sorts_._____endth : Qid ImportList SortSet SubsortDeclSet OpDeclSet MembAxSet EquationSet RuleSet ~> Module) op-hook sortMappingSymbol (sort_to_. : Sort Sort ~> SortMapping [ctor] .) op-hook emptySortMappingSetSymbol (none : ~> SortMappingSet) op-hook sortMappingSetSymbol (__ : SortMappingSet SortMappingSet ~> SortMappingSet) op-hook opMappingSymbol (op_to_. : Qid Qid ~> OpMapping) op-hook opSpecificMappingSymbol (op_:_->_to_. : Qid TypeList Type Qid ~> OpMapping) op-hook opTermMappingSymbol (op_to`term_. : Term Term ~> OpMapping) op-hook emptyOpMappingSetSymbol (none : ~> OpMappingSet) op-hook opMappingSetSymbol (__ : OpMappingSet OpMappingSet ~> OpMappingSet) op-hook viewSymbol (view_from_to_is__endv : Header ModuleExpression ModuleExpression SortMappingSet OpMappingSet ~> View) op-hook anyTypeSymbol (anyType : ~> Type?) op-hook unificandPairSymbol (_=?_ : Term Term ~> UnificandPair) op-hook unificationConjunctionSymbol (_/\_ : UnificationProblem UnificationProblem ~> UnificationProblem) op-hook resultPairSymbol ({_,_} : Term Type ~> ResultPair) op-hook resultTripleSymbol ({_,_,_} : Term Type Substitution ~> ResultTriple) op-hook result4TupleSymbol ({_,_,_,_} : Term Type Substitution Context ~> Result4Tuple) op-hook matchPairSymbol ({_,_} : Substitution Context ~> MatchPair) op-hook unificationPairSymbol ({_,_} : Substitution Nat ~> UnificationPair) op-hook unificationTripleSymbol ({_,_,_} : Substitution Substitution Nat ~> UnificationTriple) op-hook traceStepSymbol ({_,_,_} : Term Type Rule ~> TraceStep) op-hook nilTraceSymbol (nil : ~> Trace) op-hook traceSymbol (__ : Trace Trace ~> Trace) op-hook noParseSymbol (noParse : Nat ~> ResultPair?) op-hook ambiguitySymbol (ambiguity : ResultPair ResultPair ~> ResultPair?) op-hook failure2Symbol (failure : ~> ResultPair?) op-hook failure3Symbol (failure : ~> ResultTriple?) op-hook failure4Symbol (failure : ~> Result4Tuple?) op-hook noUnifierPairSymbol (noUnifier : ~> UnificationPair?) op-hook noUnifierTripleSymbol (noUnifier : ~> UnificationTriple?) op-hook noMatchSubstSymbol (noMatch : ~> Substitution?) op-hook noMatchPairSymbol (noMatch : ~> MatchPair?) op-hook failureTraceSymbol (failure : ~> Trace?) op-hook mixfixSymbol (mixfix : ~> PrintOption) op-hook withParensSymbol (with-parens : ~> PrintOption) op-hook flatSymbol (flat : ~> PrintOption) op-hook formatPrintOptionSymbol (format : ~> PrintOption) op-hook numberSymbol (number : ~> PrintOption) op-hook ratSymbol (rat : ~> PrintOption) op-hook emptyPrintOptionSetSymbol (none : ~> PrintOptionSet) op-hook printOptionSetSymbol (__ : PrintOptionSet PrintOptionSet ~> PrintOptionSet) term-hook trueTerm (true) term-hook falseTerm (false))] . op metaNormalize : Module Term ~> ResultPair [special ( id-hook MetaLevelOpSymbol (metaNormalize) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaRewrite : Module Term Bound ~> ResultPair [special ( id-hook MetaLevelOpSymbol (metaRewrite) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaFrewrite : Module Term Bound Nat ~> ResultPair [special ( id-hook MetaLevelOpSymbol (metaFrewrite) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaApply : Module Term Qid Substitution Nat ~> ResultTriple? [special ( id-hook MetaLevelOpSymbol (metaApply) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaXapply : Module Term Qid Substitution Nat Bound Nat ~> Result4Tuple? [special ( id-hook MetaLevelOpSymbol (metaXapply) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaMatch : Module Term Term Condition Nat ~> Substitution? [special ( id-hook MetaLevelOpSymbol (metaMatch) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaXmatch : Module Term Term Condition Nat Bound Nat ~> MatchPair? [special ( id-hook MetaLevelOpSymbol (metaXmatch) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaUnify : Module UnificationProblem Nat Nat ~> UnificationPair? [special ( id-hook MetaLevelOpSymbol (metaUnify) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaDisjointUnify : Module UnificationProblem Nat Nat ~> UnificationTriple? [special ( id-hook MetaLevelOpSymbol (metaDisjointUnify) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaSearch : Module Term Term Condition Qid Bound Nat ~> ResultTriple? [special ( id-hook MetaLevelOpSymbol (metaSearch) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaSearchPath : Module Term Term Condition Qid Bound Nat ~> Trace? [special ( id-hook MetaLevelOpSymbol (metaSearchPath) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaNarrow : Module Term Term Qid Bound Nat ~> ResultTriple? [special ( id-hook MetaLevelOpSymbol (metaNarrow) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaNarrow : Module Term Qid Bound Bool Nat ~> ResultPair? [special ( id-hook MetaLevelOpSymbol (metaNarrow2) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op sortLeq : Module Type Type ~> Bool [special ( id-hook MetaLevelOpSymbol (metaSortLeq) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op sameKind : Module Type Type ~> Bool [special ( id-hook MetaLevelOpSymbol (metaSameKind) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op lesserSorts : Module Type ~> SortSet [special ( id-hook MetaLevelOpSymbol (metaLesserSorts) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op glbSorts : Module Type Type ~> TypeSet [special ( id-hook MetaLevelOpSymbol (metaGlbSorts) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op leastSort : Module Term ~> Type [special ( id-hook MetaLevelOpSymbol (metaLeastSort) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op completeName : Module Type ~> Type [special ( id-hook MetaLevelOpSymbol (metaCompleteName) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaParse : Module QidList Type? ~> ResultPair? [special ( id-hook MetaLevelOpSymbol (metaParse) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op metaPrettyPrint : Module Term PrintOptionSet ~> QidList [special ( id-hook MetaLevelOpSymbol (metaPrettyPrint) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op wellFormed : Module -> Bool [special ( id-hook MetaLevelOpSymbol (metaWellFormedModule) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op wellFormed : Module Term ~> Bool [special ( id-hook MetaLevelOpSymbol (metaWellFormedTerm) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op wellFormed : Module Substitution ~> Bool [special ( id-hook MetaLevelOpSymbol (metaWellFormedSubstitution) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op getKind : Module Type ~> Kind [special ( id-hook MetaLevelOpSymbol (metaGetKind) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op getKinds : Module ~> KindSet [special ( id-hook MetaLevelOpSymbol (metaGetKinds) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op maximalSorts : Module Kind ~> SortSet [special ( id-hook MetaLevelOpSymbol (metaMaximalSorts) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op minimalSorts : Module Kind ~> SortSet [special ( id-hook MetaLevelOpSymbol (metaMinimalSorts) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op maximalAritySet : Module Qid TypeList Sort ~> TypeListSet [special ( id-hook MetaLevelOpSymbol (metaMaximalAritySet) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upModule : Qid Bool ~> Module [special ( id-hook MetaLevelOpSymbol (metaUpModule) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upImports : Qid ~> ImportList [special ( id-hook MetaLevelOpSymbol (metaUpImports) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upSorts : Qid Bool ~> SortSet [special ( id-hook MetaLevelOpSymbol (metaUpSorts) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upSubsortDecls : Qid Bool ~> SubsortDeclSet [special ( id-hook MetaLevelOpSymbol (metaUpSubsortDecls) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upOpDecls : Qid Bool ~> OpDeclSet [special ( id-hook MetaLevelOpSymbol (metaUpOpDecls) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upMbs : Qid Bool ~> MembAxSet [special ( id-hook MetaLevelOpSymbol (metaUpMbs) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upEqs : Qid Bool ~> EquationSet [special ( id-hook MetaLevelOpSymbol (metaUpEqs) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upRls : Qid Bool ~> RuleSet [special ( id-hook MetaLevelOpSymbol (metaUpRls) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upView : Qid ~> View [special ( id-hook MetaLevelOpSymbol (metaUpView) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op upTerm : Universal -> Term [poly (1) special ( id-hook MetaLevelOpSymbol (metaUpTerm) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . op downTerm : Term Universal -> Universal [poly (2 0) special ( id-hook MetaLevelOpSymbol (metaDownTerm) op-hook shareWith (metaReduce : Module Term ~> ResultPair))] . *** backward compatibility op metaPrettyPrint : Module Term ~> QidList . eq metaPrettyPrint(M:Module, T:Term) = metaPrettyPrint(M:Module, T:Term, mixfix flat format number rat) . endfm *** *** System modules. *** mod COUNTER is protecting NAT . op counter : -> [Nat] [special (id-hook CounterSymbol op-hook succSymbol (s_ : Nat ~> NzNat))] . endm mod LOOP-MODE is protecting QID-LIST . sorts State System . op [_,_,_] : QidList State QidList -> System [ctor special ( id-hook LoopSymbol op-hook qidSymbol ( : ~> Qid) op-hook nilQidListSymbol (nil : ~> QidList) op-hook qidListSymbol (__ : QidList QidList ~> QidList))] . endm mod CONFIGURATION is sorts Attribute AttributeSet . subsort Attribute < AttributeSet . op none : -> AttributeSet [ctor] . op _,_ : AttributeSet AttributeSet -> AttributeSet [ctor assoc comm id: none] . sorts Oid Cid Object Msg Portal Configuration . subsort Object Msg Portal < Configuration . op <_:_|_> : Oid Cid AttributeSet -> Object [ctor object] . op none : -> Configuration [ctor] . op __ : Configuration Configuration -> Configuration [ctor config assoc comm id: none] . op <> : -> Portal [ctor] . endm set include BOOL on . set omod include CONFIGURATION on . select CONVERSION . Maude-2.6/src/Main/machine-int.maude0000644000147300135640000000757511433337020014243 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Approximation of Maude 1.0 MachineInts. *** Version 2.3. *** *** Note that 0 lives in MachineZero. Also using out of range *** integer constants may cause incorrect results. MACHINE-INT may *** be instanciated using a view that maps $nrBits to any power of *** 2 that is >= 2. *** fmod RENAMED-INT is protecting INT * ( sort Zero to MachineZero, sort NzNat to NzMachineNat, sort Nat to MachineNat, sort NzInt to NzMachineInt, sort Int to MachineInt, op s_ : Nat -> NzNat to $succ, op sd : Nat Nat -> Nat to $sd, op -_ : Int -> Int to $neg, op _+_ : Int Int -> Int to $add, op _-_ : Int Int -> Int to $sub, op _*_ : NzInt NzInt -> NzInt to $mult, op _quo_ : Int NzInt -> Int to $quo, op _rem_ : Int NzInt -> Int to $rem, op _^_ : Int Nat -> Int to $pow, op abs : NzInt -> NzNat to $abs, op gcd : NzInt Int -> NzNat to $gcd, op lcm : NzInt NzInt -> NzNat to $lcm, op min : NzInt NzInt -> NzInt to $min, op max : NzInt NzInt -> NzInt to $max, op _xor_ : Int Int -> Int to $xor, op _>>_ : Int Nat -> Int to $shr, op _<<_ : Int Nat -> Int to $shl, op _divides_ : NzInt Int -> Bool to $divides ) . endfm fth BIT-WIDTH is protecting RENAMED-INT . op $nrBits : -> NzMachineNat . var N : NzMachineNat . eq $divides(2, $nrBits) = true [nonexec] . ceq $divides(2, N) = true if $divides(N, $nrBits) /\ N > 1 [nonexec] . endfth view 32-BIT from BIT-WIDTH to RENAMED-INT is op $nrBits to term 32 . endv view 64-BIT from BIT-WIDTH to RENAMED-INT is op $nrBits to term 64 . endv fmod MACHINE-INT{X :: BIT-WIDTH} is *** *** Note that operations *** ~_ _&_ _|_ _<_ _<=_ _>_ _=>_ *** are inherited unmodified. *** vars I J : MachineInt . var K : NzMachineInt . op $mask : -> NzMachineInt [memo] . eq $mask = $sub($nrBits, 1) . op $sign : -> NzMachineInt [memo] . eq $sign = $pow(2, $mask) . op maxMachineInt : -> NzMachineInt [memo] . eq maxMachineInt = $sub($sign, 1) . op minMachineInt : -> NzMachineInt [memo] . eq minMachineInt = $neg($sign) . op $wrap : MachineInt -> MachineInt . eq $wrap(I) = (I & maxMachineInt) | $neg(I & $sign) . op _+_ : MachineInt MachineInt -> MachineInt [assoc comm prec 33] . eq I + J = $wrap($add(I, J)) . op -_ : MachineInt -> MachineInt . eq - I = $wrap($neg(I)) . op _-_ : MachineInt MachineInt -> MachineInt [prec 33 gather (E e)] . eq I - J = $wrap($sub(I, J)) . op _*_ : MachineInt MachineInt -> MachineInt [assoc comm prec 31] . eq I * J = $wrap($mult(I, J)) . op _/_ : MachineInt NzMachineInt -> MachineInt [prec 31 gather (E e)] . eq I / K = $wrap($quo(I, K)) . op _%_ : MachineInt NzMachineInt -> MachineInt [prec 31 gather (E e)] . eq I % K = $rem(I, K) . op _^_ : MachineInt MachineInt -> MachineInt [prec 55 gather (E e)] . eq I ^ J = $xor(I, J) . op _>>_ : MachineInt MachineInt -> MachineInt [prec 35 gather (E e)] . eq I >> J = $shr(I, ($mask & J)) . op _<<_ : MachineInt MachineInt -> MachineInt [prec 35 gather (E e)] . eq I << J = $wrap($shl(I, ($mask & J))) . endfm Maude-2.6/src/Main/Makefile.in0000644000147300135640000004465211500303155013071 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = maude$(EXEEXT) subdir = src/Main DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(datadir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_maude_OBJECTS = maude-main.$(OBJEXT) maude_OBJECTS = $(am_maude_OBJECTS) @BUILD_COMPILER_TRUE@am__DEPENDENCIES_1 = \ @BUILD_COMPILER_TRUE@ ../FullCompiler/libfullCompiler.a am__DEPENDENCIES_2 = @USE_DLMALLOC_TRUE@am__DEPENDENCIES_3 = ../3rdParty/libdlmalloc.a maude_DEPENDENCIES = ../Mixfix/libmixfix.a \ ../StrategyLanguage/libstrategyLanguage.a ../Meta/libmeta.a \ ../ObjectSystem/libobjectSystem.a ../BuiltIn/libbuiltIn.a \ ../Higher/libhigher.a ../FreeTheory/libfreeTheory.a \ ../AU_Theory/libAU_Theory.a \ ../AU_Persistent/libAU_Persistent.a \ ../ACU_Theory/libACU_Theory.a \ ../ACU_Persistent/libACU_Persistent.a \ ../CUI_Theory/libCUI_Theory.a ../S_Theory/libS_Theory.a \ ../NA_Theory/libNA_Theory.a ../Variable/libvariable.a \ ../Interface/libinterface.a ../Core/libcore.a \ ../MSCP10/libmscp10.a ../Temporal/libtemporal.a \ ../IO_Stuff/libIO_Stuff.a $(am__DEPENDENCIES_1) \ ../Utility/libutility.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(maude_SOURCES) DIST_SOURCES = $(maude_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; dataDATA_INSTALL = $(INSTALL_DATA) DATA = $(data_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @BUILD_COMPILER_TRUE@FULL_COMPILER_LIB = ../FullCompiler/libfullCompiler.a @USE_DLMALLOC_TRUE@DLMALLOC_LIB = ../3rdParty/libdlmalloc.a maude_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Temporal \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/Higher \ -I$(top_srcdir)/src/CUI_Theory \ -I$(top_srcdir)/src/S_Theory \ -I$(top_srcdir)/src/NA_Theory \ -I$(top_srcdir)/src/FreeTheory \ -I$(top_srcdir)/src/ObjectSystem \ -I$(top_srcdir)/src/Mixfix \ -I$(top_srcdir)/src/BuiltIn \ -I$(top_srcdir)/src/MSCP10 \ -I$(top_srcdir)/src/IO_Stuff \ -I$(top_srcdir)/src/ACU_Persistent \ -I$(top_srcdir)/src/ACU_Theory \ -I$(top_srcdir)/src/AU_Persistent \ -I$(top_srcdir)/src/AU_Theory \ -I$(top_srcdir)/src/Meta \ -I$(top_srcdir)/src/3rdParty \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/StrategyLanguage \ -I$(top_srcdir)/src/Mixfix maude_LDADD = \ ../Mixfix/libmixfix.a \ ../StrategyLanguage/libstrategyLanguage.a \ ../Meta/libmeta.a \ ../ObjectSystem/libobjectSystem.a \ ../BuiltIn/libbuiltIn.a \ ../Higher/libhigher.a \ ../FreeTheory/libfreeTheory.a \ ../AU_Theory/libAU_Theory.a \ ../AU_Persistent/libAU_Persistent.a \ ../ACU_Theory/libACU_Theory.a \ ../ACU_Persistent/libACU_Persistent.a \ ../CUI_Theory/libCUI_Theory.a \ ../S_Theory/libS_Theory.a \ ../NA_Theory/libNA_Theory.a \ ../Variable/libvariable.a \ ../Interface/libinterface.a \ ../Core/libcore.a \ ../MSCP10/libmscp10.a \ ../Temporal/libtemporal.a \ ../IO_Stuff/libIO_Stuff.a \ $(FULL_COMPILER_LIB) \ ../Utility/libutility.a \ $(BUDDY_LIB) \ $(TECLA_LIBS) \ $(LIBSIGSEGV_LIB) \ $(GMP_LIBS) \ $(DLMALLOC_LIB) maude_SOURCES = \ main.cc data_DATA = \ prelude.maude \ model-checker.maude \ socket.maude \ linear.maude \ machine-int.maude \ term-order.maude \ metaInterpreter.maude EXTRA_DIST = \ prelude.maude \ model-checker.maude \ socket.maude \ linear.maude \ machine-int.maude \ term-order.maude \ metaInterpreter.maude all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Main/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Main/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) maude$(EXEEXT): $(maude_OBJECTS) $(maude_DEPENDENCIES) @rm -f maude$(EXEEXT) $(CXXLINK) $(maude_LDFLAGS) $(maude_OBJECTS) $(maude_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maude-main.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` maude-main.o: main.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(maude_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT maude-main.o -MD -MP -MF "$(DEPDIR)/maude-main.Tpo" -c -o maude-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/maude-main.Tpo" "$(DEPDIR)/maude-main.Po"; else rm -f "$(DEPDIR)/maude-main.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cc' object='maude-main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(maude_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o maude-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc maude-main.obj: main.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(maude_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT maude-main.obj -MD -MP -MF "$(DEPDIR)/maude-main.Tpo" -c -o maude-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/maude-main.Tpo" "$(DEPDIR)/maude-main.Po"; else rm -f "$(DEPDIR)/maude-main.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='main.cc' object='maude-main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(maude_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o maude-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi` uninstall-info-am: install-dataDATA: $(data_DATA) @$(NORMAL_INSTALL) test -z "$(datadir)" || $(mkdir_p) "$(DESTDIR)$(datadir)" @list='$(data_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(datadir)/$$f'"; \ $(dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(datadir)/$$f"; \ done uninstall-dataDATA: @$(NORMAL_UNINSTALL) @list='$(data_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(datadir)/$$f'"; \ rm -f "$(DESTDIR)$(datadir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(datadir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dataDATA install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-dataDATA \ uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dataDATA install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-dataDATA uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/Main/linear.maude0000644000147300135640000000672411433337020013314 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Maude Diophantine solver. *** Version 2.3. *** fmod VECTOR{X :: DEFAULT} is protecting (ARRAY * (sort Entry{X,Y} to Entry{Y}, sort Array{X,Y} to Vector{Y}) ){Nat, X} . endfm fmod INDEX-PAIR is protecting NAT . sort IndexPair . op _,_ : Nat Nat -> IndexPair [ctor] . endfm view IndexPair from TRIV to INDEX-PAIR is sort Elt to IndexPair . endv fmod MATRIX{X :: DEFAULT} is protecting (ARRAY * (sort Entry{X,Y} to Entry{Y}, sort Array{X,Y} to Matrix{Y}) ){IndexPair, X} . endfm fmod INT-VECTOR is protecting VECTOR{Int0} * (sort Entry{Int0} to IntVectorEntry, sort Vector{Int0} to IntVector, op empty to zeroVector) . endfm view IntVector from TRIV to INT-VECTOR is sort Elt to IntVector . endv fmod INT-MATRIX is protecting MATRIX{Int0} * (sort Entry{Int0} to IntMatrixEntry, sort Matrix{Int0} to IntMatrix, op empty to zeroMatrix) . endfm fmod DIOPHANTINE is protecting STRING . protecting INT-MATRIX . protecting SET{IntVector} * (sort NeSet{IntVector} to NeIntVectorSet, sort Set{IntVector} to IntVectorSet, op _,_ : Set{IntVector} Set{IntVector} -> Set{IntVector} to (_,_) [prec 121 format (d d ni d)]) . sort IntVectorSetPair . op [_|_] : IntVectorSet IntVectorSet -> IntVectorSetPair [format (d n++i n ni n-- d)] . op natSystemSolve : IntMatrix IntVector String -> IntVectorSetPair [special ( id-hook MatrixOpSymbol (natSystemSolve) op-hook succSymbol (s_ : Nat ~> NzNat) op-hook minusSymbol (-_ : NzNat ~> Int) op-hook stringSymbol ( : ~> Char) op-hook emptyVectorSymbol (zeroVector : ~> IntVector) op-hook vectorEntrySymbol (_|->_ : Nat Int ~> IntVectorEntry) op-hook vectorSymbol (_;_ : IntVector IntVector ~> IntVector) op-hook emptyMatrixSymbol (zeroMatrix : ~> IntMatrix) op-hook matrixEntrySymbol (_|->_ : IndexPair Int ~> IntMatrixEntry) op-hook matrixSymbol (_;_ : IntMatrix IntMatrix ~> IntMatrix) op-hook indexPairSymbol (_,_ : Nat Nat ~> IndexPair) op-hook emptyVectorSetSymbol (empty : ~> IntVectorSet) op-hook vectorSetSymbol (_,_ : IntVectorSet IntVectorSet ~> IntVectorSet) op-hook vectorSetPairSymbol ([_|_] : IntVectorSet IntVectorSet ~> IntVectorSetPair))] . op natSystemSolve : IntMatrix IntVector -> IntVectorSetPair . eq natSystemSolve(M:IntMatrix, V:IntVector) = natSystemSolve(M:IntMatrix, V:IntVector, "") . endfm Maude-2.6/src/Main/model-checker.maude0000644000147300135640000002306011433337020014534 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Maude LTL satisfiability solver and model checker. *** Version 2.3. *** fmod LTL is protecting BOOL . sort Formula . *** primitive LTL operators ops True False : -> Formula [ctor format (g o)] . op ~_ : Formula -> Formula [ctor prec 53 format (r o d)] . op _/\_ : Formula Formula -> Formula [comm ctor gather (E e) prec 55 format (d r o d)] . op _\/_ : Formula Formula -> Formula [comm ctor gather (E e) prec 59 format (d r o d)] . op O_ : Formula -> Formula [ctor prec 53 format (r o d)] . op _U_ : Formula Formula -> Formula [ctor prec 63 format (d r o d)] . op _R_ : Formula Formula -> Formula [ctor prec 63 format (d r o d)] . *** defined LTL operators op _->_ : Formula Formula -> Formula [gather (e E) prec 65 format (d r o d)] . op _<->_ : Formula Formula -> Formula [prec 65 format (d r o d)] . op <>_ : Formula -> Formula [prec 53 format (r o d)] . op []_ : Formula -> Formula [prec 53 format (r d o d)] . op _W_ : Formula Formula -> Formula [prec 63 format (d r o d)] . op _|->_ : Formula Formula -> Formula [prec 63 format (d r o d)] . *** leads-to op _=>_ : Formula Formula -> Formula [gather (e E) prec 65 format (d r o d)] . op _<=>_ : Formula Formula -> Formula [prec 65 format (d r o d)] . vars f g : Formula . eq f -> g = ~ f \/ g . eq f <-> g = (f -> g) /\ (g -> f) . eq <> f = True U f . eq [] f = False R f . eq f W g = (f U g) \/ [] f . eq f |-> g = [](f -> (<> g)) . eq f => g = [] (f -> g) . eq f <=> g = [] (f <-> g) . *** negative normal form eq ~ True = False . eq ~ False = True . eq ~ ~ f = f . eq ~ (f \/ g) = ~ f /\ ~ g . eq ~ (f /\ g) = ~ f \/ ~ g . eq ~ O f = O ~ f . eq ~(f U g) = (~ f) R (~ g) . eq ~(f R g) = (~ f) U (~ g) . endfm fmod LTL-SIMPLIFIER is including LTL . *** The simplifier is based on: *** Kousha Etessami and Gerard J. Holzman, *** "Optimizing Buchi Automata", p153-167, CONCUR 2000, LNCS 1877. *** We use the Maude sort system to do much of the work. sorts TrueFormula FalseFormula PureFormula PE-Formula PU-Formula . subsort TrueFormula FalseFormula < PureFormula < PE-Formula PU-Formula < Formula . op True : -> TrueFormula [ctor ditto] . op False : -> FalseFormula [ctor ditto] . op _/\_ : PE-Formula PE-Formula -> PE-Formula [ctor ditto] . op _/\_ : PU-Formula PU-Formula -> PU-Formula [ctor ditto] . op _/\_ : PureFormula PureFormula -> PureFormula [ctor ditto] . op _\/_ : PE-Formula PE-Formula -> PE-Formula [ctor ditto] . op _\/_ : PU-Formula PU-Formula -> PU-Formula [ctor ditto] . op _\/_ : PureFormula PureFormula -> PureFormula [ctor ditto] . op O_ : PE-Formula -> PE-Formula [ctor ditto] . op O_ : PU-Formula -> PU-Formula [ctor ditto] . op O_ : PureFormula -> PureFormula [ctor ditto] . op _U_ : PE-Formula PE-Formula -> PE-Formula [ctor ditto] . op _U_ : PU-Formula PU-Formula -> PU-Formula [ctor ditto] . op _U_ : PureFormula PureFormula -> PureFormula [ctor ditto] . op _U_ : TrueFormula Formula -> PE-Formula [ctor ditto] . op _U_ : TrueFormula PU-Formula -> PureFormula [ctor ditto] . op _R_ : PE-Formula PE-Formula -> PE-Formula [ctor ditto] . op _R_ : PU-Formula PU-Formula -> PU-Formula [ctor ditto] . op _R_ : PureFormula PureFormula -> PureFormula [ctor ditto] . op _R_ : FalseFormula Formula -> PU-Formula [ctor ditto] . op _R_ : FalseFormula PE-Formula -> PureFormula [ctor ditto] . vars p q r s : Formula . var pe : PE-Formula . var pu : PU-Formula . var pr : PureFormula . *** Rules 1, 2 and 3; each with its dual. eq (p U r) /\ (q U r) = (p /\ q) U r . eq (p R r) \/ (q R r) = (p \/ q) R r . eq (p U q) \/ (p U r) = p U (q \/ r) . eq (p R q) /\ (p R r) = p R (q /\ r) . eq True U (p U q) = True U q . eq False R (p R q) = False R q . *** Rules 4 and 5 do most of the work. eq p U pe = pe . eq p R pu = pu . *** An extra rule in the same style. eq O pr = pr . *** We also use the rules from: *** Fabio Somenzi and Roderick Bloem, *** "Efficient Buchi Automata from LTL Formulae", *** p247-263, CAV 2000, LNCS 1633. *** that are not subsumed by the previous system. *** Four pairs of duals. eq O p /\ O q = O (p /\ q) . eq O p \/ O q = O (p \/ q) . eq O p U O q = O (p U q) . eq O p R O q = O (p R q) . eq True U O p = O (True U p) . eq False R O p = O (False R p) . eq (False R (True U p)) \/ (False R (True U q)) = False R (True U (p \/ q)) . eq (True U (False R p)) /\ (True U (False R q)) = True U (False R (p /\ q)) . *** <= relation on formula op _<=_ : Formula Formula -> Bool [prec 75] . eq p <= p = true . eq False <= p = true . eq p <= True = true . ceq p <= (q /\ r) = true if (p <= q) /\ (p <= r) . ceq p <= (q \/ r) = true if p <= q . ceq (p /\ q) <= r = true if p <= r . ceq (p \/ q) <= r = true if (p <= r) /\ (q <= r) . ceq p <= (q U r) = true if p <= r . ceq (p R q) <= r = true if q <= r . ceq (p U q) <= r = true if (p <= r) /\ (q <= r) . ceq p <= (q R r) = true if (p <= q) /\ (p <= r) . ceq (p U q) <= (r U s) = true if (p <= r) /\ (q <= s) . ceq (p R q) <= (r R s) = true if (p <= r) /\ (q <= s) . *** condition rules depending on <= relation ceq p /\ q = p if p <= q . ceq p \/ q = q if p <= q . ceq p /\ q = False if p <= ~ q . ceq p \/ q = True if ~ p <= q . ceq p U q = q if p <= q . ceq p R q = q if q <= p . ceq p U q = True U q if p =/= True /\ ~ q <= p . ceq p R q = False R q if p =/= False /\ q <= ~ p . ceq p U (q U r) = q U r if p <= q . ceq p R (q R r) = q R r if q <= p . endfm fmod SAT-SOLVER is protecting LTL . *** formula lists and results sorts FormulaList SatSolveResult TautCheckResult . subsort Formula < FormulaList . subsort Bool < SatSolveResult TautCheckResult . op nil : -> FormulaList [ctor] . op _;_ : FormulaList FormulaList -> FormulaList [ctor assoc id: nil] . op model : FormulaList FormulaList -> SatSolveResult [ctor] . op satSolve : Formula ~> SatSolveResult [special ( id-hook SatSolverSymbol op-hook trueSymbol (True : ~> Formula) op-hook falseSymbol (False : ~> Formula) op-hook notSymbol (~_ : Formula ~> Formula) op-hook nextSymbol (O_ : Formula ~> Formula) op-hook andSymbol (_/\_ : Formula Formula ~> Formula) op-hook orSymbol (_\/_ : Formula Formula ~> Formula) op-hook untilSymbol (_U_ : Formula Formula ~> Formula) op-hook releaseSymbol (_R_ : Formula Formula ~> Formula) op-hook formulaListSymbol (_;_ : FormulaList FormulaList ~> FormulaList) op-hook nilFormulaListSymbol (nil : ~> FormulaList) op-hook modelSymbol (model : FormulaList FormulaList ~> SatSolveResult) term-hook falseTerm (false) )] . op counterexample : FormulaList FormulaList -> TautCheckResult [ctor] . op tautCheck : Formula ~> TautCheckResult . op $invert : SatSolveResult -> TautCheckResult . var F : Formula . vars L C : FormulaList . eq tautCheck(F) = $invert(satSolve(~ F)) . eq $invert(false) = true . eq $invert(model(L, C)) = counterexample(L, C) . endfm fmod SATISFACTION is protecting BOOL . sorts State Prop . op _|=_ : State Prop -> Bool [frozen] . endfm fmod MODEL-CHECKER is protecting QID . including SATISFACTION . including LTL . subsort Prop < Formula . *** transitions and results sorts RuleName Transition TransitionList ModelCheckResult . subsort Qid < RuleName . subsort Transition < TransitionList . subsort Bool < ModelCheckResult . ops unlabeled deadlock : -> RuleName . op {_,_} : State RuleName -> Transition [ctor] . op nil : -> TransitionList [ctor] . op __ : TransitionList TransitionList -> TransitionList [ctor assoc id: nil] . op counterexample : TransitionList TransitionList -> ModelCheckResult [ctor] . op modelCheck : State Formula ~> ModelCheckResult [special ( id-hook ModelCheckerSymbol op-hook trueSymbol (True : ~> Formula) op-hook falseSymbol (False : ~> Formula) op-hook notSymbol (~_ : Formula ~> Formula) op-hook nextSymbol (O_ : Formula ~> Formula) op-hook andSymbol (_/\_ : Formula Formula ~> Formula) op-hook orSymbol (_\/_ : Formula Formula ~> Formula) op-hook untilSymbol (_U_ : Formula Formula ~> Formula) op-hook releaseSymbol (_R_ : Formula Formula ~> Formula) op-hook satisfiesSymbol (_|=_ : State Formula ~> Bool) op-hook qidSymbol ( : ~> Qid) op-hook unlabeledSymbol (unlabeled : ~> RuleName) op-hook deadlockSymbol (deadlock : ~> RuleName) op-hook transitionSymbol ({_,_} : State RuleName ~> Transition) op-hook transitionListSymbol (__ : TransitionList TransitionList ~> TransitionList) op-hook nilTransitionListSymbol (nil : ~> TransitionList) op-hook counterexampleSymbol (counterexample : TransitionList TransitionList ~> ModelCheckResult) term-hook trueTerm (true) )] . endfm Maude-2.6/src/Main/metaInterpreter.maude0000644000147300135640000000640011433337020015203 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 2009 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Maude meta-interpreters. *** Version 2.5. *** mod META-INTERPRETER is protecting META-LEVEL . including CONFIGURATION . op interpreter : Nat -> Oid . op createInterpreter : Oid Oid -> Msg [ctor msg format (b o)] . op createdInterpreter : Oid Oid Oid -> Msg [ctor msg format (m o)] . op insertModule : Oid Oid Module -> Msg [ctor msg format (b o)] . op insertedModule : Oid Oid -> Msg [ctor msg format (m o)] . op showModule : Oid Oid Qid Bool -> Msg [ctor msg format (b o)] . op showingModule : Oid Oid Module -> Msg [ctor msg format (m o)] . op reduceTerm : Oid Oid Qid Term -> Msg [ctor msg format (b o)] . op reducedTerm : Oid Oid Nat Term Sort -> Msg [ctor msg format (m o)] . op rewriteTerm : Oid Oid Bound Qid Term -> Msg [ctor msg format (b o)] . op rewroteTerm : Oid Oid Nat Term Sort -> Msg [ctor msg format (m o)] . op frewriteTerm : Oid Oid Bound Nat Qid Term -> Msg [ctor msg format (b o)] . op frewroteTerm : Oid Oid Nat Term Sort -> Msg [ctor msg format (m o)] . op quit : Oid Oid -> Msg [ctor msg format (b o)] . op bye : Oid Oid -> Msg [ctor msg format (m o)] . op interpreterManager : -> Oid [special ( id-hook InterpreterManagerSymbol op-hook succSymbol (s_ : Nat ~> NzNat) op-hook interpreterOidSymbol (interpreter : Nat ~> Oid) op-hook createInterpreterMsg (createInterpreter : Oid Oid ~> Msg) op-hook createdInterpreterMsg (createdInterpreter : Oid Oid Oid ~> Msg) op-hook insertModuleMsg (insertModule : Oid Oid Module ~> Msg) op-hook insertedModuleMsg (insertedModule : Oid Oid ~> Msg) op-hook showModuleMsg (showModule : Oid Oid Qid Bool ~> Msg) op-hook showingModuleMsg (showingModule : Oid Oid Module ~> Msg) op-hook reduceTermMsg (reduceTerm : Oid Oid Qid Term ~> Msg) op-hook reducedTermMsg (reducedTerm : Oid Oid Nat Term Sort ~> Msg) op-hook rewriteTermMsg (rewriteTerm : Oid Oid Bound Qid Term ~> Msg) op-hook rewroteTermMsg (rewroteTerm : Oid Oid Nat Term Sort ~> Msg) op-hook frewriteTermMsg (frewriteTerm : Oid Oid Bound Nat Qid Term ~> Msg) op-hook frewroteTermMsg (frewroteTerm : Oid Oid Nat Term Sort ~> Msg) op-hook quitMsg (quit : Oid Oid ~> Msg) op-hook byeMsg (bye : Oid Oid ~> Msg) op-hook shareWith (metaReduce : Module Term ~> ResultPair) )] . endm Maude-2.6/src/Main/ChangeLog0000644000147300135640000001041011417200160012556 000000000000002010-07-13 Steven Eker * metaInterpreter.maude: added insertView/insertedView and showView/showingView ===================================Maude94a=========================================== 2010-05-18 Steven Eker * prelude.maude: split of Boolean operations into BOOL-OPS ===================================Maude93d2=========================================== 2010-05-05 Steven Eker * prelude.maude: added projection functions for meta-views 2009-08-11 Steven Eker * prelude.maude: op mappings don't take AttrSets 2009-08-07 Steven Eker * prelude.maude: added upView() 2009-08-06 Steven Eker * prelude.maude: added fmod META-VIEW 2009-08-05 Steven Eker * metaIntepreter.maude: added showModule/showingModule messages 2008-12-22 Steven Eker * prelude.maude: added TermQid to fix lub problem - Variable and Constant had multiple minimal upper bounds ===================================Maude92=========================================== 2008-08-26 Steven Eker * prelude.maude: added operator for print attribute 2008-01-22 Steven Eker * prelude.maude: added Bool arg to the XG specific version of metaNarrow ===================================Maude90=========================================== 2007-12-04 Steven Eker * prelude.maude: added a failure operator for ResultPair? added 5 arg version of metaNarrow 2007-11-19 Steven Eker * prelude.maude: metaXunify()/metaDisjointXunify() deleted; metaNarrow() added ===================================Maude89h=========================================== 2007-06-27 Steven Eker * prelude.maude: added metaXunify(), metaDisjointXunify() and associated declarations 2007-06-19 Steven Eker * prelude.maude: add UnificationProblem constructors; use for metaUnify() and metaDisjointUnify() 2007-06-14 Steven Eker * prelude.maude: added UnificationPair and ctors; updated decl for metaUnify() 2007-06-07 Steven Eker * prelude.maude: added UnificationTriple and ctors ===================================Maude89c=========================================== 2007-03-14 Steven Eker * main.cc (main): call checkForPending() if the -no-prelude flag given since we won't hit a top level EOF to check for them otherwise; this fixes a bug where we were ignoring command line files if -no-prelude flag given 2007-01-17 Steven Eker * prelude.maude: moved set include BOOL on to after last module; added syntax for metaUnify() ===================================Maude88d=========================================== 2006-11-20 Steven Eker * prelude.maude: rm getHeader() since this doesn't make sense with theories 2006-11-16 Steven Eker * prelude.maude: added getHeader() and redefined getName(); modified other projection functions so that they work with parameterized modules 2006-11-14 Steven Eker * prelude.maude: added min() and max() for Float ===================================Maude88c=========================================== 2006-11-13 Steven Eker * model-checker.maude: change protecting to including for SATISFACTION and LTL in MODEL-CHECKER 2006-11-07 Steven Eker * model-checker.maude: many minor changes recommended by Jose 2006-10-20 Steven Eker * model-checker.maude: changed importation modes 2006-10-19 Steven Eker * socket.maude: minor clean up * machine-int.maude: minor clean up * linear.maude: minor clean up * model-checker.maude: changed some importation modes * prelude.maude: added protecting BOOL to a number of modules; use set include BOOL on/off ===================================Maude88b=========================================== 2006-10-06 Steven Eker * main.cc: moved here and cleaned up ===================================Maude88a=========================================== Maude-2.6/src/Main/term-order.maude0000644000147300135640000000312311433337020014110 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Strict total ordering on terms of a given kind. *** Version 2.3. *** fmod TERM-ORDER{X :: TRIV} is protecting EXT-BOOL . protecting CONVERSION . protecting META-LEVEL . vars E F : [X$Elt] . vars Q P : Qid . vars A B : NeTermList . vars C D : TermList . vars T U : Term . op lt : [X$Elt] [X$Elt] -> Bool . eq lt(E, F) = $lt(upTerm(E), upTerm(F)) . op $lt : TermList TermList -> Bool . eq $lt(Q, P) = string(Q) < string(P) . eq $lt(Q[A], P) = $lt(Q, P) . eq $lt(Q, P[B]) = $lt(Q, P) or-else Q == P . eq $lt(Q[A], P[B]) = if Q == P then $lt(A, B) else $lt(Q, P) fi . eq $lt(empty, B) = true . eq $lt(C, empty) = false . eq $lt((T, C), (U, D)) = if T == U then $lt(C, D) else $lt(T, U) fi . endfm Maude-2.6/src/Main/main.cc0000644000147300135640000001733011350766266012273 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2010 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // main() function and misc functions. // #include "sys/param.h" #ifdef ALPHA #include #endif // utility stuff #include "macros.hh" #include "vector.hh" #include "tty.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "freeTheory.hh" #include "builtIn.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" // core class definitions #include "lineNumber.hh" // built in stuff #include "randomOpSymbol.hh" // system class definitions #include "IO_Manager.hh" // mixfix frontend definitions #include "token.hh" #include "userLevelRewritingContext.hh" #include "fileTable.hh" #include "directoryManager.hh" #include "mixfixModule.hh" #include "interpreter.hh" #include "global.hh" int main(int argc, char* argv[]) { // extern int yydebug; // yydebug = 0; // // Global function declatations // void printBanner(ostream& s); void printHelp(const char* name); void printVersion(); void createRootBuffer(FILE* fp, bool forceInteractive); bool includeFile(const string& directory, const string& fileName, bool silent, int lineNr); extern Vector pendingFiles; const char* isFlag(const char* arg, const char* flag); bool findExecutableDirectory(string& directory, string& executable); bool findPrelude(string& directory, string& fileName); void checkForPending(); bool lineWrapping = true; bool handleCtrlC = true; bool readPrelude = true; bool forceInteractive = false; bool outputBanner = true; int ansiColor = UNDECIDED; int useTecla = UNDECIDED; for (int i = 1; i < argc; i++) { char* arg = argv[i]; if (arg[0] == '-') { if (const char* s = isFlag(arg, "-xml-log=")) interpreter.beginXmlLog(s); else if (const char* s = isFlag(arg, "-random-seed=")) RandomOpSymbol::setGlobalSeed(strtoul(s, 0, 0)); else if (strcmp(arg, "--help") == 0) printHelp(argv[0]); else if (strcmp(arg, "--version") == 0) printVersion(); else if (strcmp(arg, "-no-mixfix") == 0) interpreter.setPrintFlag(Interpreter::PRINT_MIXFIX, false); else if (strcmp(arg, "-ansi-color") == 0) ansiColor = true; else if (strcmp(arg, "-no-ansi-color") == 0) ansiColor = false; else if (strcmp(arg, "-tecla") == 0) useTecla = true; else if (strcmp(arg, "-no-tecla") == 0) useTecla = false; else if (strcmp(arg, "-no-prelude") == 0) readPrelude = false; else if (strcmp(arg, "-no-banner") == 0) outputBanner = false; else if (strcmp(arg, "-no-advise") == 0) globalAdvisoryFlag = false; else if (strcmp(arg, "-no-wrap") == 0) lineWrapping = false; else if (strcmp(arg, "-batch") == 0) handleCtrlC = false; else if (strcmp(arg, "-interactive") == 0) forceInteractive = true; else { IssueWarning(LineNumber(FileTable::COMMAND_LINE) << ": unrecognised flag: " << QUOTE(arg)); } } else pendingFiles.append(arg); } if (lineWrapping) ioManager.setAutoWrap(); if (ansiColor == UNDECIDED) { // // By default we allow ANSI escape codes unless // environment variable TERM is set to dumb; or // our standard output is not a terminal. // ansiColor = true; const char* term = getenv("TERM"); if ((term != 0 && strcmp("dumb", term) == 0) || isatty(STDOUT_FILENO) == 0) ansiColor = false; } Tty::setEscapeSequencesAllowed(ansiColor); if (useTecla == UNDECIDED) { // // By default we use tecla for input unless // environment variable TERM is set to emacs or dumb; // or our standard input is not a terminal. // useTecla = true; const char* term = getenv("TERM"); if ((term != 0 && (strcmp("emacs", term) == 0 || strcmp("dumb", term) == 0)) || isatty(STDIN_FILENO) == 0) useTecla = false; } if (outputBanner) printBanner(cout); createRootBuffer(stdin, forceInteractive); UserLevelRewritingContext::setHandlers(handleCtrlC); if (useTecla) ioManager.setCommandLineEditing(); directoryManager.initialize(); string executable(argv[0]); findExecutableDirectory(executableDirectory, executable); if (readPrelude) { string directory; string fileName(PRELUDE_NAME); if (findPrelude(directory, fileName)) includeFile(directory, fileName, true, FileTable::AUTOMATIC); } else checkForPending(); // because we won't hit an EOF (void) UserLevelRewritingContext::commandLoop(); return 0; } ostream& operator<<(ostream& s, const LineNumber& lineNumber) { fileTable.printLineNumber(s, lineNumber.getLineNumber()); return s; } const char* isFlag(const char* arg, const char* flag) { char f; do { f = *flag++; if (f == 0) return arg; } while (f == *arg++); return 0; } void printHelp(const char* name) { cout << "Maude interpreter\n" << "Usage: " << name << " [options] [files]\n" << "Options:\n" << " --help\t\tDisplay this information\n" << " --version\t\tDisplay version number\n" << " -no-prelude\t\tDo not read in the standard prelude\n" << " -no-banner\t\tDo not output banner on startup\n" << " -no-advise\t\tNo advisories on startup\n" << " -no-mixfix\t\tDo not use mixfix notation for output\n" << " -no-wrap\t\tDo not automatic line wrapping for output\n" << " -ansi-color\t\tUse ANSI control sequences\n" << " -no-ansi-color\tDo not use ANSI control sequences\n" << " -tecla\t\tUse tecla command line editing\n" << " -no-tecla\t\tDo not use tecla command line editing\n" << " -batch\t\tRun in batch mode\n" << " -interactive\t\tRun in interactive mode\n" << " -random-seed=\tSet seed for random number generator\n" << " -xml-log=\tSet file in which to produce an xml log\n" << "\n" << "Send bug reports to: " << PACKAGE_BUGREPORT << endl; exit(0); } void printVersion() { cout << PACKAGE_VERSION << endl; exit(0); } bool findExecutableDirectory(string& directory, string& executable) { string::size_type p = executable.rfind('/'); if (p == string::npos) return directoryManager.searchPath("PATH", directory, executable, X_OK); else { directoryManager.realPath(executable.substr(0, p), directory); return directoryManager.checkAccess(directory, executable, X_OK); } } bool findPrelude(string& directory, string& fileName) { if (directoryManager.searchPath(MAUDE_LIB, directory, fileName, R_OK)) return true; if (!(executableDirectory.empty()) && directoryManager.checkAccess(executableDirectory, fileName, R_OK)) { directory = executableDirectory; return true; } if (directoryManager.checkAccess(".", fileName, R_OK)) { directory = "."; return true; } IssueWarning(LineNumber(FileTable::AUTOMATIC) << ": unable to locate file: " << QUOTE(fileName)); return false; } Maude-2.6/src/Main/socket.maude0000644000147300135640000000543211433337020013325 00000000000000***( This file is part of the Maude 2 interpreter. Copyright 2004-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ) *** *** Maude internet socket external objects. *** Version 2.3. *** mod SOCKET is protecting STRING . including CONFIGURATION . op socket : Nat -> Oid [ctor] . op createClientTcpSocket : Oid Oid String Nat -> Msg [ctor msg format (b o)] . op createServerTcpSocket : Oid Oid Nat Nat -> Msg [ctor msg format (b o)] . op createdSocket : Oid Oid Oid -> Msg [ctor msg format (m o)] . op acceptClient : Oid Oid -> Msg [ctor msg format (b o)] . op acceptedClient : Oid Oid String Oid -> Msg [ctor msg format (m o)] . op send : Oid Oid String -> Msg [ctor msg format (b o)] . op sent : Oid Oid -> Msg [ctor msg format (m o)] . op receive : Oid Oid -> Msg [ctor msg format (b o)] . op received : Oid Oid String -> Msg [ctor msg format (m o)] . op closeSocket : Oid Oid -> Msg [ctor msg format (b o)] . op closedSocket : Oid Oid String -> Msg [ctor msg format (m o)] . op socketError : Oid Oid String -> Msg [ctor msg format (r o)] . op socketManager : -> Oid [special ( id-hook SocketManagerSymbol op-hook succSymbol (s_ : Nat ~> NzNat) op-hook stringSymbol ( : ~> String) op-hook socketOidSymbol (socket : Nat ~> Oid) op-hook createClientTcpSocketMsg (createClientTcpSocket : Oid Oid String Nat ~> Msg) op-hook createServerTcpSocketMsg (createServerTcpSocket : Oid Oid Nat Nat ~> Msg) op-hook createdSocketMsg (createdSocket : Oid Oid Oid ~> Msg) op-hook acceptClientMsg (acceptClient : Oid Oid ~> Msg) op-hook acceptedClientMsg (acceptedClient : Oid Oid String Oid ~> Msg) op-hook sendMsg (send : Oid Oid String ~> Msg) op-hook sentMsg (sent : Oid Oid ~> Msg) op-hook receiveMsg (receive : Oid Oid ~> Msg) op-hook receivedMsg (received : Oid Oid String ~> Msg) op-hook closeSocketMsg (closeSocket : Oid Oid ~> Msg) op-hook closedSocketMsg (closedSocket : Oid Oid String ~> Msg) op-hook socketErrorMsg (socketError : Oid Oid String ~> Msg))] . endm Maude-2.6/src/Main/Makefile.am0000644000147300135640000000407411244660331013061 00000000000000bin_PROGRAMS = maude if BUILD_COMPILER FULL_COMPILER_LIB = ../FullCompiler/libfullCompiler.a endif if USE_DLMALLOC DLMALLOC_LIB = ../3rdParty/libdlmalloc.a endif maude_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Temporal \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/Higher \ -I$(top_srcdir)/src/CUI_Theory \ -I$(top_srcdir)/src/S_Theory \ -I$(top_srcdir)/src/NA_Theory \ -I$(top_srcdir)/src/FreeTheory \ -I$(top_srcdir)/src/ObjectSystem \ -I$(top_srcdir)/src/Mixfix \ -I$(top_srcdir)/src/BuiltIn \ -I$(top_srcdir)/src/MSCP10 \ -I$(top_srcdir)/src/IO_Stuff \ -I$(top_srcdir)/src/ACU_Persistent \ -I$(top_srcdir)/src/ACU_Theory \ -I$(top_srcdir)/src/AU_Persistent \ -I$(top_srcdir)/src/AU_Theory \ -I$(top_srcdir)/src/Meta \ -I$(top_srcdir)/src/3rdParty \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/StrategyLanguage \ -I$(top_srcdir)/src/Mixfix maude_LDADD = \ ../Mixfix/libmixfix.a \ ../StrategyLanguage/libstrategyLanguage.a \ ../Meta/libmeta.a \ ../ObjectSystem/libobjectSystem.a \ ../BuiltIn/libbuiltIn.a \ ../Higher/libhigher.a \ ../FreeTheory/libfreeTheory.a \ ../AU_Theory/libAU_Theory.a \ ../AU_Persistent/libAU_Persistent.a \ ../ACU_Theory/libACU_Theory.a \ ../ACU_Persistent/libACU_Persistent.a \ ../CUI_Theory/libCUI_Theory.a \ ../S_Theory/libS_Theory.a \ ../NA_Theory/libNA_Theory.a \ ../Variable/libvariable.a \ ../Interface/libinterface.a \ ../Core/libcore.a \ ../MSCP10/libmscp10.a \ ../Temporal/libtemporal.a \ ../IO_Stuff/libIO_Stuff.a \ $(FULL_COMPILER_LIB) \ ../Utility/libutility.a \ $(BUDDY_LIB) \ $(TECLA_LIBS) \ $(LIBSIGSEGV_LIB) \ $(GMP_LIBS) \ $(DLMALLOC_LIB) maude_SOURCES = \ main.cc data_DATA = \ prelude.maude \ model-checker.maude \ socket.maude \ linear.maude \ machine-int.maude \ term-order.maude \ metaInterpreter.maude EXTRA_DIST = \ prelude.maude \ model-checker.maude \ socket.maude \ linear.maude \ machine-int.maude \ term-order.maude \ metaInterpreter.maude Maude-2.6/src/ACU_Persistent/0000777000147300135640000000000011500304120013032 500000000000000Maude-2.6/src/ACU_Persistent/ACU_Stack.hh0000644000147300135640000000517511363154107015053 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for stack of pointers to red-black nodes. // #ifndef _ACU_Stack_hh_ #define _ACU_Stack_hh_ #include "ACU_RedBlackNode.hh" class ACU_Stack { NO_COPYING(ACU_Stack); public: ACU_Stack(); bool empty() const; ACU_RedBlackNode* top() const; void clear(); void push(ACU_RedBlackNode* node); ACU_RedBlackNode* pop(); void unpop(); // only valid if no clear() or push() since last pop() void multiPop(int nr); void stackLeftmostPath(ACU_RedBlackNode* n); void save(); void restore(); private: enum Sizes { STACK_SIZE = ACU_RedBlackNode::MAX_TREE_HEIGHT }; ACU_RedBlackNode** ptr; ACU_RedBlackNode** old; ACU_RedBlackNode* base[STACK_SIZE]; }; inline ACU_Stack::ACU_Stack() { ptr = base; } inline bool ACU_Stack::empty() const { return ptr == base; } inline ACU_RedBlackNode* ACU_Stack::top() const { Assert(ptr > base, "ACU_Stack::top() : stack underflow"); return *(ptr - 1); } inline void ACU_Stack::clear() { ptr = base; } inline void ACU_Stack::push(ACU_RedBlackNode* node) { Assert(ptr < base + STACK_SIZE, "ACU_Stack::push() : stack overflow"); *ptr++ = node; } inline ACU_RedBlackNode* ACU_Stack::pop() { Assert(ptr > base, "ACU_Stack::pop() : stack underflow"); return *(--ptr); } inline void ACU_Stack::unpop() { Assert(ptr < base + STACK_SIZE, "ACU_Stack::unpop() : stack overflow"); ++ptr; } inline void ACU_Stack::multiPop(int nr) { Assert(ptr - nr >= base, "ACU_Stack::multiPop() : stack underflow"); ptr -= nr; } inline void ACU_Stack::stackLeftmostPath(ACU_RedBlackNode* n) { Assert(n != 0, "ACU_Stack::stackLeftmostPath() : null pointer"); do { push(n); n = n->getLeft(); } while (n != 0); } inline void ACU_Stack::save() { old = ptr; } inline void ACU_Stack::restore() { ptr = old; } #endif Maude-2.6/src/ACU_Persistent/ACU_FastIter.hh0000644000147300135640000000346011363166602015525 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for fast iterators for ACU red-black trees. // // They are fast in the sense that we do the explicit // stack version of tail recursion elimination and therefore // may not have a full path on the stack. // #ifndef _ACU_FastIter_hh_ #define _ACU_FastIter_hh_ #include "ACU_Stack.hh" #include "ACU_Tree.hh" class ACU_FastIter : private ACU_Stack { NO_COPYING(ACU_FastIter); public: ACU_FastIter(const ACU_Tree& tree); bool valid() const; DagNode* getDagNode() const; int getMultiplicity() const; void next(); }; inline ACU_FastIter::ACU_FastIter(const ACU_Tree& tree) { stackLeftmostPath(tree.root); } inline bool ACU_FastIter::valid() const { return !empty(); } inline DagNode* ACU_FastIter::getDagNode() const { return top()->getDagNode(); } inline int ACU_FastIter::getMultiplicity() const { return top()->getMultiplicity(); } inline void ACU_FastIter::next() { if (ACU_RedBlackNode* r = pop()->getRight()) stackLeftmostPath(r); } #endif Maude-2.6/src/ACU_Persistent/ACU_Find.cc0000644000147300135640000000541507666303440014660 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Find functions for ACU red-black tree argument lists. // bool ACU_RedBlackNode::find(ACU_RedBlackNode* root, DagNode* dagNode, ACU_Stack& path) { do { path.push(root); int r = dagNode->compare(root->getDagNode()); if (r == 0) return true; root = root->getChild(r); } while (root != 0); return false; } bool ACU_RedBlackNode::find(ACU_RedBlackNode* root, Term* term, ACU_Stack& path) { do { path.push(root); int r = term->compare(root->getDagNode()); if (r == 0) return true; root = root->getChild(r); } while (root != 0); return false; } bool ACU_RedBlackNode::findFirstPotentialMatch(ACU_RedBlackNode* root, Term* key, const Substitution& partial, ACU_Stack& path) { int explore = 0; do { path.push(root); ++explore; int r = key->partialCompare(partial, root->getDagNode()); switch (r) { case Term::GREATER: { root = root->getRight(); break; } case Term::EQUAL: { return true; } case Term::LESS: { root = root->getLeft(); break; } case Term::UNKNOWN: { explore = 0; // so we can retreat to this node root = root->getLeft(); break; } } } while (root != 0); path.multiPop(explore); // retreat the last place we zero'd explore return !path.empty(); } bool ACU_RedBlackNode::findGeqMult(ACU_RedBlackNode* root, int multiplicity, ACU_Stack& path) { if (root->getMaxMult() >= multiplicity) { for(;;) { path.push(root); ACU_RedBlackNode* l = root->getLeft(); if (l != 0 && l->getMaxMult() >= multiplicity) root = l; else if (root->getMultiplicity() >= multiplicity) break; else { root = root->getRight(); Assert(root != 0 && root->getMaxMult() >= multiplicity, "maxMult invariant failed"); } } return true; } return false; } Maude-2.6/src/ACU_Persistent/ACU_Rebalance.cc0000644000147300135640000001332407666303440015652 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Copy spine of a red-black tree, rebalancing. // // We use the rebalancing method given in chapter 14 of // Thomas H. Cormen, Charles E. Leierson and Ronald L. Rivest, // "Introduction to Algorithms", // MIT Press and McGraw-Hill, 1990. // // We need to handle 2 * 2 * 3 = 12 distinct cases. // ACU_RedBlackNode* ACU_RedBlackNode::copyRebalance(ACU_Stack& path, ACU_RedBlackNode* a, ACU_RedBlackNode* old, ACU_RedBlackNode* victim, ACU_RedBlackNode* surrogate) { // // Swap surrogate for victim and increase black length by 1. // a is a new black node or possibly null. // old is the node is it is replacing in the rebuilt tree. // ACU_RedBlackNode* b; for(;;) { b = path.pop(); // old's parent ACU_RedBlackNode* b2 = (b == victim) ? surrogate : b; if (b->getLeft() == old) { // // a will replace b->getLeft() in the rebuilt tree. Thus every // path from b->getRight() must contain at least 1 black node. // Therefore d = b->getRight() exists. // ACU_RedBlackNode* d = b->getRight(); // old a's sibling ACU_RedBlackNode* c = d->getLeft(); // might be null ACU_RedBlackNode* e = d->getRight(); // might be null if (d->isRed()) { // // CLR case 1; we consider 3 subcases. // // Since d is red, every path from d must contain // at least 1 black node; so c = d->getLeft() // and e = d->getRight() exist. // ACU_RedBlackNode* p = c->getLeft(); // might be null ACU_RedBlackNode* q = c->getRight(); // might be null ACU_RedBlackNode* t; if (isRed(q)) { // // Transformation 1 followed by transformation 4. // t = redNode(c, blackNode(b2, a, p), blackNode(q, q->getLeft(), q->getRight())); } else if (isRed(p)) { // // Transformation 1 followed by transformation 3 // followed by transformation 4. // t = redNode(p, blackNode(b2, a, p->getLeft()), blackNode(c, p->getRight(), q)); } else { // // Transformation 1 followed by transformation 2. // t = blackNode(b2, a, redNode(c, p, q)); } a = blackNode(d, t, e); break; } else // d is black { if (isRed(e)) { // // CLR case 4. // a = blackNode(d, blackNode(b2, a, c), blackNode(e, e->getLeft(), e->getRight())); } else if (isRed(c)) { // // CLR case 3; we do a combined 3 then 4 transformation. // a = blackNode(c, blackNode(b2, a, c->getLeft()), blackNode(d, c->getRight(), e)); } else { // // CLR case 2. // a = blackNode(b2, a, redNode(d, c, e)); goto up; } a->makeRedIfRed(b); break; } } else { // // Reflection of previous branch. // // // a will replace b->getRight() in the rebuilt tree. Thus every // path from b->getLeft() must contain at least 1 black node. // Therefore d = b->getLeft() exists. // ACU_RedBlackNode* d = b->getLeft(); // old a's sibling ACU_RedBlackNode* c = d->getRight(); // might be null ACU_RedBlackNode* e = d->getLeft(); // might be null if (d->isRed()) { // // CLR case 1; we consider 3 subcases. // // Since d is red, every path from d must contain // at least 1 black node; so c = d->getRight() // and e = d->getLeft() exist. // ACU_RedBlackNode* p = c->getRight(); // might be null ACU_RedBlackNode* q = c->getLeft(); // might be null ACU_RedBlackNode* t; if (isRed(q)) { // // Transformation 1 followed by transformation 4. // t = redNode(c, blackNode(q, q->getLeft(), q->getRight()), blackNode(b2, p, a)); } else if (isRed(p)) { // // Transformation 1 followed by transformation 3 // followed by transformation 4. // t = redNode(p, blackNode(c, q, p->getLeft()), blackNode(b2, p->getRight(), a)); } else { // // Transformation 1 followed by transformation 2. // t = blackNode(b2, redNode(c, q, p), a); } a = blackNode(d, e, t); break; } else // d is black { if (isRed(e)) { // // CLR case 4. // a = blackNode(d, blackNode(e, e->getLeft(), e->getRight()), blackNode(b2, c, a)); } else if (isRed(c)) { // // CLR case 3; we do a combined 3 then 4 transformation. // a = blackNode(c, blackNode(d, e, c->getLeft()), blackNode(b2, c->getRight(), a)); } else { // // CLR case 2. // a = blackNode(b2, redNode(d, e, c), a); goto up; } a->makeRedIfRed(b); break; } } up: if (path.empty()) return a; if (b->isRed()) return copy(path, a, b, victim, surrogate); old = b; } if (path.empty()) return a; return copy(path, a, b, victim, surrogate); } Maude-2.6/src/ACU_Persistent/ACU_Copy.cc0000644000147300135640000000675107666303440014716 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Functions for rebuilding a the spine of a red-black tree. // ACU_RedBlackNode* ACU_RedBlackNode::copy(ACU_Stack& path, ACU_RedBlackNode* n, ACU_RedBlackNode* old) { int maxMult = 0; if (n != 0) maxMult = n->getMaxMult(); // // Rebuild spine. // while (!(path.empty())) { ACU_RedBlackNode* parent = path.pop(); ACU_RedBlackNode* l = parent->getLeft(); if (parent->getMaxMult() > maxMult) { // // Slow case; need to recalculate maxMult. // int t = parent->getMultiplicity(); if (t > maxMult) maxMult = t; if (l == old) { l = n; n = parent->getRight(); if (n != 0) { t = n->getMaxMult(); if (t > maxMult) maxMult = t; } } else { if (l != 0) { t = l->getMaxMult(); if (t > maxMult) maxMult = t; } } } else { // // Fast case. // if (l == old) { l = n; n = parent->getRight(); } } n = new ACU_RedBlackNode(parent->getDagNode(), parent->getMultiplicity(), l, n, maxMult); n->makeRedIfRed(parent); old = parent; } return n; } ACU_RedBlackNode* ACU_RedBlackNode::copy(ACU_Stack& path, ACU_RedBlackNode* n, ACU_RedBlackNode* old, ACU_RedBlackNode* victim, ACU_RedBlackNode* surrogate) { int maxMult = 0; if (n != 0) maxMult = n->getMaxMult(); // // Rebuild spine replacing victim data with surrogate data. // while (!(path.empty())) { ACU_RedBlackNode* parent = path.pop(); ACU_RedBlackNode* l = parent->getLeft(); ACU_RedBlackNode* source = parent; if (source == victim) { source = surrogate; // // surrogate is a descendant of parent. // Thus parent->getMaxMult() will be at least as // large as surrogate->getMultiplicity(). // } if (parent->getMaxMult() > maxMult) { // // Slow case; need to recalculate maxMult. // int t = source->getMultiplicity(); if (t > maxMult) maxMult = t; if (l == old) { l = n; n = parent->getRight(); if (n != 0) { t = n->getMaxMult(); if (t > maxMult) maxMult = t; } } else { if (l != 0) { t = l->getMaxMult(); if (t > maxMult) maxMult = t; } } } else { // // Fast case. // if (l == old) { l = n; n = parent->getRight(); } } n = new ACU_RedBlackNode(source->getDagNode(), source->getMultiplicity(), l, n, maxMult); n->makeRedIfRed(parent); old = parent; } return n; } Maude-2.6/src/ACU_Persistent/Makefile.in0000644000147300135640000004250311500303153015024 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/ACU_Persistent DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libACU_Persistent_a_AR = $(AR) $(ARFLAGS) libACU_Persistent_a_LIBADD = am_libACU_Persistent_a_OBJECTS = \ libACU_Persistent_a-ACU_RedBlackNode.$(OBJEXT) \ libACU_Persistent_a-ACU_Tree.$(OBJEXT) libACU_Persistent_a_OBJECTS = $(am_libACU_Persistent_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libACU_Persistent_a_SOURCES) DIST_SOURCES = $(libACU_Persistent_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libACU_Persistent.a libACU_Persistent_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libACU_Persistent_a_SOURCES = \ ACU_RedBlackNode.cc \ ACU_Tree.cc EXTRA_DIST = \ ACU_Find.cc \ ACU_Insert.cc \ ACU_Copy.cc \ ACU_Delete.cc \ ACU_Rebalance.cc noinst_HEADERS = \ ACU_FastIter.hh \ ACU_Persistent.hh \ ACU_RedBlackNode.hh \ ACU_Stack.hh \ ACU_Pair.hh \ ACU_RedBlack.hh \ ACU_SlowIter.hh \ ACU_Tree.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/ACU_Persistent/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/ACU_Persistent/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libACU_Persistent.a: $(libACU_Persistent_a_OBJECTS) $(libACU_Persistent_a_DEPENDENCIES) -rm -f libACU_Persistent.a $(libACU_Persistent_a_AR) libACU_Persistent.a $(libACU_Persistent_a_OBJECTS) $(libACU_Persistent_a_LIBADD) $(RANLIB) libACU_Persistent.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libACU_Persistent_a-ACU_RedBlackNode.o: ACU_RedBlackNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libACU_Persistent_a-ACU_RedBlackNode.o -MD -MP -MF "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Tpo" -c -o libACU_Persistent_a-ACU_RedBlackNode.o `test -f 'ACU_RedBlackNode.cc' || echo '$(srcdir)/'`ACU_RedBlackNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Tpo" "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Po"; else rm -f "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ACU_RedBlackNode.cc' object='libACU_Persistent_a-ACU_RedBlackNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libACU_Persistent_a-ACU_RedBlackNode.o `test -f 'ACU_RedBlackNode.cc' || echo '$(srcdir)/'`ACU_RedBlackNode.cc libACU_Persistent_a-ACU_RedBlackNode.obj: ACU_RedBlackNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libACU_Persistent_a-ACU_RedBlackNode.obj -MD -MP -MF "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Tpo" -c -o libACU_Persistent_a-ACU_RedBlackNode.obj `if test -f 'ACU_RedBlackNode.cc'; then $(CYGPATH_W) 'ACU_RedBlackNode.cc'; else $(CYGPATH_W) '$(srcdir)/ACU_RedBlackNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Tpo" "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Po"; else rm -f "$(DEPDIR)/libACU_Persistent_a-ACU_RedBlackNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ACU_RedBlackNode.cc' object='libACU_Persistent_a-ACU_RedBlackNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libACU_Persistent_a-ACU_RedBlackNode.obj `if test -f 'ACU_RedBlackNode.cc'; then $(CYGPATH_W) 'ACU_RedBlackNode.cc'; else $(CYGPATH_W) '$(srcdir)/ACU_RedBlackNode.cc'; fi` libACU_Persistent_a-ACU_Tree.o: ACU_Tree.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libACU_Persistent_a-ACU_Tree.o -MD -MP -MF "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Tpo" -c -o libACU_Persistent_a-ACU_Tree.o `test -f 'ACU_Tree.cc' || echo '$(srcdir)/'`ACU_Tree.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Tpo" "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Po"; else rm -f "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ACU_Tree.cc' object='libACU_Persistent_a-ACU_Tree.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libACU_Persistent_a-ACU_Tree.o `test -f 'ACU_Tree.cc' || echo '$(srcdir)/'`ACU_Tree.cc libACU_Persistent_a-ACU_Tree.obj: ACU_Tree.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libACU_Persistent_a-ACU_Tree.obj -MD -MP -MF "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Tpo" -c -o libACU_Persistent_a-ACU_Tree.obj `if test -f 'ACU_Tree.cc'; then $(CYGPATH_W) 'ACU_Tree.cc'; else $(CYGPATH_W) '$(srcdir)/ACU_Tree.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Tpo" "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Po"; else rm -f "$(DEPDIR)/libACU_Persistent_a-ACU_Tree.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ACU_Tree.cc' object='libACU_Persistent_a-ACU_Tree.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libACU_Persistent_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libACU_Persistent_a-ACU_Tree.obj `if test -f 'ACU_Tree.cc'; then $(CYGPATH_W) 'ACU_Tree.cc'; else $(CYGPATH_W) '$(srcdir)/ACU_Tree.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/ACU_Persistent/ACU_RedBlack.hh0000644000147300135640000000211407666303440015452 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for red-black representation of // ACU arguments lists. // #ifndef _ACU_RedBlack_hh_ #define _ACU_RedBlack_hh_ class ACU_RedBlackNode; class ACU_Stack; class ACU_FastIter; class ACU_SlowIter; class ACU_Tree; #endif Maude-2.6/src/ACU_Persistent/ACU_SlowIter.hh0000644000147300135640000000360211363153311015543 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for slow iterators for ACU red-black trees. // // They are slow in the sense that we always keep the full // path on the stack. // #ifndef _ACU_SlowIter_hh_ #define _ACU_SlowIter_hh_ #include "ACU_Stack.hh" #include "ACU_Tree.hh" class ACU_SlowIter : public ACU_Stack { NO_COPYING(ACU_SlowIter); public: ACU_SlowIter(); ACU_SlowIter(const ACU_Tree& tree); bool valid() const; DagNode* getDagNode() const; int getMultiplicity() const; void next(); }; inline ACU_SlowIter::ACU_SlowIter() { } inline ACU_SlowIter::ACU_SlowIter(const ACU_Tree& tree) { stackLeftmostPath(tree.root); } inline bool ACU_SlowIter::valid() const { return !empty(); } inline DagNode* ACU_SlowIter::getDagNode() const { return top()->getDagNode(); } inline int ACU_SlowIter::getMultiplicity() const { return top()->getMultiplicity(); } inline void ACU_SlowIter::next() { ACU_RedBlackNode* t = top()->getRight(); if (t != 0) stackLeftmostPath(t); else { do t = pop(); while (!empty() && top()->getRight() == t); } } #endif Maude-2.6/src/ACU_Persistent/ACU_Persistent.hh0000644000147300135640000000213407666303440016145 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for red-black representation of // ACU arguments lists. // #ifndef _ACU_RedBlack_hh_ #define _ACU_RedBlack_hh_ class ACU_RedBlackNode; class ACU_Stack; class ACU_FastIter; class ACU_SlowIter; class ACU_Pair; class ACU_Tree; #endif Maude-2.6/src/ACU_Persistent/ACU_RedBlackNode.cc0000644000147300135640000001040511307607077016250 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ACU_RedBlackNode. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "ACU_RedBlack.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "hashConsSet.hh" // ACU red-black class definitions #include "ACU_RedBlackNode.hh" #include "ACU_Stack.hh" // our parts #include "ACU_Insert.cc" #include "ACU_Delete.cc" #include "ACU_Rebalance.cc" #include "ACU_Copy.cc" #include "ACU_Find.cc" ACU_RedBlackNode* ACU_RedBlackNode::blackNode(ACU_RedBlackNode* key, ACU_RedBlackNode* left, ACU_RedBlackNode* right) { return new ACU_RedBlackNode(key->getDagNode(), key->getMultiplicity(), left, right); } // // Experimental hash consing code // ACU_RedBlackNode* ACU_RedBlackNode::canonicalRebuild(HashConsSet* hcs) { // // Horribly inefficient - recode it after we determine it is worthwhile. // bool needRebuild = false; ACU_RedBlackNode* left = getLeft(); if (left) { ACU_RedBlackNode* canonicalLeft = left->canonicalRebuild(hcs); if (left != canonicalLeft) { left = canonicalLeft; needRebuild = true; } } ACU_RedBlackNode* right = getRight(); if (right) { ACU_RedBlackNode* canonicalRight = right->canonicalRebuild(hcs); if (right != canonicalRight) { right = canonicalRight; needRebuild = true; } } DagNode* d = getDagNode(); DagNode* c = hcs->getCanonical(hcs->insert(d)); if (needRebuild || c != d) { ACU_RedBlackNode* n = new ACU_RedBlackNode(c, getMultiplicity(), left, right, getMaxMult()); n->makeRedIfRed(this); n->setSortIndex(getSortIndex()); return n; } return this; } #ifdef CHECK_TREE bool ACU_RedBlackNode::checkRedBlackProperty() { int height; if (!checkRedBlackProperty(height) || isRed()) { cerr << "Red-Black Violation\n"; dump(cerr, 0); return false; } return true; } bool ACU_RedBlackNode::checkRedBlackProperty(int& height) { bool ok = true; height = 0; if (ACU_RedBlackNode* l = getLeft()) { ok = l->checkRedBlackProperty(height); if (getDagNode()->compare(l->getDagNode()) <= 0) { cerr << "order violation " << getDagNode() << " <= " << l->getDagNode() << endl; ok = false; } } int rHeight = 0; if (ACU_RedBlackNode* r = getRight()) { ok = r->checkRedBlackProperty(rHeight) && ok; if (getDagNode()->compare(r->getDagNode()) >= 0) { cerr << "order violation " << getDagNode() << " >= " << r->getDagNode() << endl; ok = false; } } if (height != rHeight) { cerr << "black height violation " << height << " != " << rHeight << endl; ok = false; } if (!isRed()) ++height; return ok; } #endif void ACU_RedBlackNode::dump(ostream& s, int indent) { s << Indent(indent) << "address = " << this << "\tdagNode = " << getDagNode() << "\tmultiplicity = " << getMultiplicity() << "\tcolor = " << (isRed() ? "red" : "black") << endl; s << Indent(indent) << "left = "; if (ACU_RedBlackNode* l = getLeft()) { s << '\n'; l->dump(s, indent + 1); } else s << "null\n"; s << Indent(indent) << "right = "; if (ACU_RedBlackNode* r = getRight()) { s << '\n'; r->dump(s, indent + 1); } else s << "null\n"; } Maude-2.6/src/ACU_Persistent/ChangeLog0000644000147300135640000003600511363166645014555 000000000000002010-04-19 Steven Eker * ACU_FastIter.hh (ACU_FastIter::next): avoid passing null to stackLeftmostPath() * ACU_Delete.cc (ACU_RedBlackNode::consDelete): use stackLeftmostPath() * ACU_Stack.hh (ACU_Stack::stackLeftmostPath): converted loop from while-do to do-while * ACU_SlowIter.hh (ACU_SlowIter::next): deleted commented out version ===================================Maude93a=========================================== 2010-02-18 Steven Eker * ACU_RedBlackNode.hh (ACU_RedBlackNode::getChild): use sign < 0 rather than getSignBit() in the hope that the compiler can be smart about optimizing the right shift ===================================Maude92c=========================================== 2009-12-09 Steven Eker * ACU_Tree.cc (makeCanonical): added * ACU_Tree.hh (class ACU_Tree): added decl for makeCanonical() 2009-12-08 Steven Eker * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decl for canonicalRebuild() * ACU_RedBlackNode.cc (canonicalRebuild): added * ACU_RedBlackNode.hh (ACU_RedBlackNode): removed what appears to be an unneeded getMemoryCell()->setByte() ===================================Maude92b=========================================== 2003-05-29 Steven Eker * ACU_Tree.hh (deleteMult2): added 2003-05-12 Steven Eker * ACU_RedBlackNode.hh (class ACU_RedBlackNode): deleted SAT_MULT from enum PublicValues 2003-05-06 Steven Eker * ACU_Tree.hh (class ACU_Tree): added decl for computeBaseSort2() * ACU_Tree.cc (recComputeBaseSort): deleted * ACU_Tree.hh (computeBaseSort): moved here and rewritten * ACU_Tree.cc (computeBaseSort2): added (recComputeBaseSort): deleted * ACU_Find.cc (findFirstPotentialMatch): use Term::UNKNOWN 2003-05-05 Steven Eker * ACU_Rebalance.cc (copyRebalance): use makeRedIfRed() (2 places) * ACU_Insert.cc (consInsert): use makeRedIfRed() * ACU_Delete.cc (consDelete): use makeRedIfRed() * ACU_Copy.cc (copy): use makeRedIfRed() (both versions) * ACU_RedBlackNode.hh (makeRedIfRed): added * ACU_Find.cc (findGeqMult): removed SAT_MULT Assert() * ACU_Insert.cc (consInsert): don't pass size to ACU_RedBlackNode() (consInsert): use getChild() (consInsert): removed SAT_MULT check * ACU_Copy.cc (copy): don't pass size to ACU_RedBlackNode() (both versions) (copy): simplified maxMult computation (both versions) * ACU_Stack.hh (class ACU_Stack): deleted decl for pathToIndex() * ACU_Stack.cc (pathToIndex): deleted * ACU_Find.cc (findIth): deleted * ACU_RedBlackNode.hh (getSize): deleted (class ACU_RedBlackNode): store maxMult as an int data member; deleted data member size (getMaxMult): use maxMult data member (ACU_RedBlackNode): don't set size; optimize maxMult calculation (class ACU_RedBlackNode): deleted decl for findIth() * ACU_Tree.hh (getSoleDagNode): added (class ACU_Tree): aded default ctor (clear): added (getSoleMultiplicity): added * ACU_Persistent.hh: renamed from ACU_RedBlack.hh; added class ACU_Tree, class ACU_Pair * ACU_SlowIter.hh (ACU_SlowIter): rewritten * ACU_FastIter.hh (ACU_FastIter): rewritten * ACU_Tree.hh (class ACU_Tree): added decl for recComputeBaseSort() (class ACU_Tree): updated decl for computeBaseSort() * ACU_Tree.cc (computeBaseSort): added (recComputeBaseSort): added * ACU_Tree.hh (class ACU_Tree): added decls for pow2min1() and makeTree() * ACU_Tree.cc (pow2min1): added (makeTree): added 2003-05-03 Steven Eker * ACU_Tree.cc: created * ACU_Stack.hh (class ACU_Stack): ACU_RedBlackNode no longer a friend in CHECK_RED_BLACK case * ACU_Delete.cc (consDelete): handle delta argument * ACU_Tree.hh (insertMult): rewritten (deleteMult): rewritten * ACU_RedBlackNode.hh (class ACU_RedBlackNode): updated decls for consInsert() and consDelete() * ACU_Insert.cc (consInsert): handle delta argument * ACU_Stack.hh (save): added (restore): added (class ACU_Stack): added data member old 2003-04-29 Steven Eker * ACU_Tree.hh: created * ACU_Pair.hh: created ===================================Maude80=========================================== 2003-03-21 Steven Eker * ACU_Find.cc (find): use getChild() (both versions) * ACU_RedBlackNode.hh (getChild): added (class ACU_RedBlackNode): flipped LEFT_INDEX and RIGHT_INDEX values 2003-03-10 Steven Eker * ACU_RedBlackNode.hh (class ACU_RedBlackNode): made getMaxMult() public 2003-02-25 Steven Eker * ACU_Insert.cc (consInsert2): updated Assert() * ACU_Find.cc (findGeqMult): updated Assert()s (findIth): updated Assert() * ACU_Delete.cc (consDelete2): updated Assert() * ACU_Stack.hh (top): updated Assert() (push): updated Assert() (pop): updated Assert() (unpop): updated Assert() (multiPop): updated Assert() * ACU_RedBlackNode.hh (new): updated Assert() (ACU_RedBlackNode): updated Assert()s ===================================Maude79=========================================== 2003-02-13 Steven Eker * ACU_RedBlackNode.hh (class ACU_RedBlackNode): deleted decls for fastFindGeqMult(), searchGeqMult(), maxMultOK(), stackLeftmostMultPath(), nextMult(), maxMultValid(), setMaxMult() (class ACU_RedBlackNode): made slow ctor public (ACU_RedBlackNode): fixed bug where we weren't setting maxMult * ACU_Find.cc: rewritten to take advantantage of new maxMult assumptions (maxMultOK): deleted (stackLeftmostMultPath): deleted (nextMult): deleted (fastFindGeqMult): deleted (searchGeqMult): deleted * ACU_Insert.cc (consInsert): handle maxMult * ACU_Delete.cc (consDelete): don't use optimized ACU_RedBlackNode() since we have no fast way of obtaining maxMult * ACU_RedBlackNode.hh (class ACU_RedBlackNode): deleted MAX_MULT_VALID (setMaxMult): deleted (maxMultValid): deleted (ACU_RedBlackNode): handle maxMult (both versions) * ACU_Copy.cc (copy): perform maxMult calculations (both copies) 2003-02-12 Steven Eker * ACU_Delete.cc (consDelete): added optional code for cheching the red-black property * ACU_Insert.cc (consInsert): added optional code for cheching the red-black property * ACU_Rebalance.cc (copyRebalance): removed bug catching code now that bug fixed * ACU_Delete.cc (consDelete): fixed nasty bug where we were making a black copy of a red victim in the case that the victim has enough multiplicity that it isn't removed from the tree - just has it's multiplicity lowered * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decls for both versions of checkRedBlackProperty() * ACU_RedBlackNode.cc (checkRedBlackProperty): added (2 versions) * ACU_Rebalance.cc (copyRebalance): added code to dump everything when bug in logic3 example happens * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decl for dump() * ACU_RedBlackNode.cc (dump): added 2003-02-10 Steven Eker * ACU_Find.cc (multOK): added (nextMult): rewritten using maxMultOK() (stackLeftmostMultPath): rewritten using maxMultOK() (nextMult): optimized * ACU_SlowIter.hh (next): fixed bug where we had !empty rather than !empty() 2003-02-07 Steven Eker * ACU_SlowIter.hh (next): simplified * ACU_Find.cc (nextMult): rewritten to fix symmetric bug * ACU_SlowIter.hh (next): rewritten to fix nasty stack underflow bug * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decls for stackLeftmostMultPath() and nextMult() * ACU_Find.cc (stackLeftmostMultPath): added (nextMult): added (findGeqMult): rewritten using stackLeftmostMultPath() and nextMult() 2003-02-03 Steven Eker * ACU_FastIter.hh (setMarked): deleted * ACU_RedBlackNode.hh (isMarked): added 2003-01-31 Steven Eker * ACU_Stack.cc: deleted commented out copy ctor & assignment code 2003-01-30 Steven Eker * ACU_TreeDagNode.hh (class ACU_TreeDagNode): updated decl for makeDelete() * ACU_TreeDagNode.cc (markArguments): use ACU_FastIter::setMarked() (makeDelete): ACU_SlowIter -> ACU_Stack * ACU_FastIter.hh (setMarked): added * ACU_TreeDagNode.cc (getHashValue): reimplemented using ACU_FastIter (stackArguments): reimplemented using ACU_FastIter (partialReplace): ACU_SlowIter -> ACU_Stack (makeExtensionInfo): reimplemented * ACU_TreeDagNode.hh (class ACU_TreeDagNode): deleted decl for findFirstPotentialMatch * ACU_TreeDagNode.cc (findFirstPotentialMatch): deleted * ACU_Find.cc: ACU_SlowIter -> ACU_Stack * ACU_RedBlack.cc: deleted * ACU_RedBlackNode.hh (class ACU_RedBlackNode): ACU_SlowIter -> ACU_Stack * ACU_FastIter.hh (ACU_FastIter): use stackLeftmostPath() (next): use stackLeftmostPath() (leftMost): deleted * ACU_SlowIter.hh (ACU_SlowIter): use stackLeftmostPath() (next): use stackLeftmostPath() (leftMost): deleted * ACU_Stack.hh (stackLeftmostPath): added * ACU_Insert.cc (consInsert): rewritten to make use of blackNode() and copy() 2003-01-29 Steven Eker * ACU_TreeDagArgumentIterator.cc (argument): use getDagNode() * ACU_TreeDagNode.cc: use new conventions in all routines * ACU_FastIter.hh (getArgument): becomes getDagNode() * ACU_Insert.cc (consInsert): use new conventions * ACU_Delete.cc (consDelete): use new conventions * ACU_Rebalance.cc (copyRebalance): use new conventions * ACU_SlowIter.hh (getArgument): becomes getDagNode() * ACU_Find.cc: use new conventions in all routines * ACU_RedBlackNode.hh (class ACU_RedBlackNode): major reoranization of class for efficiency and cleaness * ACU_Copy.cc (copy): rewritten to use new ctor and delta trick (both versions) 2003-01-28 Steven Eker * ACU_SlowIter.hh (class ACU_SlowIter): made base class ACU_Stack public until we figure out best permissions 2003-01-27 Steven Eker * ACU_RedBlackNode.hh (class ACU_RedBlackNode): updated decl for findIth() * ACU_Find.cc (findIth): implemented; return void * ACU_TreeDagNode.cc (partialReplace): rewritten using consDelete() * ACU_RedBlackNode.hh (getDagNode): added (getMultiplicity): added 2003-01-23 Steven Eker * ACU_TreeDagNode.cc (compareArguments): fix bug where we weren't checking r after doing subcompare * ACU_TreeDagNode.hh (getRoot): added 2003-01-22 Steven Eker * ACU_TreeDagNode.cc (compareArguments): added tree comparison * ACU_TreeDagArgumentIterator.cc: removed #pragma * ACU_TreeDagArgumentIterator.hh: removed #pragma * ACU_TreeDagNode.cc: removed #pragma * ACU_TreeDagNode.hh: removed #pragma * ACU_RedBlackNode.cc: removed #pragma * ACU_FastIter.hh (leftMost): use getLeft() (next): use getRight() * ACU_SlowIter.hh (next): use getRight() (leftMost): use getLeft() * ACU_Rebalance.cc (copyRebalance): use ACU_Stack * ACU_Copy.cc (copy): use ACU_Stack (both versions) * ACU_RedBlackNode.hh (class ACU_RedBlackNode): updated decls for copy() (both versions) and copyRebalance() * ACU_RedBlack.cc: deleted * ACU_RedBlackNode.hh: removed #pragma * ACU_FastIter.hh (class ACU_FastIter): derive from ACU_Stack * ACU_SlowIter.hh (class ACU_SlowIter): derive from ACU_Stack * ACU_RedBlackNode.hh (class ACU_RedBlackNode): made getSize() public; added decls for getLeft() and getRight() (getLeft): added (getRight): added * ACU_Stack.cc: created * ACU_Stack.hh: created; moved ACU_RedBlackNode::Stack stuff here * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added PublicValues 2003-01-15 Steven Eker * ACU_TreeDagNode.cc (computeBaseSort): fixed stupid bug where we were looking at the left child twice instread of the right child * ACU_RedBlackNode.cc (Stack): commented out assignment and copy ctor; places where we might want to use them seem unsafe because of possible garbage colection of ACU_RedBlackNode following a representation change * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decl for pathToIndex() * ACU_RedBlackNode.cc (Stack): (copy ctor) added (operator=): added (pathToIndex): added * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added copy ctor and assignment for Stack 2003-01-13 Steven Eker * ACU_RedBlackNode.hh (setSortIndex): added (getSortIndex): added * ACU_TreeDagNode.hh (class ACU_TreeDagNode): added decls for computeBaseSort() (2 versions) * ACU_TreeDagNode.cc (computeBaseSort): added 2 versions * ACU_TreeDagNode.hh (class ACU_TreeDagNode): added decl for makeDelete() * ACU_TreeDagNode.cc (makeDelete): added 2003-01-12 Steven Eker * ACU_TreeDagNode.cc (findFirstPotentialMatch): added * ACU_TreeDagNode.hh (class ACU_TreeDagNode): added decl for findFirstPotentialMatch() 2003-01-11 Steven Eker * ACU_TreeDagNode.cc (argVecToTree): copy sortIndex and reduced flag (treeToArgVec): copy sortIndex and reduced flag 2003-01-10 Steven Eker * ACU_TreeDagNode.hh (class ACU_TreeDagNode): added decl for overwriteWithInsert() * ACU_TreeDagNode.cc (overwriteWithInsert): added * ACU_Delete.cc (consDelete): use blackNode(); fixed bug where we weren't returning the new node * ACU_RedBlackNode.hh (redNode): moved here * ACU_RedBlackNode.cc (blackNode): moved here * ACU_Rebalance.cc (copyRebalance): many simplifications (copyRebalance): more code factoring 2003-01-09 Steven Eker * ACU_Rebalance.cc: created from experimental code * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decls for copyRebalance() and consDelete() (class ACU_RedBlackNode): added declarations for blackNode() and redNode() * ACU_Delete.cc: created * ACU_RedBlackNode.hh (class ACU_RedBlackNode): added decl for findFirstPotentialMatch(); deletd decls for findFirst() and createFromSortedVector() * ACU_Find.cc (findFirstPotentialMatch): added (findFirst): deleted * ACU_TreeDagNode.cc (markArguments): implemented * ACU_FastIter.hh: added ACU_TreeDagNode as a friend 2003-01-08 Steven Eker * ACU_TreeDagNode.cc (arguments): implemented (overwriteWithClone): implemented (makeClone): implemented * ACU_TreeDagArgumentIterator.cc: created * ACU_TreeDagArgumentIterator.hh (class ACU_TreeDagArgumentIterator): created * ACU_TreeDagNode.cc (makeTree): need to end recursion at size == 0 * ACU_RedBlackNode.hh (class ACU_RedBlackNode): ACU_TreeDagNode becomes a friend * ACU_TreeDagNode.cc (makeTree): added * ACU_RedBlack.cc: created * ACU_RedBlack.hh: created * ACU_TreeDagNode.cc: created * ACU_TreeDagNode.hh: created * ACU_Copy.cc: created from experimental code * ACU_Insert.cc: created from experimental code * ACU_Find.cc: created from experimental code * ACU_SlowIter.hh: created from experimental code * ACU_FastIter.hh: created from experimental code * ACU_RedBlackNode.cc: created from experimental code * ACU_RedBlackNode.hh: created from experimental code (ACU_RedBlackNode): set size here, rather than trying to compute it lazily Maude-2.6/src/ACU_Persistent/ACU_Delete.cc0000644000147300135640000000570211363155232015172 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Persistent delete from ACU red-black tree argument list. // ACU_RedBlackNode* ACU_RedBlackNode::consDelete(ACU_Stack& path, int multiplicity, int& delta) { ACU_RedBlackNode* victim = path.pop(); int newMult = victim->getMultiplicity() - multiplicity; Assert(newMult >= 0, "-ve newMult"); if (newMult > 0) { delta = 0; ACU_RedBlackNode* n = new ACU_RedBlackNode(victim->getDagNode(), newMult, victim->getLeft(), victim->getRight()); n->makeRedIfRed(victim); return copy(path, n, victim); } // // Need to do a red-black delete. // delta = -1; ACU_RedBlackNode* child = victim->getLeft(); if (child != 0) { ACU_RedBlackNode* n = victim->getRight(); if (n != 0) { // // Victim has two children; need to replace it with // successor. // path.unpop(); path.stackLeftmostPath(n); ACU_RedBlackNode* surrogate = path.pop(); child = surrogate->getRight(); // might be null if (surrogate->isRed()) { // // Surrogate is replaced by it's only child, and victim // is replaced by surrogate. // return copy(path, child, surrogate, victim, surrogate); } else if (isRed(child)) { // // Surrogate is replaced by a black copy of it's // only child, and victim is replaced by surrogate. // return copy(path, blackNode(child, child->getLeft(), child->getRight()), surrogate, victim, surrogate); } // // Need to increase black length for child. // return copyRebalance(path, child, surrogate, victim, surrogate); } } else child = victim->getRight(); // // Victim has no children or one child only. // if (path.empty()) { return isRed(child) ? blackNode(child, child->getLeft(), child->getRight()) : child; } if (victim->isRed()) return copy(path, child, victim); else if (isRed(child)) return copy(path, blackNode(child, child->getLeft(), child->getRight()), victim); // // Need to increase black length for child. // return copyRebalance(path, child, victim, 0, 0); } Maude-2.6/src/ACU_Persistent/ACU_Pair.hh0000644000147300135640000000277007666303440014706 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for argument-multiplicity pairs. // #ifndef _ACU_Pair_hh_ #define _ACU_Pair_hh_ class ACU_Pair { public: ACU_Pair(); ACU_Pair(DagNode* d, int m); void set(DagNode* d, int m); DagNode* getDagNode() const; int getMultiplicity() const; /* HACK private: */ DagNode* dagNode; int multiplicity; }; inline ACU_Pair::ACU_Pair() { } inline ACU_Pair::ACU_Pair(DagNode* d, int m) { dagNode = d; multiplicity = m; } inline void ACU_Pair::set(DagNode* d, int m) { dagNode = d; multiplicity = m; } inline DagNode* ACU_Pair::getDagNode() const { return dagNode; } inline int ACU_Pair::getMultiplicity() const { return multiplicity; } #endif Maude-2.6/src/ACU_Persistent/ACU_Insert.cc0000644000147300135640000000753307666303440015247 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Persistent insert into ACU red-black tree argument list. // // We use the algorithm from: // Chris Okasaki, // "Functional Pearl: Red-black trees in a functional setting", // Journal of Functional Programming, 9(4):471-477, July 1999. // ACU_RedBlackNode* ACU_RedBlackNode::consInsert(ACU_RedBlackNode* p, DagNode* argument, int multiplicity, int& delta) { Assert(p != 0, "inserting into empty tree not allowed"); ACU_Stack path; bool goLeft; { // // First figure out where to insert new argument. // int r; do { r = argument->compare(p->getDagNode()); if (r == 0) { delta = 0; int newMult = p->getMultiplicity() + multiplicity; int maxMult = p->getMaxMult(); if (newMult > maxMult) maxMult = newMult; ACU_RedBlackNode* n = new ACU_RedBlackNode(p->getDagNode(), newMult, p->getLeft(), p->getRight(), maxMult); if (path.empty()) return n; n->makeRedIfRed(p); return copy(path, n, p); } path.push(p); p = p->getChild(r); } while (p != 0); goLeft = (r < 0); } // // Now insert and copy spine, rebalancing as we go. // delta = 1; ACU_RedBlackNode* parent = path.pop(); ACU_RedBlackNode* left = 0; ACU_RedBlackNode* right = 0; while (parent->isRed()) { // // Resolve red-red conflict using Okisaka's balancing scheme. // ACU_RedBlackNode* grandParent = path.pop(); // red nodes always have a parent if (goLeft) { if (grandParent->getLeft() == parent) { left = new ACU_RedBlackNode(argument, multiplicity, left, right); right = blackNode(grandParent, parent->getRight(), grandParent->getRight()); argument = parent->getDagNode(); multiplicity = parent->getMultiplicity(); } else { left = blackNode(grandParent, grandParent->getLeft(), left); right = blackNode(parent, right, parent->getRight()); } } else { if (grandParent->getLeft() == parent) { left = blackNode(parent, parent->getLeft(), left); right = blackNode(grandParent, right, grandParent->getRight()); } else { right = new ACU_RedBlackNode(argument, multiplicity, left, right); left = blackNode(grandParent, grandParent->getLeft(), parent->getLeft()); argument = parent->getDagNode(); multiplicity = parent->getMultiplicity(); } } if (path.empty()) { // // New root must be black. // return new ACU_RedBlackNode(argument, multiplicity, left, right); } parent = path.pop(); goLeft = (parent->getLeft() == grandParent); } // // Create red node. // ACU_RedBlackNode* n = new ACU_RedBlackNode(argument, multiplicity, left, right); n->makeRed(); // // Copy rest of spine without rebalancing. // ACU_RedBlackNode* newRoot = goLeft ? blackNode(parent, n, parent->getRight()) : blackNode(parent, parent->getLeft(), n); return copy(path, newRoot, parent); } Maude-2.6/src/ACU_Persistent/ACU_Tree.cc0000644000147300135640000001112211310013106014641 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ACU_Tree. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "ACU_RedBlack.hh" // interface class definitions #include "binarySymbol.hh" #include "dagNode.hh" #include "term.hh" // ACU red-black class definitions #include "ACU_RedBlackNode.hh" #include "ACU_Stack.hh" #include "ACU_Tree.hh" ACU_Tree::ACU_Tree(const ArgVec& source) { size = source.length(); root = makeTree(source, 0, size, false); #ifdef CHECK_TREE checkIntegrity(); #endif } local_inline bool ACU_Tree::pow2min1(int i) { // // Return true iff i is 2^n - 1 for some n >= 0. // return ((i + 1) & i) == 0; } ACU_RedBlackNode* ACU_Tree::makeTree(const ArgVec& args, int first, int size, bool makeRed) { if (size == 0) return 0; int leftSize = size / 2; int rightSize = size - 1 - leftSize; ACU_RedBlackNode* leftTree = makeTree(args, first, leftSize, leftSize > rightSize && pow2min1(leftSize)); ACU_RedBlackNode* rightTree = makeTree(args, first + leftSize + 1, rightSize, false); ACU_RedBlackNode* t = new ACU_RedBlackNode(args[first + leftSize].dagNode, args[first + leftSize].multiplicity, leftTree, rightTree); if (makeRed) t->makeRed(); return t; } /* void ACU_Tree::copyToArgVec(ArgVec& dest) const { ArgVec::iterator j = dest->argArray.begin(); for (ACU_FastIter i(t); i.valid(); i.next(), ++j) { j->dagNode = i.getDagNode(); j->multiplicity = i.getMultiplicity(); } } */ int ACU_Tree::computeBaseSort2(BinarySymbol* symbol, ACU_RedBlackNode* root) { // // Postorder traversal of node is red-black tree without a sort. // ACU_Stack s; ACU_RedBlackNode* n; for(;;) { n = root->getLeft(); if (n == 0 || n->getSortIndex() != Sort::SORT_UNKNOWN) { tryRight: n = root->getRight(); if (n == 0 || n->getSortIndex() != Sort::SORT_UNKNOWN) break; } s.push(root); root = n; } int f = root->getDagNode()->getSortIndex(); f = symbol->computeMultSortIndex(f, f, root->getMultiplicity() - 1); n = root->getLeft(); if (n != 0) f = symbol->computeSortIndex(f, n->getSortIndex()); n = root->getRight(); if (n != 0) f = symbol->computeSortIndex(f, n->getSortIndex()); root->setSortIndex(f); while (!(s.empty())) { ACU_RedBlackNode* oldRoot = root; root = s.pop(); n = root->getLeft(); if (n == oldRoot) goto tryRight; if (n != 0) f = symbol->computeSortIndex(f, n->getSortIndex()); f = symbol->computeMultSortIndex(f, root->getDagNode()->getSortIndex(), root->getMultiplicity()); root->setSortIndex(f); } return f; } void ACU_Tree::mark() { // // Preorder traversal of unmarked nodes in red-black tree. // ACU_Stack i; ACU_RedBlackNode* n = root; for(;;) { while (n != 0 && !(n->isMarked())) { n->setMarked(); n->getDagNode()->mark(); i.push(n); n = n->getLeft(); } if (i.empty()) break; n = i.pop()->getRight(); } } bool ACU_Tree::makeCanonical(ACU_Tree& canonizedVersion, HashConsSet* hcs) { ACU_RedBlackNode* c = root->canonicalRebuild(hcs); if (c != root) { canonizedVersion.size = size; canonizedVersion.root = c; return true; } return false; } #ifdef CHECK_TREE void ACU_Tree::checkIntegrity(DagNode* dagNode, int multiplicity) const { // // should also check size // if (root != 0 && !(root->checkRedBlackProperty())) { if (dagNode != 0) { cerr << "dagNode = " << dagNode << "\t multiplcity = " << multiplicity << endl; } root->dump(cerr, 0); abort(); } } #endif Maude-2.6/src/ACU_Persistent/ACU_RedBlackNode.hh0000644000147300135640000001634311337360206016262 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for nodes in persistent red-black trees. // #ifndef _ACU_RedBlackNode_hh_ #define _ACU_RedBlackNode_hh_ #include "symbol.hh" // HACK #include "dagNode.hh" // HACK #include "memoryCell.hh" class ACU_RedBlackNode { NO_COPYING(ACU_RedBlackNode); public: enum PublicValues { MAX_TREE_HEIGHT = 64 // must be height of largest red-black tree }; ACU_RedBlackNode(DagNode* dagNode, int multiplicity, ACU_RedBlackNode* left, ACU_RedBlackNode* right); ACU_RedBlackNode(DagNode* dagNode, int multiplicity, ACU_RedBlackNode* left, ACU_RedBlackNode* right, int maxMult); DagNode* getDagNode() const; int getMultiplicity() const; ACU_RedBlackNode* getLeft() const; ACU_RedBlackNode* getRight() const; int getMaxMult() const; void setSortIndex(int index); int getSortIndex() const; void makeRed(); // need for conversion from array void* operator new(size_t size); void setMarked(); bool isMarked(); static bool find(ACU_RedBlackNode* root, DagNode* dagNode, ACU_Stack& path); static bool find(ACU_RedBlackNode* root, Term* term, ACU_Stack& path); static bool findFirstPotentialMatch(ACU_RedBlackNode* root, Term* key, const Substitution& partial, ACU_Stack& path); static bool findGeqMult(ACU_RedBlackNode* root, int multiplicity, ACU_Stack& path); static ACU_RedBlackNode* consInsert(ACU_RedBlackNode* root, DagNode* dagNode, int multiplicity, int& delta); static ACU_RedBlackNode* consDelete(ACU_Stack& path, int multiplicity, int& delta); // // Experimental hash cons code. // ACU_RedBlackNode* canonicalRebuild(HashConsSet* hcs); void dump(ostream& s, int indent); #ifdef CHECK_TREE // // Extra functions for strict checking of red-black property // after each operation. // bool checkRedBlackProperty(); bool checkRedBlackProperty(int& height); static ACU_RedBlackNode* consInsert2(ACU_RedBlackNode* root, DagNode* dagNode, int multiplicity); static ACU_RedBlackNode* consDelete2(ACU_Stack& path, int multiplicity); #endif private: enum Values { LEFT_INDEX = 1, RIGHT_INDEX = 0 }; enum Flags { RED = 1 }; // // Returns left child if negative, right child otherwise. // ACU_RedBlackNode* getChild(int sign) const; static ACU_RedBlackNode* copy(ACU_Stack& path, ACU_RedBlackNode* n, ACU_RedBlackNode* old); static ACU_RedBlackNode* copy(ACU_Stack& path, ACU_RedBlackNode* n, ACU_RedBlackNode* old, ACU_RedBlackNode* victim, ACU_RedBlackNode* surrogate); static ACU_RedBlackNode* copyRebalance(ACU_Stack& path, ACU_RedBlackNode* n, ACU_RedBlackNode* old, ACU_RedBlackNode* victim, ACU_RedBlackNode* surrogate); static ACU_RedBlackNode* blackNode(ACU_RedBlackNode* key, ACU_RedBlackNode* left, ACU_RedBlackNode* right); static ACU_RedBlackNode* redNode(ACU_RedBlackNode* key, ACU_RedBlackNode* left, ACU_RedBlackNode* right); bool isRed() const; static bool isRed(const ACU_RedBlackNode* mightBeNull); void makeRedIfRed(const ACU_RedBlackNode* other); // // Nasty cross casting stuff. // MemoryCell* getMemoryCell(); const MemoryCell* getMemoryCell() const; DagNode* const dagNode; int const multiplicity; ACU_RedBlackNode* children[2]; // no way to initialize const int maxMult; }; inline MemoryCell* ACU_RedBlackNode::getMemoryCell() { return static_cast(static_cast(this)); } inline const MemoryCell* ACU_RedBlackNode::getMemoryCell() const { return static_cast(static_cast(this)); } inline void* ACU_RedBlackNode::operator new(size_t size) { // // We rely on MemoryCell::allocateMemoryCell() setting the half word to // Sort::SORT_UNKNOWN. // Assert(size <= sizeof(MemoryCell), "red-black node too big"); return MemoryCell::allocateMemoryCell(); } inline void ACU_RedBlackNode::setMarked() { getMemoryCell()->setMarked(); } inline bool ACU_RedBlackNode::isMarked() { return getMemoryCell()->isMarked(); } inline int ACU_RedBlackNode::getMaxMult() const { return maxMult; } inline ACU_RedBlackNode::ACU_RedBlackNode(DagNode* dagNode, int multiplicity, ACU_RedBlackNode* left, ACU_RedBlackNode* right) : dagNode(dagNode), multiplicity(multiplicity) { int mm = multiplicity; if (left != 0) { int t = left->maxMult; if (t > mm) mm = t; } if (right != 0) { int t = right->maxMult; if (t > mm) mm = t; } maxMult = mm; children[LEFT_INDEX] = left; children[RIGHT_INDEX] = right; } inline ACU_RedBlackNode::ACU_RedBlackNode(DagNode* dagNode, int multiplicity, ACU_RedBlackNode* left, ACU_RedBlackNode* right, int maxMult) : dagNode(dagNode), multiplicity(multiplicity), maxMult(maxMult) { Assert(maxMult == max(multiplicity, max((left == 0) ? 0 : left->maxMult, (right == 0) ? 0 : right->maxMult)), "bad maxMult"); children[LEFT_INDEX] = left; children[RIGHT_INDEX] = right; } inline DagNode* ACU_RedBlackNode::getDagNode() const { return dagNode; } inline int ACU_RedBlackNode::getMultiplicity() const { return multiplicity; } inline ACU_RedBlackNode* ACU_RedBlackNode::getLeft() const { return children[LEFT_INDEX]; } inline ACU_RedBlackNode* ACU_RedBlackNode::getRight() const { return children[RIGHT_INDEX]; } inline ACU_RedBlackNode* ACU_RedBlackNode::getChild(int sign) const { return children[sign < 0]; } inline void ACU_RedBlackNode::setSortIndex(int index) { getMemoryCell()->setHalfWord(index); } inline int ACU_RedBlackNode::getSortIndex() const { return getMemoryCell()->getHalfWord(); } inline bool ACU_RedBlackNode::isRed() const { return getMemoryCell()->getFlag(RED); } inline bool ACU_RedBlackNode::isRed(const ACU_RedBlackNode* mightBeNull) { return mightBeNull != 0 && mightBeNull->getMemoryCell()->getFlag(RED); } inline void ACU_RedBlackNode::makeRed() { getMemoryCell()->setFlag(RED); } inline void ACU_RedBlackNode::makeRedIfRed(const ACU_RedBlackNode* other) { getMemoryCell()->copySetFlags(RED, other->getMemoryCell()); } inline ACU_RedBlackNode* ACU_RedBlackNode::redNode(ACU_RedBlackNode* key, ACU_RedBlackNode* left, ACU_RedBlackNode* right) { ACU_RedBlackNode* n = blackNode(key, left, right); n->makeRed(); return n; } #endif Maude-2.6/src/ACU_Persistent/Makefile.am0000644000147300135640000000106307711546253015032 00000000000000noinst_LIBRARIES = libACU_Persistent.a libACU_Persistent_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libACU_Persistent_a_SOURCES = \ ACU_RedBlackNode.cc \ ACU_Tree.cc EXTRA_DIST = \ ACU_Find.cc \ ACU_Insert.cc \ ACU_Copy.cc \ ACU_Delete.cc \ ACU_Rebalance.cc noinst_HEADERS = \ ACU_FastIter.hh \ ACU_Persistent.hh \ ACU_RedBlackNode.hh \ ACU_Stack.hh \ ACU_Pair.hh \ ACU_RedBlack.hh \ ACU_SlowIter.hh \ ACU_Tree.hh Maude-2.6/src/ACU_Persistent/ACU_Tree.hh0000644000147300135640000001121111310012612014653 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for red-black trees of argument-multiplicity pairs. // #ifndef _ACU_Tree_hh_ #define _ACU_Tree_hh_ #include "argVec.hh" #include "ACU_Pair.hh" #include "ACU_RedBlackNode.hh" #include "ACU_Stack.hh" class ACU_Tree { public: ACU_Tree(){} ACU_Tree(const ArgVec& source); void clear(); int getSize() const; int getMaxMult() const; void copyToArgVec(ArgVec& dest) const; DagNode* getSoleDagNode() const; int getSoleMultiplicity() const; bool find(DagNode* dagNode, ACU_Stack& path) const; bool find(Term* term, ACU_Stack& path) const ; bool findFirstPotentialMatch(Term* key, const Substitution& partial, ACU_Stack& path) const; bool findGeqMult(int multiplicity, ACU_Stack& path) const; void insertMult(DagNode* dagNode, int multiplicity); void deleteMult(ACU_Stack& path, int multiplicity); void deleteMult2(ACU_Stack& path, int multiplicity); int computeBaseSort(BinarySymbol* symbol) const; void mark(); #ifdef CHECK_TREE void checkIntegrity(DagNode* dagNode = 0, int multiplicity = 0) const; #endif // // Hash cons stuff. // bool makeCanonical(ACU_Tree& canonizedVersion, HashConsSet* hcs); private: static bool pow2min1(int i); static ACU_RedBlackNode* makeTree(const ArgVec& args, int first, int size, bool makeRed); static int computeBaseSort2(BinarySymbol* symbol, ACU_RedBlackNode* root); int size; ACU_RedBlackNode* root; friend class ACU_FastIter; friend class ACU_SlowIter; }; inline int ACU_Tree::getSize() const { return size; } inline void ACU_Tree::clear() { size = 0; root = 0; } inline int ACU_Tree::getMaxMult() const { return root->getMaxMult(); } inline DagNode* ACU_Tree::getSoleDagNode() const { Assert(size == 1, "more than one node in tree"); return root->getDagNode(); } inline int ACU_Tree::getSoleMultiplicity() const { Assert(size == 1, "more than one node in tree"); return root->getMultiplicity(); } inline bool ACU_Tree::find(DagNode* dagNode, ACU_Stack& path) const { return ACU_RedBlackNode::find(root, dagNode, path); } inline bool ACU_Tree::find(Term* term, ACU_Stack& path) const { return ACU_RedBlackNode::find(root, term, path); } inline bool ACU_Tree::findFirstPotentialMatch(Term* key, const Substitution& partial, ACU_Stack& path) const { return ACU_RedBlackNode::findFirstPotentialMatch(root, key, partial, path); } inline bool ACU_Tree::findGeqMult(int multiplicity, ACU_Stack& path) const { return ACU_RedBlackNode::findGeqMult(root, multiplicity, path); } inline int ACU_Tree::computeBaseSort(BinarySymbol* symbol) const { Assert(size > 0 && root != 0, "bad tree for sort computation"); int index = root->getSortIndex(); if (index != Sort::SORT_UNKNOWN) return index; return computeBaseSort2(symbol, root); } inline void ACU_Tree::insertMult(DagNode* dagNode, int multiplicity) { #ifdef CHECK_TREE checkIntegrity(); #endif int delta; root = ACU_RedBlackNode::consInsert(root, dagNode, multiplicity, delta); size += delta; #ifdef CHECK_TREE checkIntegrity(dagNode, multiplicity); #endif } inline void ACU_Tree::deleteMult(ACU_Stack& path, int multiplicity) { #ifdef CHECK_TREE checkIntegrity(); ACU_RedBlackNode* dagNode = path.top(); #endif int delta; root = ACU_RedBlackNode::consDelete(path, multiplicity, delta); size += delta; #ifdef CHECK_TREE checkIntegrity(dagNode, multiplicity); #endif } inline void ACU_Tree::deleteMult2(ACU_Stack& path, int multiplicity) { // // This version preserves the stack. // #ifdef CHECK_TREE checkIntegrity(); ACU_RedBlackNode* dagNode = path.top(); #endif path.save(); int delta; root = ACU_RedBlackNode::consDelete(path, multiplicity, delta); size += delta; path.restore(); #ifdef CHECK_TREE checkIntegrity(dagNode, multiplicity); #endif } #endif Maude-2.6/src/CUI_Theory/0000777000147300135640000000000011500304121012155 500000000000000Maude-2.6/src/CUI_Theory/CUI_RhsAutomaton.hh0000644000147300135640000000313307666303124015562 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for right hand side automata for theories made from C, Ul, Ur and I axioms. // #ifndef _CUI_RhsAutomaton_hh_ #define _CUI_RhsAutomaton_hh_ #include "rhsAutomaton.hh" class CUI_RhsAutomaton : public RhsAutomaton { NO_COPYING(CUI_RhsAutomaton); public: CUI_RhsAutomaton(CUI_Symbol* symbol); void close(int sourceIndex0, int sourceIndex1, int destinationIndex); // // Standard RhsAutomaton operations // void remapIndices(VariableInfo& variableInfo); DagNode* construct(Substitution& matcher); void replace(DagNode* old, Substitution& matcher); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: CUI_Symbol* const topSymbol; int source0; int source1; int destination; }; #endif Maude-2.6/src/CUI_Theory/CUI_Matcher.cc0000644000147300135640000001521711234445334014511 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // CUI matcher. // bool CUI_LhsAutomaton::match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { DisjunctiveSubproblemAccumulator alternatives(solution); Flags f = flags; bool greedyMatchOK = f & GREEDY_MATCH_OK; if (subject->symbol() == topSymbol) { Assert(extensionInfo == 0, "shouldn't have extension info"); CUI_DagNode* s = static_cast(subject); DagNode* s0 = s->argArray[0]; DagNode* s1 = s->argArray[1]; if (f & FORWARD) { // // Try forward non-collapse possibility. // local.copy(solution); if (freeMatch(s0, s1, local, returnedSubproblem)) { if ((f & UNIQUE_BRANCH) || (greedyMatchOK && returnedSubproblem == 0)) { solution.copy(local); return true; } alternatives.addOption(local, returnedSubproblem, 0); } } if ((f & REVERSE) || ((f & CONDITIONAL_REVERSE) && !(s0->equal(s1)))) { // // Try reverse non-collapse possibility. // local.copy(solution); if (freeMatch(s1, s0, local, returnedSubproblem)) { if ((f & UNIQUE_BRANCH) || (greedyMatchOK && returnedSubproblem == 0)) { solution.copy(local); return true; } alternatives.addOption(local, returnedSubproblem, 0); } } } else { if (!(f & COLLAPSE)) return false; } // // Three ways to collapse. // if (f & ID0_COLLAPSE) { local.copy(solution); if (id0CollapseMatch(subject, local, returnedSubproblem, extensionInfo)) { if (greedyMatchOK && returnedSubproblem == 0) { solution.copy(local); return true; } alternatives.addOption(local, returnedSubproblem, extensionInfo); } } if (f & ID1_COLLAPSE) { local.copy(solution); if (id1CollapseMatch(subject, local, returnedSubproblem, extensionInfo)) { if (greedyMatchOK && returnedSubproblem == 0) { solution.copy(local); return true; } alternatives.addOption(local, returnedSubproblem, extensionInfo); } } if (f & IDEM_COLLAPSE) { local.copy(solution); if ((extensionInfo == 0) ? idemCollapseMatch(subject, local, returnedSubproblem) : idemCollapseMatch(subject, local, returnedSubproblem, extensionInfo)) { if (greedyMatchOK && returnedSubproblem == 0) { solution.copy(local); return true; } alternatives.addOption(local, returnedSubproblem, extensionInfo); } } return alternatives.extract(solution, returnedSubproblem, extensionInfo); } bool CUI_LhsAutomaton::freeMatch(DagNode* subject0, DagNode* subject1, Substitution& solution, Subproblem*& returnedSubproblem) { Subproblem* sp0; Subproblem* sp1; if (subpattern0.match(subject0, solution, sp0)) { if (subpattern1.match(subject1, solution, sp1)) { SubproblemAccumulator subproblems; subproblems.add(sp0); subproblems.add(sp1); returnedSubproblem = subproblems.extractSubproblem(); return true; } else delete sp0; // important! } return false; } bool CUI_LhsAutomaton::id0CollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { Subproblem* sp0; Subproblem* sp1; if (subpattern0.match(topSymbol->getIdentityDag(), solution, sp0)) { if (subpattern1.match(subject, solution, sp1, matchAtTop, extensionInfo)) { SubproblemAccumulator subproblems; subproblems.add(sp0); subproblems.add(sp1); returnedSubproblem = subproblems.extractSubproblem(); return true; } else delete sp0; } return false; } bool CUI_LhsAutomaton::id1CollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { Term* identity = topSymbol->getIdentity(); if ((flags & ID0_COLLAPSE) && identity->equal(subject)) return false; // we will have already discovered solution on id0Collapse branch Subproblem* sp0; Subproblem* sp1; if (subpattern1.match(topSymbol->getIdentityDag(), solution, sp1)) { if (subpattern0.match(subject, solution, sp0, matchAtTop, extensionInfo)) { SubproblemAccumulator subproblems; subproblems.add(sp1); subproblems.add(sp0); if (extensionInfo != 0 && (flags & ID0_COLLAPSE)) subproblems.add(new EqualitySubproblem(identity, extensionInfo, false)); returnedSubproblem = subproblems.extractSubproblem(); return true; } else delete sp1; } return false; } bool CUI_LhsAutomaton::idemCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem) { Term* identity = topSymbol->getIdentity(); if (identity != 0 && identity->equal(subject)) return false; Subproblem* sp0; Subproblem* sp1; if (subpattern0.match(subject, solution, sp0, matchAtTop)) { if (subpattern1.match(subject, solution, sp1, matchAtTop)) { SubproblemAccumulator subproblems; subproblems.add(sp1); subproblems.add(sp0); returnedSubproblem = subproblems.extractSubproblem(); return true; } else delete sp0; } return false; } bool CUI_LhsAutomaton::idemCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo) { Subproblem* sp; if (subpattern0.topAutomaton->match(subject, solution, sp, extensionInfo)) { SubproblemAccumulator subproblems; subproblems.add(sp); Term* identity = topSymbol->getIdentity(); if (identity != 0) subproblems.add(new EqualitySubproblem(identity, extensionInfo, false)); subproblems.add(new ExtensionMatchSubproblem(subpattern1.automaton, extensionInfo, solution.nrFragileBindings())); returnedSubproblem = subproblems.extractSubproblem(); return true; } return false; } Maude-2.6/src/CUI_Theory/CUI_ArgumentIterator.hh0000644000147300135640000000255507666303124016441 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for argument iterator for CUI terms. // #ifndef _CUI_ArgumentIterator_hh_ #define _CUI_ArgumentIterator_hh_ #include "rawArgumentIterator.hh" class CUI_ArgumentIterator : public RawArgumentIterator { public: CUI_ArgumentIterator(const Vector& arguments); bool valid() const; Term* argument() const; void next(); private: const Vector& argArray; int position; }; inline CUI_ArgumentIterator::CUI_ArgumentIterator(const Vector& arguments) : argArray(arguments) { position = 0; } #endif Maude-2.6/src/CUI_Theory/CUI_ArgumentIterator.cc0000644000147300135640000000254607666303124016427 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_ArgumentIterator. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" // CUI theory class definitions #include "CUI_ArgumentIterator.hh" bool CUI_ArgumentIterator::valid() const { return position < 2; } Term* CUI_ArgumentIterator::argument() const { Assert(position < 2, "no args left"); return argArray[position]; } void CUI_ArgumentIterator::next() { Assert(position < 2, "no args left"); ++position; } Maude-2.6/src/CUI_Theory/CUI_LhsAutomaton.cc0000644000147300135640000001415007666303124015543 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_LhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "CUI_Theory.hh" // interface class definitions #include "argVec.hh" #include "binarySymbol.hh" #include "dagNode.hh" #include "term.hh" #include "subproblem.hh" #include "lhsAutomaton.hh" #include "rhsAutomaton.hh" #include "extensionInfo.hh" // core class definitions #include "variableInfo.hh" #include "subproblemAccumulator.hh" #include "disjunctiveSubproblemAccumulator.hh" #include "equalitySubproblem.hh" #include "extensionMatchSubproblem.hh" #include "substitution.hh" #include "localBinding.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" #include "CUI_LhsAutomaton.hh" #include "CUI_Matcher.cc" CUI_LhsAutomaton::CUI_LhsAutomaton(CUI_Symbol* topSymbol, bool matchAtTop, Flags flags, int nrVariables) : topSymbol(topSymbol), matchAtTop(matchAtTop), flags(flags), local(nrVariables) { subpattern0.type = UNDEFINED; subpattern0.automaton = 0; subpattern0.topAutomaton = 0; subpattern1.automaton = 0; subpattern1.topAutomaton = 0; } CUI_LhsAutomaton::~CUI_LhsAutomaton() { delete subpattern0.automaton; delete subpattern0.topAutomaton; delete subpattern1.automaton; delete subpattern1.topAutomaton; } bool CUI_LhsAutomaton::addSubpattern(Term* term, const VariableInfo& variableInfo, NatSet& boundUniquely) { bool first = (subpattern0.type == UNDEFINED); Subpattern& sp = first ? subpattern0 : subpattern1; if (matchAtTop && (flags & (first ? (ID1_COLLAPSE | IDEM_COLLAPSE) : (ID0_COLLAPSE | IDEM_COLLAPSE)))) { // // Need to compile a top automaton for this subpattern. // VariableInfo localVariableInfo(variableInfo); // // Ulgy hack to prevent greedy matching because extension // is shared in idem match. // if (first && (flags & IDEM_COLLAPSE)) localVariableInfo.addConditionVariables(term->occursBelow()); NatSet local(boundUniquely); bool spl; sp.topAutomaton = term->compileLhs(true, localVariableInfo, local, spl); } if (term->ground()) { sp.type = GROUND_ALIEN; sp.term = term; return false; } VariableTerm* v = dynamic_cast(term); if (v != 0) { sp.type = VARIABLE; sp.varIndex = v->getIndex(); sp.sort = v->getSort(); if (flags & UNIQUE_BRANCH) { boundUniquely.insert(v->getIndex()); return false; } if (first || !matchAtTop || !(flags & IDEM_COLLAPSE)) return false; } else { sp.type = NON_GROUND_ALIEN; if (flags & UNIQUE_BRANCH) { bool spl; sp.automaton = term->compileLhs(false, variableInfo, boundUniquely, spl); return spl; } } NatSet local(boundUniquely); bool spl; sp.automaton = term->compileLhs(false, variableInfo, local, spl); return spl; } #ifdef DUMP void CUI_LhsAutomaton::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{CUI_LhsAutomaton}\n"; ++indentLevel; s << Indent(indentLevel) << "topSymbol = \"" << topSymbol << "\"\tmatchAtTop = " << matchAtTop << '\n'; s << Indent(indentLevel) << "flags = " << flags << '\n'; s << Indent(indentLevel) << "subpattern0:\n"; subpattern0.dump(s, variableInfo, indentLevel + 1); s << Indent(indentLevel) << "subpattern1:\n"; subpattern1.dump(s, variableInfo, indentLevel + 1); s << Indent(indentLevel - 1) << "End{CUI_Automaton}\n"; } void CUI_LhsAutomaton::Subpattern::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "type = " << type << '\n'; switch (type) { case UNDEFINED: return; case GROUND_ALIEN: s << Indent(indentLevel) << "term = \"" << term << "\"\n"; break; case VARIABLE: s << Indent(indentLevel) << "varIndex = " << varIndex << " \"" << variableInfo.index2Variable(varIndex) << "\"\tsort = \"" << sort << "\"\n"; if (automaton == 0) break; // fall thru case NON_GROUND_ALIEN: s << Indent(indentLevel) << "automaton =\n"; automaton->dump(s, variableInfo, indentLevel + 1); break; } if (topAutomaton != 0) { s << Indent(indentLevel) << "topAutomaton =\n"; topAutomaton->dump(s, variableInfo, indentLevel + 1); } } ostream& operator<<(ostream& s, CUI_LhsAutomaton::Flags flags) { static const char* const names[] = {"GREEDY_MATCH_OK", "UNIQUE_BRANCH", "FORWARD", "REVERSE", "CONDITIONAL_REVERSE", "ID0_COLLAPSE", "ID1_COLLAPSE", "IDEM_COLLAPSE"}; s << '{'; int m = 1; bool already = false; for (int i = 0; i < 8; i++) { if (flags & m) { if (already) s << ", "; s << names[i]; already = true; } m <<= 1; } s << '}'; return s; } ostream& operator<<(ostream& s, CUI_LhsAutomaton::PatternType type) { static const char* const names[] = {"UNDEFINED", "GROUND_ALIEN", "VARIABLE", "NON_GROUND_ALIEN"}; s << names[type]; return s; } #endif Maude-2.6/src/CUI_Theory/CUI_Symbol.cc0000644000147300135640000002337111500265564014374 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_Symbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "CUI_Theory.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" #include "lhsAutomaton.hh" #include "rhsAutomaton.hh" #include "subproblem.hh" // core class definitions #include "rewritingContext.hh" #include "variableInfo.hh" #include "sortBdds.hh" #include "hashConsSet.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" #include "CUI_Term.hh" #include "CUI_UnificationSubproblem.hh" CUI_Symbol::CUI_Symbol(int id, const Vector& strategy, bool memoFlag, Axioms axioms, Term* identity) : BinarySymbol(id, memoFlag, identity), axioms(axioms) { if (axioms & COMM) setPermuteStrategy(strategy); else setStrategy(strategy, 2, memoFlag); } void CUI_Symbol::compileOpDeclarations() { if (axioms & COMM) commutativeSortCompletion(); Symbol::compileOpDeclarations(); // do default sort processing if (axioms & IDEM) idempotentSortCheck(); } void CUI_Symbol::postOpDeclarationPass() { processIdentity(); if (axioms & LEFT_ID) leftIdentitySortCheck(); // // If we are commutative, a problem that shows up with rightIdentitySortCheck() // will already have shown up with leftIdentitySortCheck() and the latter is faster. // if (!(axioms & COMM)) { if (axioms & RIGHT_ID) rightIdentitySortCheck(); } } Term* CUI_Symbol::makeTerm(const Vector& args) { return new CUI_Term(this, args); } DagNode* CUI_Symbol::makeDagNode(const Vector& args) { CUI_DagNode* c = new CUI_DagNode(this); c->argArray[0] = args[0]; c->argArray[1] = args[1]; return c; } bool CUI_Symbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); CUI_DagNode* s = static_cast(subject); DagNode** args = s->argArray; if (standardStrategy()) { args[0]->reduce(context); args[1]->reduce(context); if (s->normalizeAtTop()) return false; return !(equationFree()) && applyReplace(s, context); } else { if (isMemoized()) { MemoTable::SourceSet from; bool result = memoStrategy(from, subject, context); memoEnter(from, subject); // // We may need to return true in the case we collapse to a unreduced subterm. // return result; } // // Execute user supplied strategy. // const Vector& userStrategy = getStrategy(); int stratLen = userStrategy.length(); bool seenZero = false; for (int i = 0; i < stratLen; i++) { int a = userStrategy[i]; if(a == 0) { if (!seenZero) { args[0]->computeTrueSort(context); args[1]->computeTrueSort(context); seenZero = true; } // // If we collapse to one of our subterms which has not been // reduced we pretend that we did a rewrite so that the // reduction process continues. // if (s->normalizeAtTop()) return !(s->isReduced()); if ((i + 1 == stratLen) ? applyReplace(s, context) : applyReplaceNoOwise(s, context)) return true; } else { --a; // real arguments start at 0 not 1 if (seenZero) { args[a] = args[a]->copyReducible(); // // A previous call to applyReplace() may have // computed a true sort for our subject which will be // invalidated by the reduce we are about to do. // s->repudiateSortInfo(); } args[a]->reduce(context); } } return false; } } bool CUI_Symbol::memoStrategy(MemoTable::SourceSet& from, DagNode* subject, RewritingContext& context) { CUI_DagNode* s = static_cast(subject); DagNode** args = s->argArray; // // Execute user supplied strategy. // const Vector& userStrategy = getStrategy(); int stratLen = userStrategy.length(); bool seenZero = false; for (int i = 0; i < stratLen; i++) { int a = userStrategy[i]; if(a == 0) { if (!seenZero) { args[0]->computeTrueSort(context); args[1]->computeTrueSort(context); seenZero = true; } // // If we collapse to one of our subterms which has not been // reduced we pretend that we did a rewrite so that the // reduction process continues. // if (s->normalizeAtTop()) return !(s->isReduced()); if (memoRewrite(from, subject, context)) return false; if ((i + 1 == stratLen) ? applyReplace(s, context) : applyReplaceNoOwise(s, context)) { subject->reduce(context); return false; } } else { --a; // real arguments start at 0 not 1 if (seenZero) { args[a] = args[a]->copyReducible(); // // A previous call to applyReplace() may have // computed a true sort for our subject which will be // invalidated by the reduce we are about to do. // s->repudiateSortInfo(); } args[a]->reduce(context); } } return false; } void CUI_Symbol::computeBaseSort(DagNode* subject) { Assert(this == subject->symbol(), "bad symbol"); DagNode** args = static_cast(subject)->argArray; int i0 = args[0]->getSortIndex(); int i1 = args[1]->getSortIndex(); Assert(i0 >= 0 && i1 >= 0, "bad sort index"); subject->setSortIndex(traverse(traverse(0, i0), i1)); } void CUI_Symbol::normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); CUI_DagNode* s = static_cast(subject); DagNode** args = s->argArray; // // Make sure each subterm has a sort. // args[0]->computeTrueSort(context); args[1]->computeTrueSort(context); // // Put subject in normal form (could collapse to a subterm). // if (s->normalizeAtTop()) return; // // Finally compute subjects true sort. // fastComputeTrueSort(subject, context); } void CUI_Symbol::stackArguments(DagNode* subject, Vector& stack, int parentIndex) { DagNode** args = safeCast(CUI_DagNode*, subject)->argArray; const NatSet& frozen = getFrozen(); DagNode* d = args[0]; if (!(frozen.contains(0)) && !(d->isUnstackable())) stack.append(RedexPosition(args[0], parentIndex, 0, eagerArgument(0))); d = args[1]; if (!(frozen.contains(1)) && !(d->isUnstackable())) stack.append(RedexPosition(args[1], parentIndex, 1, eagerArgument(1))); } void CUI_Symbol::setFrozen(const NatSet& frozen) { if (axioms & COMM) setPermuteFrozen(frozen); else BinarySymbol::setFrozen(frozen); } // // Unification code. // void CUI_Symbol::computeGeneralizedSort(const SortBdds& sortBdds, const Vector& realToBdd, DagNode* subject, Vector& generalizedSort) { DagNode** args = safeCast(CUI_DagNode*, subject)->argArray; int varCounter = 0; bddPair* argMap = bdd_newpair(); for (int i = 0; i < 2; i++) { Vector argGenSort; args[i]->computeGeneralizedSort(sortBdds, realToBdd, argGenSort); int nrBdds = argGenSort.size(); for (int j = 0; j < nrBdds; ++j, ++varCounter) bdd_setbddpair(argMap, varCounter, argGenSort[j]); } const Vector& sortFunction = sortBdds.getSortFunction(this); int nrBdds = sortFunction.size(); generalizedSort.resize(nrBdds); for (int i = 0; i < nrBdds; ++i) generalizedSort[i] = bdd_veccompose(sortFunction[i], argMap); bdd_freepair(argMap); } UnificationSubproblem* CUI_Symbol::makeUnificationSubproblem() { return new CUI_UnificationSubproblem(); } // // Hash cons code. // DagNode* CUI_Symbol::makeCanonical(DagNode* original, HashConsSet* hcs) { DagNode** p = safeCast(CUI_DagNode*, original)->argArray; DagNode* d = p[0]; DagNode* c = hcs->getCanonical(hcs->insert(d)); DagNode* d1 = p[1]; DagNode* c1 = hcs->getCanonical(hcs->insert(d1)); if (c == d && c1 == d1) return original; // can use the original dag node as the canonical version // // Need to make new node. // CUI_DagNode* n = new CUI_DagNode(this); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); n->argArray[0] = c; n->argArray[1] = c1; return n; } DagNode* CUI_Symbol::makeCanonicalCopy(DagNode* original, HashConsSet* hcs) { // // We have a unreduced node - copy forced. // CUI_DagNode* n = new CUI_DagNode(this); n->copySetRewritingFlags(original); n->setSortIndex(original->getSortIndex()); DagNode** p = safeCast(CUI_DagNode*, original)->argArray; n->argArray[0] = hcs->getCanonical(hcs->insert(p[0])); n->argArray[1] = hcs->getCanonical(hcs->insert(p[1])); return n; } Maude-2.6/src/CUI_Theory/CUI_DagArgumentIterator.cc0000644000147300135640000000255707666303124017045 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_DagArgumentIterator. // // utility stuff #include "macros.hh" // forward declarations #include "interface.hh" // CUI theory class definitions #include "CUI_DagArgumentIterator.hh" bool CUI_DagArgumentIterator::valid() const { return nrRemaining > 0; } DagNode* CUI_DagArgumentIterator::argument() const { Assert(nrRemaining > 0, "no args left"); return *position; } void CUI_DagArgumentIterator::next() { Assert(nrRemaining > 0, "no args left"); ++position; --nrRemaining; } Maude-2.6/src/CUI_Theory/CUI_LhsCompiler.cc0000644000147300135640000001264107666303124015351 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation of match compilation for theories made from C, Ul, Ur and I axioms. // bool CUI_Term::betterToReverseOrder(NatSet& boundUniquely) const { Term* t0 = argArray[0]; Term* t1 = argArray[1]; NatSet forward(boundUniquely); t0->analyseConstraintPropagation(forward); t1->analyseConstraintPropagation(forward); NatSet reverse(boundUniquely); t1->analyseConstraintPropagation(reverse); t0->analyseConstraintPropagation(reverse); if (reverse.cardinality() > forward.cardinality()) { boundUniquely = reverse; // deep copy return true; } boundUniquely = forward; // deep copy return false; } void CUI_Term::analyseConstraintPropagation(NatSet& boundUniquely) const { // // If any collapse is possible then constraint propagation analysis // becomes extraordinarily complicated; subtle counter-examples // show that we can't guarantee anything in most cases. // Thus we don't bother doing anything. // if (id0CollapsePossible || id1CollapsePossible || idemCollapsePossible) return; Term* t0 = argArray[0]; Term* t1 = argArray[1]; if (t0->ground() || t0->willGroundOutMatch(boundUniquely) || t0->equal(t1)) t1->analyseConstraintPropagation(boundUniquely); else if (t1->ground() || t1->willGroundOutMatch(boundUniquely)) t0->analyseConstraintPropagation(boundUniquely); else if (!(symbol()->comm()) || t0->matchIndependent(t1)) (void) betterToReverseOrder(boundUniquely); } LhsAutomaton* CUI_Term::compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely) { // // Check to see if greedy matching is safe. // bool greedy = greedySafe(variableInfo, boundUniquely); int flags = greedy ? CUI_LhsAutomaton::GREEDY_MATCH_OK : 0; Term* t0 = argArray[0]; Term* t1 = argArray[1]; bool comm = symbol()->comm(); bool uniqueBranch = false; bool subtermsEqual = t0->equal(t1); bool swap = false; // // We need to decide whether to swap our arguments for matching // and whether we have a unique branch. // if (id0CollapsePossible || id1CollapsePossible || idemCollapsePossible) { // // Collapse case. // if (comm && dynamic_cast(t0) != 0 && dynamic_cast(t1) == 0) swap = true; // match variable last to heuristically improve substitution else if (matchAtTop && idemCollapsePossible && t1->ground()) { Assert(!(t0->ground()), "can't have idem collapse with two ground terms"); swap = true; } } else { // // Non-collapse case. // if (t0->ground() || t0->willGroundOutMatch(boundUniquely) || subtermsEqual) uniqueBranch = true; else if (t1->ground() || t1->willGroundOutMatch(boundUniquely)) { uniqueBranch = true; swap = true; } else if (!comm || t0->matchIndependent(t1)) { uniqueBranch = true; NatSet local(boundUniquely); swap = betterToReverseOrder(local); } else if (dynamic_cast(t0) != 0 && dynamic_cast(t1) == 0) swap = true; // match variable last to heuristically improve substitution if (uniqueBranch) flags |= CUI_LhsAutomaton::UNIQUE_BRANCH; } // // Now we decide on whether to match forward and/or reverse. // if (!comm || (t0->stable() && t1->stable() && t0->symbol() != t1->symbol())) flags |= swap ? CUI_LhsAutomaton::REVERSE : CUI_LhsAutomaton::FORWARD; else { flags |= CUI_LhsAutomaton::FORWARD; if (symbol()->idem()) flags |= CUI_LhsAutomaton::REVERSE; else if (!subtermsEqual) flags |= CUI_LhsAutomaton::CONDITIONAL_REVERSE; } // // Swap arguments and enter collapse info into flags. // if (swap) { Term* t = t0; t0 = t1; t1 = t; if (id0CollapsePossible) flags |= CUI_LhsAutomaton::ID1_COLLAPSE; if (id1CollapsePossible) flags |= CUI_LhsAutomaton::ID0_COLLAPSE; } else { if (id0CollapsePossible) flags |= CUI_LhsAutomaton::ID0_COLLAPSE; if (id1CollapsePossible) flags |= CUI_LhsAutomaton::ID1_COLLAPSE; } if (idemCollapsePossible) flags |= CUI_LhsAutomaton::IDEM_COLLAPSE; // // Construct CUI automaton and determine likelihood that it will return a // subproblem at match time. // CUI_LhsAutomaton* a = new CUI_LhsAutomaton(symbol(), matchAtTop, static_cast(flags), variableInfo.getNrProtectedVariables()); bool spl = a->addSubpattern(t0, variableInfo, boundUniquely); spl = a->addSubpattern(t1, variableInfo, boundUniquely) || spl; subproblemLikely = spl || (!uniqueBranch && !greedy); return a; } Maude-2.6/src/CUI_Theory/CUI_Term.cc0000644000147300135640000002005510272243551014027 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_Term. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "CUI_Theory.hh" // interface class definitions #include "binarySymbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "rewritingContext.hh" #include "equation.hh" #include "symbolMap.hh" #include "termBag.hh" #include "rhsBuilder.hh" // variable class definitions #include "variableTerm.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" #include "CUI_Term.hh" #include "CUI_ArgumentIterator.hh" #include "CUI_LhsAutomaton.hh" #include "CUI_RhsAutomaton.hh" #include "CUI_LhsCompiler.cc" CUI_Term::CUI_Term(CUI_Symbol* symbol, const Vector& arguments) : Term(symbol), argArray(2) { Assert(arguments.length() == 2, "bad number of arguments for " << symbol); argArray[0] = arguments[0]; argArray[1] = arguments[1]; } CUI_Term::CUI_Term(const CUI_Term& original, CUI_Symbol* symbol, SymbolMap* translator) : Term(symbol), argArray(2) { argArray[0] = original.argArray[0]->deepCopy(translator); argArray[1] = original.argArray[1]->deepCopy(translator); } RawArgumentIterator* CUI_Term::arguments() { return new CUI_ArgumentIterator(argArray); } void CUI_Term::deepSelfDestruct() { argArray[0]->deepSelfDestruct(); argArray[1]->deepSelfDestruct(); delete this; } Term* CUI_Term::deepCopy2(SymbolMap* translator) const { CUI_Symbol* s = symbol(); if (translator != 0) { Symbol* s2 = translator->translate(s); if (s2 == 0) return translator->translateTerm(this); s = dynamic_cast(s2); if (s == 0) { Vector args(2); args[0] = argArray[0]->deepCopy(translator); args[1] = argArray[1]->deepCopy(translator); return s2->makeTerm(args); } } return new CUI_Term(*this, s, translator); } Term* CUI_Term::collapseTo(int argNr) { argArray[1 - argNr]->deepSelfDestruct(); Term* r = argArray[argNr]; delete this; return r; } Term* CUI_Term::normalize(bool full, bool& changed) { argArray[0] = argArray[0]->normalize(full, changed); bool subtermChanged; argArray[1] = argArray[1]->normalize(full, subtermChanged); if (subtermChanged) changed = true; CUI_Symbol* s = symbol(); Term* identity = s->getIdentity(); if (identity != 0) { if (s->leftId() && identity->equal(argArray[0])) { changed = true; return collapseTo(1); } if (s->rightId() && identity->equal(argArray[1])) { changed = true; return collapseTo(0); } } if (s->comm() || s->idem()) { int r = argArray[0]->compare(argArray[1]); if (s->idem() && r == 0) { changed = true; return collapseTo(0); } if (s->comm() && r > 0) { changed = true; Term* t = argArray[0]; argArray[0] = argArray[1]; argArray[1] = t; } } unsigned int hashValue = symbol()->getHashValue(); hashValue = hash(hashValue, argArray[0]->getHashValue()); setHashValue(hash(hashValue, argArray[1]->getHashValue())); return this; } int CUI_Term::compareArguments(const Term* other) const { const Vector& argArray2 = static_cast(other)->argArray; int r = argArray[0]->compare(argArray2[0]); if (r != 0) return r; return argArray[1]->compare(argArray2[1]); } int CUI_Term::compareArguments(const DagNode* other) const { const CUI_DagNode* d = static_cast(other); int r = argArray[0]->compare(d->argArray[0]); if (r != 0) return r; return argArray[1]->compare(d->argArray[1]); } void CUI_Term::findEagerVariables(bool atTop, NatSet& eagerVariables) const { CUI_Symbol* s = symbol(); if (atTop ? s->eagerArgument(0) : s->evaluatedArgument(0)) argArray[0]->findEagerVariables(false, eagerVariables); if (atTop ? s->eagerArgument(1) : s->evaluatedArgument(1)) argArray[1]->findEagerVariables(false, eagerVariables); } void CUI_Term::markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables) { CUI_Symbol* s = symbol(); if (s->eagerArgument(0)) argArray[0]->markEager(nrVariables, eagerVariables, problemVariables); if (s->eagerArgument(1)) argArray[1]->markEager(nrVariables, eagerVariables, problemVariables); } DagNode* CUI_Term::dagify2() { CUI_DagNode* d = new CUI_DagNode(symbol()); d->argArray[0] = argArray[0]->dagify(); d->argArray[1] = argArray[1]->dagify(); return d; } void CUI_Term::analyseCollapses2() { Term* t0 = argArray[0]; Term* t1 = argArray[1]; t0->analyseCollapses(); t1->analyseCollapses(); CUI_Symbol* topSymbol = symbol(); id0CollapsePossible = false; if (topSymbol->leftId() && topSymbol->mightMatchOurIdentity(t0)) { addCollapseSymbol(t1->symbol()); addCollapseSymbols(t1->collapseSymbols()); id0CollapsePossible = true; } id1CollapsePossible = false; if (topSymbol->rightId() && topSymbol->mightMatchOurIdentity(t1)) { addCollapseSymbol(t0->symbol()); addCollapseSymbols(t0->collapseSymbols()); id1CollapsePossible = true; } idemCollapsePossible = false; if (topSymbol->idem() && !(t0->matchIndependent(t1))) { PointerSet symbols; Term::commonSymbols(argArray, symbols); if (!(symbols.empty())) { addCollapseSymbols(symbols); idemCollapsePossible = true; } } } #ifdef DUMP void CUI_Term::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{CUI_Term}\n"; ++indentLevel; dumpCommon(s, variableInfo, indentLevel); s << Indent(indentLevel) << "id0CollapsePossible = " << id0CollapsePossible << "\tid1CollapsePossible = " << id1CollapsePossible << "\tidemCollapsePossible = " << idemCollapsePossible << '\n'; s << Indent(indentLevel) << "arguments:\n"; ++indentLevel; argArray[0]->dump(s, variableInfo, indentLevel); argArray[1]->dump(s, variableInfo, indentLevel); s << Indent(indentLevel - 2) << "End{CUI_Term}\n"; } #endif void CUI_Term::findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop) { if (ground()) return; CUI_Symbol* s = symbol(); if (!atTop) availableTerms.insertMatchedTerm(this, eagerContext); argArray[0]->findAvailableTerms(availableTerms, eagerContext && (atTop ? s->eagerArgument(0) : s->evaluatedArgument(0))); argArray[1]->findAvailableTerms(availableTerms, eagerContext && (atTop ? s->eagerArgument(1) : s->evaluatedArgument(1))); } int CUI_Term::compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext) { CUI_Symbol* s = symbol(); CUI_RhsAutomaton* automaton = new CUI_RhsAutomaton(s); int i0 = argArray[0]->compileRhs(rhsBuilder, variableInfo, availableTerms, eagerContext && s->eagerArgument(0)); int i1 = argArray[1]->compileRhs(rhsBuilder, variableInfo, availableTerms, eagerContext && s->eagerArgument(1)); // // Need to flag last use of each source. // variableInfo.useIndex(i0); variableInfo.useIndex(i1); int index = variableInfo.makeConstructionIndex(); automaton->close(i0, i1, index); rhsBuilder.addRhsAutomaton(automaton); return index; } Maude-2.6/src/CUI_Theory/Makefile.in0000644000147300135640000007763711500303154014167 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/CUI_Theory DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libCUI_Theory_a_AR = $(AR) $(ARFLAGS) libCUI_Theory_a_LIBADD = am_libCUI_Theory_a_OBJECTS = libCUI_Theory_a-CUI_Symbol.$(OBJEXT) \ libCUI_Theory_a-CUI_DagNode.$(OBJEXT) \ libCUI_Theory_a-CUI_DagArgumentIterator.$(OBJEXT) \ libCUI_Theory_a-CUI_RhsAutomaton.$(OBJEXT) \ libCUI_Theory_a-CUI_Term.$(OBJEXT) \ libCUI_Theory_a-CUI_ArgumentIterator.$(OBJEXT) \ libCUI_Theory_a-CUI_UnificationSubproblem.$(OBJEXT) \ libCUI_Theory_a-CUI_LhsAutomaton.$(OBJEXT) libCUI_Theory_a_OBJECTS = $(am_libCUI_Theory_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libCUI_Theory_a_SOURCES) DIST_SOURCES = $(libCUI_Theory_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libCUI_Theory.a libCUI_Theory_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libCUI_Theory_a_SOURCES = \ CUI_Symbol.cc \ CUI_DagNode.cc \ CUI_DagArgumentIterator.cc \ CUI_RhsAutomaton.cc \ CUI_Term.cc \ CUI_ArgumentIterator.cc \ CUI_UnificationSubproblem.cc \ CUI_LhsAutomaton.cc EXTRA_DIST = \ CUI_LhsCompiler.cc \ CUI_Matcher.cc noinst_HEADERS = \ CUI_ArgumentIterator.hh \ CUI_DagArgumentIterator.hh \ CUI_DagNode.hh \ CUI_LhsAutomaton.hh \ CUI_RhsAutomaton.hh \ CUI_Symbol.hh \ CUI_Term.hh \ CUI_UnificationSubproblem.hh \ CUI_Theory.hh all: all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/CUI_Theory/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/CUI_Theory/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libCUI_Theory.a: $(libCUI_Theory_a_OBJECTS) $(libCUI_Theory_a_DEPENDENCIES) -rm -f libCUI_Theory.a $(libCUI_Theory_a_AR) libCUI_Theory.a $(libCUI_Theory_a_OBJECTS) $(libCUI_Theory_a_LIBADD) $(RANLIB) libCUI_Theory.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_Term.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libCUI_Theory_a-CUI_Symbol.o: CUI_Symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_Symbol.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Tpo" -c -o libCUI_Theory_a-CUI_Symbol.o `test -f 'CUI_Symbol.cc' || echo '$(srcdir)/'`CUI_Symbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_Symbol.cc' object='libCUI_Theory_a-CUI_Symbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_Symbol.o `test -f 'CUI_Symbol.cc' || echo '$(srcdir)/'`CUI_Symbol.cc libCUI_Theory_a-CUI_Symbol.obj: CUI_Symbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_Symbol.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Tpo" -c -o libCUI_Theory_a-CUI_Symbol.obj `if test -f 'CUI_Symbol.cc'; then $(CYGPATH_W) 'CUI_Symbol.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_Symbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_Symbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_Symbol.cc' object='libCUI_Theory_a-CUI_Symbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_Symbol.obj `if test -f 'CUI_Symbol.cc'; then $(CYGPATH_W) 'CUI_Symbol.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_Symbol.cc'; fi` libCUI_Theory_a-CUI_DagNode.o: CUI_DagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_DagNode.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Tpo" -c -o libCUI_Theory_a-CUI_DagNode.o `test -f 'CUI_DagNode.cc' || echo '$(srcdir)/'`CUI_DagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_DagNode.cc' object='libCUI_Theory_a-CUI_DagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_DagNode.o `test -f 'CUI_DagNode.cc' || echo '$(srcdir)/'`CUI_DagNode.cc libCUI_Theory_a-CUI_DagNode.obj: CUI_DagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_DagNode.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Tpo" -c -o libCUI_Theory_a-CUI_DagNode.obj `if test -f 'CUI_DagNode.cc'; then $(CYGPATH_W) 'CUI_DagNode.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_DagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_DagNode.cc' object='libCUI_Theory_a-CUI_DagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_DagNode.obj `if test -f 'CUI_DagNode.cc'; then $(CYGPATH_W) 'CUI_DagNode.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_DagNode.cc'; fi` libCUI_Theory_a-CUI_DagArgumentIterator.o: CUI_DagArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_DagArgumentIterator.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Tpo" -c -o libCUI_Theory_a-CUI_DagArgumentIterator.o `test -f 'CUI_DagArgumentIterator.cc' || echo '$(srcdir)/'`CUI_DagArgumentIterator.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_DagArgumentIterator.cc' object='libCUI_Theory_a-CUI_DagArgumentIterator.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_DagArgumentIterator.o `test -f 'CUI_DagArgumentIterator.cc' || echo '$(srcdir)/'`CUI_DagArgumentIterator.cc libCUI_Theory_a-CUI_DagArgumentIterator.obj: CUI_DagArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_DagArgumentIterator.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Tpo" -c -o libCUI_Theory_a-CUI_DagArgumentIterator.obj `if test -f 'CUI_DagArgumentIterator.cc'; then $(CYGPATH_W) 'CUI_DagArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_DagArgumentIterator.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_DagArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_DagArgumentIterator.cc' object='libCUI_Theory_a-CUI_DagArgumentIterator.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_DagArgumentIterator.obj `if test -f 'CUI_DagArgumentIterator.cc'; then $(CYGPATH_W) 'CUI_DagArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_DagArgumentIterator.cc'; fi` libCUI_Theory_a-CUI_RhsAutomaton.o: CUI_RhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_RhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Tpo" -c -o libCUI_Theory_a-CUI_RhsAutomaton.o `test -f 'CUI_RhsAutomaton.cc' || echo '$(srcdir)/'`CUI_RhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_RhsAutomaton.cc' object='libCUI_Theory_a-CUI_RhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_RhsAutomaton.o `test -f 'CUI_RhsAutomaton.cc' || echo '$(srcdir)/'`CUI_RhsAutomaton.cc libCUI_Theory_a-CUI_RhsAutomaton.obj: CUI_RhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_RhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Tpo" -c -o libCUI_Theory_a-CUI_RhsAutomaton.obj `if test -f 'CUI_RhsAutomaton.cc'; then $(CYGPATH_W) 'CUI_RhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_RhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_RhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_RhsAutomaton.cc' object='libCUI_Theory_a-CUI_RhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_RhsAutomaton.obj `if test -f 'CUI_RhsAutomaton.cc'; then $(CYGPATH_W) 'CUI_RhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_RhsAutomaton.cc'; fi` libCUI_Theory_a-CUI_Term.o: CUI_Term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_Term.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Tpo" -c -o libCUI_Theory_a-CUI_Term.o `test -f 'CUI_Term.cc' || echo '$(srcdir)/'`CUI_Term.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_Term.cc' object='libCUI_Theory_a-CUI_Term.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_Term.o `test -f 'CUI_Term.cc' || echo '$(srcdir)/'`CUI_Term.cc libCUI_Theory_a-CUI_Term.obj: CUI_Term.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_Term.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Tpo" -c -o libCUI_Theory_a-CUI_Term.obj `if test -f 'CUI_Term.cc'; then $(CYGPATH_W) 'CUI_Term.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_Term.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_Term.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_Term.cc' object='libCUI_Theory_a-CUI_Term.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_Term.obj `if test -f 'CUI_Term.cc'; then $(CYGPATH_W) 'CUI_Term.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_Term.cc'; fi` libCUI_Theory_a-CUI_ArgumentIterator.o: CUI_ArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_ArgumentIterator.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Tpo" -c -o libCUI_Theory_a-CUI_ArgumentIterator.o `test -f 'CUI_ArgumentIterator.cc' || echo '$(srcdir)/'`CUI_ArgumentIterator.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_ArgumentIterator.cc' object='libCUI_Theory_a-CUI_ArgumentIterator.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_ArgumentIterator.o `test -f 'CUI_ArgumentIterator.cc' || echo '$(srcdir)/'`CUI_ArgumentIterator.cc libCUI_Theory_a-CUI_ArgumentIterator.obj: CUI_ArgumentIterator.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_ArgumentIterator.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Tpo" -c -o libCUI_Theory_a-CUI_ArgumentIterator.obj `if test -f 'CUI_ArgumentIterator.cc'; then $(CYGPATH_W) 'CUI_ArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_ArgumentIterator.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_ArgumentIterator.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_ArgumentIterator.cc' object='libCUI_Theory_a-CUI_ArgumentIterator.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_ArgumentIterator.obj `if test -f 'CUI_ArgumentIterator.cc'; then $(CYGPATH_W) 'CUI_ArgumentIterator.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_ArgumentIterator.cc'; fi` libCUI_Theory_a-CUI_UnificationSubproblem.o: CUI_UnificationSubproblem.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_UnificationSubproblem.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Tpo" -c -o libCUI_Theory_a-CUI_UnificationSubproblem.o `test -f 'CUI_UnificationSubproblem.cc' || echo '$(srcdir)/'`CUI_UnificationSubproblem.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_UnificationSubproblem.cc' object='libCUI_Theory_a-CUI_UnificationSubproblem.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_UnificationSubproblem.o `test -f 'CUI_UnificationSubproblem.cc' || echo '$(srcdir)/'`CUI_UnificationSubproblem.cc libCUI_Theory_a-CUI_UnificationSubproblem.obj: CUI_UnificationSubproblem.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_UnificationSubproblem.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Tpo" -c -o libCUI_Theory_a-CUI_UnificationSubproblem.obj `if test -f 'CUI_UnificationSubproblem.cc'; then $(CYGPATH_W) 'CUI_UnificationSubproblem.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_UnificationSubproblem.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_UnificationSubproblem.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_UnificationSubproblem.cc' object='libCUI_Theory_a-CUI_UnificationSubproblem.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_UnificationSubproblem.obj `if test -f 'CUI_UnificationSubproblem.cc'; then $(CYGPATH_W) 'CUI_UnificationSubproblem.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_UnificationSubproblem.cc'; fi` libCUI_Theory_a-CUI_LhsAutomaton.o: CUI_LhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_LhsAutomaton.o -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Tpo" -c -o libCUI_Theory_a-CUI_LhsAutomaton.o `test -f 'CUI_LhsAutomaton.cc' || echo '$(srcdir)/'`CUI_LhsAutomaton.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_LhsAutomaton.cc' object='libCUI_Theory_a-CUI_LhsAutomaton.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_LhsAutomaton.o `test -f 'CUI_LhsAutomaton.cc' || echo '$(srcdir)/'`CUI_LhsAutomaton.cc libCUI_Theory_a-CUI_LhsAutomaton.obj: CUI_LhsAutomaton.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libCUI_Theory_a-CUI_LhsAutomaton.obj -MD -MP -MF "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Tpo" -c -o libCUI_Theory_a-CUI_LhsAutomaton.obj `if test -f 'CUI_LhsAutomaton.cc'; then $(CYGPATH_W) 'CUI_LhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_LhsAutomaton.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Tpo" "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Po"; else rm -f "$(DEPDIR)/libCUI_Theory_a-CUI_LhsAutomaton.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CUI_LhsAutomaton.cc' object='libCUI_Theory_a-CUI_LhsAutomaton.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libCUI_Theory_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libCUI_Theory_a-CUI_LhsAutomaton.obj `if test -f 'CUI_LhsAutomaton.cc'; then $(CYGPATH_W) 'CUI_LhsAutomaton.cc'; else $(CYGPATH_W) '$(srcdir)/CUI_LhsAutomaton.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/CUI_Theory/CUI_DagNode.cc0000644000147300135640000003101611433104462014415 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_DagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "CUI_Theory.hh" // interface class definitions #include "binarySymbol.hh" #include "dagNode.hh" #include "term.hh" #include "rawDagArgumentIterator.hh" #include "lhsAutomaton.hh" #include "rhsAutomaton.hh" #include "subproblem.hh" #include "extensionInfo.hh" // core class definitions #include "substitution.hh" #include "pendingUnificationStack.hh" #include "unificationContext.hh" // variable class definitions #include "variableDagNode.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" #include "CUI_DagArgumentIterator.hh" RawDagArgumentIterator* CUI_DagNode::arguments() { return new CUI_DagArgumentIterator(argArray); } size_t CUI_DagNode::getHashValue() { if (isHashValid()) return hashCache; size_t hashValue = hash(hash(symbol()->getHashValue(), argArray[0]->getHashValue()), argArray[1]->getHashValue()); hashCache = hashValue; setHashValid(); return hashValue; } int CUI_DagNode::compareArguments(const DagNode* other) const { const CUI_DagNode* d = static_cast(other); int r = argArray[0]->compare(d->argArray[0]); if (r != 0) return r; return argArray[1]->compare(d->argArray[1]); } DagNode* CUI_DagNode::markArguments() { argArray[0]->mark(); return argArray[1]; } DagNode* CUI_DagNode::copyEagerUptoReduced2() { CUI_Symbol* s = symbol(); CUI_DagNode* n = new CUI_DagNode(s); n->argArray[0] = s->eagerArgument(0) ? argArray[0]->copyEagerUptoReduced() : argArray[0]; n->argArray[1] = s->eagerArgument(1) ? argArray[1]->copyEagerUptoReduced() : argArray[1]; return n; } void CUI_DagNode::clearCopyPointers2() { argArray[0]->clearCopyPointers(); argArray[1]->clearCopyPointers(); } void CUI_DagNode::overwriteWithClone(DagNode* old) { CUI_DagNode* d = new(old) CUI_DagNode(symbol()); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); d->argArray[0] = argArray[0]; d->argArray[1] = argArray[1]; } DagNode* CUI_DagNode::makeClone() { CUI_DagNode* d = new CUI_DagNode(symbol()); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); d->argArray[0] = argArray[0]; d->argArray[1] = argArray[1]; return d; } DagNode* CUI_DagNode::copyWithReplacement(int argIndex, DagNode* replacement) { CUI_DagNode* d = new CUI_DagNode(symbol()); if (argIndex == 0) { d->argArray[0] = replacement; d->argArray[1] = argArray[1]; } else { Assert(argIndex == 1, "bad argument index"); d->argArray[0] = argArray[0]; d->argArray[1] = replacement; } return d; } DagNode* CUI_DagNode::copyWithReplacement(Vector& redexStack, int first, int last) { if (first == last) return copyWithReplacement(redexStack[first].argIndex(), redexStack[first].node()); Assert(first + 1 == last, "nrArgs clash"); CUI_DagNode* d = new CUI_DagNode(symbol()); d->argArray[0] = redexStack[first].node(); d->argArray[1] = redexStack[last].node(); return d; } void CUI_DagNode::stackArguments(Vector& stack, int parentIndex, bool respectFrozen) { /* DebugAdvisory("CUI_DagNode::stackArguments() " << this << " left = " << argArray[0]->isUnstackable() << " right = " << argArray[1]->isUnstackable()); */ const NatSet& frozen = symbol()->getFrozen(); DagNode* d = argArray[0]; if (!(respectFrozen && frozen.contains(0)) && !(d->isUnstackable())) stack.append(RedexPosition(d, parentIndex, 0)); DagNode* d2 = argArray[1]; if (!(respectFrozen && frozen.contains(1)) && !(d2->isUnstackable()) && !(symbol()->comm() && d->equal(d2))) // don't stack equal args in the comm case stack.append(RedexPosition(d2, parentIndex, 1)); } void CUI_DagNode::collapseTo(int argNr) { DagNode* remaining = (symbol()->eagerArgument(argNr)) ? argArray[argNr] : argArray[argNr]->copyReducible(); remaining->overwriteWithClone(this); } bool CUI_DagNode::normalizeAtTop() { CUI_Symbol* s = symbol(); Term* identity = s->getIdentity(); if (identity != 0) { if (s->leftId() && identity->equal(argArray[0])) { collapseTo(1); return true; } if (s->rightId() && identity->equal(argArray[1])) { collapseTo(0); return true; } } if (s->comm() || s->idem()) { int r = argArray[0]->compare(argArray[1]); if (s->idem() && r == 0) { collapseTo(0); return true; } if (s->comm() && r > 0) { DagNode* t = argArray[0]; argArray[0] = argArray[1]; argArray[1] = t; } } return false; } // // Unification code. // DagNode::ReturnResult CUI_DagNode::computeBaseSortForGroundSubterms() { CUI_Symbol* s = symbol(); if (s->leftId() || s->rightId() || s->idem()) { // // We only support unification for commutativity at the moment // so let the backstop version handle it. // return DagNode::computeBaseSortForGroundSubterms(); } ReturnResult r0 = argArray[0]->computeBaseSortForGroundSubterms(); if (r0 == UNIMPLEMENTED) return UNIMPLEMENTED; ReturnResult r1 = argArray[1]->computeBaseSortForGroundSubterms(); if (r1 == UNIMPLEMENTED) return UNIMPLEMENTED; if (r0 == GROUND && r1 == GROUND) { s->computeBaseSort(this); return GROUND; } return NONGROUND; } bool CUI_DagNode::computeSolvedForm2(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending) { CUI_Symbol* s = symbol(); if (s == rhs->symbol()) { // // Both dagnodes are assumed to have their arguments sorted in ascending order. Equality // between any two of the four arguments eliminates the need for branching. // DagNode** rhsArgs = safeCast(CUI_DagNode*, rhs)->argArray; DagNode* l0 = argArray[0]; DagNode* l1 = argArray[1]; DagNode* r0 = rhsArgs[0]; DagNode* r1 = rhsArgs[1]; // // We know l0 <= l1 and r0 <= r1 because of normal forms. We will decide if at least one of // the 6 possible equalities holds in at most 4 comparisons. // int r = l0->compare(r0); if (r == 0) return l1->computeSolvedForm(r1, solution, pending); if (r < 0) { r = l1->compare(r0); if (r == 0) return l0->computeSolvedForm(r1, solution, pending); if (r < 0) { // // We have l0 <= l1 < r0 <= r1 so we just check the two inequalities. // if (l0->equal(l1) || r0->equal(r1)) goto dupArg; } else { r = l1->compare(r1); if (r == 0) return l0->computeSolvedForm(r0, solution, pending); if (r < 0) { // // We have l0 < r0 < l1 < r1. No equalities possible. // } else { // // We have l0 < r0 < l1 and r1 < l1. So r0 <= r1 is our only possible equality. // if (r0->equal(r1)) goto dupArg; } } } else { r = l0->compare(r1); if (r == 0) return l1->computeSolvedForm(r0, solution, pending); if (r < 0) { r = l1->compare(r1); if (r == 0) return l0->computeSolvedForm(r0, solution, pending); if (r < 0) { // // We have r0 < l0 < r1 and l1 < r1. So l0 <= l1 is our only possible equality. // if (l0->equal(l1)) goto dupArg; } else { // // We have r0 < l0 < r1 < l1. No equalities possible. // } } else { // // We have r0 <= r1 < l0 <= l1 so we just check the two inequalities. // if (l0->equal(l1) || r0->equal(r1)) goto dupArg; } } // // We got here by falling out of one of the branches because no equalities were found. Therefore // we have two possible ways of unifying that could give a mgu and need to postpone the decision. // pending.push(s, this, rhs); return true; dupArg: // // We got here because one side of the problem had duplicate arguments. // return l0->computeSolvedForm(r0, solution, pending) && l1->computeSolvedForm(r1, solution, pending); } if (VariableDagNode* v = dynamic_cast(rhs)) { // // Get representative variable. // VariableDagNode* r = v->lastVariableInChain(solution); if (DagNode* value = solution.value(r->getIndex())) return computeSolvedForm2(value, solution, pending); // // We need to bind the variable our purified form. // // We cut a corner here by treating each commutative symbol as its // own theory, and rely on cycle detection to do occurs checks that // pass through multiple symbols. // bool needToRebuild = false; DagNode* l0 = argArray[0]; if (VariableDagNode* a = dynamic_cast(l0)) { if (a->lastVariableInChain(solution)->equal(r)) return false; // occurs check fail } else { VariableDagNode* abstractionVariable = solution.makeFreshVariable(s->domainComponent(0)); // // solution.unificationBind(abstractionVariable, l0) would be unsafe since l0 might not be pure. // l0->computeSolvedForm(abstractionVariable, solution, pending); l0 = abstractionVariable; needToRebuild = true; } DagNode* l1 = argArray[1]; if (l1->equal(argArray[0])) l1 = l0; // arguments equal so treat them the same in purified version else { if (VariableDagNode* a = dynamic_cast(l1)) { if (a->lastVariableInChain(solution)->equal(r)) return false; // occurs check fail } else { VariableDagNode* abstractionVariable = solution.makeFreshVariable(s->domainComponent(1)); // // solution.unificationBind(abstractionVariable, l1) would be unsafe since l1 might not be pure. // l1->computeSolvedForm(abstractionVariable, solution, pending); l1 = abstractionVariable; needToRebuild = true; } } CUI_DagNode* purified = this; if (needToRebuild) { purified = new CUI_DagNode(s); if (l0->compare(l1) <= 0) { purified->argArray[0] = l0; purified->argArray[1] = l1; } else { purified->argArray[0] = l1; purified->argArray[1] = l0; } } solution.unificationBind(r, purified); return true; } return pending.resolveTheoryClash(this, rhs); } void CUI_DagNode::insertVariables2(NatSet& occurs) { argArray[0]->insertVariables(occurs); argArray[1]->insertVariables(occurs); } DagNode* CUI_DagNode::instantiate2(const Substitution& substitution) { bool changed = false; DagNode* a0 = argArray[0]; if (DagNode* n = a0->instantiate(substitution)) { a0 = n; changed = true; } DagNode* a1 = argArray[1]; if (DagNode* n = a1->instantiate(substitution)) { a1 = n; changed = true; } if (changed) { CUI_Symbol* s = symbol(); CUI_DagNode* d = new CUI_DagNode(s); d->argArray[0] = a0; d->argArray[1] = a1; if(!(d->normalizeAtTop()) && a0->isGround() && a1->isGround()) { s->computeBaseSort(d); d->setGround(); } return d; } return 0; } // // Narrowing code. // bool CUI_DagNode::indexVariables2(NarrowingVariableInfo& indices, int baseIndex) { return argArray[0]->indexVariables(indices, baseIndex) & // always make both calls argArray[1]->indexVariables(indices, baseIndex); } DagNode* CUI_DagNode::instantiateWithReplacement(const Substitution& substitution, int argIndex, DagNode* replacement) { CUI_DagNode* d = new CUI_DagNode(symbol()); int other = 1 - argIndex; d->argArray[argIndex] = replacement; DagNode* n = argArray[other]; if (DagNode* c = n->instantiate(substitution)) // changed under substitutition n = c; d->argArray[other] = n; return d; } Maude-2.6/src/CUI_Theory/CUI_LhsAutomaton.hh0000644000147300135640000001147507666303124015564 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for left hand side automata for theories made from C, Ul, Ur and I axioms. // #ifndef _CUI_LhsAutomaton_hh_ #define _CUI_LhsAutomaton_hh_ #include "lhsAutomaton.hh" class CUI_LhsAutomaton : public LhsAutomaton { NO_COPYING(CUI_LhsAutomaton); public: enum Flags { GREEDY_MATCH_OK = 1, UNIQUE_BRANCH = 2, FORWARD = 4, REVERSE = 8, CONDITIONAL_REVERSE = 16, ID0_COLLAPSE = 32, // Collapse to subpattern1 possible ID1_COLLAPSE = 64, // Collapse to subpattern0 possible IDEM_COLLAPSE = 128, COLLAPSE = ID0_COLLAPSE | ID1_COLLAPSE | IDEM_COLLAPSE }; CUI_LhsAutomaton(CUI_Symbol* topSymbol, bool matchAtTop, Flags flags, int nrVariables); ~CUI_LhsAutomaton(); bool addSubpattern(Term* term, const VariableInfo& variableInfo, NatSet& boundUniquely); // // Standard LhsAutomaton operations. // bool match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: enum PatternType { UNDEFINED, GROUND_ALIEN, VARIABLE, NON_GROUND_ALIEN }; struct Subpattern { bool match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, bool matchAtTop = false, ExtensionInfo* extensionInfo = 0); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif PatternType type; union { Term* term; // for ground aliens int varIndex; // for variables }; LhsAutomaton* automaton; // for non ground aliens (and sometimes variables) LhsAutomaton* topAutomaton; // for when we match whole subject at top Sort* sort; // for variables only }; bool freeMatch(DagNode* subject0, DagNode* subject1, Substitution& solution, Subproblem*& returnedSubproblem); bool id0CollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); bool id1CollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); bool idemCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem); bool idemCollapseMatch(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, ExtensionInfo* extensionInfo); CUI_Symbol* const topSymbol; const bool matchAtTop; const Flags flags; Subpattern subpattern0; Subpattern subpattern1; // // Data storage for match-time use // Substitution local; friend ostream& operator<<(ostream& s, PatternType type); }; inline bool CUI_LhsAutomaton::Subpattern::match(DagNode* subject, Substitution& solution, Subproblem*& returnedSubproblem, bool matchAtTop, ExtensionInfo* extensionInfo) { if (matchAtTop) { // // Even if the subject has no extension, the top automaton may // need to do something special; like clone the subject's top // node if it gets assigned to a variable that occurs in the // rhs of an equation to avoid intoducing loop into dag. // return topAutomaton->match(subject, solution, returnedSubproblem, extensionInfo); } else if (type == VARIABLE) { DagNode* d = solution.value(varIndex); if (d == 0) { if (subject->checkSort(sort, returnedSubproblem)) { solution.bind(varIndex, subject); return true; } return false; } else { returnedSubproblem = 0; return subject->equal(d); } } else if (type == GROUND_ALIEN) { returnedSubproblem = 0; return term->equal(subject); } return automaton->match(subject, solution, returnedSubproblem); } #ifdef DUMP ostream& operator<<(ostream& s, CUI_LhsAutomaton::Flags flags); ostream& operator<<(ostream& s, CUI_LhsAutomaton::PatternType type); #endif #endif Maude-2.6/src/CUI_Theory/CUI_DagNode.hh0000644000147300135640000000637211433104413014432 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for DAG nodes belonging to theories made from C, Ul, Ur and I axioms. // #ifndef _CUI_DagNode_hh_ #define _CUI_DagNode_hh_ #include "dagNode.hh" class CUI_DagNode : public DagNode { public: CUI_DagNode(CUI_Symbol* symbol); // // Member functions required by theory interface. // RawDagArgumentIterator* arguments(); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); DagNode* copyWithReplacement(int argIndex, DagNode* replacement); DagNode* copyWithReplacement(Vector& redexStack, int first, int last); void stackArguments(Vector& stack, int parentIndex, bool respectFrozen); // // Unification member functions. // ReturnResult computeBaseSortForGroundSubterms(); bool computeSolvedForm2(DagNode* rhs, UnificationContext& solution, PendingUnificationStack& pending); void insertVariables2(NatSet& occurs); DagNode* instantiate2(const Substitution& substitution); // // Interface for narrowing. // bool indexVariables2(NarrowingVariableInfo& indices, int baseIndex); DagNode* instantiateWithReplacement(const Substitution& substitution, int argIndex, DagNode* newDag); // // Functions particular to CUI_DagNode. // CUI_Symbol* symbol() const; DagNode* getArgument(int i) const; private: // // Theory interface functions. // DagNode* markArguments(); DagNode* copyEagerUptoReduced2(); void clearCopyPointers2(); // // Normalization functions. // void collapseTo(int argNr); bool normalizeAtTop(); // // Arguments under CUI symbol. // DagNode* argArray[2]; // // Slot for caching hash value. // size_t hashCache; // // Most related classes need direct access to our argument list for efficiency. // friend class CUI_Symbol; // to reduce subterms prior to rewrite, normalization friend class CUI_Term; // for term->DAG conversion & comparison friend class CUI_LhsAutomaton; // for matching DAG subject friend class CUI_RhsAutomaton; // for constructing replacement DAG }; inline CUI_DagNode::CUI_DagNode(CUI_Symbol* symbol) : DagNode(symbol) { } inline CUI_Symbol* CUI_DagNode::symbol() const { return static_cast(DagNode::symbol()); } inline DagNode* CUI_DagNode::getArgument(int i) const { Assert(i == 0 || i == 1, "bad argument index"); return argArray[i]; } #endif Maude-2.6/src/CUI_Theory/CUI_Symbol.hh0000644000147300135640000000554611457440620014411 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols belonging to theories made from C, Ul, Ur and I axioms. // #ifndef _CUI_Symbol_hh_ #define _CUI_Symbol_hh_ #include "binarySymbol.hh" class CUI_Symbol : public BinarySymbol { public: enum Axioms { COMM = 1, // commutativity LEFT_ID = 2, // left identity RIGHT_ID = 4, // right identity IDEM = 8 // idempotence }; CUI_Symbol(int id, const Vector& strategy, bool memoFlag, Axioms axioms, Term* identity = 0); // // Member functions required by theory interface. // Term* makeTerm(const Vector& args); DagNode* makeDagNode(const Vector& args); void computeBaseSort(DagNode* subject); void normalizeAndComputeTrueSort(DagNode* subject, RewritingContext& context); bool eqRewrite(DagNode* subject, RewritingContext& context); void stackArguments(DagNode* subject, Vector& stack, int parentIndex); // Member functions overiding default handling. // void compileOpDeclarations(); void postOpDeclarationPass(); void setFrozen(const NatSet& frozen); // // Unification stuff. // void computeGeneralizedSort(const SortBdds& sortBdds, const Vector& realToBdd, DagNode* subject, Vector& generalizedSort); UnificationSubproblem* makeUnificationSubproblem(); // // Hash cons stuff. // DagNode* makeCanonical(DagNode* original, HashConsSet* hcs); DagNode* makeCanonicalCopy(DagNode* original, HashConsSet* hcs); // // Member functions specific to CUI_Symbol. // bool comm() const; bool leftId() const; bool rightId() const; bool idem() const; private: bool memoStrategy(MemoTable::SourceSet& from, DagNode* subject, RewritingContext& context); Axioms axioms; }; inline bool CUI_Symbol::comm() const { return axioms & COMM; } inline bool CUI_Symbol::leftId() const { return axioms & LEFT_ID; } inline bool CUI_Symbol::rightId() const { return axioms & RIGHT_ID; } inline bool CUI_Symbol::idem() const { return axioms & IDEM; } #endif Maude-2.6/src/CUI_Theory/CUI_UnificationSubproblem.cc0000644000147300135640000000735411426151051017425 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2008 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_UnificationSubproblem. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "CUI_Theory.hh" // interface class definitions #include "dagNode.hh" // core class definitions #include "variableInfo.hh" //#include "subproblemAccumulator.hh" #include "unificationContext.hh" #include "localBinding.hh" // variable class definitions #include "variableSymbol.hh" #include "variableDagNode.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" #include "CUI_UnificationSubproblem.hh" CUI_UnificationSubproblem::CUI_UnificationSubproblem() { DebugAdvisory("Created CUI_UnificationSubproblem() base " << ((void*) this)); } CUI_UnificationSubproblem::~CUI_UnificationSubproblem() { } void CUI_UnificationSubproblem::markReachableNodes() { // maybe we only need to mark one of these? FOR_EACH_CONST(i, Vector, problems) { int nrFragile = i->savedSubstitution.nrFragileBindings(); for (int j = 0; j < nrFragile; j++) { if (DagNode* d = i->savedSubstitution.value(j)) d->mark(); } } } void CUI_UnificationSubproblem::addUnification(DagNode* lhs, DagNode* rhs, bool marked, UnificationContext& /* solution */) { Assert(marked == false, "we don't handle collapse yet"); problems.append(Problem(safeCast(CUI_DagNode*, lhs), safeCast(CUI_DagNode*, rhs))); } bool CUI_UnificationSubproblem::solve(bool findFirst, UnificationContext& solution, PendingUnificationStack& pending) { int nrProblems = problems.size(); int i; if (findFirst) { i = 0; forward: for (; i < nrProblems; ++i) { Problem& p = problems[i]; // // Save state before solving this problem. // p.savedSubstitution.clone(solution); p.savedPendingState = pending.checkPoint(); p.reverseTried = false; if (!(p.lhs->getArgument(0)->computeSolvedForm(p.rhs->getArgument(0), solution, pending) && p.lhs->getArgument(1)->computeSolvedForm(p.rhs->getArgument(1), solution, pending))) goto backtrack; } return true; } else { i = nrProblems - 1; backtrack: for (; i >= 0; --i) { Problem& p = problems[i]; if (!p.reverseTried) { // // Restore the state to what it was before we solved this problem the first time. // solution.clone(p.savedSubstitution); pending.restore(p.savedPendingState); if (p.lhs->getArgument(0)->computeSolvedForm(p.rhs->getArgument(1), solution, pending) && p.lhs->getArgument(1)->computeSolvedForm(p.rhs->getArgument(0), solution, pending)) { p.reverseTried = true; ++i; goto forward; } } } } // // Restore initial state. // Problem& p = problems[0]; solution.clone(p.savedSubstitution); pending.restore(p.savedPendingState); return false; } Maude-2.6/src/CUI_Theory/CUI_RhsAutomaton.cc0000644000147300135640000000503607666303124015554 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class CUI_RhsAutomaton. // // utility stuff #include "macros.hh" #include "vector.hh" #include "indent.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "CUI_Theory.hh" // core class definitions #include "substitution.hh" #include "variableInfo.hh" // CUI theory class definitions #include "CUI_Symbol.hh" #include "CUI_DagNode.hh" #include "CUI_RhsAutomaton.hh" CUI_RhsAutomaton::CUI_RhsAutomaton(CUI_Symbol* symbol) : topSymbol(symbol) { } void CUI_RhsAutomaton::remapIndices(VariableInfo& variableInfo) { source0 = variableInfo.remapIndex(source0); source1 = variableInfo.remapIndex(source1); destination = variableInfo.remapIndex(destination); } void CUI_RhsAutomaton::close(int sourceIndex0, int sourceIndex1, int destinationIndex) { source0 = sourceIndex0; source1 = sourceIndex1; destination = destinationIndex; } DagNode* CUI_RhsAutomaton::construct(Substitution& matcher) { CUI_DagNode* n = new CUI_DagNode(topSymbol); n->argArray[0] = matcher.value(source0); n->argArray[1] = matcher.value(source1); matcher.bind(destination, n); return n; } void CUI_RhsAutomaton::replace(DagNode* old, Substitution& matcher) { CUI_DagNode* n = new(old) CUI_DagNode(topSymbol); n->argArray[0] = matcher.value(source0); n->argArray[1] = matcher.value(source1); } #ifdef DUMP void CUI_RhsAutomaton::dump(ostream& s, const VariableInfo& variableInfo, int indentLevel) { s << Indent(indentLevel) << "Begin{CUI_RhsAutomaton}\n"; s << Indent(indentLevel + 1) << "[" << destination << "] <= " << topSymbol << '(' << '[' << source0 << "], [" << source1 << "])\n"; s << Indent(indentLevel) << "End{CUI_RhsAutomaton}\n"; } #endif Maude-2.6/src/CUI_Theory/CUI_Term.hh0000644000147300135640000000553310272237512014045 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for terms belonging to theories made from C, Ul, Ur and I axioms. // #ifndef _CUI_Term_hh_ #define _CUI_Term_hh_ #include "term.hh" class CUI_Term : public Term { NO_COPYING(CUI_Term); public: CUI_Term(CUI_Symbol* symbol, const Vector& arguments); // // Member functions required by theory interface. // RawArgumentIterator* arguments(); void deepSelfDestruct(); Term* deepCopy2(SymbolMap* translator) const; Term* normalize(bool full, bool& changed); int compareArguments(const Term* other) const; int compareArguments(const DagNode* other) const; void findEagerVariables(bool atTop, NatSet& eagerVariables) const; void analyseCollapses2(); void analyseConstraintPropagation(NatSet& boundUniquely) const; LhsAutomaton* compileLhs2(bool matchAtTop, const VariableInfo& variableInfo, NatSet& boundUniquely, bool& subproblemLikely); void markEagerArguments(int nrVariables, const NatSet& eagerVariables, Vector& problemVariables); DagNode* dagify2(); void findAvailableTerms(TermBag& availableTerms, bool eagerContext, bool atTop); int compileRhs2(RhsBuilder& rhsBuilder, VariableInfo& variableInfo, TermBag& availableTerms, bool eagerContext); #ifdef DUMP void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif // // Functions particular to CUI_Term. // CUI_Symbol* symbol() const; private: CUI_Term(const CUI_Term& original, CUI_Symbol* symbol, SymbolMap* translator); bool betterToReverseOrder(NatSet& boundUniquely) const; Term* collapseTo(int argNr); Vector argArray; // // Flags for compiling patterns. // bool id0CollapsePossible; // possible collapse to argArray[1] bool id1CollapsePossible; // possible collapse to argArray[0] bool idemCollapsePossible; // possible collapse with argArray[0] = argArray[1] }; inline CUI_Symbol* CUI_Term::symbol() const { return static_cast(Term::symbol()); } #endif Maude-2.6/src/CUI_Theory/CUI_DagArgumentIterator.hh0000644000147300135640000000254507666303124017054 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for argument iterator for CUI dag nodes. // #ifndef _CUI_DagArgumentIterator_hh_ #define _CUI_DagArgumentIterator_hh_ #include "rawDagArgumentIterator.hh" class CUI_DagArgumentIterator : public RawDagArgumentIterator { public: CUI_DagArgumentIterator(DagNode** first); bool valid() const; DagNode* argument() const; void next(); private: DagNode** position; int nrRemaining; }; inline CUI_DagArgumentIterator::CUI_DagArgumentIterator(DagNode** first) { position = first; nrRemaining = 2; } #endif Maude-2.6/src/CUI_Theory/ChangeLog0000644000147300135640000010721511500265621013664 000000000000002010-12-09 Steven Eker * CUI_Symbol.cc (CUI_Symbol::postOpDeclarationPass): don't call rightIdentitySortCheck() if we are commutative ===================================Maude95b=========================================== 2010-10-19 Steven Eker * CUI_Symbol.cc (CUI_Symbol::makeCanonicalCopyEagerUptoReduced): becomes makeCanonicalCopy() with a change of semantics * CUI_Symbol.hh (class CUI_Symbol): makeCanonicalCopyEagerUptoReduced() -> makeCanonicalCopy() ===================================Maude95a=========================================== 2010-09-29 Steven Eker * CUI_Symbol.cc (CUI_Symbol::makeCanonicalCopyEagerUptoReduced): simplify now that we are only passed unreduced nodes; use getCanonicalCopyEagerUptoReduced() * CUI_Symbol.hh (class CUI_Symbol): added decl for makeCanonicalCopyEagerUptoReduced() * CUI_Symbol.cc: added 2010-08-18 Steven Eker * CUI_DagNode.cc (CUI_DagNode::nonVariableSize): deleted * CUI_DagNode.hh (class CUI_DagNode): deleted decl for nonVariableSize() ===================================Maude95=========================================== 2010-08-12 Steven Eker * CUI_DagNode.cc (CUI_DagNode::computeSolvedForm2): use computeSolvedForm() rather than unificationBind() to ensure we don't bind the abstraction variable to an impure term (CUI_DagNode::computeSolvedForm2): use equalt() rather than == for comparing arguments during purification 2010-08-10 Steven Eker * CUI_DagNode.cc (CUI_DagNode::computeSolvedForm2): handle binding of variables, purification and local occurs check 2010-08-03 Steven Eker * CUI_UnificationSubproblem.hh (class CUI_UnificationSubproblem): updated decl for addUnification() * CUI_UnificationSubproblem.cc (CUI_UnificationSubproblem::addUnification): take marked arg 2010-07-29 Steven Eker * CUI_UnificationSubproblem.cc (CUI_UnificationSubproblem::addUnification): take solution argument * CUI_UnificationSubproblem.hh (class CUI_UnificationSubproblem): updated decl for addUnification() ===================================Maude94a=========================================== 2010-06-30 Steven Eker * CUI_DagNode.cc (CUI_DagNode::computeSolvedForm2): use resolveTheoryClash() 2009-12-22 Steven Eker * CUI_DagNode.cc (stackArguments): fixed nasty bug where we were checking the first argument unstackable flag when deciding whether we should stack the second argument 2009-12-02 Steven Eker * CUI_Symbol.hh (class CUI_Symbol): added decl for makeCanonical() * CUI_Symbol.cc (makeCanonical): added ===================================Maude92b=========================================== 2009-07-30 Steven Eker * CUI_Matcher.cc (freeMatch): fix critical bug where pointer to subproblem returned via sp0 was being lost without the subproblem being deleted if the second Subpattern::match() called failed (id0CollapseMatch, id1CollapseMatch, idemCollapseMatch): fix symmetric bugs 2008-12-22 Steven Eker * CUI_Symbol.cc (computeGeneralizedSort): new getSortFunction() convention ===================================Maude92=========================================== 2008-03-23 Steven Eker * CUI_DagNode.cc (computeSolvedForm2): deleted commented out old version * CUI_DagNode.hh (class CUI_DagNode): deleted commented out old decl for computeSolvedForm2() ===================================Maude90a=========================================== 2008-02-12 Steven Eker * CUI_UnificationSubproblem.cc (solve): implemented * CUI_UnificationSubproblem.hh (class CUI_UnificationSubproblem): problems becomes a Vector; delete ProblemList (class CUI_UnificationSubproblem): lhs, rhs of Problem become CUI_DagNode* 2008-02-11 Steven Eker * CUI_UnificationSubproblem.cc: created * CUI_UnificationSubproblem.hh: created * CUI_Symbol.cc (makeUnificationSubproblem): added * CUI_Symbol.hh (class CUI_Symbol): added decl for makeUnificationSubproblem() * CUI_DagNode.cc (computeSolvedForm2): implemented stub 2008-02-08 Steven Eker * CUI_DagNode.cc (computeSolvedForm2): Substitution -> UnificationContext * CUI_DagNode.hh (class CUI_DagNode): updated decl for computeSolvedForm2() 2008-02-05 Steven Eker * CUI_DagNode.cc (computeSolvedForm2): converted to stub * CUI_DagNode.hh (class CUI_DagNode): updated decl for computeSolvedForm2() 2008-01-17 Steven Eker * CUI_DagNode.cc (computeSolvedForm2): don't pass nrBindings to SolvedFormSubproblemDisjunction ===================================Maude90=========================================== 2008-01-11 Steven Eker * CUI_DagNode.cc (computeSolvedForm2): add missing subproblems.add() in reverse order only case ===================================Maude89j=========================================== 2007-11-12 Steven Eker * CUI_DagNode.cc (instantiate2): check ground flags of arguments; set ground flag in new node if necessary (instantiate2): call normalizeAtTop() rather than just assuming we have a C symbol 2007-11-05 Steven Eker * CUI_DagNode.cc (stackArguments): optimize by not stacking equal arguments in the comm case 2007-11-01 Steven Eker * CUI_DagNode.cc (indexVariables2): added (instantiateWithReplacement): added * CUI_DagNode.hh (class CUI_DagNode): added decls for indexVariables2() and instantiateWithReplacement() * CUI_DagNode.cc (instantiate2): updated * CUI_DagNode.hh (class CUI_DagNode): updated decl for instantiate2() ===================================Maude89h=========================================== 2007-08-24 Steven Eker * CUI_DagNode.cc (computeBaseSortForGroundSubterms): reimplemented * CUI_DagNode.hh (class CUI_DagNode): updated decl for computeBaseSortForGroundSubterms() 2007-08-23 Steven Eker * CUI_DagNode.cc (computeSolvedForm): becomes computeSolvedForm2() * CUI_DagNode.hh (class CUI_DagNode): computeSolvedForm() -> computeSolvedForm2() ===================================Maude89g=========================================== 2007-08-07 Steven Eker * CUI_DagNode.hh (class CUI_DagNode): updated decl for computeSolvedForm() * CUI_DagNode.cc (computeSolvedForm): added extensionInfo argument ===================================Maude89f=========================================== 2007-03-16 Steven Eker * CUI_DagNode.cc (unify, occurs2): deleted * CUI_DagNode.hh (class CUI_DagNode): deleted decls for unify() and occurs2() 2007-03-15 Steven Eker * CUI_DagNode.cc (computeSolvedForm): clear local substitutions * CUI_Symbol.cc (computeGeneralizedSort): pass realToBdd by ref * CUI_Symbol.hh (class CUI_Symbol): fix computeGeneralizedSort() decl ===================================Maude89a=========================================== 2007-03-05 Steven Eker * CUI_DagNode.cc (nonVariableSize): return mpz_class * CUI_DagNode.hh (class CUI_DagNode): nonVariableSize() now returns mpz_class 2007-03-02 Steven Eker * CUI_DagNode.cc (computeSolvedForm): use merge(); don't copy parent substitution (computeSolvedForm): use class SolvedFormSubproblemDisjunction 2007-03-01 Steven Eker * CUI_DagNode.cc (nonVariableSize, insertVariables2): added (computeSolvedForm): added * CUI_DagNode.hh (class CUI_DagNode): added decls for computeSolvedForm(), nonVariableSize() and insertVariables2() ===================================Maude89=========================================== 2007-02-09 Steven Eker * CUI_DagNode.cc (instantiate2): normalize wrt to comm (instantiate2): simplify 2007-02-07 Steven Eker * CUI_DagNode.cc (unify): rewritten using UnificationSubproblemDisjunction and unificationDifference() (unify): check for symmetry; get unifications in the reverse order correct 2007-02-06 Steven Eker * CUI_DagNode.cc (occurs2): added (instantiate2): added (computeBaseSortForGroundSubterms): added (unify): added * CUI_DagNode.hh (class CUI_DagNode): added decls for unify(), computeBaseSortForGroundSubterms(), instantiate2(), occurs2() 2007-02-05 Steven Eker * CUI_Symbol.cc (computeGeneralizedSort): added * CUI_Symbol.hh (class CUI_Symbol): added decl for computeGeneralizedSort() ===================================Maude88f=========================================== 2005-07-28 Steven Eker * CUI_Term.cc (CUI_Term): force symbol arg to be a CUI_Symbol (deepCopy2): handle translation to non-CUI_Symbol * CUI_Term.hh (class CUI_Term): updated decl for SymbolMap* ctor 2005-06-24 Steven Eker * CUI_Term.hh (class CUI_Term): updated decls for SymbolMap* ctor and deepCopy2() * CUI_Term.cc (deepCopy2): rewritten (CUI_Term): SymbolMap* rewritten ===================================Maude86b=========================================== 2003-08-29 Steven Eker * CUI_Symbol.cc (eqRewrite): use applyReplaceNoOwise() (memoStrategy): use applyReplaceNoOwise() ===================================Maude82=========================================== 2003-05-01 Steven Eker * CUI_DagNode.cc (overwriteWithClone): use copySetRewritingFlags() (makeClone): copySetRewritingFlags() ===================================Maude80=========================================== 2003-02-25 Steven Eker * CUI_Term.cc: removed #pragma (CUI_Term): updated Assert() * CUI_Term.hh: removed #pragma * CUI_Symbol.cc: removed #pragma (eqRewrite): updated Assert() (computeBaseSort): updated Assert()s (normalizeAndComputeTrueSort): updated Assert() * CUI_Symbol.hh: removed #pragma * CUI_RhsAutomaton.cc: removed #pragma * CUI_RhsAutomaton.hh: removed #pragma * CUI_Matcher.cc (match): updated Assert() * CUI_LhsCompiler.cc (compileLhs2): updated Assert() * CUI_LhsAutomaton.cc: removed #pragma * CUI_LhsAutomaton.hh: removed #pragma * CUI_DagNode.cc: removed #pragma (copyWithReplacement): updated Assert() (both versions) * CUI_DagNode.hh: removed #pragma (getArgument): updated Assert() * CUI_DagArgumentIterator.cc: removed #pragma (argument): updated Assert() (next): updated Assert() * CUI_DagArgumentIterator.hh: removed #pragma * CUI_ArgumentIterator.cc: removed #pragma (argument): updated Assert() (next): updated Assert() * CUI_ArgumentIterator.hh: removed #pragma ===================================Maude79=========================================== 2003-01-31 Steven Eker * CUI_Term.cc (analyseCollapses): becomes analyseCollapses2() * CUI_Term.hh (class CUI_Term): analyseCollapses() -> analyseCollapses2() ===================================Maude78=========================================== 2002-10-16 Steven Eker * CUI_Symbol.cc (postOpDeclarationPass): becomes postOpDeclarationPass() since sort tables arem't computed at postInterSymbolPass time * CUI_Symbol.hh (class CUI_Symbol): postInterSymbolPass() -> postOpDeclarationPass() 2002-10-08 Steven Eker * CUI_Symbol.hh (class CUI_Symbol): added decl for setFrozen() * CUI_Symbol.cc (setFrozen): added 2002-10-04 Steven Eker * CUI_DagNode.hh (class CUI_DagNode): updated decl for complex version of copyWithReplacement() * CUI_DagNode.cc (copyWithReplacement): complex version: handle the case where we only want to replace one arg * CUI_Symbol.cc (stackArguments): only stack args that aren't frozen or unstackable 2002-10-03 Steven Eker * CUI_DagNode.hh (class CUI_DagNode): updated decl for stackArguments() * CUI_DagNode.cc (stackArguments): handle respectFrozen argument ===================================Maude76================================================== 2002-08-02 Steven Eker * CUI_Term.cc (compileRhs2): added code to flag the last use of each source ===================================Maude74================================================== 2002-04-24 Steven Eker * CUI_RhsAutomaton.cc (dump): don't bother incrementing indentLevel (since we don't have subautomata to output) ===================================Maude72================================================== 2002-01-29 Steven Eker * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added friend decl for PatternType << function ===================================Maude70================================================== 2001-04-03 Steven Eker * CUI_DagNode.hh (class CUI_DagNode): added decl for Vector version of copyWithReplacement() * CUI_DagNode.cc (copyWithReplacement): added (Vector version) ===================================Engine66================================================== 2001-03-08 Steven Eker * CUI_Symbol.hh (class CUI_Symbol): added decl for stackArguments() * CUI_Symbol.cc (stackArguments): added ===================================Engine65================================================== 2001-01-26 Steven Eker * CUI_DagNode.hh (class CUI_DagNode): updated markArguments() decl and make it private * CUI_DagNode.cc (markArguments): rewritten with new semantics ===================================Engine64================================================== 2000-08-04 Steven Eker * CUI_Symbol.cc (eqRewrite): greatly simplified now that we no longer treat last strategy zero specially when term is in the error sort (memoStrategy): ditto 2000-07-31 Steven Eker * CUI_Symbol.cc (computeBaseSort): don't handle union sorts ===================================Engine60================================================== 2000-07-28 Steven Eker * CUI_RhsAutomaton.hh (class CUI_RhsAutomaton): added decl for remapIndices() * CUI_RhsAutomaton.cc (remapIndices): added 2000-07-26 Steven Eker * CUI_LhsCompiler.cc (compileLhs2): use getNrProtectedVariables() instead of nrVariables() * CUI_Term.cc (compileRhs2): use makeConstructionIndex() instead of allocateIndex() 2000-07-25 Steven Eker * CUI_Term.cc (findAvailableTerms): don't insert ground terms into availableTerms since we can't do left->right sharing on them * CUI_RhsAutomaton.cc (construct): don't call buildAliens() (replace): don't call buildAliens() (dump): don't call buildAliens() * CUI_Term.hh (class CUI_Term): deleted decls for compileRhs() and findIndex() * CUI_Term.cc (compileRhs): deleted (findIndex): deleted ===================================Engine60================================================== 2000-07-12 Steven Eker * CUI_Term.cc (findAvailableTerms): added (compileRhs2): added * CUI_Term.hh (class CUI_Term): added decls for findAvailableTerms() and compileRhs2() ===================================Engine59================================================== 2000-07-05 Steven Eker * CUI_LhsCompiler.cc (compileLhs): becomes compileLhs2() * CUI_Term.hh: compileLhs() -> compileLhs2() 2000-06-26 Steven Eker * CUI_Term.cc (findIndex): modifiedIndex() -> getModifiedIndex() * CUI_LhsAutomaton.cc (addSubpattern): index() -> getIndex() (addSubpattern): lookupSort() -> getSort() ===================================Engine58================================================== 2000-03-30 Steven Eker * CUI_LhsAutomaton.cc (addSubpattern): need to make topAutomaton for subpattern1 if matchAtTop and IDEM_COLLAPSE; previously we only did this for subpattern0 in the IDEM_COLLAPSE case unless ther was a ID0_COLLAPSE; non-existant topAutomaton cause seg fault * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added added comments to clarify enum Flags * CUI_Term.hh (class CUI_Term): added comments to clarify flags * CUI_LhsAutomaton.hh (match): moved comment inside of "if (matchAtTop)" 2000-03-17 Steven Eker * CUI_Term.cc (dump): ifdef'd * CUI_Term.hh (class CUI_Term): use NO_COPYING() macro; ifdef'd dump() decls * CUI_RhsAutomaton.cc (dump): ifdef'd * CUI_RhsAutomaton.hh (class CUI_RhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decls * CUI_LhsAutomaton.cc (dump): ifdef'd (both versions) * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): use NO_COPYING() macro; ifdef'd dump() decls * CUI_Symbol.cc (eqRewrite): AdvisoryCheck() -> IssueAdvisory() (memoStrategy): AdvisoryCheck() -> IssueAdvisory() ===================================Engine56================================================== 1999-11-03 Steven Eker * CUI_Symbol.hh (class CUI_Symbol): added decl for memoStrategy() * CUI_Symbol.cc (eqRewrite): set seenZero if we see a zero! (eqRewrite): use memoStrategy() in the memo case (memoStrategy): added 1999-10-29 Steven Eker * CUI_Symbol.cc (CUI_Symbol): use new BinarySymbol conventions ===================================Engine53================================================== 1999-10-26 Steven Eker * CUI_LhsAutomaton.cc (addSubpattern): VariableTerm::dynamicCast() -> dynamic_cast() * CUI_LhsCompiler.cc (compileLhs): VariableTerm::dynamicCast() -> dynamic_cast() (*4) * CUI_Term.cc (findIndex): VariableTerm::dynamicCast() -> dynamic_cast() * CUI_Symbol.cc (CUI_Symbol): added memoFlag arg * CUI_Symbol.hh (class CUI_Symbol): added memoFlag arg to ctor decl 1999-10-19 Steven Eker * CUI_DagNode.cc (getHashValue): added * CUI_DagNode.hh (class CUI_DagNode): added data member hashCache (class CUI_DagNode): added decl for getHashValue() ===================================Engine52================================================== 1999-05-12 Steven Eker * CUI_Symbol.hh (class CUI_Symbol): computeTrueSort() -> normalizeAndComputeTrueSort() * CUI_Symbol.cc (computeTrueSort): become normalizeAndComputeTrueSort() (normalizeAndComputeTrueSort): use fastComputeTrueSort() ===================================Engine49================================================== Fri Nov 6 16:24:35 1998 Steven Eker * CUI_Term.cc (deepCopy): -> deepCopy2() * CUI_Term.hh: deepCopy() -> deepCopy2() ===================================Engine43================================================== Thu Oct 8 14:24:30 1998 Steven Eker * CUI_Term.cc (compareArguments): inserted const ===================================Engine41================================================== Fri Sep 18 15:04:48 1998 Steven Eker * CUI_Symbol.cc (computeBaseSort): rewritten using setSortIndex(), traverse(), lookupSortIndex() * CUI_DagNode.cc (overwriteWithClone): use setSortIndex() (makeClone): use setSortIndex() Wed Sep 9 11:49:29 1998 Steven Eker * CUI_Symbol.cc (compileOpDeclarations): do commutativeSortCompletion() before Symbol::compileOpDeclarations() due to new implementation ===================================Engine40================================================== Tue Jul 21 10:29:54 1998 Steven Eker * CUI_Term.hh (class CUI_Term): added decl for new ctor * CUI_Term.cc: added new ctor (deepCopy): added * CUI_Term.hh (class CUI_Term): added decl for deepCopy() ===================================Engine39================================================== Wed Jun 10 14:39:56 1998 Steven Eker * CUI_Symbol.hh (class CUI_Symbol): added decl for postInterSymbolPass() * CUI_Symbol.cc (compileOpDeclarations): no longer do identity stuff here (postInterSymbolPass): added to do identity stuff * CUI_Term.hh (class CUI_Term): updated normalize() decl * CUI_Term.cc (normalize): don't use earlyGetIdentity() (normalize): compute changed flag * CUI_LhsAutomaton.cc: IntSet -> NatSet * CUI_Term.cc: IntSet -> NatSet * CUI_LhsCompiler.cc: IntSet -> NatSet * CUI_Term.hh: IntSet -> NatSet ===================================Engine38================================================== Wed Jun 3 16:37:10 1998 Steven Eker * CUI_Term.cc (normalize): use earlyGetIdentity() ===================================Engine37================================================== Fri Feb 20 17:33:46 1998 Steven Eker * CUI_DagNode.cc (stackArguments): only stack arguments that are not flagged as unstackable ===================================Engine36================================================== Thu Feb 12 14:40:08 1998 Steven Eker * CUI_LhsAutomaton.cc (~CUI_LhsAutomaton): added (CUI_LhsAutomaton): clear all automata pointers at outset to allow for safe destruction at any time. (addSubpattern): no need to clear automata pointers here * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added decl for ~CUI_LhsAutomaton() * CUI_Term.cc (normalize): compare() == 0 changed to equal() (2 places) * CUI_Matcher.cc (match): compare() != 0 changed to !equal() (idemCollapseMatch): compare() == 0 changed to equal() (id1CollapseMatch): compare() == 0 changed to equal() * CUI_LhsCompiler.cc (analyseConstraintPropagation):compare() == 0 changed to equal() (compileLhs): compare() == 0 changed to equal() * CUI_DagNode.cc (normalizeAtTop): compare() == 0 changed to equal() (2 places) * CUI_LhsAutomaton.hh (match): compare() == 0 changed to equal() (2 places) =============================Engine35======================================================== Tue Dec 23 13:27:27 1997 Steven Eker * CUI_LhsCompiler.cc (compileLhs): use greedySafe() Wed Dec 10 16:44:50 1997 Steven Eker * CUI_LhsAutomaton.cc (addSubpattern): added a real ugly hack to prevent first topAutomaton being compiled for greedy matching in idem case because even if variables are not shared between subterms, extension is. Fri Dec 5 14:45:23 1997 Steven Eker * CUI_Symbol.cc (compileOpDeclarations): call leftIdentitySortCheck(), rightIdentitySortCheck() and idempotentSortCheck() if needed Thu Dec 4 10:43:15 1997 Steven Eker * CUI_Matcher.cc (id1CollapseMatch): only exclude the case where the subject (portion of subject) matched is our identity if ID0_COLLAPSE; otherwise we miss matches if we only have a right identity * CUI_Symbol.cc (CUI_Symbol): deleted inert arg * CUI_Symbol.hh (class CUI_Symbol): deleted inert arg from ctor decl * CUI_LhsAutomaton.cc (dump): removed extra \t (Subpattern::dump): print ground alien correctly * CUI_LhsCompiler.cc (compileLhs): make flags an int to avoid conversion from `int' to `enum CUI_LhsAutomaton::Flags warning Wed Dec 3 11:14:09 1997 Steven Eker * CUI_LhsCompiler.cc (compileLhs): heavily rewritten to use flags and handle non-comm case; also comm case optimized in that we set forward and reverse flags to avoid checking other possibility in the case where the subterms are stable and have different top symbols * CUI_Matcher.cc: commMatch() -> freeMatch() throughout * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): commMatch() -> freeMatch() * CUI_LhsAutomaton.cc (CUI_LhsAutomaton): rewritten to use Flags (addSubpattern): rewritten to use Flags (operator<<): added (Flags version) (dump): now print flags * CUI_Matcher.cc (match): rewritten to use Flags * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): deleted idempotent and subpatternsDistinct data memebers (class CUI_LhsAutomaton): redesigned around new enum Flags * CUI_Matcher.cc (match): use forward, reverse and conditional reverse flags to handle non-commutative case * CUI_LhsCompiler.cc (analyseConstraintPropagation): handle non-commutative case Tue Dec 2 10:24:34 1997 Steven Eker * CUI_DagNode.cc (copyEagerUptoReduced2): rewritten to deal with non-permutative strategies (normalizeAtTop): rewritten to handle non-commutative case (collapseTo): rewritten to deal with non-permutative strategies * CUI_Symbol.hh (comm): added (leftId): added (rightId): added (idem): updated * CUI_Term.cc (normalize): rewritten to handle non-commutative case (findEagerVariables): rewritten to deal with non-permutative strategies (markEagerArguments): rewritten to deal with non-permutative strategies (analyseCollapses): deal with seperate left and right identity axioms * CUI_Symbol.cc (CUI_Symbol): take axioms arg; call setStrategy() if not commutative (eqRewrite): rewritten to deal with non-permutative strategies * CUI_Symbol.hh (class CUI_Symbol): idemFlag data member deleted, axioms data memeber added, enum Axioms added, ctor decl now take Axioms arg Mon Dec 1 12:34:48 1997 Steven Eker * CUI_DagNode.cc (copyEagerUptoReduced2): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol (collapseTo): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol * CUI_Term.cc (findEagerVariables): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol (*3) (markEagerArguments): use getPermuteStrategy(); PermuteSymbol -> BinarySymbol * CUI_Symbol.cc (CUI_Symbol): PermuteSymbol -> BinarySymbol; call setPermuteStrategy() (eqRewrite): use getPermuteStrategy() (*3) * CUI_Symbol.hh (class CUI_Symbol): PermuteSymbol -> BinarySymbol Tue Nov 25 10:20:05 1997 Steven Eker * CUI_LhsAutomaton.cc (dump): implemented * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): updated dump() decl (class CUI_LhsAutomaton): unionized struct Subpattern (class CUI_LhsAutomaton): added decl for Subpattern::dump() * CUI_RhsAutomaton.cc (buildAliens): deleted (dump): implemented * CUI_RhsAutomaton.hh (addAlien): deleted (class CUI_RhsAutomaton): deleted decls for buildAliens(), addAlien(); deleted data member aliens; update decl for dump() =============================Engine33======================================================== Tue Nov 18 16:36:36 1997 Steven Eker * CUI_Term.cc (dumpArguments): deleted (dump): added * CUI_Term.hh (class CUI_Term): deleted decls for compileLhsNonCollapse(), compileLhsCollapse() and addSubterm() (class CUI_Term): dumpArguments() decl now passes variableInfo by ref; removed const; switch varableInfo, indentLevel args (class CUI_Term): dumpArguments() decl becomes dump() * CUI_LhsCompiler.cc (compileLhs): incorporate compileLhsNonCollapse() and compileLhsCollapse() since these are now very similar (compileLhsNonCollapse): deleted (compileLhsCollapse): deleted =============================Engine32======================================================== Tue Nov 11 10:22:20 1997 Steven Eker * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): removed comment that id1CollapsePossible implies subpatternsDistinct as we no longer ensure this; we don't generate repeated solutions since if we have a collapse and the subpatterns are identical then (1) we are not idempotent and (2) the only thing we could match by collapse is identity and this case is caught in id1CollapseMatch() * CUI_LhsAutomaton.cc (addSubpattern): in the variable case we need to insert variable into boundUniquely if we are in the uniqueBranch situation * CUI_Theory.hh: deleted forward decl for class CUI_Subproblem * CUI_DagNode.hh (class CUI_DagNode): revoke friendship for class CUI_Subproblem since this class won't be created * CUI_LhsCompiler.cc (compileLhsCollapse): pass greedy to ctor; removed call to complete() (compileLhsCollapse): take greedy into spl calculation (compileLhsNonCollapse): pass greedy to ctor; removed call to complete() (compileLhsNonCollapse): use addSubpattern() in place of addSubterm() (addSubterm): deleted * CUI_LhsAutomaton.cc (operator<<): added * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): greedyMatchOK data member becomes const * CUI_LhsAutomaton.cc (complete): deleted (CUI_LhsAutomaton): added greedyMatchOK arg * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): boundUniquely arg to addSubpattern() no longer const (class CUI_LhsAutomaton): ctor takes greedyMatchOK arg (class CUI_LhsAutomaton): deleted decl for complete() (class CUI_LhsAutomaton): UNSET -> UNDEFINED * CUI_LhsAutomaton.cc (addGroundAlien): deleted (addTopVariable): deleted (addNonGroundAlien): deleted (addSubpattern): now handle uniqueBranch case * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): deleted decls for addGroundAlien(), addTopVariable(), addNonGroundAlien() * CUI_Matcher.cc (id1CollapseMatch): reject matches where subject (or in extension case matched portion) is our identity since these solutionns will have already been found on the id0Collapse branch (idemCollapseMatch): (non-ex) reject matches where subject is our identity (idemCollapseMatch): (ex) add EqualitySubproblem to reject matches where matched portion is our identity Mon Nov 10 11:59:54 1997 Steven Eker * CUI_LhsCompiler.cc (compileLhsCollapse): use addSubpattern() * CUI_LhsAutomaton.cc (addSubpattern): added * CUI_Term.hh (class CUI_Term): added decls for compileLhsNonCollapse() and compileLhsCollapse() * CUI_LhsCompiler.cc (compileLhs): main code split off into compileLhsCollapse() and compileLhsNonCollapse() (compileLhsNonCollapse): created (addSubterm): standard automata are always compiled with matchAtTop = false (compileLhsCollapse): added Fri Nov 7 10:01:16 1997 Steven Eker * CUI_LhsCompiler.cc (compileLhs): if one subterm is variable and other is not match variable last to improve substitution (addSubterm): in variable case when we have unique branch, update boundUniquely * CUI_Matcher.cc (match): fixed bug where we were passing solution rather than local to simpler matching functions * CUI_Term.cc (normalize): set hash value in the case we don't collapse * CUI_LhsAutomaton.cc (addNonGroundAlien): added (addTopVariable): added (addGroundAlien): added * CUI_Term.hh (class CUI_Term): added decl for addSubterm() * CUI_LhsCompiler.cc (analyseConstraintPropagation): check for ground() before testing for willGroundOutMatch() (addSubterm): added (compileLhs): rewritten Thu Nov 6 10:30:42 1997 Steven Eker * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added decls for ctor and complete() * CUI_LhsAutomaton.cc (complete): added (CUI_LhsAutomaton): added * CUI_LhsCompiler.cc (betterToReverseOrder): moved here from CUI_Term.cc (analyseConstraintPropagation): moved here from CUI_Term.cc (compileLhs): moved here from CUI_Term.cc * CUI_Term.cc (insertAbstractionVariables): deleted * CUI_Term.hh (class CUI_Term): deleted decl for insertAbstractionVariables() * CUI_Matcher.cc (idemCollapseMatch): ExtensionMatchSubproblem() needs nrVariables arg (match): handle non-collapse failure efficiently * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): deleted abstractionVariable data member * CUI_Matcher.cc (idemCollapseMatch): (non-ext version) rewritten to use new Subpattern::match(); now deals correctly with matchAtTop case when there is no extension (idemCollapseMatch): (ext version) deleted null subproblem special case; since our new extensionInfo convention allows us to return both a subproblem and valid extensionInfo we don't need this case; The speed up of handling this special case is marginal since we must be at top we will not lose any constraint propagation by delaying second subterm match until solve phase. BTW this case should be very rare anyway. Use class ExtensionMatchSubproblem an avoid the need for abstraction variables. (match): simplified by using ?: within if() Wed Nov 5 09:56:45 1997 Steven Eker * CUI_Matcher.cc (id0CollapseMatch): rewritten to use new Subpattern::match() (id1CollapseMatch): made symmetric with id0CollapseMatch() * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added matchAtTop and extensionInfo args to Subpattern::match() (match): added matchAtTop and extensionInfo args * CUI_Matcher.cc (match): removed uniqueBranch code from from collapse cases * CUI_Term.cc (analyseConstraintPropagation): simplified and bug fixed; don't bother with analysis in collapse cases; take honorGroundOutMatch into account; make sure that subterms are match idependent before calling betterToReverseOrder(); treat subterms the same as a special case (betterToReverseOrder): remove test for collapse since this will be done in caller * CUI_Matcher.cc (match): rewritten to use uniqueBranch * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): extAutomaton -> topAutomaton since we may need to clone subject when matching at top. * CUI_Matcher.cc (id0CollapseMatch): rewritten to make use of the fact that identity dags are now safe from garbage collection and aboid the need for an abstraction variable (id1CollapseMatch): added; symmetric with id0CollapseMatch() * CUI_Term.hh (class CUI_Term): added decls for betterToReverseOrder(), id0CollapsePossible and id1CollapsePossible * CUI_Term.cc (analyseCollapses): use Term::commonSymbols(); set idemCollapsePossible (analyseCollapses): set id0CollapsePossible and id1CollapsePossible (betterToReverseOrder): added (analyseConstraintPropagation): implemented * CUI_Term.hh (class CUI_Term): added data member idemCollapsePossible * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added uniqueBranch and collapsePossible data members Tue Nov 4 17:13:59 1997 Steven Eker * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added idempotent and matchAtTop data members * CUI_Matcher.cc (match): in non collapse case don't try 2nd possibility if subpatterns are the same or subject subterms are the same. * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): added subpatternsDistinct data member Mon Nov 3 12:02:21 1997 Steven Eker * CUI_LhsAutomaton.cc: created * CUI_LhsAutomaton.hh (class CUI_LhsAutomaton): created * CUI_Matcher.cc: greatly simplified from rought draft using DisjunctiveSubproblemAccumulator =============================Engine31======================================================== Tue Oct 21 12:36:47 1997 Steven Eker * CUI_Term.cc (dagify2): switched decl to new convention * CUI_Term.hh (class CUI_Term): switched dagify2() decl to new convention Fri Oct 17 10:37:12 1997 Steven Eker * CUI_ArgumentIterator.hh (CUI_ArgumentIterator): initialize position to 0, not 2 * CUI_Term.cc (normalize): fixed bug in 2nd id collapse case * CUI_DagNode.cc (normalizeAtTop): fixed bug in 2nd id collapse case * CUI_Term.cc: created * CUI_ArgumentIterator.hh (class CUI_ArgumentIterator): created * CUI_ArgumentIterator.cc: created * CUI_RhsAutomaton.cc: created * CUI_RhsAutomaton.hh (class CUI_RhsAutomaton): created * CUI_Term.hh: created Thu Oct 16 17:33:23 1997 Steven Eker * CUI_Symbol.hh (idem): added (class CUI_Symbol): added decl for idem() * CUI_DagNode.hh (class CUI_DagNode): added decl for collapseTo() * CUI_DagNode.cc (collapseTo): added * CUI_DagArgumentIterator.cc: created * CUI_DagArgumentIterator.hh (class CUI_DagArgumentIterator): created * CUI_DagNode.cc: created * CUI_DagNode.hh (class CUI_DagNode): created * CUI_Symbol.cc: created * CUI_Symbol.hh (class CUI_Symbol): created Maude-2.6/src/CUI_Theory/CUI_UnificationSubproblem.hh0000644000147300135640000000516411426151136017440 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2008 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for unification subproblems in the AC theory. // It consists of the AC symbol, a vector of abstracted subterms and a basis for the // Diophantine system corresponding the purified AC unification problem. // #ifndef _CUI_UnificationSubproblem_hh_ #define _CUI_UnificationSubproblem_hh_ //#include #include "unificationSubproblem.hh" #include "simpleRootContainer.hh" //#include "natSet.hh" //#include "dagNode.hh" //#include "dagNodeSet.hh" #include "substitution.hh" #include "pendingUnificationStack.hh" class CUI_UnificationSubproblem : public UnificationSubproblem, private SimpleRootContainer { NO_COPYING(CUI_UnificationSubproblem); public: CUI_UnificationSubproblem(); ~CUI_UnificationSubproblem(); void addUnification(DagNode* lhs, DagNode* rhs, bool marked, UnificationContext& solution); bool solve(bool findFirst, UnificationContext& solution, PendingUnificationStack& pending); #ifdef DUMP //void dump(ostream& s, const VariableInfo& variableInfo, int indentLevel); #endif private: struct Problem { Problem(CUI_DagNode* lhs, CUI_DagNode* rhs); Problem(); Problem(const Problem& original); CUI_DagNode* const lhs; CUI_DagNode* const rhs; Substitution savedSubstitution; PendingUnificationStack::Marker savedPendingState; bool reverseTried; }; void markReachableNodes(); Vector problems; }; inline CUI_UnificationSubproblem::Problem::Problem() // HACK : lhs(0), rhs(0), savedSubstitution(0) { } inline CUI_UnificationSubproblem::Problem::Problem(CUI_DagNode* lhs, CUI_DagNode* rhs) : lhs(lhs), rhs(rhs), savedSubstitution(0) { } inline CUI_UnificationSubproblem::Problem::Problem(const Problem& original) : lhs(original.lhs), rhs(original.rhs), savedSubstitution(0) // HACK { } #endif Maude-2.6/src/CUI_Theory/CUI_Theory.hh0000644000147300135640000000214707666303124014414 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for CUI theory classes. // #ifndef _CUI_Theory_hh_ #define _CUI_Theory_hh_ class CUI_Symbol; class CUI_Term; class CUI_ArgumentIterator; class CUI_DagNode; class CUI_DagArgumentIterator; class CUI_LhsAutomaton; class CUI_RhsAutomaton; #endif Maude-2.6/src/CUI_Theory/Makefile.am0000644000147300135640000000130510754212242014140 00000000000000noinst_LIBRARIES = libCUI_Theory.a libCUI_Theory_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler libCUI_Theory_a_SOURCES = \ CUI_Symbol.cc \ CUI_DagNode.cc \ CUI_DagArgumentIterator.cc \ CUI_RhsAutomaton.cc \ CUI_Term.cc \ CUI_ArgumentIterator.cc \ CUI_UnificationSubproblem.cc \ CUI_LhsAutomaton.cc EXTRA_DIST = \ CUI_LhsCompiler.cc \ CUI_Matcher.cc noinst_HEADERS = \ CUI_ArgumentIterator.hh \ CUI_DagArgumentIterator.hh \ CUI_DagNode.hh \ CUI_LhsAutomaton.hh \ CUI_RhsAutomaton.hh \ CUI_Symbol.hh \ CUI_Term.hh \ CUI_UnificationSubproblem.hh \ CUI_Theory.hh Maude-2.6/src/3rdParty/0000777000147300135640000000000011500304116011717 500000000000000Maude-2.6/src/3rdParty/Makefile.in0000644000147300135640000003026211500303153013703 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/3rdParty DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libdlmalloc_a_AR = $(AR) $(ARFLAGS) libdlmalloc_a_LIBADD = am__libdlmalloc_a_SOURCES_DIST = malloc.c @USE_DLMALLOC_TRUE@am_libdlmalloc_a_OBJECTS = malloc.$(OBJEXT) libdlmalloc_a_OBJECTS = $(am_libdlmalloc_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libdlmalloc_a_SOURCES) DIST_SOURCES = $(am__libdlmalloc_a_SOURCES_DIST) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @USE_DLMALLOC_TRUE@noinst_LIBRARIES = libdlmalloc.a @USE_DLMALLOC_TRUE@libdlmalloc_a_SOURCES = \ @USE_DLMALLOC_TRUE@ malloc.c noinst_HEADERS = \ MersenneTwister.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/3rdParty/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/3rdParty/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libdlmalloc.a: $(libdlmalloc_a_OBJECTS) $(libdlmalloc_a_DEPENDENCIES) -rm -f libdlmalloc.a $(libdlmalloc_a_AR) libdlmalloc.a $(libdlmalloc_a_OBJECTS) $(libdlmalloc_a_LIBADD) $(RANLIB) libdlmalloc.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/3rdParty/MersenneTwister.h0000644000147300135640000003345110057207732015164 00000000000000// MersenneTwister.h // Mersenne Twister random number generator -- a C++ class MTRand // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus // Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com // The Mersenne Twister is an algorithm for generating random numbers. It // was designed with consideration of the flaws in various other generators. // The period, 2^19937-1, and the order of equidistribution, 623 dimensions, // are far greater. The generator is also fast; it avoids multiplication and // division, and it benefits from caches and pipelines. For more information // see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html // Reference // M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally // Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on // Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, // Copyright (C) 2000 - 2003, Richard J. Wagner // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. The names of its contributors may not be used to endorse or promote // products derived from this software without specific prior written // permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // The original code included the following notice: // // When you use this, send an email to: matumoto@math.keio.ac.jp // with an appropriate reference to your work. // // It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu // when you write. #ifndef MERSENNETWISTER_H #define MERSENNETWISTER_H // Not thread safe (unless auto-initialization is avoided and each thread has // its own MTRand object) #include #include #include #include #include class MTRand { // Data public: typedef unsigned long uint32; // unsigned integer type, at least 32 bits enum { N = 624 }; // length of state vector enum { SAVE = N + 1 }; // length of array for save() protected: enum { M = 397 }; // period parameter uint32 state[N]; // internal state uint32 *pNext; // next value to get from state int left; // number of values left before reload needed //Methods public: MTRand( const uint32& oneSeed ); // initialize with a simple uint32 MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array MTRand(); // auto-initialize with /dev/urandom or time() and clock() // Do NOT use for CRYPTOGRAPHY without securely hashing several returned // values together, otherwise the generator state can be learned after // reading 624 consecutive values. // Access to 32-bit random numbers double rand(); // real number in [0,1] double rand( const double& n ); // real number in [0,n] double randExc(); // real number in [0,1) double randExc( const double& n ); // real number in [0,n) double randDblExc(); // real number in (0,1) double randDblExc( const double& n ); // real number in (0,n) uint32 randInt(); // integer in [0,2^32-1] uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32 double operator()() { return rand(); } // same as rand() // Access to 53-bit random numbers (capacity of IEEE double precision) double rand53(); // real number in [0,1) // Access to nonuniform random number distributions double randNorm( const double& mean = 0.0, const double& variance = 0.0 ); // Re-seeding functions with same behavior as initializers void seed( const uint32 oneSeed ); void seed( uint32 *const bigSeed, const uint32 seedLength = N ); void seed(); // Saving and loading generator state void save( uint32* saveArray ) const; // to array of size SAVE void load( uint32 *const loadArray ); // from such array friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand ); friend std::istream& operator>>( std::istream& is, MTRand& mtrand ); protected: void initialize( const uint32 oneSeed ); void reload(); uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; } uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; } uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; } uint32 mixBits( const uint32& u, const uint32& v ) const { return hiBit(u) | loBits(v); } uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const { return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); } static uint32 hash( time_t t, clock_t c ); }; inline MTRand::MTRand( const uint32& oneSeed ) { seed(oneSeed); } inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength ) { seed(bigSeed,seedLength); } inline MTRand::MTRand() { seed(); } inline double MTRand::rand() { return double(randInt()) * (1.0/4294967295.0); } inline double MTRand::rand( const double& n ) { return rand() * n; } inline double MTRand::randExc() { return double(randInt()) * (1.0/4294967296.0); } inline double MTRand::randExc( const double& n ) { return randExc() * n; } inline double MTRand::randDblExc() { return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); } inline double MTRand::randDblExc( const double& n ) { return randDblExc() * n; } inline double MTRand::rand53() { uint32 a = randInt() >> 5, b = randInt() >> 6; return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0); // by Isaku Wada } inline double MTRand::randNorm( const double& mean, const double& variance ) { // Return a real number from a normal (Gaussian) distribution with given // mean and variance by Box-Muller method double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance; double phi = 2.0 * 3.14159265358979323846264338328 * randExc(); return mean + r * cos(phi); } inline MTRand::uint32 MTRand::randInt() { // Pull a 32-bit integer from the generator state // Every other access function simply transforms the numbers extracted here if( left == 0 ) reload(); --left; register uint32 s1; s1 = *pNext++; s1 ^= (s1 >> 11); s1 ^= (s1 << 7) & 0x9d2c5680UL; s1 ^= (s1 << 15) & 0xefc60000UL; return ( s1 ^ (s1 >> 18) ); } inline MTRand::uint32 MTRand::randInt( const uint32& n ) { // Find which bits are used in n // Optimized by Magnus Jonsson (magnus@smartelectronix.com) uint32 used = n; used |= used >> 1; used |= used >> 2; used |= used >> 4; used |= used >> 8; used |= used >> 16; // Draw numbers until one is found in [0,n] uint32 i; do i = randInt() & used; // toss unused bits to shorten search while( i > n ); return i; } inline void MTRand::seed( const uint32 oneSeed ) { // Seed the generator with a simple uint32 initialize(oneSeed); reload(); } inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength ) { // Seed the generator with an array of uint32's // There are 2^19937-1 possible initial states. This function allows // all of those to be accessed by providing at least 19937 bits (with a // default seed length of N = 624 uint32's). Any bits above the lower 32 // in each element are discarded. // Just call seed() if you want to get array from /dev/urandom initialize(19650218UL); register int i = 1; register uint32 j = 0; register int k = ( N > seedLength ? N : seedLength ); for( ; k; --k ) { state[i] = state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL ); state[i] += ( bigSeed[j] & 0xffffffffUL ) + j; state[i] &= 0xffffffffUL; ++i; ++j; if( i >= N ) { state[0] = state[N-1]; i = 1; } if( j >= seedLength ) j = 0; } for( k = N - 1; k; --k ) { state[i] = state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL ); state[i] -= i; state[i] &= 0xffffffffUL; ++i; if( i >= N ) { state[0] = state[N-1]; i = 1; } } state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array reload(); } inline void MTRand::seed() { // Seed the generator with an array from /dev/urandom if available // Otherwise use a hash of time() and clock() values // First try getting an array from /dev/urandom FILE* urandom = fopen( "/dev/urandom", "rb" ); if( urandom ) { uint32 bigSeed[N]; register uint32 *s = bigSeed; register int i = N; register bool success = true; while( success && i-- ) success = fread( s++, sizeof(uint32), 1, urandom ); fclose(urandom); if( success ) { seed( bigSeed, N ); return; } } // Was not successful, so use time() and clock() instead seed( hash( time(NULL), clock() ) ); } inline void MTRand::initialize( const uint32 seed ) { // Initialize generator state with seed // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. // In previous versions, most significant bits (MSBs) of the seed affect // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. register uint32 *s = state; register uint32 *r = state; register int i = 1; *s++ = seed & 0xffffffffUL; for( ; i < N; ++i ) { *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL; r++; } } inline void MTRand::reload() { // Generate N new values in state // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) register uint32 *p = state; register int i; for( i = N - M; i--; ++p ) *p = twist( p[M], p[0], p[1] ); for( i = M; --i; ++p ) *p = twist( p[M-N], p[0], p[1] ); *p = twist( p[M-N], p[0], state[0] ); left = N, pNext = state; } inline MTRand::uint32 MTRand::hash( time_t t, clock_t c ) { // Get a uint32 from t and c // Better than uint32(x) in case x is floating point in [0,1] // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) static uint32 differ = 0; // guarantee time-based seeds will change uint32 h1 = 0; unsigned char *p = (unsigned char *) &t; for( size_t i = 0; i < sizeof(t); ++i ) { h1 *= UCHAR_MAX + 2U; h1 += p[i]; } uint32 h2 = 0; p = (unsigned char *) &c; for( size_t j = 0; j < sizeof(c); ++j ) { h2 *= UCHAR_MAX + 2U; h2 += p[j]; } return ( h1 + differ++ ) ^ h2; } inline void MTRand::save( uint32* saveArray ) const { register uint32 *sa = saveArray; register const uint32 *s = state; register int i = N; for( ; i--; *sa++ = *s++ ) {} *sa = left; } inline void MTRand::load( uint32 *const loadArray ) { register uint32 *s = state; register uint32 *la = loadArray; register int i = N; for( ; i--; *s++ = *la++ ) {} left = *la; pNext = &state[N-left]; } inline std::ostream& operator<<( std::ostream& os, const MTRand& mtrand ) { register const MTRand::uint32 *s = mtrand.state; register int i = mtrand.N; for( ; i--; os << *s++ << "\t" ) {} return os << mtrand.left; } inline std::istream& operator>>( std::istream& is, MTRand& mtrand ) { register MTRand::uint32 *s = mtrand.state; register int i = mtrand.N; for( ; i--; is >> *s++ ) {} is >> mtrand.left; mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left]; return is; } #endif // MERSENNETWISTER_H // Change log: // // v0.1 - First release on 15 May 2000 // - Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus // - Translated from C to C++ // - Made completely ANSI compliant // - Designed convenient interface for initialization, seeding, and // obtaining numbers in default or user-defined ranges // - Added automatic seeding from /dev/urandom or time() and clock() // - Provided functions for saving and loading generator state // // v0.2 - Fixed bug which reloaded generator one step too late // // v0.3 - Switched to clearer, faster reload() code from Matthew Bellew // // v0.4 - Removed trailing newline in saved generator format to be consistent // with output format of built-in types // // v0.5 - Improved portability by replacing static const int's with enum's and // clarifying return values in seed(); suggested by Eric Heimburg // - Removed MAXINT constant; use 0xffffffffUL instead // // v0.6 - Eliminated seed overflow when uint32 is larger than 32 bits // - Changed integer [0,n] generator to give better uniformity // // v0.7 - Fixed operator precedence ambiguity in reload() // - Added access for real numbers in (0,1) and (0,n) // // v0.8 - Included time.h header to properly support time_t and clock_t // // v1.0 - Revised seeding to match 26 Jan 2002 update of Nishimura and Matsumoto // - Allowed for seeding with arrays of any length // - Added access for real numbers in [0,1) with 53-bit resolution // - Added access for real numbers from normal (Gaussian) distributions // - Increased overall speed by optimizing twist() // - Doubled speed of integer [0,n] generation // - Fixed out-of-range number generation on 64-bit machines // - Improved portability by substituting literal constants for long enum's // - Changed license from GNU LGPL to BSD Maude-2.6/src/3rdParty/malloc.c0000644000147300135640000053746510321265635013306 00000000000000/* This is a version (aka dlmalloc) of malloc/free/realloc written by Doug Lea and released to the public domain, as explained at http://creativecommons.org/licenses/publicdomain. Send questions, comments, complaints, performance data, etc to dl@cs.oswego.edu * Version 2.8.3 Thu Sep 22 11:16:15 2005 Doug Lea (dl at gee) Note: There may be an updated version of this malloc obtainable at ftp://gee.cs.oswego.edu/pub/misc/malloc.c Check before installing! * Quickstart This library is all in one file to simplify the most common usage: ftp it, compile it (-O3), and link it into another program. All of the compile-time options default to reasonable values for use on most platforms. You might later want to step through various compile-time and dynamic tuning options. For convenience, an include file for code using this malloc is at: ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.3.h You don't really need this .h file unless you call functions not defined in your system include files. The .h file contains only the excerpts from this file needed for using this malloc on ANSI C/C++ systems, so long as you haven't changed compile-time options about naming and tuning parameters. If you do, then you can create your own malloc.h that does include all settings by cutting at the point indicated below. Note that you may already by default be using a C library containing a malloc that is based on some version of this malloc (for example in linux). You might still want to use the one in this file to customize settings or to avoid overheads associated with library versions. * Vital statistics: Supported pointer/size_t representation: 4 or 8 bytes size_t MUST be an unsigned type of the same width as pointers. (If you are using an ancient system that declares size_t as a signed type, or need it to be a different width than pointers, you can use a previous release of this malloc (e.g. 2.7.2) supporting these.) Alignment: 8 bytes (default) This suffices for nearly all current machines and C compilers. However, you can define MALLOC_ALIGNMENT to be wider than this if necessary (up to 128bytes), at the expense of using more space. Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) 8 or 16 bytes (if 8byte sizes) Each malloced chunk has a hidden word of overhead holding size and status information, and additional cross-check word if FOOTERS is defined. Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) 8-byte ptrs: 32 bytes (including overhead) Even a request for zero bytes (i.e., malloc(0)) returns a pointer to something of the minimum allocatable size. The maximum overhead wastage (i.e., number of extra bytes allocated than were requested in malloc) is less than or equal to the minimum size, except for requests >= mmap_threshold that are serviced via mmap(), where the worst case wastage is about 32 bytes plus the remainder from a system page (the minimal mmap unit); typically 4096 or 8192 bytes. Security: static-safe; optionally more or less The "security" of malloc refers to the ability of malicious code to accentuate the effects of errors (for example, freeing space that is not currently malloc'ed or overwriting past the ends of chunks) in code that calls malloc. This malloc guarantees not to modify any memory locations below the base of heap, i.e., static variables, even in the presence of usage errors. The routines additionally detect most improper frees and reallocs. All this holds as long as the static bookkeeping for malloc itself is not corrupted by some other means. This is only one aspect of security -- these checks do not, and cannot, detect all possible programming errors. If FOOTERS is defined nonzero, then each allocated chunk carries an additional check word to verify that it was malloced from its space. These check words are the same within each execution of a program using malloc, but differ across executions, so externally crafted fake chunks cannot be freed. This improves security by rejecting frees/reallocs that could corrupt heap memory, in addition to the checks preventing writes to statics that are always on. This may further improve security at the expense of time and space overhead. (Note that FOOTERS may also be worth using with MSPACES.) By default detected errors cause the program to abort (calling "abort()"). You can override this to instead proceed past errors by defining PROCEED_ON_ERROR. In this case, a bad free has no effect, and a malloc that encounters a bad address caused by user overwrites will ignore the bad address by dropping pointers and indices to all known memory. This may be appropriate for programs that should continue if at all possible in the face of programming errors, although they may run out of memory because dropped memory is never reclaimed. If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. Thread-safety: NOT thread-safe unless USE_LOCKS defined When USE_LOCKS is defined, each public call to malloc, free, etc is surrounded with either a pthread mutex or a win32 spinlock (depending on WIN32). This is not especially fast, and can be a major bottleneck. It is designed only to provide minimal protection in concurrent environments, and to provide a basis for extensions. If you are using malloc in a concurrent program, consider instead using ptmalloc, which is derived from a version of this malloc. (See http://www.malloc.de). System requirements: Any combination of MORECORE and/or MMAP/MUNMAP This malloc can use unix sbrk or any emulation (invoked using the CALL_MORECORE macro) and/or mmap/munmap or any emulation (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system memory. On most unix systems, it tends to work best if both MORECORE and MMAP are enabled. On Win32, it uses emulations based on VirtualAlloc. It also uses common C library functions like memset. Compliance: I believe it is compliant with the Single Unix Specification (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably others as well. * Overview of algorithms This is not the fastest, most space-conserving, most portable, or most tunable malloc ever written. However it is among the fastest while also being among the most space-conserving, portable and tunable. Consistent balance across these factors results in a good general-purpose allocator for malloc-intensive programs. In most ways, this malloc is a best-fit allocator. Generally, it chooses the best-fitting existing chunk for a request, with ties broken in approximately least-recently-used order. (This strategy normally maintains low fragmentation.) However, for requests less than 256bytes, it deviates from best-fit when there is not an exactly fitting available chunk by preferring to use space adjacent to that used for the previous small request, as well as by breaking ties in approximately most-recently-used order. (These enhance locality of series of small allocations.) And for very large requests (>= 256Kb by default), it relies on system memory mapping facilities, if supported. (This helps avoid carrying around and possibly fragmenting memory used only for large chunks.) All operations (except malloc_stats and mallinfo) have execution times that are bounded by a constant factor of the number of bits in a size_t, not counting any clearing in calloc or copying in realloc, or actions surrounding MORECORE and MMAP that have times proportional to the number of non-contiguous regions returned by system allocation routines, which is often just 1. The implementation is not very modular and seriously overuses macros. Perhaps someday all C compilers will do as good a job inlining modular code as can now be done by brute-force expansion, but now, enough of them seem not to. Some compilers issue a lot of warnings about code that is dead/unreachable only on some platforms, and also about intentional uses of negation on unsigned types. All known cases of each can be ignored. For a longer but out of date high-level description, see http://gee.cs.oswego.edu/dl/html/malloc.html * MSPACES If MSPACES is defined, then in addition to malloc, free, etc., this file also defines mspace_malloc, mspace_free, etc. These are versions of malloc routines that take an "mspace" argument obtained using create_mspace, to control all internal bookkeeping. If ONLY_MSPACES is defined, only these versions are compiled. So if you would like to use this allocator for only some allocations, and your system malloc for others, you can compile with ONLY_MSPACES and then do something like... static mspace mymspace = create_mspace(0,0); // for example #define mymalloc(bytes) mspace_malloc(mymspace, bytes) (Note: If you only need one instance of an mspace, you can instead use "USE_DL_PREFIX" to relabel the global malloc.) You can similarly create thread-local allocators by storing mspaces as thread-locals. For example: static __thread mspace tlms = 0; void* tlmalloc(size_t bytes) { if (tlms == 0) tlms = create_mspace(0, 0); return mspace_malloc(tlms, bytes); } void tlfree(void* mem) { mspace_free(tlms, mem); } Unless FOOTERS is defined, each mspace is completely independent. You cannot allocate from one and free to another (although conformance is only weakly checked, so usage errors are not always caught). If FOOTERS is defined, then each chunk carries around a tag indicating its originating mspace, and frees are directed to their originating spaces. ------------------------- Compile-time options --------------------------- Be careful in setting #define values for numerical constants of type size_t. On some systems, literal values are not automatically extended to size_t precision unless they are explicitly casted. WIN32 default: defined if _WIN32 defined Defining WIN32 sets up defaults for MS environment and compilers. Otherwise defaults are for unix. MALLOC_ALIGNMENT default: (size_t)8 Controls the minimum alignment for malloc'ed chunks. It must be a power of two and at least 8, even on machines for which smaller alignments would suffice. It may be defined as larger than this though. Note however that code and data structures are optimized for the case of 8-byte alignment. MSPACES default: 0 (false) If true, compile in support for independent allocation spaces. This is only supported if HAVE_MMAP is true. ONLY_MSPACES default: 0 (false) If true, only compile in mspace versions, not regular versions. USE_LOCKS default: 0 (false) Causes each call to each public routine to be surrounded with pthread or WIN32 mutex lock/unlock. (If set true, this can be overridden on a per-mspace basis for mspace versions.) FOOTERS default: 0 If true, provide extra checking and dispatching by placing information in the footers of allocated chunks. This adds space and time overhead. INSECURE default: 0 If true, omit checks for usage errors and heap space overwrites. USE_DL_PREFIX default: NOT defined Causes compiler to prefix all public routines with the string 'dl'. This can be useful when you only want to use this malloc in one part of a program, using your regular system malloc elsewhere. ABORT default: defined as abort() Defines how to abort on failed checks. On most systems, a failed check cannot die with an "assert" or even print an informative message, because the underlying print routines in turn call malloc, which will fail again. Generally, the best policy is to simply call abort(). It's not very useful to do more than this because many errors due to overwriting will show up as address faults (null, odd addresses etc) rather than malloc-triggered checks, so will also abort. Also, most compilers know that abort() does not return, so can better optimize code conditionally calling it. PROCEED_ON_ERROR default: defined as 0 (false) Controls whether detected bad addresses cause them to bypassed rather than aborting. If set, detected bad arguments to free and realloc are ignored. And all bookkeeping information is zeroed out upon a detected overwrite of freed heap space, thus losing the ability to ever return it from malloc again, but enabling the application to proceed. If PROCEED_ON_ERROR is defined, the static variable malloc_corruption_error_count is compiled in and can be examined to see if errors have occurred. This option generates slower code than the default abort policy. DEBUG default: NOT defined The DEBUG setting is mainly intended for people trying to modify this code or diagnose problems when porting to new platforms. However, it may also be able to better isolate user errors than just using runtime checks. The assertions in the check routines spell out in more detail the assumptions and invariants underlying the algorithms. The checking is fairly extensive, and will slow down execution noticeably. Calling malloc_stats or mallinfo with DEBUG set will attempt to check every non-mmapped allocated and free chunk in the course of computing the summaries. ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) Debugging assertion failures can be nearly impossible if your version of the assert macro causes malloc to be called, which will lead to a cascade of further failures, blowing the runtime stack. ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), which will usually make debugging easier. MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 The action to take before "return 0" when malloc fails to be able to return memory because there is none available. HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES True if this system supports sbrk or an emulation of it. MORECORE default: sbrk The name of the sbrk-style system routine to call to obtain more memory. See below for guidance on writing custom MORECORE functions. The type of the argument to sbrk/MORECORE varies across systems. It cannot be size_t, because it supports negative arguments, so it is normally the signed type of the same width as size_t (sometimes declared as "intptr_t"). It doesn't much matter though. Internally, we only call it with arguments less than half the max value of a size_t, which should work across all reasonable possibilities, although sometimes generating compiler warnings. See near the end of this file for guidelines for creating a custom version of MORECORE. MORECORE_CONTIGUOUS default: 1 (true) If true, take advantage of fact that consecutive calls to MORECORE with positive arguments always return contiguous increasing addresses. This is true of unix sbrk. It does not hurt too much to set it true anyway, since malloc copes with non-contiguities. Setting it false when definitely non-contiguous saves time and possibly wasted space it would take to discover this though. MORECORE_CANNOT_TRIM default: NOT defined True if MORECORE cannot release space back to the system when given negative arguments. This is generally necessary only if you are using a hand-crafted MORECORE function that cannot handle negative arguments. HAVE_MMAP default: 1 (true) True if this system supports mmap or an emulation of it. If so, and HAVE_MORECORE is not true, MMAP is used for all system allocation. If set and HAVE_MORECORE is true as well, MMAP is primarily used to directly allocate very large blocks. It is also used as a backup strategy in cases where MORECORE fails to provide space from system. Note: A single call to MUNMAP is assumed to be able to unmap memory that may have be allocated using multiple calls to MMAP, so long as they are adjacent. HAVE_MREMAP default: 1 on linux, else 0 If true realloc() uses mremap() to re-allocate large blocks and extend or shrink allocation spaces. MMAP_CLEARS default: 1 on unix True if mmap clears memory so calloc doesn't need to. This is true for standard unix mmap using /dev/zero. USE_BUILTIN_FFS default: 0 (i.e., not used) Causes malloc to use the builtin ffs() function to compute indices. Some compilers may recognize and intrinsify ffs to be faster than the supplied C version. Also, the case of x86 using gcc is special-cased to an asm instruction, so is already as fast as it can be, and so this setting has no effect. (On most x86s, the asm version is only slightly faster than the C version.) malloc_getpagesize default: derive from system includes, or 4096. The system page size. To the extent possible, this malloc manages memory from the system in page-size units. This may be (and usually is) a function rather than a constant. This is ignored if WIN32, where page size is determined using getSystemInfo during initialization. USE_DEV_RANDOM default: 0 (i.e., not used) Causes malloc to use /dev/random to initialize secure magic seed for stamping footers. Otherwise, the current time is used. NO_MALLINFO default: 0 If defined, don't compile "mallinfo". This can be a simple way of dealing with mismatches between system declarations and those in this file. MALLINFO_FIELD_TYPE default: size_t The type of the fields in the mallinfo struct. This was originally defined as "int" in SVID etc, but is more usefully defined as size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set REALLOC_ZERO_BYTES_FREES default: not defined This should be set if a call to realloc with zero bytes should be the same as a call to free. Some people think it should. Otherwise, since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H LACKS_STDLIB_H default: NOT defined unless on WIN32 Define these if your system does not have these header files. You might need to manually insert some of the declarations they provide. DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, system_info.dwAllocationGranularity in WIN32, otherwise 64K. Also settable using mallopt(M_GRANULARITY, x) The unit for allocating and deallocating memory from the system. On most systems with contiguous MORECORE, there is no reason to make this more than a page. However, systems with MMAP tend to either require or encourage larger granularities. You can increase this value to prevent system allocation functions to be called so often, especially if they are slow. The value must be at least one page and must be a power of two. Setting to 0 causes initialization to either page size or win32 region size. (Note: In previous versions of malloc, the equivalent of this option was called "TOP_PAD") DEFAULT_TRIM_THRESHOLD default: 2MB Also settable using mallopt(M_TRIM_THRESHOLD, x) The maximum amount of unused top-most memory to keep before releasing via malloc_trim in free(). Automatic trimming is mainly useful in long-lived programs using contiguous MORECORE. Because trimming via sbrk can be slow on some systems, and can sometimes be wasteful (in cases where programs immediately afterward allocate more large chunks) the value should be high enough so that your overall system performance would improve by releasing this much memory. As a rough guide, you might set to a value close to the average size of a process (program) running on your system. Releasing this much memory would allow such a process to run in memory. Generally, it is worth tuning trim thresholds when a program undergoes phases where several large chunks are allocated and released in ways that can reuse each other's storage, perhaps mixed with phases where there are no such chunks at all. The trim value must be greater than page size to have any useful effect. To disable trimming completely, you can set to MAX_SIZE_T. Note that the trick some people use of mallocing a huge space and then freeing it at program startup, in an attempt to reserve system memory, doesn't have the intended effect under automatic trimming, since that memory will immediately be returned to the system. DEFAULT_MMAP_THRESHOLD default: 256K Also settable using mallopt(M_MMAP_THRESHOLD, x) The request size threshold for using MMAP to directly service a request. Requests of at least this size that cannot be allocated using already-existing space will be serviced via mmap. (If enough normal freed space already exists it is used instead.) Using mmap segregates relatively large chunks of memory so that they can be individually obtained and released from the host system. A request serviced through mmap is never reused by any other request (at least not directly; the system may just so happen to remap successive requests to the same locations). Segregating space in this way has the benefits that: Mmapped space can always be individually released back to the system, which helps keep the system level memory demands of a long-lived program low. Also, mapped memory doesn't become `locked' between other chunks, as can happen with normally allocated chunks, which means that even trimming via malloc_trim would not release them. However, it has the disadvantage that the space cannot be reclaimed, consolidated, and then used to service later requests, as happens with normal chunks. The advantages of mmap nearly always outweigh disadvantages for "large" chunks, but the value of "large" may vary across systems. The default is an empirically derived value that works well in most systems. You can disable mmap by setting to MAX_SIZE_T. */ #ifndef WIN32 #ifdef _WIN32 #define WIN32 1 #endif /* _WIN32 */ #endif /* WIN32 */ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 #define LACKS_UNISTD_H #define LACKS_SYS_PARAM_H #define LACKS_SYS_MMAN_H #define LACKS_STRING_H #define LACKS_STRINGS_H #define LACKS_SYS_TYPES_H #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ #endif /* WIN32 */ #if defined(DARWIN) || defined(_DARWIN) /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ #ifndef HAVE_MORECORE #define HAVE_MORECORE 0 #define HAVE_MMAP 1 #endif /* HAVE_MORECORE */ #endif /* DARWIN */ #ifndef LACKS_SYS_TYPES_H #include /* For size_t */ #endif /* LACKS_SYS_TYPES_H */ /* The maximum possible size_t value has all bits set */ #define MAX_SIZE_T (~(size_t)0) #ifndef ONLY_MSPACES #define ONLY_MSPACES 0 #endif /* ONLY_MSPACES */ #ifndef MSPACES #if ONLY_MSPACES #define MSPACES 1 #else /* ONLY_MSPACES */ #define MSPACES 0 #endif /* ONLY_MSPACES */ #endif /* MSPACES */ #ifndef MALLOC_ALIGNMENT #define MALLOC_ALIGNMENT ((size_t)8U) #endif /* MALLOC_ALIGNMENT */ #ifndef FOOTERS #define FOOTERS 0 #endif /* FOOTERS */ #ifndef ABORT #define ABORT abort() #endif /* ABORT */ #ifndef ABORT_ON_ASSERT_FAILURE #define ABORT_ON_ASSERT_FAILURE 1 #endif /* ABORT_ON_ASSERT_FAILURE */ #ifndef PROCEED_ON_ERROR #define PROCEED_ON_ERROR 0 #endif /* PROCEED_ON_ERROR */ #ifndef USE_LOCKS #define USE_LOCKS 0 #endif /* USE_LOCKS */ #ifndef INSECURE #define INSECURE 0 #endif /* INSECURE */ #ifndef HAVE_MMAP #define HAVE_MMAP 1 #endif /* HAVE_MMAP */ #ifndef MMAP_CLEARS #define MMAP_CLEARS 1 #endif /* MMAP_CLEARS */ #ifndef HAVE_MREMAP #ifdef linux #define HAVE_MREMAP 1 #else /* linux */ #define HAVE_MREMAP 0 #endif /* linux */ #endif /* HAVE_MREMAP */ #ifndef MALLOC_FAILURE_ACTION #define MALLOC_FAILURE_ACTION errno = ENOMEM; #endif /* MALLOC_FAILURE_ACTION */ #ifndef HAVE_MORECORE #if ONLY_MSPACES #define HAVE_MORECORE 0 #else /* ONLY_MSPACES */ #define HAVE_MORECORE 1 #endif /* ONLY_MSPACES */ #endif /* HAVE_MORECORE */ #if !HAVE_MORECORE #define MORECORE_CONTIGUOUS 0 #else /* !HAVE_MORECORE */ #ifndef MORECORE #define MORECORE sbrk #endif /* MORECORE */ #ifndef MORECORE_CONTIGUOUS #define MORECORE_CONTIGUOUS 1 #endif /* MORECORE_CONTIGUOUS */ #endif /* HAVE_MORECORE */ #ifndef DEFAULT_GRANULARITY #if MORECORE_CONTIGUOUS #define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ #else /* MORECORE_CONTIGUOUS */ #define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) #endif /* MORECORE_CONTIGUOUS */ #endif /* DEFAULT_GRANULARITY */ #ifndef DEFAULT_TRIM_THRESHOLD #ifndef MORECORE_CANNOT_TRIM #define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) #else /* MORECORE_CANNOT_TRIM */ #define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T #endif /* MORECORE_CANNOT_TRIM */ #endif /* DEFAULT_TRIM_THRESHOLD */ #ifndef DEFAULT_MMAP_THRESHOLD #if HAVE_MMAP #define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) #else /* HAVE_MMAP */ #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T #endif /* HAVE_MMAP */ #endif /* DEFAULT_MMAP_THRESHOLD */ #ifndef USE_BUILTIN_FFS #define USE_BUILTIN_FFS 0 #endif /* USE_BUILTIN_FFS */ #ifndef USE_DEV_RANDOM #define USE_DEV_RANDOM 0 #endif /* USE_DEV_RANDOM */ #ifndef NO_MALLINFO #define NO_MALLINFO 0 #endif /* NO_MALLINFO */ #ifndef MALLINFO_FIELD_TYPE #define MALLINFO_FIELD_TYPE size_t #endif /* MALLINFO_FIELD_TYPE */ /* mallopt tuning options. SVID/XPG defines four standard parameter numbers for mallopt, normally defined in malloc.h. None of these are used in this malloc, so setting them has no effect. But this malloc does support the following options. */ #define M_TRIM_THRESHOLD (-1) #define M_GRANULARITY (-2) #define M_MMAP_THRESHOLD (-3) /* ------------------------ Mallinfo declarations ------------------------ */ #if !NO_MALLINFO /* This version of malloc supports the standard SVID/XPG mallinfo routine that returns a struct containing usage properties and statistics. It should work on any system that has a /usr/include/malloc.h defining struct mallinfo. The main declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a /usr/include/malloc.h file that includes a declaration of struct mallinfo. If so, it is included; else a compliant version is declared below. These must be precisely the same for mallinfo() to work. The original SVID version of this struct, defined on most systems with mallinfo, declares all fields as ints. But some others define as unsigned long. If your system defines the fields using a type of different width than listed here, you MUST #include your system version and #define HAVE_USR_INCLUDE_MALLOC_H. */ /* #define HAVE_USR_INCLUDE_MALLOC_H */ #ifdef HAVE_USR_INCLUDE_MALLOC_H #include "/usr/include/malloc.h" #else /* HAVE_USR_INCLUDE_MALLOC_H */ struct mallinfo { MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ MALLINFO_FIELD_TYPE smblks; /* always 0 */ MALLINFO_FIELD_TYPE hblks; /* always 0 */ MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ MALLINFO_FIELD_TYPE fordblks; /* total free space */ MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ }; #endif /* HAVE_USR_INCLUDE_MALLOC_H */ #endif /* NO_MALLINFO */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if !ONLY_MSPACES /* ------------------- Declarations of public routines ------------------- */ #ifndef USE_DL_PREFIX #define dlcalloc calloc #define dlfree free #define dlmalloc malloc #define dlmemalign memalign #define dlrealloc realloc #define dlvalloc valloc #define dlpvalloc pvalloc #define dlmallinfo mallinfo #define dlmallopt mallopt #define dlmalloc_trim malloc_trim #define dlmalloc_stats malloc_stats #define dlmalloc_usable_size malloc_usable_size #define dlmalloc_footprint malloc_footprint #define dlmalloc_max_footprint malloc_max_footprint #define dlindependent_calloc independent_calloc #define dlindependent_comalloc independent_comalloc #endif /* USE_DL_PREFIX */ /* malloc(size_t n) Returns a pointer to a newly allocated chunk of at least n bytes, or null if no space is available, in which case errno is set to ENOMEM on ANSI C systems. If n is zero, malloc returns a minimum-sized chunk. (The minimum size is 16 bytes on most 32bit systems, and 32 bytes on 64bit systems.) Note that size_t is an unsigned type, so calls with arguments that would be negative if signed are interpreted as requests for huge amounts of space, which will often fail. The maximum supported value of n differs across systems, but is in all cases less than the maximum representable value of a size_t. */ void* dlmalloc(size_t); /* free(void* p) Releases the chunk of memory pointed to by p, that had been previously allocated using malloc or a related routine such as realloc. It has no effect if p is null. If p was not malloced or already freed, free(p) will by default cause the current program to abort. */ void dlfree(void*); /* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */ void* dlcalloc(size_t, size_t); /* realloc(void* p, size_t n) Returns a pointer to a chunk of size n that contains the same data as does chunk p up to the minimum of (n, p's size) bytes, or null if no space is available. The returned pointer may or may not be the same as p. The algorithm prefers extending p in most cases when possible, otherwise it employs the equivalent of a malloc-copy-free sequence. If p is null, realloc is equivalent to malloc. If space is not available, realloc returns null, errno is set (if on ANSI) and p is NOT freed. if n is for fewer bytes than already held by p, the newly unused space is lopped off and freed if possible. realloc with a size argument of zero (re)allocates a minimum-sized chunk. The old unix realloc convention of allowing the last-free'd chunk to be used as an argument to realloc is not supported. */ void* dlrealloc(void*, size_t); /* memalign(size_t alignment, size_t n); Returns a pointer to a newly allocated chunk of n bytes, aligned in accord with the alignment argument. The alignment argument should be a power of two. If the argument is not a power of two, the nearest greater power is used. 8-byte alignment is guaranteed by normal malloc calls, so don't bother calling memalign with an argument of 8 or less. Overreliance on memalign is a sure way to fragment space. */ void* dlmemalign(size_t, size_t); /* valloc(size_t n); Equivalent to memalign(pagesize, n), where pagesize is the page size of the system. If the pagesize is unknown, 4096 is used. */ void* dlvalloc(size_t); /* mallopt(int parameter_number, int parameter_value) Sets tunable parameters The format is to provide a (parameter-number, parameter-value) pair. mallopt then sets the corresponding parameter to the argument value if it can (i.e., so long as the value is meaningful), and returns 1 if successful else 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, normally defined in malloc.h. None of these are use in this malloc, so setting them has no effect. But this malloc also supports other options in mallopt. See below for details. Briefly, supported parameters are as follows (listed defaults are for "typical" configurations). Symbol param # default allowed param values M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) M_GRANULARITY -2 page size any power of 2 >= page size M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) */ int dlmallopt(int, int); /* malloc_footprint(); Returns the number of bytes obtained from the system. The total number of bytes allocated by malloc, realloc etc., is less than this value. Unlike mallinfo, this function returns only a precomputed result, so can be called frequently to monitor memory consumption. Even if locks are otherwise defined, this function does not use them, so results might not be up to date. */ size_t dlmalloc_footprint(void); /* malloc_max_footprint(); Returns the maximum number of bytes obtained from the system. This value will be greater than current footprint if deallocated space has been reclaimed by the system. The peak number of bytes allocated by malloc, realloc etc., is less than this value. Unlike mallinfo, this function returns only a precomputed result, so can be called frequently to monitor memory consumption. Even if locks are otherwise defined, this function does not use them, so results might not be up to date. */ size_t dlmalloc_max_footprint(void); #if !NO_MALLINFO /* mallinfo() Returns (by copy) a struct containing various summary statistics: arena: current total non-mmapped bytes allocated from system ordblks: the number of free chunks smblks: always zero. hblks: current number of mmapped regions hblkhd: total bytes held in mmapped regions usmblks: the maximum total allocated space. This will be greater than current total if trimming has occurred. fsmblks: always zero uordblks: current total allocated space (normal or mmapped) fordblks: total free space keepcost: the maximum number of bytes that could ideally be released back to system via malloc_trim. ("ideally" means that it ignores page restrictions etc.) Because these fields are ints, but internal bookkeeping may be kept as longs, the reported values may wrap around zero and thus be inaccurate. */ struct mallinfo dlmallinfo(void); #endif /* NO_MALLINFO */ /* independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); independent_calloc is similar to calloc, but instead of returning a single cleared space, it returns an array of pointers to n_elements independent elements that can hold contents of size elem_size, each of which starts out cleared, and can be independently freed, realloc'ed etc. The elements are guaranteed to be adjacently allocated (this is not guaranteed to occur with multiple callocs or mallocs), which may also improve cache locality in some applications. The "chunks" argument is optional (i.e., may be null, which is probably the most typical usage). If it is null, the returned array is itself dynamically allocated and should also be freed when it is no longer needed. Otherwise, the chunks array must be of at least n_elements in length. It is filled in with the pointers to the chunks. In either case, independent_calloc returns this pointer array, or null if the allocation failed. If n_elements is zero and "chunks" is null, it returns a chunk representing an array with zero elements (which should be freed if not wanted). Each element must be individually freed when it is no longer needed. If you'd like to instead be able to free all at once, you should instead use regular calloc and assign pointers into this space to represent elements. (In this case though, you cannot independently free elements.) independent_calloc simplifies and speeds up implementations of many kinds of pools. It may also be useful when constructing large data structures that initially have a fixed number of fixed-sized nodes, but the number is not known at compile time, and some of the nodes may later need to be freed. For example: struct Node { int item; struct Node* next; }; struct Node* build_list() { struct Node** pool; int n = read_number_of_nodes_needed(); if (n <= 0) return 0; pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); if (pool == 0) die(); // organize into a linked list... struct Node* first = pool[0]; for (i = 0; i < n-1; ++i) pool[i]->next = pool[i+1]; free(pool); // Can now free the array (or not, if it is needed later) return first; } */ void** dlindependent_calloc(size_t, size_t, void**); /* independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); independent_comalloc allocates, all at once, a set of n_elements chunks with sizes indicated in the "sizes" array. It returns an array of pointers to these elements, each of which can be independently freed, realloc'ed etc. The elements are guaranteed to be adjacently allocated (this is not guaranteed to occur with multiple callocs or mallocs), which may also improve cache locality in some applications. The "chunks" argument is optional (i.e., may be null). If it is null the returned array is itself dynamically allocated and should also be freed when it is no longer needed. Otherwise, the chunks array must be of at least n_elements in length. It is filled in with the pointers to the chunks. In either case, independent_comalloc returns this pointer array, or null if the allocation failed. If n_elements is zero and chunks is null, it returns a chunk representing an array with zero elements (which should be freed if not wanted). Each element must be individually freed when it is no longer needed. If you'd like to instead be able to free all at once, you should instead use a single regular malloc, and assign pointers at particular offsets in the aggregate space. (In this case though, you cannot independently free elements.) independent_comallac differs from independent_calloc in that each element may have a different size, and also that it does not automatically clear elements. independent_comalloc can be used to speed up allocation in cases where several structs or objects must always be allocated at the same time. For example: struct Head { ... } struct Foot { ... } void send_message(char* msg) { int msglen = strlen(msg); size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; void* chunks[3]; if (independent_comalloc(3, sizes, chunks) == 0) die(); struct Head* head = (struct Head*)(chunks[0]); char* body = (char*)(chunks[1]); struct Foot* foot = (struct Foot*)(chunks[2]); // ... } In general though, independent_comalloc is worth using only for larger values of n_elements. For small values, you probably won't detect enough difference from series of malloc calls to bother. Overuse of independent_comalloc can increase overall memory usage, since it cannot reuse existing noncontiguous small chunks that might be available for some of the elements. */ void** dlindependent_comalloc(size_t, size_t*, void**); /* pvalloc(size_t n); Equivalent to valloc(minimum-page-that-holds(n)), that is, round up n to nearest pagesize. */ void* dlpvalloc(size_t); /* malloc_trim(size_t pad); If possible, gives memory back to the system (via negative arguments to sbrk) if there is unused memory at the `high' end of the malloc pool or in unused MMAP segments. You can call this after freeing large blocks of memory to potentially reduce the system-level memory requirements of a program. However, it cannot guarantee to reduce memory. Under some allocation patterns, some large free blocks of memory will be locked between two used chunks, so they cannot be given back to the system. The `pad' argument to malloc_trim represents the amount of free trailing space to leave untrimmed. If this argument is zero, only the minimum amount of memory to maintain internal data structures will be left. Non-zero arguments can be supplied to maintain enough trailing space to service future expected allocations without having to re-obtain memory from the system. Malloc_trim returns 1 if it actually released any memory, else 0. */ int dlmalloc_trim(size_t); /* malloc_usable_size(void* p); Returns the number of bytes you can actually use in an allocated chunk, which may be more than you requested (although often not) due to alignment and minimum size constraints. You can use this many bytes without worrying about overwriting other allocated objects. This is not a particularly great programming practice. malloc_usable_size can be more useful in debugging and assertions, for example: p = malloc(n); assert(malloc_usable_size(p) >= 256); */ size_t dlmalloc_usable_size(void*); /* malloc_stats(); Prints on stderr the amount of space obtained from the system (both via sbrk and mmap), the maximum amount (which may be more than current if malloc_trim and/or munmap got called), and the current number of bytes allocated via malloc (or realloc, etc) but not yet freed. Note that this is the number of bytes allocated, not the number requested. It will be larger than the number requested because of alignment and bookkeeping overhead. Because it includes alignment wastage as being in use, this figure may be greater than zero even when no user-level chunks are allocated. The reported current and maximum system memory can be inaccurate if a program makes other calls to system memory allocation functions (normally sbrk) outside of malloc. malloc_stats prints only the most commonly interesting statistics. More information can be obtained by calling mallinfo. */ void dlmalloc_stats(void); #endif /* ONLY_MSPACES */ #if MSPACES /* mspace is an opaque type representing an independent region of space that supports mspace_malloc, etc. */ typedef void* mspace; /* create_mspace creates and returns a new independent space with the given initial capacity, or, if 0, the default granularity size. It returns null if there is no system memory available to create the space. If argument locked is non-zero, the space uses a separate lock to control access. The capacity of the space will grow dynamically as needed to service mspace_malloc requests. You can control the sizes of incremental increases of this space by compiling with a different DEFAULT_GRANULARITY or dynamically setting with mallopt(M_GRANULARITY, value). */ mspace create_mspace(size_t capacity, int locked); /* destroy_mspace destroys the given space, and attempts to return all of its memory back to the system, returning the total number of bytes freed. After destruction, the results of access to all memory used by the space become undefined. */ size_t destroy_mspace(mspace msp); /* create_mspace_with_base uses the memory supplied as the initial base of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this space is used for bookkeeping, so the capacity must be at least this large. (Otherwise 0 is returned.) When this initial space is exhausted, additional memory will be obtained from the system. Destroying this space will deallocate all additionally allocated space (if possible) but not the initial base. */ mspace create_mspace_with_base(void* base, size_t capacity, int locked); /* mspace_malloc behaves as malloc, but operates within the given space. */ void* mspace_malloc(mspace msp, size_t bytes); /* mspace_free behaves as free, but operates within the given space. If compiled with FOOTERS==1, mspace_free is not actually needed. free may be called instead of mspace_free because freed chunks from any space are handled by their originating spaces. */ void mspace_free(mspace msp, void* mem); /* mspace_realloc behaves as realloc, but operates within the given space. If compiled with FOOTERS==1, mspace_realloc is not actually needed. realloc may be called instead of mspace_realloc because realloced chunks from any space are handled by their originating spaces. */ void* mspace_realloc(mspace msp, void* mem, size_t newsize); /* mspace_calloc behaves as calloc, but operates within the given space. */ void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); /* mspace_memalign behaves as memalign, but operates within the given space. */ void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); /* mspace_independent_calloc behaves as independent_calloc, but operates within the given space. */ void** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void* chunks[]); /* mspace_independent_comalloc behaves as independent_comalloc, but operates within the given space. */ void** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void* chunks[]); /* mspace_footprint() returns the number of bytes obtained from the system for this space. */ size_t mspace_footprint(mspace msp); /* mspace_max_footprint() returns the peak number of bytes obtained from the system for this space. */ size_t mspace_max_footprint(mspace msp); #if !NO_MALLINFO /* mspace_mallinfo behaves as mallinfo, but reports properties of the given space. */ struct mallinfo mspace_mallinfo(mspace msp); #endif /* NO_MALLINFO */ /* mspace_malloc_stats behaves as malloc_stats, but reports properties of the given space. */ void mspace_malloc_stats(mspace msp); /* mspace_trim behaves as malloc_trim, but operates within the given space. */ int mspace_trim(mspace msp, size_t pad); /* An alias for mallopt. */ int mspace_mallopt(int, int); #endif /* MSPACES */ #ifdef __cplusplus }; /* end of extern "C" */ #endif /* __cplusplus */ /* ======================================================================== To make a fully customizable malloc.h header file, cut everything above this line, put into file malloc.h, edit to suit, and #include it on the next line, as well as in programs that use this malloc. ======================================================================== */ /* #include "malloc.h" */ /*------------------------------ internal #includes ---------------------- */ #ifdef WIN32 #pragma warning( disable : 4146 ) /* no "unsigned" warnings */ #endif /* WIN32 */ #include /* for printing in malloc_stats */ #ifndef LACKS_ERRNO_H #include /* for MALLOC_FAILURE_ACTION */ #endif /* LACKS_ERRNO_H */ #if FOOTERS #include /* for magic initialization */ #endif /* FOOTERS */ #ifndef LACKS_STDLIB_H #include /* for abort() */ #endif /* LACKS_STDLIB_H */ #ifdef DEBUG #if ABORT_ON_ASSERT_FAILURE #define assert(x) if(!(x)) ABORT #else /* ABORT_ON_ASSERT_FAILURE */ #include #endif /* ABORT_ON_ASSERT_FAILURE */ #else /* DEBUG */ #define assert(x) #endif /* DEBUG */ #ifndef LACKS_STRING_H #include /* for memset etc */ #endif /* LACKS_STRING_H */ #if USE_BUILTIN_FFS #ifndef LACKS_STRINGS_H #include /* for ffs */ #endif /* LACKS_STRINGS_H */ #endif /* USE_BUILTIN_FFS */ #if HAVE_MMAP #ifndef LACKS_SYS_MMAN_H #include /* for mmap */ #endif /* LACKS_SYS_MMAN_H */ #ifndef LACKS_FCNTL_H #include #endif /* LACKS_FCNTL_H */ #endif /* HAVE_MMAP */ #if HAVE_MORECORE #ifndef LACKS_UNISTD_H #include /* for sbrk */ #else /* LACKS_UNISTD_H */ #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) extern void* sbrk(ptrdiff_t); #endif /* FreeBSD etc */ #endif /* LACKS_UNISTD_H */ #endif /* HAVE_MMAP */ #ifndef WIN32 #ifndef malloc_getpagesize # ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ # ifndef _SC_PAGE_SIZE # define _SC_PAGE_SIZE _SC_PAGESIZE # endif # endif # ifdef _SC_PAGE_SIZE # define malloc_getpagesize sysconf(_SC_PAGE_SIZE) # else # if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) extern size_t getpagesize(); # define malloc_getpagesize getpagesize() # else # ifdef WIN32 /* use supplied emulation of getpagesize */ # define malloc_getpagesize getpagesize() # else # ifndef LACKS_SYS_PARAM_H # include # endif # ifdef EXEC_PAGESIZE # define malloc_getpagesize EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define malloc_getpagesize NBPG # else # define malloc_getpagesize (NBPG * CLSIZE) # endif # else # ifdef NBPC # define malloc_getpagesize NBPC # else # ifdef PAGESIZE # define malloc_getpagesize PAGESIZE # else /* just guess */ # define malloc_getpagesize ((size_t)4096U) # endif # endif # endif # endif # endif # endif # endif #endif #endif /* ------------------- size_t and alignment properties -------------------- */ /* The byte and bit size of a size_t */ #define SIZE_T_SIZE (sizeof(size_t)) #define SIZE_T_BITSIZE (sizeof(size_t) << 3) /* Some constants coerced to size_t */ /* Annoying but necessary to avoid errors on some plaftorms */ #define SIZE_T_ZERO ((size_t)0) #define SIZE_T_ONE ((size_t)1) #define SIZE_T_TWO ((size_t)2) #define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) #define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) #define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) #define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) /* The bit mask value corresponding to MALLOC_ALIGNMENT */ #define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) /* True if address a has acceptable alignment */ #define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) /* the number of bytes to offset an address to align it */ #define align_offset(A)\ ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) /* -------------------------- MMAP preliminaries ------------------------- */ /* If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and checks to fail so compiler optimizer can delete code rather than using so many "#if"s. */ /* MORECORE and MMAP must return MFAIL on failure */ #define MFAIL ((void*)(MAX_SIZE_T)) #define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ #if !HAVE_MMAP #define IS_MMAPPED_BIT (SIZE_T_ZERO) #define USE_MMAP_BIT (SIZE_T_ZERO) #define CALL_MMAP(s) MFAIL #define CALL_MUNMAP(a, s) (-1) #define DIRECT_MMAP(s) MFAIL #else /* HAVE_MMAP */ #define IS_MMAPPED_BIT (SIZE_T_ONE) #define USE_MMAP_BIT (SIZE_T_ONE) #ifndef WIN32 #define CALL_MUNMAP(a, s) munmap((a), (s)) #define MMAP_PROT (PROT_READ|PROT_WRITE) #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #define MAP_ANONYMOUS MAP_ANON #endif /* MAP_ANON */ #ifdef MAP_ANONYMOUS #define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) #define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) #else /* MAP_ANONYMOUS */ /* Nearly all versions of mmap support MAP_ANONYMOUS, so the following is unlikely to be needed, but is supplied just in case. */ #define MMAP_FLAGS (MAP_PRIVATE) static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ #define CALL_MMAP(s) ((dev_zero_fd < 0) ? \ (dev_zero_fd = open("/dev/zero", O_RDWR), \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) #endif /* MAP_ANONYMOUS */ #define DIRECT_MMAP(s) CALL_MMAP(s) #else /* WIN32 */ /* Win32 MMAP via VirtualAlloc */ static void* win32mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ static void* win32direct_mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* This function supports releasing coalesed segments */ static int win32munmap(void* ptr, size_t size) { MEMORY_BASIC_INFORMATION minfo; char* cptr = ptr; while (size) { if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) return -1; if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || minfo.State != MEM_COMMIT || minfo.RegionSize > size) return -1; if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) return -1; cptr += minfo.RegionSize; size -= minfo.RegionSize; } return 0; } #define CALL_MMAP(s) win32mmap(s) #define CALL_MUNMAP(a, s) win32munmap((a), (s)) #define DIRECT_MMAP(s) win32direct_mmap(s) #endif /* WIN32 */ #endif /* HAVE_MMAP */ #if HAVE_MMAP && HAVE_MREMAP #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) #else /* HAVE_MMAP && HAVE_MREMAP */ #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL #endif /* HAVE_MMAP && HAVE_MREMAP */ #if HAVE_MORECORE #define CALL_MORECORE(S) MORECORE(S) #else /* HAVE_MORECORE */ #define CALL_MORECORE(S) MFAIL #endif /* HAVE_MORECORE */ /* mstate bit set if continguous morecore disabled or failed */ #define USE_NONCONTIGUOUS_BIT (4U) /* segment bit set in create_mspace_with_base */ #define EXTERN_BIT (8U) /* --------------------------- Lock preliminaries ------------------------ */ #if USE_LOCKS /* When locks are defined, there are up to two global locks: * If HAVE_MORECORE, morecore_mutex protects sequences of calls to MORECORE. In many cases sys_alloc requires two calls, that should not be interleaved with calls by other threads. This does not protect against direct calls to MORECORE by other threads not using this lock, so there is still code to cope the best we can on interference. * magic_init_mutex ensures that mparams.magic and other unique mparams values are initialized only once. */ #ifndef WIN32 /* By default use posix locks */ #include #define MLOCK_T pthread_mutex_t #define INITIAL_LOCK(l) pthread_mutex_init(l, NULL) #define ACQUIRE_LOCK(l) pthread_mutex_lock(l) #define RELEASE_LOCK(l) pthread_mutex_unlock(l) #if HAVE_MORECORE static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; #else /* WIN32 */ /* Because lock-protected regions have bounded times, and there are no recursive lock calls, we can use simple spinlocks. */ #define MLOCK_T long static int win32_acquire_lock (MLOCK_T *sl) { for (;;) { #ifdef InterlockedCompareExchangePointer if (!InterlockedCompareExchange(sl, 1, 0)) return 0; #else /* Use older void* version */ if (!InterlockedCompareExchange((void**)sl, (void*)1, (void*)0)) return 0; #endif /* InterlockedCompareExchangePointer */ Sleep (0); } } static void win32_release_lock (MLOCK_T *sl) { InterlockedExchange (sl, 0); } #define INITIAL_LOCK(l) *(l)=0 #define ACQUIRE_LOCK(l) win32_acquire_lock(l) #define RELEASE_LOCK(l) win32_release_lock(l) #if HAVE_MORECORE static MLOCK_T morecore_mutex; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex; #endif /* WIN32 */ #define USE_LOCK_BIT (2U) #else /* USE_LOCKS */ #define USE_LOCK_BIT (0U) #define INITIAL_LOCK(l) #endif /* USE_LOCKS */ #if USE_LOCKS && HAVE_MORECORE #define ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex); #define RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex); #else /* USE_LOCKS && HAVE_MORECORE */ #define ACQUIRE_MORECORE_LOCK() #define RELEASE_MORECORE_LOCK() #endif /* USE_LOCKS && HAVE_MORECORE */ #if USE_LOCKS #define ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex); #define RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex); #else /* USE_LOCKS */ #define ACQUIRE_MAGIC_INIT_LOCK() #define RELEASE_MAGIC_INIT_LOCK() #endif /* USE_LOCKS */ /* ----------------------- Chunk representations ------------------------ */ /* (The following includes lightly edited explanations by Colin Plumb.) The malloc_chunk declaration below is misleading (but accurate and necessary). It declares a "view" into memory allowing access to necessary fields at known offsets from a given base. Chunks of memory are maintained using a `boundary tag' method as originally described by Knuth. (See the paper by Paul Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such techniques.) Sizes of free chunks are stored both in the front of each chunk and at the end. This makes consolidating fragmented chunks into bigger chunks fast. The head fields also hold bits representing whether chunks are free or in use. Here are some pictures to make it clearer. They are "exploded" to show that the state of a chunk can be thought of as extending from the high 31 bits of the head field of its header through the prev_foot and PINUSE_BIT bit of the following chunk header. A chunk that's in use looks like: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk (if P = 1) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | Size of this chunk 1| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +- -+ | | +- -+ | : +- size - sizeof(size_t) available payload bytes -+ : | chunk-> +- -+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| | Size of next chunk (may or may not be in use) | +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ And if it's free, it looks like this: chunk-> +- -+ | User payload (must be in use, or we would have merged!) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | Size of this chunk 0| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Prev pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : +- size - sizeof(struct chunk) unused bytes -+ : | chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of this chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| | Size of next chunk (must be in use, or we would have merged)| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : +- User payload -+ : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| +-+ Note that since we always merge adjacent free chunks, the chunks adjacent to a free chunk must be in use. Given a pointer to a chunk (which can be derived trivially from the payload pointer) we can, in O(1) time, find out whether the adjacent chunks are free, and if so, unlink them from the lists that they are on and merge them with the current chunk. Chunks always begin on even word boundaries, so the mem portion (which is returned to the user) is also on an even word boundary, and thus at least double-word aligned. The P (PINUSE_BIT) bit, stored in the unused low-order bit of the chunk size (which is always a multiple of two words), is an in-use bit for the *previous* chunk. If that bit is *clear*, then the word before the current chunk size contains the previous chunk size, and can be used to find the front of the previous chunk. The very first chunk allocated always has this bit set, preventing access to non-existent (or non-owned) memory. If pinuse is set for any given chunk, then you CANNOT determine the size of the previous chunk, and might even get a memory addressing fault when trying to do so. The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of the chunk size redundantly records whether the current chunk is inuse. This redundancy enables usage checks within free and realloc, and reduces indirection when freeing and consolidating chunks. Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. Note that the `foot' of the current chunk is actually represented as the prev_foot of the NEXT chunk. This makes it easier to deal with alignments etc but can be very confusing when trying to extend or adapt this code. The exceptions to all this are 1. The special chunk `top' is the top-most available chunk (i.e., the one bordering the end of available memory). It is treated specially. Top is never included in any bin, is used only if no other chunk is available, and is released back to the system if it is very large (see M_TRIM_THRESHOLD). In effect, the top chunk is treated as larger (and thus less well fitting) than any other available chunk. The top chunk doesn't update its trailing size field since there is no next contiguous chunk that would have to index off it. However, space is still allocated for it (TOP_FOOT_SIZE) to enable separation or merging when space is extended. 3. Chunks allocated via mmap, which have the lowest-order bit (IS_MMAPPED_BIT) set in their prev_foot fields, and do not set PINUSE_BIT in their head fields. Because they are allocated one-by-one, each must carry its own prev_foot field, which is also used to hold the offset this chunk has within its mmapped region, which is needed to preserve alignment. Each mmapped chunk is trailed by the first two fields of a fake next-chunk for sake of usage checks. */ struct malloc_chunk { size_t prev_foot; /* Size of previous chunk (if free). */ size_t head; /* Size and inuse bits. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; }; typedef struct malloc_chunk mchunk; typedef struct malloc_chunk* mchunkptr; typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ typedef unsigned int bindex_t; /* Described below */ typedef unsigned int binmap_t; /* Described below */ typedef unsigned int flag_t; /* The type of various bit flag sets */ /* ------------------- Chunks sizes and alignments ----------------------- */ #define MCHUNK_SIZE (sizeof(mchunk)) #if FOOTERS #define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) #else /* FOOTERS */ #define CHUNK_OVERHEAD (SIZE_T_SIZE) #endif /* FOOTERS */ /* MMapped chunks need a second word of overhead ... */ #define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) /* ... and additional padding for fake next-chunk at foot */ #define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) /* The smallest size we can malloc is an aligned minimal chunk */ #define MIN_CHUNK_SIZE\ ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) /* conversion from malloc headers to user pointers, and back */ #define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) /* chunk associated with aligned address A */ #define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) /* Bounds on request (not chunk) sizes. */ #define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) /* pad request bytes into a usable size */ #define pad_request(req) \ (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) /* pad request, checking for minimum (but not maximum) */ #define request2size(req) \ (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) /* ------------------ Operations on head and foot fields ----------------- */ /* The head field of a chunk is or'ed with PINUSE_BIT when previous adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in use. If the chunk was obtained with mmap, the prev_foot field has IS_MMAPPED_BIT set, otherwise holding the offset of the base of the mmapped region to the base of the chunk. */ #define PINUSE_BIT (SIZE_T_ONE) #define CINUSE_BIT (SIZE_T_TWO) #define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) /* Head value for fenceposts */ #define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) /* extraction of fields from head words */ #define cinuse(p) ((p)->head & CINUSE_BIT) #define pinuse(p) ((p)->head & PINUSE_BIT) #define chunksize(p) ((p)->head & ~(INUSE_BITS)) #define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) #define clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) /* Treat space at ptr +/- offset as a chunk */ #define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) #define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) /* Ptr to next or previous physical malloc_chunk. */ #define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) #define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) /* extract next chunk's pinuse bit */ #define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) /* Get/set size at footer */ #define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) #define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) /* Set size, pinuse bit, and foot */ #define set_size_and_pinuse_of_free_chunk(p, s)\ ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) /* Set size, pinuse bit, foot, and clear next pinuse */ #define set_free_with_pinuse(p, s, n)\ (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) #define is_mmapped(p)\ (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) /* Get the internal overhead associated with chunk p */ #define overhead_for(p)\ (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) /* Return true if malloced space is not necessarily cleared */ #if MMAP_CLEARS #define calloc_must_clear(p) (!is_mmapped(p)) #else /* MMAP_CLEARS */ #define calloc_must_clear(p) (1) #endif /* MMAP_CLEARS */ /* ---------------------- Overlaid data structures ----------------------- */ /* When chunks are not in use, they are treated as nodes of either lists or trees. "Small" chunks are stored in circular doubly-linked lists, and look like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space (may be 0 bytes long) . . . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Larger chunks are kept in a form of bitwise digital trees (aka tries) keyed on chunksizes. Because malloc_tree_chunks are only for free chunks greater than 256 bytes, their size doesn't impose any constraints on user chunk sizes. Each node looks like: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk of same size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk of same size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to left child (child[0]) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to right child (child[1]) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to parent | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | bin index of this chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Each tree holding treenodes is a tree of unique chunk sizes. Chunks of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, done by inspecting individual bits. Using these rules, each node's left subtree contains all smaller sizes than its right subtree. However, the node at the root of each subtree has no particular ordering relationship to either. (The dividing line between the subtree sizes is based on trie relation.) If we remove the last chunk of a given size from the interior of the tree, we need to replace it with a leaf node. The tree ordering rules permit a node to be replaced by any leaf below it. The smallest chunk in a tree (a common operation in a best-fit allocator) can be found by walking a path to the leftmost leaf in the tree. Unlike a usual binary tree, where we follow left child pointers until we reach a null, here we follow the right child pointer any time the left one is null, until we reach a leaf with both child pointers null. The smallest chunk in the tree will be somewhere along that path. The worst case number of steps to add, find, or remove a node is bounded by the number of bits differentiating chunks within bins. Under current bin calculations, this ranges from 6 up to 21 (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case is of course much better. */ struct malloc_tree_chunk { /* The first four fields must be compatible with malloc_chunk */ size_t prev_foot; size_t head; struct malloc_tree_chunk* fd; struct malloc_tree_chunk* bk; struct malloc_tree_chunk* child[2]; struct malloc_tree_chunk* parent; bindex_t index; }; typedef struct malloc_tree_chunk tchunk; typedef struct malloc_tree_chunk* tchunkptr; typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ /* A little helper macro for trees */ #define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) /* ----------------------------- Segments -------------------------------- */ /* Each malloc space may include non-contiguous segments, held in a list headed by an embedded malloc_segment record representing the top-most space. Segments also include flags holding properties of the space. Large chunks that are directly allocated by mmap are not included in this list. They are instead independently created and destroyed without otherwise keeping track of them. Segment management mainly comes into play for spaces allocated by MMAP. Any call to MMAP might or might not return memory that is adjacent to an existing segment. MORECORE normally contiguously extends the current space, so this space is almost always adjacent, which is simpler and faster to deal with. (This is why MORECORE is used preferentially to MMAP when both are available -- see sys_alloc.) When allocating using MMAP, we don't use any of the hinting mechanisms (inconsistently) supported in various implementations of unix mmap, or distinguish reserving from committing memory. Instead, we just ask for space, and exploit contiguity when we get it. It is probably possible to do better than this on some systems, but no general scheme seems to be significantly better. Management entails a simpler variant of the consolidation scheme used for chunks to reduce fragmentation -- new adjacent memory is normally prepended or appended to an existing segment. However, there are limitations compared to chunk consolidation that mostly reflect the fact that segment processing is relatively infrequent (occurring only when getting memory from system) and that we don't expect to have huge numbers of segments: * Segments are not indexed, so traversal requires linear scans. (It would be possible to index these, but is not worth the extra overhead and complexity for most programs on most platforms.) * New segments are only appended to old ones when holding top-most memory; if they cannot be prepended to others, they are held in different segments. Except for the top-most segment of an mstate, each segment record is kept at the tail of its segment. Segments are added by pushing segment records onto the list headed by &mstate.seg for the containing mstate. Segment flags control allocation/merge/deallocation policies: * If EXTERN_BIT set, then we did not allocate this segment, and so should not try to deallocate or merge with others. (This currently holds only for the initial segment passed into create_mspace_with_base.) * If IS_MMAPPED_BIT set, the segment may be merged with other surrounding mmapped segments and trimmed/de-allocated using munmap. * If neither bit is set, then the segment was obtained using MORECORE so can be merged with surrounding MORECORE'd segments and deallocated/trimmed using MORECORE with negative arguments. */ struct malloc_segment { char* base; /* base address */ size_t size; /* allocated size */ struct malloc_segment* next; /* ptr to next segment */ flag_t sflags; /* mmap and extern flag */ }; #define is_mmapped_segment(S) ((S)->sflags & IS_MMAPPED_BIT) #define is_extern_segment(S) ((S)->sflags & EXTERN_BIT) typedef struct malloc_segment msegment; typedef struct malloc_segment* msegmentptr; /* ---------------------------- malloc_state ----------------------------- */ /* A malloc_state holds all of the bookkeeping for a space. The main fields are: Top The topmost chunk of the currently active segment. Its size is cached in topsize. The actual size of topmost space is topsize+TOP_FOOT_SIZE, which includes space reserved for adding fenceposts and segment records if necessary when getting more space from the system. The size at which to autotrim top is cached from mparams in trim_check, except that it is disabled if an autotrim fails. Designated victim (dv) This is the preferred chunk for servicing small requests that don't have exact fits. It is normally the chunk split off most recently to service another small request. Its size is cached in dvsize. The link fields of this chunk are not maintained since it is not kept in a bin. SmallBins An array of bin headers for free chunks. These bins hold chunks with sizes less than MIN_LARGE_SIZE bytes. Each bin contains chunks of all the same size, spaced 8 bytes apart. To simplify use in double-linked lists, each bin header acts as a malloc_chunk pointing to the real first node, if it exists (else pointing to itself). This avoids special-casing for headers. But to avoid waste, we allocate only the fd/bk pointers of bins, and then use repositioning tricks to treat these as the fields of a chunk. TreeBins Treebins are pointers to the roots of trees holding a range of sizes. There are 2 equally spaced treebins for each power of two from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything larger. Bin maps There is one bit map for small bins ("smallmap") and one for treebins ("treemap). Each bin sets its bit when non-empty, and clears the bit when empty. Bit operations are then used to avoid bin-by-bin searching -- nearly all "search" is done without ever looking at bins that won't be selected. The bit maps conservatively use 32 bits per map word, even if on 64bit system. For a good description of some of the bit-based techniques used here, see Henry S. Warren Jr's book "Hacker's Delight" (and supplement at http://hackersdelight.org/). Many of these are intended to reduce the branchiness of paths through malloc etc, as well as to reduce the number of memory locations read or written. Segments A list of segments headed by an embedded malloc_segment record representing the initial space. Address check support The least_addr field is the least address ever obtained from MORECORE or MMAP. Attempted frees and reallocs of any address less than this are trapped (unless INSECURE is defined). Magic tag A cross-check field that should always hold same value as mparams.magic. Flags Bits recording whether to use MMAP, locks, or contiguous MORECORE Statistics Each space keeps track of current and maximum system memory obtained via MORECORE or MMAP. Locking If USE_LOCKS is defined, the "mutex" lock is acquired and released around every public call using this mspace. */ /* Bin types, widths and sizes */ #define NSMALLBINS (32U) #define NTREEBINS (32U) #define SMALLBIN_SHIFT (3U) #define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) #define TREEBIN_SHIFT (8U) #define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) #define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) #define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) struct malloc_state { binmap_t smallmap; binmap_t treemap; size_t dvsize; size_t topsize; char* least_addr; mchunkptr dv; mchunkptr top; size_t trim_check; size_t magic; mchunkptr smallbins[(NSMALLBINS+1)*2]; tbinptr treebins[NTREEBINS]; size_t footprint; size_t max_footprint; flag_t mflags; #if USE_LOCKS MLOCK_T mutex; /* locate lock among fields that rarely change */ #endif /* USE_LOCKS */ msegment seg; }; typedef struct malloc_state* mstate; /* ------------- Global malloc_state and malloc_params ------------------- */ /* malloc_params holds global properties, including those that can be dynamically set using mallopt. There is a single instance, mparams, initialized in init_mparams. */ struct malloc_params { size_t magic; size_t page_size; size_t granularity; size_t mmap_threshold; size_t trim_threshold; flag_t default_mflags; }; static struct malloc_params mparams; /* The global malloc_state used for all non-"mspace" calls */ static struct malloc_state _gm_; #define gm (&_gm_) #define is_global(M) ((M) == &_gm_) #define is_initialized(M) ((M)->top != 0) /* -------------------------- system alloc setup ------------------------- */ /* Operations on mflags */ #define use_lock(M) ((M)->mflags & USE_LOCK_BIT) #define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) #define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) #define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) #define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) #define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) #define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) #define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) #define set_lock(M,L)\ ((M)->mflags = (L)?\ ((M)->mflags | USE_LOCK_BIT) :\ ((M)->mflags & ~USE_LOCK_BIT)) /* page-align a size */ #define page_align(S)\ (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) /* granularity-align a size */ #define granularity_align(S)\ (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) #define is_page_aligned(S)\ (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) #define is_granularity_aligned(S)\ (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) /* True if segment S holds address A */ #define segment_holds(S, A)\ ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) /* Return segment holding given address */ static msegmentptr segment_holding(mstate m, char* addr) { msegmentptr sp = &m->seg; for (;;) { if (addr >= sp->base && addr < sp->base + sp->size) return sp; if ((sp = sp->next) == 0) return 0; } } /* Return true if segment contains a segment link */ static int has_segment_link(mstate m, msegmentptr ss) { msegmentptr sp = &m->seg; for (;;) { if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) return 1; if ((sp = sp->next) == 0) return 0; } } #ifndef MORECORE_CANNOT_TRIM #define should_trim(M,s) ((s) > (M)->trim_check) #else /* MORECORE_CANNOT_TRIM */ #define should_trim(M,s) (0) #endif /* MORECORE_CANNOT_TRIM */ /* TOP_FOOT_SIZE is padding at the end of a segment, including space that may be needed to place segment records and fenceposts when new noncontiguous segments are added. */ #define TOP_FOOT_SIZE\ (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) /* ------------------------------- Hooks -------------------------------- */ /* PREACTION should be defined to return 0 on success, and nonzero on failure. If you are not using locking, you can redefine these to do anything you like. */ #if USE_LOCKS /* Ensure locks are initialized */ #define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams()) #define PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) #define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } #else /* USE_LOCKS */ #ifndef PREACTION #define PREACTION(M) (0) #endif /* PREACTION */ #ifndef POSTACTION #define POSTACTION(M) #endif /* POSTACTION */ #endif /* USE_LOCKS */ /* CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. USAGE_ERROR_ACTION is triggered on detected bad frees and reallocs. The argument p is an address that might have triggered the fault. It is ignored by the two predefined actions, but might be useful in custom actions that try to help diagnose errors. */ #if PROCEED_ON_ERROR /* A count of the number of corruption errors causing resets */ int malloc_corruption_error_count; /* default corruption action */ static void reset_on_error(mstate m); #define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) #define USAGE_ERROR_ACTION(m, p) #else /* PROCEED_ON_ERROR */ #ifndef CORRUPTION_ERROR_ACTION #define CORRUPTION_ERROR_ACTION(m) ABORT #endif /* CORRUPTION_ERROR_ACTION */ #ifndef USAGE_ERROR_ACTION #define USAGE_ERROR_ACTION(m,p) ABORT #endif /* USAGE_ERROR_ACTION */ #endif /* PROCEED_ON_ERROR */ /* -------------------------- Debugging setup ---------------------------- */ #if ! DEBUG #define check_free_chunk(M,P) #define check_inuse_chunk(M,P) #define check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) #define check_malloc_state(M) #define check_top_chunk(M,P) #else /* DEBUG */ #define check_free_chunk(M,P) do_check_free_chunk(M,P) #define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) #define check_top_chunk(M,P) do_check_top_chunk(M,P) #define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) #define check_malloc_state(M) do_check_malloc_state(M) static void do_check_any_chunk(mstate m, mchunkptr p); static void do_check_top_chunk(mstate m, mchunkptr p); static void do_check_mmapped_chunk(mstate m, mchunkptr p); static void do_check_inuse_chunk(mstate m, mchunkptr p); static void do_check_free_chunk(mstate m, mchunkptr p); static void do_check_malloced_chunk(mstate m, void* mem, size_t s); static void do_check_tree(mstate m, tchunkptr t); static void do_check_treebin(mstate m, bindex_t i); static void do_check_smallbin(mstate m, bindex_t i); static void do_check_malloc_state(mstate m); static int bin_find(mstate m, mchunkptr x); static size_t traverse_and_check(mstate m); #endif /* DEBUG */ /* ---------------------------- Indexing Bins ---------------------------- */ #define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) #define small_index(s) ((s) >> SMALLBIN_SHIFT) #define small_index2size(i) ((i) << SMALLBIN_SHIFT) #define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) /* addressing by index. See above about smallbin repositioning */ #define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) #define treebin_at(M,i) (&((M)->treebins[i])) /* assign tree index for size S to variable I */ #if defined(__GNUC__) && defined(i386) #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int K;\ __asm__("bsrl %1,%0\n\t" : "=r" (K) : "rm" (X));\ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ }\ } #else /* GNUC */ #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int Y = (unsigned int)X;\ unsigned int N = ((Y - 0x100) >> 16) & 8;\ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ N += K;\ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ K = 14 - N + ((Y <<= K) >> 15);\ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ }\ } #endif /* GNUC */ /* Bit representing maximum resolved size in a treebin at i */ #define bit_for_tree_index(i) \ (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) /* Shift placing maximum resolved bit in a treebin at i as sign bit */ #define leftshift_for_tree_index(i) \ ((i == NTREEBINS-1)? 0 : \ ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) /* The size of the smallest chunk held in bin with index i */ #define minsize_for_tree_index(i) \ ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) /* ------------------------ Operations on bin maps ----------------------- */ /* bit corresponding to given index */ #define idx2bit(i) ((binmap_t)(1) << (i)) /* Mark/Clear bits with given index */ #define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) #define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) #define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) #define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) #define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) #define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) /* index corresponding to given bit */ #if defined(__GNUC__) && defined(i386) #define compute_bit2idx(X, I)\ {\ unsigned int J;\ __asm__("bsfl %1,%0\n\t" : "=r" (J) : "rm" (X));\ I = (bindex_t)J;\ } #else /* GNUC */ #if USE_BUILTIN_FFS #define compute_bit2idx(X, I) I = ffs(X)-1 #else /* USE_BUILTIN_FFS */ #define compute_bit2idx(X, I)\ {\ unsigned int Y = X - 1;\ unsigned int K = Y >> (16-4) & 16;\ unsigned int N = K; Y >>= K;\ N += K = Y >> (8-3) & 8; Y >>= K;\ N += K = Y >> (4-2) & 4; Y >>= K;\ N += K = Y >> (2-1) & 2; Y >>= K;\ N += K = Y >> (1-0) & 1; Y >>= K;\ I = (bindex_t)(N + Y);\ } #endif /* USE_BUILTIN_FFS */ #endif /* GNUC */ /* isolate the least set bit of a bitmap */ #define least_bit(x) ((x) & -(x)) /* mask with all bits to left of least bit of x on */ #define left_bits(x) ((x<<1) | -(x<<1)) /* mask with all bits to left of or equal to least bit of x on */ #define same_or_left_bits(x) ((x) | -(x)) /* ----------------------- Runtime Check Support ------------------------- */ /* For security, the main invariant is that malloc/free/etc never writes to a static address other than malloc_state, unless static malloc_state itself has been corrupted, which cannot occur via malloc (because of these checks). In essence this means that we believe all pointers, sizes, maps etc held in malloc_state, but check all of those linked or offsetted from other embedded data structures. These checks are interspersed with main code in a way that tends to minimize their run-time cost. When FOOTERS is defined, in addition to range checking, we also verify footer fields of inuse chunks, which can be used guarantee that the mstate controlling malloc/free is intact. This is a streamlined version of the approach described by William Robertson et al in "Run-time Detection of Heap-based Overflows" LISA'03 http://www.usenix.org/events/lisa03/tech/robertson.html The footer of an inuse chunk holds the xor of its mstate and a random seed, that is checked upon calls to free() and realloc(). This is (probablistically) unguessable from outside the program, but can be computed by any code successfully malloc'ing any chunk, so does not itself provide protection against code that has already broken security through some other means. Unlike Robertson et al, we always dynamically check addresses of all offset chunks (previous, next, etc). This turns out to be cheaper than relying on hashes. */ #if !INSECURE /* Check if address a is at least as high as any from MORECORE or MMAP */ #define ok_address(M, a) ((char*)(a) >= (M)->least_addr) /* Check if address of next chunk n is higher than base chunk p */ #define ok_next(p, n) ((char*)(p) < (char*)(n)) /* Check if p has its cinuse bit on */ #define ok_cinuse(p) cinuse(p) /* Check if p has its pinuse bit on */ #define ok_pinuse(p) pinuse(p) #else /* !INSECURE */ #define ok_address(M, a) (1) #define ok_next(b, n) (1) #define ok_cinuse(p) (1) #define ok_pinuse(p) (1) #endif /* !INSECURE */ #if (FOOTERS && !INSECURE) /* Check if (alleged) mstate m has expected magic field */ #define ok_magic(M) ((M)->magic == mparams.magic) #else /* (FOOTERS && !INSECURE) */ #define ok_magic(M) (1) #endif /* (FOOTERS && !INSECURE) */ /* In gcc, use __builtin_expect to minimize impact of checks */ #if !INSECURE #if defined(__GNUC__) && __GNUC__ >= 3 #define RTCHECK(e) __builtin_expect(e, 1) #else /* GNUC */ #define RTCHECK(e) (e) #endif /* GNUC */ #else /* !INSECURE */ #define RTCHECK(e) (1) #endif /* !INSECURE */ /* macros to set up inuse chunks with or without footers */ #if !FOOTERS #define mark_inuse_foot(M,p,s) /* Set cinuse bit and pinuse bit of next chunk */ #define set_inuse(M,p,s)\ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) /* Set cinuse and pinuse of this chunk and pinuse of next chunk */ #define set_inuse_and_pinuse(M,p,s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) /* Set size, cinuse and pinuse bit of this chunk */ #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) #else /* FOOTERS */ /* Set foot of inuse chunk to be xor of mstate and seed */ #define mark_inuse_foot(M,p,s)\ (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) #define get_mstate_for(p)\ ((mstate)(((mchunkptr)((char*)(p) +\ (chunksize(p))))->prev_foot ^ mparams.magic)) #define set_inuse(M,p,s)\ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ mark_inuse_foot(M,p,s)) #define set_inuse_and_pinuse(M,p,s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ mark_inuse_foot(M,p,s)) #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ mark_inuse_foot(M, p, s)) #endif /* !FOOTERS */ /* ---------------------------- setting mparams -------------------------- */ /* Initialize mparams */ static int init_mparams(void) { if (mparams.page_size == 0) { size_t s; mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; #if MORECORE_CONTIGUOUS mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; #else /* MORECORE_CONTIGUOUS */ mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; #endif /* MORECORE_CONTIGUOUS */ #if (FOOTERS && !INSECURE) { #if USE_DEV_RANDOM int fd; unsigned char buf[sizeof(size_t)]; /* Try to use /dev/urandom, else fall back on using time */ if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && read(fd, buf, sizeof(buf)) == sizeof(buf)) { s = *((size_t *) buf); close(fd); } else #endif /* USE_DEV_RANDOM */ s = (size_t)(time(0) ^ (size_t)0x55555555U); s |= (size_t)8U; /* ensure nonzero */ s &= ~(size_t)7U; /* improve chances of fault for bad values */ } #else /* (FOOTERS && !INSECURE) */ s = (size_t)0x58585858U; #endif /* (FOOTERS && !INSECURE) */ ACQUIRE_MAGIC_INIT_LOCK(); if (mparams.magic == 0) { mparams.magic = s; /* Set up lock for main malloc area */ INITIAL_LOCK(&gm->mutex); gm->mflags = mparams.default_mflags; } RELEASE_MAGIC_INIT_LOCK(); #ifndef WIN32 mparams.page_size = malloc_getpagesize; mparams.granularity = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : mparams.page_size); #else /* WIN32 */ { SYSTEM_INFO system_info; GetSystemInfo(&system_info); mparams.page_size = system_info.dwPageSize; mparams.granularity = system_info.dwAllocationGranularity; } #endif /* WIN32 */ /* Sanity-check configuration: size_t must be unsigned and as wide as pointer type. ints must be at least 4 bytes. alignment must be at least 8. Alignment, min chunk size, and page size must all be powers of 2. */ if ((sizeof(size_t) != sizeof(char*)) || (MAX_SIZE_T < MIN_CHUNK_SIZE) || (sizeof(int) < 4) || (MALLOC_ALIGNMENT < (size_t)8U) || ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || ((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) || ((mparams.page_size & (mparams.page_size-SIZE_T_ONE)) != 0)) ABORT; } return 0; } /* support for mallopt */ static int change_mparam(int param_number, int value) { size_t val = (size_t)value; init_mparams(); switch(param_number) { case M_TRIM_THRESHOLD: mparams.trim_threshold = val; return 1; case M_GRANULARITY: if (val >= mparams.page_size && ((val & (val-1)) == 0)) { mparams.granularity = val; return 1; } else return 0; case M_MMAP_THRESHOLD: mparams.mmap_threshold = val; return 1; default: return 0; } } #if DEBUG /* ------------------------- Debugging Support --------------------------- */ /* Check properties of any chunk, whether free, inuse, mmapped etc */ static void do_check_any_chunk(mstate m, mchunkptr p) { assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); } /* Check properties of top chunk */ static void do_check_top_chunk(mstate m, mchunkptr p) { msegmentptr sp = segment_holding(m, (char*)p); size_t sz = chunksize(p); assert(sp != 0); assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); assert(sz == m->topsize); assert(sz > 0); assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); assert(pinuse(p)); assert(!next_pinuse(p)); } /* Check properties of (inuse) mmapped chunks */ static void do_check_mmapped_chunk(mstate m, mchunkptr p) { size_t sz = chunksize(p); size_t len = (sz + (p->prev_foot & ~IS_MMAPPED_BIT) + MMAP_FOOT_PAD); assert(is_mmapped(p)); assert(use_mmap(m)); assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); assert(!is_small(sz)); assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); } /* Check properties of inuse chunks */ static void do_check_inuse_chunk(mstate m, mchunkptr p) { do_check_any_chunk(m, p); assert(cinuse(p)); assert(next_pinuse(p)); /* If not pinuse and not mmapped, previous chunk has OK offset */ assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); if (is_mmapped(p)) do_check_mmapped_chunk(m, p); } /* Check properties of free chunks */ static void do_check_free_chunk(mstate m, mchunkptr p) { size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); mchunkptr next = chunk_plus_offset(p, sz); do_check_any_chunk(m, p); assert(!cinuse(p)); assert(!next_pinuse(p)); assert (!is_mmapped(p)); if (p != m->dv && p != m->top) { if (sz >= MIN_CHUNK_SIZE) { assert((sz & CHUNK_ALIGN_MASK) == 0); assert(is_aligned(chunk2mem(p))); assert(next->prev_foot == sz); assert(pinuse(p)); assert (next == m->top || cinuse(next)); assert(p->fd->bk == p); assert(p->bk->fd == p); } else /* markers are always of size SIZE_T_SIZE */ assert(sz == SIZE_T_SIZE); } } /* Check properties of malloced chunks at the point they are malloced */ static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { if (mem != 0) { mchunkptr p = mem2chunk(mem); size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); do_check_inuse_chunk(m, p); assert((sz & CHUNK_ALIGN_MASK) == 0); assert(sz >= MIN_CHUNK_SIZE); assert(sz >= s); /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); } } /* Check a tree and its subtrees. */ static void do_check_tree(mstate m, tchunkptr t) { tchunkptr head = 0; tchunkptr u = t; bindex_t tindex = t->index; size_t tsize = chunksize(t); bindex_t idx; compute_tree_index(tsize, idx); assert(tindex == idx); assert(tsize >= MIN_LARGE_SIZE); assert(tsize >= minsize_for_tree_index(idx)); assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); do { /* traverse through chain of same-sized nodes */ do_check_any_chunk(m, ((mchunkptr)u)); assert(u->index == tindex); assert(chunksize(u) == tsize); assert(!cinuse(u)); assert(!next_pinuse(u)); assert(u->fd->bk == u); assert(u->bk->fd == u); if (u->parent == 0) { assert(u->child[0] == 0); assert(u->child[1] == 0); } else { assert(head == 0); /* only one node on chain has parent */ head = u; assert(u->parent != u); assert (u->parent->child[0] == u || u->parent->child[1] == u || *((tbinptr*)(u->parent)) == u); if (u->child[0] != 0) { assert(u->child[0]->parent == u); assert(u->child[0] != u); do_check_tree(m, u->child[0]); } if (u->child[1] != 0) { assert(u->child[1]->parent == u); assert(u->child[1] != u); do_check_tree(m, u->child[1]); } if (u->child[0] != 0 && u->child[1] != 0) { assert(chunksize(u->child[0]) < chunksize(u->child[1])); } } u = u->fd; } while (u != t); assert(head != 0); } /* Check all the chunks in a treebin. */ static void do_check_treebin(mstate m, bindex_t i) { tbinptr* tb = treebin_at(m, i); tchunkptr t = *tb; int empty = (m->treemap & (1U << i)) == 0; if (t == 0) assert(empty); if (!empty) do_check_tree(m, t); } /* Check all the chunks in a smallbin. */ static void do_check_smallbin(mstate m, bindex_t i) { sbinptr b = smallbin_at(m, i); mchunkptr p = b->bk; unsigned int empty = (m->smallmap & (1U << i)) == 0; if (p == b) assert(empty); if (!empty) { for (; p != b; p = p->bk) { size_t size = chunksize(p); mchunkptr q; /* each chunk claims to be free */ do_check_free_chunk(m, p); /* chunk belongs in bin */ assert(small_index(size) == i); assert(p->bk == b || chunksize(p->bk) == chunksize(p)); /* chunk is followed by an inuse chunk */ q = next_chunk(p); if (q->head != FENCEPOST_HEAD) do_check_inuse_chunk(m, q); } } } /* Find x in a bin. Used in other check functions. */ static int bin_find(mstate m, mchunkptr x) { size_t size = chunksize(x); if (is_small(size)) { bindex_t sidx = small_index(size); sbinptr b = smallbin_at(m, sidx); if (smallmap_is_marked(m, sidx)) { mchunkptr p = b; do { if (p == x) return 1; } while ((p = p->fd) != b); } } else { bindex_t tidx; compute_tree_index(size, tidx); if (treemap_is_marked(m, tidx)) { tchunkptr t = *treebin_at(m, tidx); size_t sizebits = size << leftshift_for_tree_index(tidx); while (t != 0 && chunksize(t) != size) { t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; sizebits <<= 1; } if (t != 0) { tchunkptr u = t; do { if (u == (tchunkptr)x) return 1; } while ((u = u->fd) != t); } } } return 0; } /* Traverse each chunk and check it; return total */ static size_t traverse_and_check(mstate m) { size_t sum = 0; if (is_initialized(m)) { msegmentptr s = &m->seg; sum += m->topsize + TOP_FOOT_SIZE; while (s != 0) { mchunkptr q = align_as_chunk(s->base); mchunkptr lastq = 0; assert(pinuse(q)); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { sum += chunksize(q); if (cinuse(q)) { assert(!bin_find(m, q)); do_check_inuse_chunk(m, q); } else { assert(q == m->dv || bin_find(m, q)); assert(lastq == 0 || cinuse(lastq)); /* Not 2 consecutive free */ do_check_free_chunk(m, q); } lastq = q; q = next_chunk(q); } s = s->next; } } return sum; } /* Check all properties of malloc_state. */ static void do_check_malloc_state(mstate m) { bindex_t i; size_t total; /* check bins */ for (i = 0; i < NSMALLBINS; ++i) do_check_smallbin(m, i); for (i = 0; i < NTREEBINS; ++i) do_check_treebin(m, i); if (m->dvsize != 0) { /* check dv chunk */ do_check_any_chunk(m, m->dv); assert(m->dvsize == chunksize(m->dv)); assert(m->dvsize >= MIN_CHUNK_SIZE); assert(bin_find(m, m->dv) == 0); } if (m->top != 0) { /* check top chunk */ do_check_top_chunk(m, m->top); assert(m->topsize == chunksize(m->top)); assert(m->topsize > 0); assert(bin_find(m, m->top) == 0); } total = traverse_and_check(m); assert(total <= m->footprint); assert(m->footprint <= m->max_footprint); } #endif /* DEBUG */ /* ----------------------------- statistics ------------------------------ */ #if !NO_MALLINFO static struct mallinfo internal_mallinfo(mstate m) { struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (!PREACTION(m)) { check_malloc_state(m); if (is_initialized(m)) { size_t nfree = SIZE_T_ONE; /* top always free */ size_t mfree = m->topsize + TOP_FOOT_SIZE; size_t sum = mfree; msegmentptr s = &m->seg; while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { size_t sz = chunksize(q); sum += sz; if (!cinuse(q)) { mfree += sz; ++nfree; } q = next_chunk(q); } s = s->next; } nm.arena = sum; nm.ordblks = nfree; nm.hblkhd = m->footprint - sum; nm.usmblks = m->max_footprint; nm.uordblks = m->footprint - mfree; nm.fordblks = mfree; nm.keepcost = m->topsize; } POSTACTION(m); } return nm; } #endif /* !NO_MALLINFO */ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { size_t maxfp = 0; size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; maxfp = m->max_footprint; fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { if (!cinuse(q)) used -= chunksize(q); q = next_chunk(q); } s = s->next; } } fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); POSTACTION(m); } } /* ----------------------- Operations on smallbins ----------------------- */ /* Various forms of linking and unlinking are defined as macros. Even the ones for trees, which are very long but have very short typical paths. This is ugly but reduces reliance on inlining support of compilers. */ /* Link a free chunk into a smallbin */ #define insert_small_chunk(M, P, S) {\ bindex_t I = small_index(S);\ mchunkptr B = smallbin_at(M, I);\ mchunkptr F = B;\ assert(S >= MIN_CHUNK_SIZE);\ if (!smallmap_is_marked(M, I))\ mark_smallmap(M, I);\ else if (RTCHECK(ok_address(M, B->fd)))\ F = B->fd;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ B->fd = P;\ F->bk = P;\ P->fd = F;\ P->bk = B;\ } /* Unlink a chunk from a smallbin */ #define unlink_small_chunk(M, P, S) {\ mchunkptr F = P->fd;\ mchunkptr B = P->bk;\ bindex_t I = small_index(S);\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (F == B)\ clear_smallmap(M, I);\ else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ (B == smallbin_at(M,I) || ok_address(M, B)))) {\ F->bk = B;\ B->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } /* Unlink the first chunk from a smallbin */ #define unlink_first_small_chunk(M, B, P, I) {\ mchunkptr F = P->fd;\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (B == F)\ clear_smallmap(M, I);\ else if (RTCHECK(ok_address(M, F))) {\ B->fd = F;\ F->bk = B;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } /* Replace dv node, binning the old one */ /* Used only when dvsize known to be small */ #define replace_dv(M, P, S) {\ size_t DVS = M->dvsize;\ if (DVS != 0) {\ mchunkptr DV = M->dv;\ assert(is_small(DVS));\ insert_small_chunk(M, DV, DVS);\ }\ M->dvsize = S;\ M->dv = P;\ } /* ------------------------- Operations on trees ------------------------- */ /* Insert chunk into tree */ #define insert_large_chunk(M, X, S) {\ tbinptr* H;\ bindex_t I;\ compute_tree_index(S, I);\ H = treebin_at(M, I);\ X->index = I;\ X->child[0] = X->child[1] = 0;\ if (!treemap_is_marked(M, I)) {\ mark_treemap(M, I);\ *H = X;\ X->parent = (tchunkptr)H;\ X->fd = X->bk = X;\ }\ else {\ tchunkptr T = *H;\ size_t K = S << leftshift_for_tree_index(I);\ for (;;) {\ if (chunksize(T) != S) {\ tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ K <<= 1;\ if (*C != 0)\ T = *C;\ else if (RTCHECK(ok_address(M, C))) {\ *C = X;\ X->parent = T;\ X->fd = X->bk = X;\ break;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ break;\ }\ }\ else {\ tchunkptr F = T->fd;\ if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ T->fd = F->bk = X;\ X->fd = F;\ X->bk = T;\ X->parent = 0;\ break;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ break;\ }\ }\ }\ }\ } /* Unlink steps: 1. If x is a chained node, unlink it from its same-sized fd/bk links and choose its bk node as its replacement. 2. If x was the last node of its size, but not a leaf node, it must be replaced with a leaf node (not merely one with an open left or right), to make sure that lefts and rights of descendents correspond properly to bit masks. We use the rightmost descendent of x. We could use any other leaf, but this is easy to locate and tends to counteract removal of leftmosts elsewhere, and so keeps paths shorter than minimally guaranteed. This doesn't loop much because on average a node in a tree is near the bottom. 3. If x is the base of a chain (i.e., has parent links) relink x's parent and children to x's replacement (or null if none). */ #define unlink_large_chunk(M, X) {\ tchunkptr XP = X->parent;\ tchunkptr R;\ if (X->bk != X) {\ tchunkptr F = X->fd;\ R = X->bk;\ if (RTCHECK(ok_address(M, F))) {\ F->bk = R;\ R->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ else {\ tchunkptr* RP;\ if (((R = *(RP = &(X->child[1]))) != 0) ||\ ((R = *(RP = &(X->child[0]))) != 0)) {\ tchunkptr* CP;\ while ((*(CP = &(R->child[1])) != 0) ||\ (*(CP = &(R->child[0])) != 0)) {\ R = *(RP = CP);\ }\ if (RTCHECK(ok_address(M, RP)))\ *RP = 0;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ }\ if (XP != 0) {\ tbinptr* H = treebin_at(M, X->index);\ if (X == *H) {\ if ((*H = R) == 0) \ clear_treemap(M, X->index);\ }\ else if (RTCHECK(ok_address(M, XP))) {\ if (XP->child[0] == X) \ XP->child[0] = R;\ else \ XP->child[1] = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ if (R != 0) {\ if (RTCHECK(ok_address(M, R))) {\ tchunkptr C0, C1;\ R->parent = XP;\ if ((C0 = X->child[0]) != 0) {\ if (RTCHECK(ok_address(M, C0))) {\ R->child[0] = C0;\ C0->parent = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ if ((C1 = X->child[1]) != 0) {\ if (RTCHECK(ok_address(M, C1))) {\ R->child[1] = C1;\ C1->parent = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ } /* Relays to large vs small bin operations */ #define insert_chunk(M, P, S)\ if (is_small(S)) insert_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } #define unlink_chunk(M, P, S)\ if (is_small(S)) unlink_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } /* Relays to internal calls to malloc/free from realloc, memalign etc */ #if ONLY_MSPACES #define internal_malloc(m, b) mspace_malloc(m, b) #define internal_free(m, mem) mspace_free(m,mem); #else /* ONLY_MSPACES */ #if MSPACES #define internal_malloc(m, b)\ (m == gm)? dlmalloc(b) : mspace_malloc(m, b) #define internal_free(m, mem)\ if (m == gm) dlfree(mem); else mspace_free(m,mem); #else /* MSPACES */ #define internal_malloc(m, b) dlmalloc(b) #define internal_free(m, mem) dlfree(mem) #endif /* MSPACES */ #endif /* ONLY_MSPACES */ /* ----------------------- Direct-mmapping chunks ----------------------- */ /* Directly mmapped chunks are set up with an offset to the start of the mmapped region stored in the prev_foot field of the chunk. This allows reconstruction of the required argument to MUNMAP when freed, and also allows adjustment of the returned chunk to meet alignment requirements (especially in memalign). There is also enough space allocated to hold a fake next chunk of size SIZE_T_SIZE to maintain the PINUSE bit so frees can be checked. */ /* Malloc using mmap */ static void* mmap_alloc(mstate m, size_t nb) { size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); if (mmsize > nb) { /* Check for wrap around 0 */ char* mm = (char*)(DIRECT_MMAP(mmsize)); if (mm != CMFAIL) { size_t offset = align_offset(chunk2mem(mm)); size_t psize = mmsize - offset - MMAP_FOOT_PAD; mchunkptr p = (mchunkptr)(mm + offset); p->prev_foot = offset | IS_MMAPPED_BIT; (p)->head = (psize|CINUSE_BIT); mark_inuse_foot(m, p, psize); chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; if (mm < m->least_addr) m->least_addr = mm; if ((m->footprint += mmsize) > m->max_footprint) m->max_footprint = m->footprint; assert(is_aligned(chunk2mem(p))); check_mmapped_chunk(m, p); return chunk2mem(p); } } return 0; } /* Realloc using mmap */ static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) { size_t oldsize = chunksize(oldp); if (is_small(nb)) /* Can't shrink mmap regions below small size */ return 0; /* Keep old chunk if big enough but not too big */ if (oldsize >= nb + SIZE_T_SIZE && (oldsize - nb) <= (mparams.granularity << 1)) return oldp; else { size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT; size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); char* cp = (char*)CALL_MREMAP((char*)oldp - offset, oldmmsize, newmmsize, 1); if (cp != CMFAIL) { mchunkptr newp = (mchunkptr)(cp + offset); size_t psize = newmmsize - offset - MMAP_FOOT_PAD; newp->head = (psize|CINUSE_BIT); mark_inuse_foot(m, newp, psize); chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; if (cp < m->least_addr) m->least_addr = cp; if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) m->max_footprint = m->footprint; check_mmapped_chunk(m, newp); return newp; } } return 0; } /* -------------------------- mspace management -------------------------- */ /* Initialize top chunk and its size */ static void init_top(mstate m, mchunkptr p, size_t psize) { /* Ensure alignment */ size_t offset = align_offset(chunk2mem(p)); p = (mchunkptr)((char*)p + offset); psize -= offset; m->top = p; m->topsize = psize; p->head = psize | PINUSE_BIT; /* set size of fake trailing chunk holding overhead space only once */ chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; m->trim_check = mparams.trim_threshold; /* reset on each update */ } /* Initialize bins for a new mstate that is otherwise zeroed out */ static void init_bins(mstate m) { /* Establish circular links for smallbins */ bindex_t i; for (i = 0; i < NSMALLBINS; ++i) { sbinptr bin = smallbin_at(m,i); bin->fd = bin->bk = bin; } } #if PROCEED_ON_ERROR /* default corruption action */ static void reset_on_error(mstate m) { int i; ++malloc_corruption_error_count; /* Reinitialize fields to forget about all memory */ m->smallbins = m->treebins = 0; m->dvsize = m->topsize = 0; m->seg.base = 0; m->seg.size = 0; m->seg.next = 0; m->top = m->dv = 0; for (i = 0; i < NTREEBINS; ++i) *treebin_at(m, i) = 0; init_bins(m); } #endif /* PROCEED_ON_ERROR */ /* Allocate chunk and prepend remainder with chunk in successor base. */ static void* prepend_alloc(mstate m, char* newbase, char* oldbase, size_t nb) { mchunkptr p = align_as_chunk(newbase); mchunkptr oldfirst = align_as_chunk(oldbase); size_t psize = (char*)oldfirst - (char*)p; mchunkptr q = chunk_plus_offset(p, nb); size_t qsize = psize - nb; set_size_and_pinuse_of_inuse_chunk(m, p, nb); assert((char*)oldfirst > (char*)q); assert(pinuse(oldfirst)); assert(qsize >= MIN_CHUNK_SIZE); /* consolidate remainder with first chunk of old base */ if (oldfirst == m->top) { size_t tsize = m->topsize += qsize; m->top = q; q->head = tsize | PINUSE_BIT; check_top_chunk(m, q); } else if (oldfirst == m->dv) { size_t dsize = m->dvsize += qsize; m->dv = q; set_size_and_pinuse_of_free_chunk(q, dsize); } else { if (!cinuse(oldfirst)) { size_t nsize = chunksize(oldfirst); unlink_chunk(m, oldfirst, nsize); oldfirst = chunk_plus_offset(oldfirst, nsize); qsize += nsize; } set_free_with_pinuse(q, qsize, oldfirst); insert_chunk(m, q, qsize); check_free_chunk(m, q); } check_malloced_chunk(m, chunk2mem(p), nb); return chunk2mem(p); } /* Add a segment to hold a new noncontiguous region */ static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { /* Determine locations and sizes of segment, fenceposts, old top */ char* old_top = (char*)m->top; msegmentptr oldsp = segment_holding(m, old_top); char* old_end = oldsp->base + oldsp->size; size_t ssize = pad_request(sizeof(struct malloc_segment)); char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); size_t offset = align_offset(chunk2mem(rawsp)); char* asp = rawsp + offset; char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; mchunkptr sp = (mchunkptr)csp; msegmentptr ss = (msegmentptr)(chunk2mem(sp)); mchunkptr tnext = chunk_plus_offset(sp, ssize); mchunkptr p = tnext; int nfences = 0; /* reset top to new space */ init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); /* Set up segment record */ assert(is_aligned(ss)); set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); *ss = m->seg; /* Push current record */ m->seg.base = tbase; m->seg.size = tsize; m->seg.sflags = mmapped; m->seg.next = ss; /* Insert trailing fenceposts */ for (;;) { mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); p->head = FENCEPOST_HEAD; ++nfences; if ((char*)(&(nextp->head)) < old_end) p = nextp; else break; } assert(nfences >= 2); /* Insert the rest of old top into a bin as an ordinary free chunk */ if (csp != old_top) { mchunkptr q = (mchunkptr)old_top; size_t psize = csp - old_top; mchunkptr tn = chunk_plus_offset(q, psize); set_free_with_pinuse(q, psize, tn); insert_chunk(m, q, psize); } check_top_chunk(m, m->top); } /* -------------------------- System allocation -------------------------- */ /* Get memory from system using MORECORE or MMAP */ static void* sys_alloc(mstate m, size_t nb) { char* tbase = CMFAIL; size_t tsize = 0; flag_t mmap_flag = 0; init_mparams(); /* Directly map large chunks */ if (use_mmap(m) && nb >= mparams.mmap_threshold) { void* mem = mmap_alloc(m, nb); if (mem != 0) return mem; } /* Try getting memory in any of three ways (in most-preferred to least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is used as a noncontiguous system allocator. This is a useful backup strategy for systems with holes in address spaces -- in this case sbrk cannot contiguously expand the heap, but mmap may be able to find space. 3. A call to MORECORE that cannot usually contiguously extend memory. (disabled if not HAVE_MORECORE) */ if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { char* br = CMFAIL; msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); size_t asize = 0; ACQUIRE_MORECORE_LOCK(); if (ss == 0) { /* First time through or recovery */ char* base = (char*)CALL_MORECORE(0); if (base != CMFAIL) { asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); /* Adjust to end on a page boundary */ if (!is_page_aligned(base)) asize += (page_align((size_t)base) - (size_t)base); /* Can't call MORECORE if size is negative when treated as signed */ if (asize < HALF_MAX_SIZE_T && (br = (char*)(CALL_MORECORE(asize))) == base) { tbase = base; tsize = asize; } } } else { /* Subtract out existing available top space from MORECORE request. */ asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE); /* Use mem here only if it did continuously extend old space */ if (asize < HALF_MAX_SIZE_T && (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) { tbase = br; tsize = asize; } } if (tbase == CMFAIL) { /* Cope with partial failure */ if (br != CMFAIL) { /* Try to use/extend the space we did get */ if (asize < HALF_MAX_SIZE_T && asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) { size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize); if (esize < HALF_MAX_SIZE_T) { char* end = (char*)CALL_MORECORE(esize); if (end != CMFAIL) asize += esize; else { /* Can't use; try to release */ CALL_MORECORE(-asize); br = CMFAIL; } } } } if (br != CMFAIL) { /* Use the space we did get */ tbase = br; tsize = asize; } else disable_contiguous(m); /* Don't try contiguous path in the future */ } RELEASE_MORECORE_LOCK(); } if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE; size_t rsize = granularity_align(req); if (rsize > nb) { /* Fail if wraps around zero */ char* mp = (char*)(CALL_MMAP(rsize)); if (mp != CMFAIL) { tbase = mp; tsize = rsize; mmap_flag = IS_MMAPPED_BIT; } } } if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); if (asize < HALF_MAX_SIZE_T) { char* br = CMFAIL; char* end = CMFAIL; ACQUIRE_MORECORE_LOCK(); br = (char*)(CALL_MORECORE(asize)); end = (char*)(CALL_MORECORE(0)); RELEASE_MORECORE_LOCK(); if (br != CMFAIL && end != CMFAIL && br < end) { size_t ssize = end - br; if (ssize > nb + TOP_FOOT_SIZE) { tbase = br; tsize = ssize; } } } } if (tbase != CMFAIL) { if ((m->footprint += tsize) > m->max_footprint) m->max_footprint = m->footprint; if (!is_initialized(m)) { /* first-time initialization */ m->seg.base = m->least_addr = tbase; m->seg.size = tsize; m->seg.sflags = mmap_flag; m->magic = mparams.magic; init_bins(m); if (is_global(m)) init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); else { /* Offset top by embedded malloc_state */ mchunkptr mn = next_chunk(mem2chunk(m)); init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); } } else { /* Try to merge with an existing segment */ msegmentptr sp = &m->seg; while (sp != 0 && tbase != sp->base + sp->size) sp = sp->next; if (sp != 0 && !is_extern_segment(sp) && (sp->sflags & IS_MMAPPED_BIT) == mmap_flag && segment_holds(sp, m->top)) { /* append */ sp->size += tsize; init_top(m, m->top, m->topsize + tsize); } else { if (tbase < m->least_addr) m->least_addr = tbase; sp = &m->seg; while (sp != 0 && sp->base != tbase + tsize) sp = sp->next; if (sp != 0 && !is_extern_segment(sp) && (sp->sflags & IS_MMAPPED_BIT) == mmap_flag) { char* oldbase = sp->base; sp->base = tbase; sp->size += tsize; return prepend_alloc(m, tbase, oldbase, nb); } else add_segment(m, tbase, tsize, mmap_flag); } } if (nb < m->topsize) { /* Allocate from new or extended top space */ size_t rsize = m->topsize -= nb; mchunkptr p = m->top; mchunkptr r = m->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(m, p, nb); check_top_chunk(m, m->top); check_malloced_chunk(m, chunk2mem(p), nb); return chunk2mem(p); } } MALLOC_FAILURE_ACTION; return 0; } /* ----------------------- system deallocation -------------------------- */ /* Unmap and unlink any mmapped segments that don't contain used chunks */ static size_t release_unused_segments(mstate m) { size_t released = 0; msegmentptr pred = &m->seg; msegmentptr sp = pred->next; while (sp != 0) { char* base = sp->base; size_t size = sp->size; msegmentptr next = sp->next; if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { mchunkptr p = align_as_chunk(base); size_t psize = chunksize(p); /* Can unmap if first chunk holds entire segment and not pinned */ if (!cinuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { tchunkptr tp = (tchunkptr)p; assert(segment_holds(sp, (char*)sp)); if (p == m->dv) { m->dv = 0; m->dvsize = 0; } else { unlink_large_chunk(m, tp); } if (CALL_MUNMAP(base, size) == 0) { released += size; m->footprint -= size; /* unlink obsoleted record */ sp = pred; sp->next = next; } else { /* back out if cannot unmap */ insert_large_chunk(m, tp, psize); } } } pred = sp; sp = next; } return released; } static int sys_trim(mstate m, size_t pad) { size_t released = 0; if (pad < MAX_REQUEST && is_initialized(m)) { pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ if (m->topsize > pad) { /* Shrink top space in granularity-size units, keeping at least one */ size_t unit = mparams.granularity; size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - SIZE_T_ONE) * unit; msegmentptr sp = segment_holding(m, (char*)m->top); if (!is_extern_segment(sp)) { if (is_mmapped_segment(sp)) { if (HAVE_MMAP && sp->size >= extra && !has_segment_link(m, sp)) { /* can't shrink if pinned */ size_t newsize = sp->size - extra; /* Prefer mremap, fall back to munmap */ if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { released = extra; } } } else if (HAVE_MORECORE) { if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; ACQUIRE_MORECORE_LOCK(); { /* Make sure end of memory is where we last set it. */ char* old_br = (char*)(CALL_MORECORE(0)); if (old_br == sp->base + sp->size) { char* rel_br = (char*)(CALL_MORECORE(-extra)); char* new_br = (char*)(CALL_MORECORE(0)); if (rel_br != CMFAIL && new_br < old_br) released = old_br - new_br; } } RELEASE_MORECORE_LOCK(); } } if (released != 0) { sp->size -= released; m->footprint -= released; init_top(m, m->top, m->topsize - released); check_top_chunk(m, m->top); } } /* Unmap any unused mmapped segments */ if (HAVE_MMAP) released += release_unused_segments(m); /* On failure, disable autotrim to avoid repeated failed future calls */ if (released == 0) m->trim_check = MAX_SIZE_T; } return (released != 0)? 1 : 0; } /* ---------------------------- malloc support --------------------------- */ /* allocate a large request from the best fitting chunk in a treebin */ static void* tmalloc_large(mstate m, size_t nb) { tchunkptr v = 0; size_t rsize = -nb; /* Unsigned negation */ tchunkptr t; bindex_t idx; compute_tree_index(nb, idx); if ((t = *treebin_at(m, idx)) != 0) { /* Traverse tree for this bin looking for node with size == nb */ size_t sizebits = nb << leftshift_for_tree_index(idx); tchunkptr rst = 0; /* The deepest untaken right subtree */ for (;;) { tchunkptr rt; size_t trem = chunksize(t) - nb; if (trem < rsize) { v = t; if ((rsize = trem) == 0) break; } rt = t->child[1]; t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; if (rt != 0 && rt != t) rst = rt; if (t == 0) { t = rst; /* set t to least subtree holding sizes > nb */ break; } sizebits <<= 1; } } if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; if (leftbits != 0) { bindex_t i; binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); t = *treebin_at(m, i); } } while (t != 0) { /* find smallest of tree or subtree */ size_t trem = chunksize(t) - nb; if (trem < rsize) { rsize = trem; v = t; } t = leftmost_child(t); } /* If dv is a better fit, return 0 so malloc will use it */ if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { if (RTCHECK(ok_address(m, v))) { /* split */ mchunkptr r = chunk_plus_offset(v, nb); assert(chunksize(v) == rsize + nb); if (RTCHECK(ok_next(v, r))) { unlink_large_chunk(m, v); if (rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(m, v, (rsize + nb)); else { set_size_and_pinuse_of_inuse_chunk(m, v, nb); set_size_and_pinuse_of_free_chunk(r, rsize); insert_chunk(m, r, rsize); } return chunk2mem(v); } } CORRUPTION_ERROR_ACTION(m); } return 0; } /* allocate a small request from the best fitting chunk in a treebin */ static void* tmalloc_small(mstate m, size_t nb) { tchunkptr t, v; size_t rsize; bindex_t i; binmap_t leastbit = least_bit(m->treemap); compute_bit2idx(leastbit, i); v = t = *treebin_at(m, i); rsize = chunksize(t) - nb; while ((t = leftmost_child(t)) != 0) { size_t trem = chunksize(t) - nb; if (trem < rsize) { rsize = trem; v = t; } } if (RTCHECK(ok_address(m, v))) { mchunkptr r = chunk_plus_offset(v, nb); assert(chunksize(v) == rsize + nb); if (RTCHECK(ok_next(v, r))) { unlink_large_chunk(m, v); if (rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(m, v, (rsize + nb)); else { set_size_and_pinuse_of_inuse_chunk(m, v, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(m, r, rsize); } return chunk2mem(v); } } CORRUPTION_ERROR_ACTION(m); return 0; } /* --------------------------- realloc support --------------------------- */ static void* internal_realloc(mstate m, void* oldmem, size_t bytes) { if (bytes >= MAX_REQUEST) { MALLOC_FAILURE_ACTION; return 0; } if (!PREACTION(m)) { mchunkptr oldp = mem2chunk(oldmem); size_t oldsize = chunksize(oldp); mchunkptr next = chunk_plus_offset(oldp, oldsize); mchunkptr newp = 0; void* extra = 0; /* Try to either shrink or extend into top. Else malloc-copy-free */ if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) && ok_next(oldp, next) && ok_pinuse(next))) { size_t nb = request2size(bytes); if (is_mmapped(oldp)) newp = mmap_resize(m, oldp, nb); else if (oldsize >= nb) { /* already big enough */ size_t rsize = oldsize - nb; newp = oldp; if (rsize >= MIN_CHUNK_SIZE) { mchunkptr remainder = chunk_plus_offset(newp, nb); set_inuse(m, newp, nb); set_inuse(m, remainder, rsize); extra = chunk2mem(remainder); } } else if (next == m->top && oldsize + m->topsize > nb) { /* Expand into top */ size_t newsize = oldsize + m->topsize; size_t newtopsize = newsize - nb; mchunkptr newtop = chunk_plus_offset(oldp, nb); set_inuse(m, oldp, nb); newtop->head = newtopsize |PINUSE_BIT; m->top = newtop; m->topsize = newtopsize; newp = oldp; } } else { USAGE_ERROR_ACTION(m, oldmem); POSTACTION(m); return 0; } POSTACTION(m); if (newp != 0) { if (extra != 0) { internal_free(m, extra); } check_inuse_chunk(m, newp); return chunk2mem(newp); } else { void* newmem = internal_malloc(m, bytes); if (newmem != 0) { size_t oc = oldsize - overhead_for(oldp); memcpy(newmem, oldmem, (oc < bytes)? oc : bytes); internal_free(m, oldmem); } return newmem; } } return 0; } /* --------------------------- memalign support -------------------------- */ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */ return internal_malloc(m, bytes); if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ alignment = MIN_CHUNK_SIZE; if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ size_t a = MALLOC_ALIGNMENT << 1; while (a < alignment) a <<= 1; alignment = a; } if (bytes >= MAX_REQUEST - alignment) { if (m != 0) { /* Test isn't needed but avoids compiler warning */ MALLOC_FAILURE_ACTION; } } else { size_t nb = request2size(bytes); size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; char* mem = (char*)internal_malloc(m, req); if (mem != 0) { void* leader = 0; void* trailer = 0; mchunkptr p = mem2chunk(mem); if (PREACTION(m)) return 0; if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */ /* Find an aligned spot inside chunk. Since we need to give back leading space in a chunk of at least MIN_CHUNK_SIZE, if the first calculation places us at a spot with less than MIN_CHUNK_SIZE leader, we can move to the next aligned spot. We've allocated enough total room so that this is always possible. */ char* br = (char*)mem2chunk((size_t)(((size_t)(mem + alignment - SIZE_T_ONE)) & -alignment)); char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? br : br+alignment; mchunkptr newp = (mchunkptr)pos; size_t leadsize = pos - (char*)(p); size_t newsize = chunksize(p) - leadsize; if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ newp->prev_foot = p->prev_foot + leadsize; newp->head = (newsize|CINUSE_BIT); } else { /* Otherwise, give back leader, use the rest */ set_inuse(m, newp, newsize); set_inuse(m, p, leadsize); leader = chunk2mem(p); } p = newp; } /* Give back spare room at the end */ if (!is_mmapped(p)) { size_t size = chunksize(p); if (size > nb + MIN_CHUNK_SIZE) { size_t remainder_size = size - nb; mchunkptr remainder = chunk_plus_offset(p, nb); set_inuse(m, p, nb); set_inuse(m, remainder, remainder_size); trailer = chunk2mem(remainder); } } assert (chunksize(p) >= nb); assert((((size_t)(chunk2mem(p))) % alignment) == 0); check_inuse_chunk(m, p); POSTACTION(m); if (leader != 0) { internal_free(m, leader); } if (trailer != 0) { internal_free(m, trailer); } return chunk2mem(p); } } return 0; } /* ------------------------ comalloc/coalloc support --------------------- */ static void** ialloc(mstate m, size_t n_elements, size_t* sizes, int opts, void* chunks[]) { /* This provides common support for independent_X routines, handling all of the combinations that can result. The opts arg has: bit 0 set if all elements are same size (using sizes[0]) bit 1 set if elements should be zeroed */ size_t element_size; /* chunksize of each element, if all same */ size_t contents_size; /* total size of elements */ size_t array_size; /* request size of pointer array */ void* mem; /* malloced aggregate space */ mchunkptr p; /* corresponding chunk */ size_t remainder_size; /* remaining bytes while splitting */ void** marray; /* either "chunks" or malloced ptr array */ mchunkptr array_chunk; /* chunk for malloced ptr array */ flag_t was_enabled; /* to disable mmap */ size_t size; size_t i; /* compute array length, if needed */ if (chunks != 0) { if (n_elements == 0) return chunks; /* nothing to do */ marray = chunks; array_size = 0; } else { /* if empty req, must still return chunk representing empty array */ if (n_elements == 0) return (void**)internal_malloc(m, 0); marray = 0; array_size = request2size(n_elements * (sizeof(void*))); } /* compute total element size */ if (opts & 0x1) { /* all-same-size */ element_size = request2size(*sizes); contents_size = n_elements * element_size; } else { /* add up all the sizes */ element_size = 0; contents_size = 0; for (i = 0; i != n_elements; ++i) contents_size += request2size(sizes[i]); } size = contents_size + array_size; /* Allocate the aggregate chunk. First disable direct-mmapping so malloc won't use it, since we would not be able to later free/realloc space internal to a segregated mmap region. */ was_enabled = use_mmap(m); disable_mmap(m); mem = internal_malloc(m, size - CHUNK_OVERHEAD); if (was_enabled) enable_mmap(m); if (mem == 0) return 0; if (PREACTION(m)) return 0; p = mem2chunk(mem); remainder_size = chunksize(p); assert(!is_mmapped(p)); if (opts & 0x2) { /* optionally clear the elements */ memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); } /* If not provided, allocate the pointer array as final part of chunk */ if (marray == 0) { size_t array_chunk_size; array_chunk = chunk_plus_offset(p, contents_size); array_chunk_size = remainder_size - contents_size; marray = (void**) (chunk2mem(array_chunk)); set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); remainder_size = contents_size; } /* split out elements */ for (i = 0; ; ++i) { marray[i] = chunk2mem(p); if (i != n_elements-1) { if (element_size != 0) size = element_size; else size = request2size(sizes[i]); remainder_size -= size; set_size_and_pinuse_of_inuse_chunk(m, p, size); p = chunk_plus_offset(p, size); } else { /* the final element absorbs any overallocation slop */ set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); break; } } #if DEBUG if (marray != chunks) { /* final element must have exactly exhausted chunk */ if (element_size != 0) { assert(remainder_size == element_size); } else { assert(remainder_size == request2size(sizes[i])); } check_inuse_chunk(m, mem2chunk(marray)); } for (i = 0; i != n_elements; ++i) check_inuse_chunk(m, mem2chunk(marray[i])); #endif /* DEBUG */ POSTACTION(m); return marray; } /* -------------------------- public routines ---------------------------- */ #if !ONLY_MSPACES void* dlmalloc(size_t bytes) { /* Basic algorithm: If a small request (< 256 bytes minus per-chunk overhead): 1. If one exists, use a remainderless chunk in associated smallbin. (Remainderless means that there are too few excess bytes to represent as a chunk.) 2. If it is big enough, use the dv chunk, which is normally the chunk adjacent to the one used for the most recent small request. 3. If one exists, split the smallest available chunk in a bin, saving remainder in dv. 4. If it is big enough, use the top chunk. 5. If available, get memory from system and use it Otherwise, for a large request: 1. Find the smallest available binned chunk that fits, and use it if it is better fitting than dv chunk, splitting if necessary. 2. If better fitting than any binned chunk, use the dv chunk. 3. If it is big enough, use the top chunk. 4. If request size >= mmap threshold, try to directly mmap this chunk. 5. If available, get memory from system and use it The ugly goto's here ensure that postaction occurs along all paths. */ if (!PREACTION(gm)) { void* mem; size_t nb; if (bytes <= MAX_SMALL_REQUEST) { bindex_t idx; binmap_t smallbits; nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); idx = small_index(nb); smallbits = gm->smallmap >> idx; if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ mchunkptr b, p; idx += ~smallbits & 1; /* Uses next bin if idx empty */ b = smallbin_at(gm, idx); p = b->fd; assert(chunksize(p) == small_index2size(idx)); unlink_first_small_chunk(gm, b, p, idx); set_inuse_and_pinuse(gm, p, small_index2size(idx)); mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (nb > gm->dvsize) { if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ mchunkptr b, p, r; size_t rsize; bindex_t i; binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); b = smallbin_at(gm, i); p = b->fd; assert(chunksize(p) == small_index2size(i)); unlink_first_small_chunk(gm, b, p, i); rsize = small_index2size(i) - nb; /* Fit here cannot be remainderless if 4byte sizes */ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(gm, p, small_index2size(i)); else { set_size_and_pinuse_of_inuse_chunk(gm, p, nb); r = chunk_plus_offset(p, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(gm, r, rsize); } mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { check_malloced_chunk(gm, mem, nb); goto postaction; } } } else if (bytes >= MAX_REQUEST) nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ else { nb = pad_request(bytes); if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { check_malloced_chunk(gm, mem, nb); goto postaction; } } if (nb <= gm->dvsize) { size_t rsize = gm->dvsize - nb; mchunkptr p = gm->dv; if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ mchunkptr r = gm->dv = chunk_plus_offset(p, nb); gm->dvsize = rsize; set_size_and_pinuse_of_free_chunk(r, rsize); set_size_and_pinuse_of_inuse_chunk(gm, p, nb); } else { /* exhaust dv */ size_t dvs = gm->dvsize; gm->dvsize = 0; gm->dv = 0; set_inuse_and_pinuse(gm, p, dvs); } mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (nb < gm->topsize) { /* Split top */ size_t rsize = gm->topsize -= nb; mchunkptr p = gm->top; mchunkptr r = gm->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(gm, p, nb); mem = chunk2mem(p); check_top_chunk(gm, gm->top); check_malloced_chunk(gm, mem, nb); goto postaction; } mem = sys_alloc(gm, nb); postaction: POSTACTION(gm); return mem; } return 0; } void dlfree(void* mem) { /* Consolidate freed chunks with preceeding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for top, dv, mmapped chunks, and usage errors. */ if (mem != 0) { mchunkptr p = mem2chunk(mem); #if FOOTERS mstate fm = get_mstate_for(p); if (!ok_magic(fm)) { USAGE_ERROR_ACTION(fm, p); return; } #else /* FOOTERS */ #define fm gm #endif /* FOOTERS */ if (!PREACTION(fm)) { check_inuse_chunk(fm, p); if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { size_t psize = chunksize(p); mchunkptr next = chunk_plus_offset(p, psize); if (!pinuse(p)) { size_t prevsize = p->prev_foot; if ((prevsize & IS_MMAPPED_BIT) != 0) { prevsize &= ~IS_MMAPPED_BIT; psize += prevsize + MMAP_FOOT_PAD; if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) fm->footprint -= psize; goto postaction; } else { mchunkptr prev = chunk_minus_offset(p, prevsize); psize += prevsize; p = prev; if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ if (p != fm->dv) { unlink_chunk(fm, p, prevsize); } else if ((next->head & INUSE_BITS) == INUSE_BITS) { fm->dvsize = psize; set_free_with_pinuse(p, psize, next); goto postaction; } } else goto erroraction; } } if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { if (!cinuse(next)) { /* consolidate forward */ if (next == fm->top) { size_t tsize = fm->topsize += psize; fm->top = p; p->head = tsize | PINUSE_BIT; if (p == fm->dv) { fm->dv = 0; fm->dvsize = 0; } if (should_trim(fm, tsize)) sys_trim(fm, 0); goto postaction; } else if (next == fm->dv) { size_t dsize = fm->dvsize += psize; fm->dv = p; set_size_and_pinuse_of_free_chunk(p, dsize); goto postaction; } else { size_t nsize = chunksize(next); psize += nsize; unlink_chunk(fm, next, nsize); set_size_and_pinuse_of_free_chunk(p, psize); if (p == fm->dv) { fm->dvsize = psize; goto postaction; } } } else set_free_with_pinuse(p, psize, next); insert_chunk(fm, p, psize); check_free_chunk(fm, p); goto postaction; } } erroraction: USAGE_ERROR_ACTION(fm, p); postaction: POSTACTION(fm); } } #if !FOOTERS #undef fm #endif /* FOOTERS */ } void* dlcalloc(size_t n_elements, size_t elem_size) { void* mem; size_t req = 0; if (n_elements != 0) { req = n_elements * elem_size; if (((n_elements | elem_size) & ~(size_t)0xffff) && (req / n_elements != elem_size)) req = MAX_SIZE_T; /* force downstream failure on overflow */ } mem = dlmalloc(req); if (mem != 0 && calloc_must_clear(mem2chunk(mem))) memset(mem, 0, req); return mem; } void* dlrealloc(void* oldmem, size_t bytes) { if (oldmem == 0) return dlmalloc(bytes); #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { dlfree(oldmem); return 0; } #endif /* REALLOC_ZERO_BYTES_FREES */ else { #if ! FOOTERS mstate m = gm; #else /* FOOTERS */ mstate m = get_mstate_for(mem2chunk(oldmem)); if (!ok_magic(m)) { USAGE_ERROR_ACTION(m, oldmem); return 0; } #endif /* FOOTERS */ return internal_realloc(m, oldmem, bytes); } } void* dlmemalign(size_t alignment, size_t bytes) { return internal_memalign(gm, alignment, bytes); } void** dlindependent_calloc(size_t n_elements, size_t elem_size, void* chunks[]) { size_t sz = elem_size; /* serves as 1-element array */ return ialloc(gm, n_elements, &sz, 3, chunks); } void** dlindependent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]) { return ialloc(gm, n_elements, sizes, 0, chunks); } void* dlvalloc(size_t bytes) { size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, bytes); } void* dlpvalloc(size_t bytes) { size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); } int dlmalloc_trim(size_t pad) { int result = 0; if (!PREACTION(gm)) { result = sys_trim(gm, pad); POSTACTION(gm); } return result; } size_t dlmalloc_footprint(void) { return gm->footprint; } size_t dlmalloc_max_footprint(void) { return gm->max_footprint; } #if !NO_MALLINFO struct mallinfo dlmallinfo(void) { return internal_mallinfo(gm); } #endif /* NO_MALLINFO */ void dlmalloc_stats() { internal_malloc_stats(gm); } size_t dlmalloc_usable_size(void* mem) { if (mem != 0) { mchunkptr p = mem2chunk(mem); if (cinuse(p)) return chunksize(p) - overhead_for(p); } return 0; } int dlmallopt(int param_number, int value) { return change_mparam(param_number, value); } #endif /* !ONLY_MSPACES */ /* ----------------------------- user mspaces ---------------------------- */ #if MSPACES static mstate init_user_mstate(char* tbase, size_t tsize) { size_t msize = pad_request(sizeof(struct malloc_state)); mchunkptr mn; mchunkptr msp = align_as_chunk(tbase); mstate m = (mstate)(chunk2mem(msp)); memset(m, 0, msize); INITIAL_LOCK(&m->mutex); msp->head = (msize|PINUSE_BIT|CINUSE_BIT); m->seg.base = m->least_addr = tbase; m->seg.size = m->footprint = m->max_footprint = tsize; m->magic = mparams.magic; m->mflags = mparams.default_mflags; disable_contiguous(m); init_bins(m); mn = next_chunk(mem2chunk(m)); init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); check_top_chunk(m, m->top); return m; } mspace create_mspace(size_t capacity, int locked) { mstate m = 0; size_t msize = pad_request(sizeof(struct malloc_state)); init_mparams(); /* Ensure pagesize etc initialized */ if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { size_t rs = ((capacity == 0)? mparams.granularity : (capacity + TOP_FOOT_SIZE + msize)); size_t tsize = granularity_align(rs); char* tbase = (char*)(CALL_MMAP(tsize)); if (tbase != CMFAIL) { m = init_user_mstate(tbase, tsize); m->seg.sflags = IS_MMAPPED_BIT; set_lock(m, locked); } } return (mspace)m; } mspace create_mspace_with_base(void* base, size_t capacity, int locked) { mstate m = 0; size_t msize = pad_request(sizeof(struct malloc_state)); init_mparams(); /* Ensure pagesize etc initialized */ if (capacity > msize + TOP_FOOT_SIZE && capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { m = init_user_mstate((char*)base, capacity); m->seg.sflags = EXTERN_BIT; set_lock(m, locked); } return (mspace)m; } size_t destroy_mspace(mspace msp) { size_t freed = 0; mstate ms = (mstate)msp; if (ok_magic(ms)) { msegmentptr sp = &ms->seg; while (sp != 0) { char* base = sp->base; size_t size = sp->size; flag_t flag = sp->sflags; sp = sp->next; if ((flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) && CALL_MUNMAP(base, size) == 0) freed += size; } } else { USAGE_ERROR_ACTION(ms,ms); } return freed; } /* mspace versions of routines are near-clones of the global versions. This is not so nice but better than the alternatives. */ void* mspace_malloc(mspace msp, size_t bytes) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } if (!PREACTION(ms)) { void* mem; size_t nb; if (bytes <= MAX_SMALL_REQUEST) { bindex_t idx; binmap_t smallbits; nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); idx = small_index(nb); smallbits = ms->smallmap >> idx; if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ mchunkptr b, p; idx += ~smallbits & 1; /* Uses next bin if idx empty */ b = smallbin_at(ms, idx); p = b->fd; assert(chunksize(p) == small_index2size(idx)); unlink_first_small_chunk(ms, b, p, idx); set_inuse_and_pinuse(ms, p, small_index2size(idx)); mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (nb > ms->dvsize) { if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ mchunkptr b, p, r; size_t rsize; bindex_t i; binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); b = smallbin_at(ms, i); p = b->fd; assert(chunksize(p) == small_index2size(i)); unlink_first_small_chunk(ms, b, p, i); rsize = small_index2size(i) - nb; /* Fit here cannot be remainderless if 4byte sizes */ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(ms, p, small_index2size(i)); else { set_size_and_pinuse_of_inuse_chunk(ms, p, nb); r = chunk_plus_offset(p, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(ms, r, rsize); } mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { check_malloced_chunk(ms, mem, nb); goto postaction; } } } else if (bytes >= MAX_REQUEST) nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ else { nb = pad_request(bytes); if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { check_malloced_chunk(ms, mem, nb); goto postaction; } } if (nb <= ms->dvsize) { size_t rsize = ms->dvsize - nb; mchunkptr p = ms->dv; if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ mchunkptr r = ms->dv = chunk_plus_offset(p, nb); ms->dvsize = rsize; set_size_and_pinuse_of_free_chunk(r, rsize); set_size_and_pinuse_of_inuse_chunk(ms, p, nb); } else { /* exhaust dv */ size_t dvs = ms->dvsize; ms->dvsize = 0; ms->dv = 0; set_inuse_and_pinuse(ms, p, dvs); } mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (nb < ms->topsize) { /* Split top */ size_t rsize = ms->topsize -= nb; mchunkptr p = ms->top; mchunkptr r = ms->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(ms, p, nb); mem = chunk2mem(p); check_top_chunk(ms, ms->top); check_malloced_chunk(ms, mem, nb); goto postaction; } mem = sys_alloc(ms, nb); postaction: POSTACTION(ms); return mem; } return 0; } void mspace_free(mspace msp, void* mem) { if (mem != 0) { mchunkptr p = mem2chunk(mem); #if FOOTERS mstate fm = get_mstate_for(p); #else /* FOOTERS */ mstate fm = (mstate)msp; #endif /* FOOTERS */ if (!ok_magic(fm)) { USAGE_ERROR_ACTION(fm, p); return; } if (!PREACTION(fm)) { check_inuse_chunk(fm, p); if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { size_t psize = chunksize(p); mchunkptr next = chunk_plus_offset(p, psize); if (!pinuse(p)) { size_t prevsize = p->prev_foot; if ((prevsize & IS_MMAPPED_BIT) != 0) { prevsize &= ~IS_MMAPPED_BIT; psize += prevsize + MMAP_FOOT_PAD; if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) fm->footprint -= psize; goto postaction; } else { mchunkptr prev = chunk_minus_offset(p, prevsize); psize += prevsize; p = prev; if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ if (p != fm->dv) { unlink_chunk(fm, p, prevsize); } else if ((next->head & INUSE_BITS) == INUSE_BITS) { fm->dvsize = psize; set_free_with_pinuse(p, psize, next); goto postaction; } } else goto erroraction; } } if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { if (!cinuse(next)) { /* consolidate forward */ if (next == fm->top) { size_t tsize = fm->topsize += psize; fm->top = p; p->head = tsize | PINUSE_BIT; if (p == fm->dv) { fm->dv = 0; fm->dvsize = 0; } if (should_trim(fm, tsize)) sys_trim(fm, 0); goto postaction; } else if (next == fm->dv) { size_t dsize = fm->dvsize += psize; fm->dv = p; set_size_and_pinuse_of_free_chunk(p, dsize); goto postaction; } else { size_t nsize = chunksize(next); psize += nsize; unlink_chunk(fm, next, nsize); set_size_and_pinuse_of_free_chunk(p, psize); if (p == fm->dv) { fm->dvsize = psize; goto postaction; } } } else set_free_with_pinuse(p, psize, next); insert_chunk(fm, p, psize); check_free_chunk(fm, p); goto postaction; } } erroraction: USAGE_ERROR_ACTION(fm, p); postaction: POSTACTION(fm); } } } void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { void* mem; size_t req = 0; mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } if (n_elements != 0) { req = n_elements * elem_size; if (((n_elements | elem_size) & ~(size_t)0xffff) && (req / n_elements != elem_size)) req = MAX_SIZE_T; /* force downstream failure on overflow */ } mem = internal_malloc(ms, req); if (mem != 0 && calloc_must_clear(mem2chunk(mem))) memset(mem, 0, req); return mem; } void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { if (oldmem == 0) return mspace_malloc(msp, bytes); #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { mspace_free(msp, oldmem); return 0; } #endif /* REALLOC_ZERO_BYTES_FREES */ else { #if FOOTERS mchunkptr p = mem2chunk(oldmem); mstate ms = get_mstate_for(p); #else /* FOOTERS */ mstate ms = (mstate)msp; #endif /* FOOTERS */ if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return internal_realloc(ms, oldmem, bytes); } } void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return internal_memalign(ms, alignment, bytes); } void** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void* chunks[]) { size_t sz = elem_size; /* serves as 1-element array */ mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return ialloc(ms, n_elements, &sz, 3, chunks); } void** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void* chunks[]) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return ialloc(ms, n_elements, sizes, 0, chunks); } int mspace_trim(mspace msp, size_t pad) { int result = 0; mstate ms = (mstate)msp; if (ok_magic(ms)) { if (!PREACTION(ms)) { result = sys_trim(ms, pad); POSTACTION(ms); } } else { USAGE_ERROR_ACTION(ms,ms); } return result; } void mspace_malloc_stats(mspace msp) { mstate ms = (mstate)msp; if (ok_magic(ms)) { internal_malloc_stats(ms); } else { USAGE_ERROR_ACTION(ms,ms); } } size_t mspace_footprint(mspace msp) { size_t result; mstate ms = (mstate)msp; if (ok_magic(ms)) { result = ms->footprint; } USAGE_ERROR_ACTION(ms,ms); return result; } size_t mspace_max_footprint(mspace msp) { size_t result; mstate ms = (mstate)msp; if (ok_magic(ms)) { result = ms->max_footprint; } USAGE_ERROR_ACTION(ms,ms); return result; } #if !NO_MALLINFO struct mallinfo mspace_mallinfo(mspace msp) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); } return internal_mallinfo(ms); } #endif /* NO_MALLINFO */ int mspace_mallopt(int param_number, int value) { return change_mparam(param_number, value); } #endif /* MSPACES */ /* -------------------- Alternative MORECORE functions ------------------- */ /* Guidelines for creating a custom version of MORECORE: * For best performance, MORECORE should allocate in multiples of pagesize. * MORECORE may allocate more memory than requested. (Or even less, but this will usually result in a malloc failure.) * MORECORE must not allocate memory when given argument zero, but instead return one past the end address of memory from previous nonzero call. * For best performance, consecutive calls to MORECORE with positive arguments should return increasing addresses, indicating that space has been contiguously extended. * Even though consecutive calls to MORECORE need not return contiguous addresses, it must be OK for malloc'ed chunks to span multiple regions in those cases where they do happen to be contiguous. * MORECORE need not handle negative arguments -- it may instead just return MFAIL when given negative arguments. Negative arguments are always multiples of pagesize. MORECORE must not misinterpret negative args as large positive unsigned args. You can suppress all such calls from even occurring by defining MORECORE_CANNOT_TRIM, As an example alternative MORECORE, here is a custom allocator kindly contributed for pre-OSX macOS. It uses virtually but not necessarily physically contiguous non-paged memory (locked in, present and won't get swapped out). You can use it by uncommenting this section, adding some #includes, and setting up the appropriate defines above: #define MORECORE osMoreCore There is also a shutdown routine that should somehow be called for cleanup upon program exit. #define MAX_POOL_ENTRIES 100 #define MINIMUM_MORECORE_SIZE (64 * 1024U) static int next_os_pool; void *our_os_pools[MAX_POOL_ENTRIES]; void *osMoreCore(int size) { void *ptr = 0; static void *sbrk_top = 0; if (size > 0) { if (size < MINIMUM_MORECORE_SIZE) size = MINIMUM_MORECORE_SIZE; if (CurrentExecutionLevel() == kTaskLevel) ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); if (ptr == 0) { return (void *) MFAIL; } // save ptrs so they can be freed during cleanup our_os_pools[next_os_pool] = ptr; next_os_pool++; ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); sbrk_top = (char *) ptr + size; return ptr; } else if (size < 0) { // we don't currently support shrink behavior return (void *) MFAIL; } else { return sbrk_top; } } // cleanup any allocated memory pools // called as last thing before shutting down driver void osCleanupMem(void) { void **ptr; for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) if (*ptr) { PoolDeallocate(*ptr); *ptr = 0; } } */ /* ----------------------------------------------------------------------- History: V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) * Add max_footprint functions * Ensure all appropriate literals are size_t * Fix conditional compilation problem for some #define settings * Avoid concatenating segments with the one provided in create_mspace_with_base * Rename some variables to avoid compiler shadowing warnings * Use explicit lock initialization. * Better handling of sbrk interference. * Simplify and fix segment insertion, trimming and mspace_destroy * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x * Thanks especially to Dennis Flanagan for help on these. V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) * Fix memalign brace error. V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) * Fix improper #endif nesting in C++ * Add explicit casts needed for C++ V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) * Use trees for large bins * Support mspaces * Use segments to unify sbrk-based and mmap-based system allocation, removing need for emulation on most platforms without sbrk. * Default safety checks * Optional footer checks. Thanks to William Robertson for the idea. * Internal code refactoring * Incorporate suggestions and platform-specific changes. Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, Aaron Bachmann, Emery Berger, and others. * Speed up non-fastbin processing enough to remove fastbins. * Remove useless cfree() to avoid conflicts with other apps. * Remove internal memcpy, memset. Compilers handle builtins better. * Remove some options that no one ever used and rename others. V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) * Fix malloc_state bitmap array misdeclaration V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) * Allow tuning of FIRST_SORTED_BIN_SIZE * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. * Better detection and support for non-contiguousness of MORECORE. Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger * Bypass most of malloc if no frees. Thanks To Emery Berger. * Fix freeing of old top non-contiguous chunk im sysmalloc. * Raised default trim and map thresholds to 256K. * Fix mmap-related #defines. Thanks to Lubos Lunak. * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. * Branch-free bin calculation * Default trim and mmap thresholds now 256K. V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) * Introduce independent_comalloc and independent_calloc. Thanks to Michael Pachos for motivation and help. * Make optional .h file available * Allow > 2GB requests on 32bit systems. * new WIN32 sbrk, mmap, munmap, lock code from . Thanks also to Andreas Mueller , and Anonymous. * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for helping test this.) * memalign: check alignment arg * realloc: don't try to shift chunks backwards, since this leads to more fragmentation in some programs and doesn't seem to help in any others. * Collect all cases in malloc requiring system memory into sysmalloc * Use mmap as backup to sbrk * Place all internal state in malloc_state * Introduce fastbins (although similar to 2.5.1) * Many minor tunings and cosmetic improvements * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS Thanks to Tony E. Bennett and others. * Include errno.h to support default failure action. V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) * return null for negative arguments * Added Several WIN32 cleanups from Martin C. Fong * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' (e.g. WIN32 platforms) * Cleanup header file inclusion for WIN32 platforms * Cleanup code to avoid Microsoft Visual C++ compiler complaints * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing memory allocation routines * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to usage of 'assert' in non-WIN32 code * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to avoid infinite loop * Always call 'fREe()' rather than 'free()' V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) * Fixed ordering problem with boundary-stamping V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) * Added pvalloc, as recommended by H.J. Liu * Added 64bit pointer support mainly from Wolfram Gloger * Added anonymously donated WIN32 sbrk emulation * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen * malloc_extend_top: fix mask error that caused wastage after foreign sbrks * Add linux mremap support code from HJ Liu V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) * Integrated most documentation with the code. * Add support for mmap, with help from Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Use last_remainder in more cases. * Pack bins using idea from colin@nyx10.cs.du.edu * Use ordered bins instead of best-fit threshhold * Eliminate block-local decls to simplify tracing and debugging. * Support another case of realloc via move into top * Fix error occuring when initial sbrk_base not word-aligned. * Rely on page size for units instead of SBRK_UNIT to avoid surprises about sbrk alignment conventions. * Add mallinfo, mallopt. Thanks to Raymond Nijssen (raymond@es.ele.tue.nl) for the suggestion. * Add `pad' argument to malloc_trim and top_pad mallopt parameter. * More precautions for cases where other routines call sbrk, courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Added macros etc., allowing use in linux libc from H.J. Lu (hjl@gnu.ai.mit.edu) * Inverted this history list V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) * Re-tuned and fixed to behave more nicely with V2.6.0 changes. * Removed all preallocation code since under current scheme the work required to undo bad preallocations exceeds the work saved in good cases for most test programs. * No longer use return list or unconsolidated bins since no scheme using them consistently outperforms those that don't given above changes. * Use best fit for very large chunks to prevent some worst-cases. * Added some support for debugging V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) * Removed footers when chunks are in use. Thanks to Paul Wilson (wilson@cs.texas.edu) for the suggestion. V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) * Added malloc_trim, with help from Wolfram Gloger (wmglo@Dent.MED.Uni-Muenchen.DE). V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) * realloc: try to expand in both directions * malloc: swap order of clean-bin strategy; * realloc: only conditionally expand backwards * Try not to scavenge used bins * Use bin counts as a guide to preallocation * Occasionally bin return list chunks in first scan * Add a few optimizations from colin@nyx10.cs.du.edu V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) * faster bin computation & slightly different binning * merged all consolidations to one part of malloc proper (eliminating old malloc_find_space & malloc_clean_bin) * Scan 2 returns chunks (not just 1) * Propagate failure in realloc if malloc returns 0 * Add stuff to allow compilation on non-ANSI compilers from kpv@research.att.com V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) * removed potential for odd address access in prev_chunk * removed dependency on getpagesize.h * misc cosmetics and a bit more internal documentation * anticosmetics: mangled names in macros to evade debugger strangeness * tested on sparc, hp-700, dec-mips, rs6000 with gcc & native cc (hp, dec only) allowing Detlefs & Zorn comparison study (in SIGPLAN Notices.) Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) */ Maude-2.6/src/3rdParty/Makefile.am0000644000147300135640000000020510057442467013706 00000000000000if USE_DLMALLOC noinst_LIBRARIES = libdlmalloc.a libdlmalloc_a_SOURCES = \ malloc.c endif noinst_HEADERS = \ MersenneTwister.h Maude-2.6/src/Mixfix/0000777000147300135640000000000011500304123011451 500000000000000Maude-2.6/src/Mixfix/lexerAux.cc0000644000147300135640000001553010757442142013516 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Auxiliary functions and data needed by lexical analyzer. // #define MAX_IN_DEPTH 10 int inStackPtr = 0; YY_BUFFER_STATE inStack[MAX_IN_DEPTH]; int dirMarkerStack[MAX_IN_DEPTH]; Vector pendingFiles; int nrPendingRead = 0; bool rootInteractive = false; bool fakeNewline = false; // fake \n for files that don't end with \n bool fakeNewlineStack[MAX_IN_DEPTH]; void getInput(char* buf, int& result, int max_size) { result = YY_NULL; if (UserLevelRewritingContext::interrupted()) fakeNewline = false; else { int n = ioManager.getInput(buf, max_size, yyin); if (UserLevelRewritingContext::interrupted()) fakeNewline = false; else { if (n > 0) { result = n; fakeNewline = (buf[n - 1] != '\n'); } else { if (fakeNewline && max_size > 0) { buf[0] = '\n'; result = 1; fakeNewline = false; } } } } } void cleanUpLexer() { if (inStackPtr > 0) { IssueAdvisory("closing open files."); while (inStackPtr > 0) { fclose(yyin); yy_delete_buffer(YY_CURRENT_BUFFER); --inStackPtr; yy_switch_to_buffer(inStack[inStackPtr]); } directoryManager.popd(dirMarkerStack[0]); fakeNewline = false; UserLevelRewritingContext::setInteractive(rootInteractive); } fileTable.abortEverything(lineNumber); nrPendingRead = pendingFiles.length(); // avoid any further reading of pending files BEGIN(INITIAL); } void lexerIdMode() { BEGIN(ID_MODE); } void lexBubble(int termination, int minLen) { terminationSet = termination; parenCount = 0; minLength = minLen; lexerBubble.clear(); yy_push_state(BUBBLE_MODE); } void lexBubble(const Token& first, int termination, int minLen, int pCount) { terminationSet = termination; parenCount = pCount; minLength = minLen; lexerBubble.clear(); lexerBubble.append(first); yy_push_state(BUBBLE_MODE); } void lexContinueBubble(const Token& next, int termination, int minLen, int pCount) { terminationSet = termination; parenCount = pCount; lexerBubble.append(next); minLength = minLen + lexerBubble.length(); yy_push_state(BUBBLE_MODE); } void lexSave(const Token& first) { lexerBubble.clear(); lexerBubble.append(first); } void lexContinueSave(const Token& next) { lexerBubble.append(next); } void lexerCmdMode() { BEGIN(CMD_MODE); } void lexerInitialMode() { BEGIN(INITIAL); } void lexerFileNameMode() { accumulator.erase(); yy_push_state(FILE_NAME_MODE); } void lexerStringMode() { yy_push_state(STRING_MODE); } void lexerLatexMode() { braceCount = 0; parenCount = 1; accumulator.erase(); yy_push_state(LATEX_MODE); } void createRootBuffer(FILE* fp, bool forceInteractive) { yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE)); rootInteractive = forceInteractive || (isatty(fileno(fp)) > 0); UserLevelRewritingContext::setInteractive(rootInteractive); } bool includeFile(const string& directory, const string& fileName, bool silent, int lineNr) { if (inStackPtr >= MAX_IN_DEPTH) { IssueWarning(LineNumber(lineNr) << ": ins nested too deeply - couldn't open file " << QUOTE(fileName)); return false; } int dirMarker = directoryManager.pushd(directory.c_str()); if (dirMarker == UNDEFINED) { IssueWarning(LineNumber(lineNr) << ": couldn't chdir to " << QUOTE(directory)); return false; } FILE* fp = fopen(fileName.c_str(), "r"); if (fp == 0) { IssueWarning(LineNumber(lineNr) << ": couldn't open file " << QUOTE(fileName)); directoryManager.popd(dirMarker); return false; } dirMarkerStack[inStackPtr] = dirMarker; inStack[inStackPtr] = YY_CURRENT_BUFFER; fakeNewlineStack[inStackPtr] = fakeNewline; fakeNewline = false; ++inStackPtr; yyin = fp; fileTable.openFile(lineNumber, fileName.c_str(), silent); yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); UserLevelRewritingContext::setInteractive(false); return true; } bool handleEof() { if (inStackPtr == 0) return false; --inStackPtr; fclose(yyin); fileTable.closeFile(lineNumber); yy_delete_buffer(YY_CURRENT_BUFFER); yy_switch_to_buffer(inStack[inStackPtr]); directoryManager.popd(dirMarkerStack[inStackPtr]); fakeNewline = fakeNewlineStack[inStackPtr]; if (inStackPtr == 0) { if (nrPendingRead < pendingFiles.length()) { string directory; string fileName; if (findFile(pendingFiles[nrPendingRead++], directory, fileName, FileTable::COMMAND_LINE) && includeFile(directory, fileName, true, FileTable::COMMAND_LINE)) return true; nrPendingRead = pendingFiles.length(); // avoid any futher reading of pending files } UserLevelRewritingContext::setInteractive(rootInteractive); } return true; } void checkForPending() { if (nrPendingRead < pendingFiles.length()) { string directory; string fileName; if (!(findFile(pendingFiles[nrPendingRead++], directory, fileName, FileTable::COMMAND_LINE) && includeFile(directory, fileName, true, FileTable::COMMAND_LINE))) nrPendingRead = pendingFiles.length(); // avoid any futher reading of pending files } } void eatComment(bool firstNonWhite) { bool passThrough = !firstNonWhite && fileTable.outputLine(); bool parenMode = false; int parenCount = 0; bool backquoteSeen = false; for (;;) { int c = yyinput(); switch(c) { case ' ': case '\t': case '\r': break; case '\n': case '\f': { ++lineNumber; if (!parenMode) { if (passThrough) cout << endl; return; } break; } case '(': { if (firstNonWhite) { firstNonWhite = false; parenMode = true; parenCount = 1; } else { if (parenMode && !backquoteSeen) ++parenCount; } break; } case ')': { if (parenMode && !backquoteSeen) { --parenCount; if (parenCount == 0) return; } break; } case EOF: return; default: firstNonWhite = false; } backquoteSeen = (c == '`'); if (passThrough) cout << static_cast(c); } } Maude-2.6/src/Mixfix/freshVariableSource.cc0000644000147300135640000000571210723134031015644 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2007 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class FreshVariableSource. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "symbolMap.hh" // front end class definitions #include "token.hh" #include "mixfixModule.hh" #include "freshVariableSource.hh" FreshVariableSource::FreshVariableSource(MixfixModule* module) : module(module), baseNumber(0) { } FreshVariableSource::FreshVariableSource(MixfixModule* module, const mpz_class& baseNumber) : module(module), baseNumber(baseNumber) { } int FreshVariableSource::getFreshVariableName(int index) { // // Check to see if we've aready computed a variable name for this index. // int nrCached = cache.size(); if (index < nrCached) { int t = cache[index]; if (t >= 0) return t; } // // In order to avoid allocating the name twice we convert the negative index to a // string and replace the minus sign with a '#'. // int negIndex = -(index + 1); mpz_class negativeIndex = negIndex - baseNumber; char* name = mpz_get_str (0, 10, negativeIndex.get_mpz_t()); name[0] = '#'; int code = Token::encode(name); free(name); // // Cache newly computed name index. // if (index >= nrCached) { cache.resize(index + 1); for (int i = nrCached; i < index; ++i) cache[i] = -1; } cache[index] = code; return code; } Symbol* FreshVariableSource::getBaseVariableSymbol(Sort* sort) { return module->instantiateVariable(sort); } bool FreshVariableSource::variableNameConflict(int id) { const char* name = Token::name(Token::unflaggedCode(id)); if (name[0] != '#' || name[1] == '0' || name[1] == '\0') return false; for (const char* p = name + 1; *p; ++p) { if (!isdigit(*p)) return false; } // // name looks like a fresh variable name so we need to get its index. // mpz_class index(name + 1); return index > baseNumber; } Maude-2.6/src/Mixfix/quotedIdentifierSymbol.hh0000644000147300135640000000325711457445604016434 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for quoted identifier symbols. // #ifndef _quotedIdentifierSymbol_hh_ #define _quotedIdentifierSymbol_hh_ #include "NA_Symbol.hh" class QuotedIdentifierSymbol : public NA_Symbol { public: QuotedIdentifierSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void fillInSortInfo(Term* subject); void computeBaseSort(DagNode* subject); bool isConstructor(DagNode* subject); void compileOpDeclarations(); private: Sort* determineSort(int idIndex); Sort* baseSort; Sort* constantSort; Sort* variableSort; Sort* sortSort; Sort* kindSort; }; #endif Maude-2.6/src/Mixfix/sharedTokens.hh0000644000147300135640000000220610457242727014365 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to hold codes for special tokens that are shared between various classes. // #ifndef _sharedTokens_hh_ #define _sharedTokens_hh_ class SharedTokens { public: SharedTokens(); protected: #define MACRO(Name, String) \ static int Name; #include "specialTokens.cc" #undef MACRO }; #endif Maude-2.6/src/Mixfix/moduleExpression.hh0000644000147300135640000000540210216707402015266 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for module expressions. // #ifndef _moduleExpression_hh_ #define _moduleExpression_hh_ #include #include "token.hh" class ModuleExpression { public: enum Type { MODULE, SUMMATION, RENAMING, INSTANTIATION }; ModuleExpression(Token moduleName); ModuleExpression(ModuleExpression* left, ModuleExpression* right); ModuleExpression(ModuleExpression* module, Renaming* renaming); ModuleExpression(ModuleExpression* module, const Vector& arguments); Type getType() const; Token getModuleName() const; const list& getModules() const; ModuleExpression* getModule() const; Renaming* getRenaming() const; const Vector& getArguments() const; void deepSelfDestruct(); private: const Type type; // // For named module. // Token moduleName; // // For summation. // list modules; // // For renaming and instantiation. // ModuleExpression* module; // // For renaming. // Renaming* renaming; // // For instantiation. // Vector arguments; }; ostream& operator<<(ostream& s, const ModuleExpression* expr); inline ModuleExpression::Type ModuleExpression::getType() const { return type; } inline Token ModuleExpression::getModuleName() const { Assert(type == MODULE, "not a named module"); return moduleName; } inline const list& ModuleExpression::getModules() const { Assert(type == SUMMATION, "not a summation"); return modules; } inline ModuleExpression* ModuleExpression::getModule() const { Assert(type == RENAMING || type == INSTANTIATION, "not a renaming or instantiation"); return module; } inline Renaming* ModuleExpression::getRenaming() const { Assert(type == RENAMING, "not a renaming"); return renaming; } inline const Vector& ModuleExpression::getArguments() const { Assert(type == INSTANTIATION, "not instantiation"); return arguments; } #endif Maude-2.6/src/Mixfix/view.cc0000644000147300135640000005106311404510605012662 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class View. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "core.hh" #include "interface.hh" #include "variable.hh" #include "higher.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" // variable class definitions #include "variableTerm.hh" // front end class definitions #include "token.hh" #include "moduleExpression.hh" #include "syntacticPreModule.hh" #include "interpreter.hh" //#include "maudemlBuffer.hh" #include "global.hh" // HACK shouldn't be accessing global variables #include "view.hh" View::View(Token viewName) : NamedEntity(viewName.code()), LineNumber(viewName.lineNumber()) { fromTheory = 0; toModule = 0; newFromTheory = 0; newToModule = 0; status = INITIAL; } View::~View() { clearOpTermMap(); if (fromTheory != 0) fromTheory->removeUser(this); if (toModule != 0) toModule->removeUser(this); if (newFromTheory != 0) newFromTheory->deepSelfDestruct(); if (newToModule != 0) newToModule->deepSelfDestruct(); fromExpr->deepSelfDestruct(); toExpr->deepSelfDestruct(); informUsers(); } void View::clearOpTermMap() { FOR_EACH_CONST(i, OpTermMap, opTermMap) { i->second.first->deepSelfDestruct(); i->second.second->deepSelfDestruct(); } opTermMap.clear(); } void View::addVarDecl(Token varName) { varDecls.push_back(VarDecl()); varDecls.back().varName = varName; varDecls.back().lastWithCurrentDef = false; } void View::addType(bool kind, const Vector& tokens) { if (varDecls.empty() || varDecls.back().lastWithCurrentDef) Renaming::addType(kind, tokens); // not ours else { varDecls.back().lastWithCurrentDef = true; varDefs.push_back(Type()); varDefs.back().kind = kind; varDefs.back().tokens = tokens; } } void View::addOpTermMapping(const Vector& fromOp, const Vector& toTerm) { opTermList.push_back(BubblePair()); opTermList.back().fromBubble = fromOp; // deep copy opTermList.back().toBubble = toTerm; // deep copy } void View::regretToInform(Entity* doomedEntity) { if (doomedEntity == fromTheory) fromTheory = 0; else if (doomedEntity == newFromTheory) newFromTheory = 0; else if(doomedEntity == toModule) toModule = 0; else if(doomedEntity == newToModule) newToModule = 0; else CantHappen("unexpected regretToInform()"); // // Something we depended on changed so self destruct all calculated stuff. // clearOpTermMap(); if (fromTheory != 0) { fromTheory->removeUser(this); fromTheory = 0; } if (newFromTheory != 0) { newFromTheory->deepSelfDestruct(); newFromTheory = 0; } if (toModule != 0) { toModule->removeUser(this); toModule = 0; } if (newToModule != 0) { newToModule->deepSelfDestruct(); newToModule = 0; } status = STALE; } ConnectedComponent* View::mapComponent(const ConnectedComponent* component, ImportModule* module) const { Sort* sort = module->findSort(renameSort(component->sort(1)->id())); Assert(sort != 0, "translation for sort failed"); return sort->component(); } Sort* View::mapSort(const Sort* sort, ImportModule* module) const { if (sort->index() == Sort::KIND) return mapComponent(sort->component(), module)->sort(Sort::KIND); Sort* transSort = module->findSort(renameSort(sort->id())); Assert(transSort != 0, "translation for sort failed"); return transSort; } void View::finishView() { evaluate(); } void View::finishModule1(ImportModule* module) { module->importSorts(); module->closeSortSet(); Assert(!(module->isBad()), "copy of a non-bad theory bad"); module->importOps(); Assert(!(module->isBad()), "copy of a non-bad theory bad"); } void View::finishModule2(ImportModule* module) { module->closeSignature(); module->fixUpImportedOps(); Assert(!(module->isBad()), "copy of a non-bad theory bad"); module->closeFixUps(); module->localStatementsComplete(); module->resetImports(); } bool View::checkSorts() { // // We check that for each pair of sorts (A, B) lying in the same kind in // fromTheory, there exists under our mapping sorts (A', B') that are in // the same kind in toModule, and further more if A <= B then A' <= B'. // const Vector kinds = fromTheory->getConnectedComponents(); // // We examine the sort structure of the from theory one connected component at a time. // FOR_EACH_CONST(i, Vector, kinds) { ConnectedComponent* kind = (*i); // // For each kind, we examine its sorts. // int nrSorts = kind->nrSorts(); for (int j = 1; j < nrSorts; ++j) { Sort* jSort = kind->sort(j); int jId = jSort->id(); int jTrans = renameSort(jSort->id()); if (fromTheory->moduleDeclared(jSort) && jTrans != jId) { IssueAdvisory(*this << ": sort mapping not applied to sort " << QUOTE(jSort) << " as it was declared in a module rather than in a theory."); jTrans = jId; } Sort* jTransSort = toModule->findSort(jTrans); if (jTransSort == 0) { IssueWarning(*this << ": failed to find sort " << QUOTE(Token::sortName(jTrans)) << " in " << QUOTE(toModule) << " to represent sort " << QUOTE(jSort) << " from " << QUOTE(fromTheory) << '.'); return false; } ConnectedComponent* transKind = jTransSort->component(); // // Now we compare the sort to earlier sorts which have already been // check for a valid translation. // for (int k = 1; k < j; ++k) { Sort* kSort = kind->sort(k); int kId = kSort->id(); if (!(fromTheory->moduleDeclared(kSort))) kId = renameSort(kId); Sort* kTransSort = toModule->findSort(kId); if (kTransSort->component() != transKind) { IssueWarning(*this << ": sorts " << QUOTE(jSort) << " and " << QUOTE(kSort) << " from " << QUOTE(fromTheory) << " are in the same kind but " << QUOTE(jTransSort) << " and " << QUOTE(kTransSort) << " from " << QUOTE(toModule) << " are in different kinds."); return false; } if (leq(jSort, kSort) && !(leq(jTransSort, kTransSort))) { // // <= is not preserved but this case doesn't lead to serious // inconsistancies later on so we keep going. // IssueWarning(*this << ": " << QUOTE(jSort) << " is a subsort of " << QUOTE(kSort) << " in " << QUOTE(fromTheory) << " but " << QUOTE(jTransSort) << " is not a subsort of " << QUOTE(kTransSort) << " in " << QUOTE(toModule) << '.'); } } } } return true; } bool View::handleVarDecls() { Sort* fromSort = 0; Sort* toSort = 0; TypeList::const_iterator j = varDefs.begin(); FOR_EACH_CONST(i, VarDeclList, varDecls) { if (fromSort == 0) { int code = j->tokens[0].code(); fromSort = newFromTheory->findSort(code); if (fromSort == 0) { IssueWarning(LineNumber(j->tokens[0].lineNumber()) << ": failed to find sort " << QUOTE(Token::sortName(code)) << " in " << QUOTE(newFromTheory) << '.'); return false; } toSort = newToModule->findSort(renameSort(code)); Assert(toSort != 0, "couldn't find translation of sort"); if (j->kind) { int nrTokens = j->tokens.size(); for (int k = 1; k < nrTokens; ++k) { int code = j->tokens[k].code(); Sort* extraSort = newFromTheory->findSort(code); if (extraSort == 0) { IssueWarning(LineNumber(j->tokens[k].lineNumber()) << ": failed to find sort " << QUOTE(Token::sortName(code)) << " in " << QUOTE(newFromTheory) << '.'); return false; } if (extraSort->component() != fromSort->component()) { IssueWarning(LineNumber(j->tokens[k].lineNumber()) << ": sorts " << QUOTE(fromSort) << " and " << QUOTE(extraSort) << " are in different components."); return false; } } fromSort = fromSort->component()->sort(Sort::KIND); toSort = toSort->component()->sort(Sort::KIND); } ++j; } newFromTheory->addVariableAlias(i->varName, fromSort); newToModule->addVariableAlias(i->varName, toSort); if (i->lastWithCurrentDef) fromSort = 0; } return true; } bool View::indexRhsVariables(Term* term, const VarMap& varMap, int lineNr) { if (VariableTerm* vt = dynamic_cast(term)) { const VarMap::const_iterator i = varMap.find(vt->id()); if (i == varMap.end() || i->second.first != vt->getSort()) { IssueWarning(LineNumber(lineNr) << ": rhs of operator mapping contains a variable " << QUOTE(term) << " which is not the mapping of a lhs variable."); return false; } vt->setIndex(i->second.second); } else { for (ArgumentIterator i(*term); i.valid(); i.next()) { if (!indexRhsVariables(i.argument(), varMap, lineNr)) return false; } } return true; } bool View::typeMatch(const ConnectedComponent* c1, const ConnectedComponent* c2) { // // c1 and c2 are in different theories but they typeMatch if they have sorts with the same name. // Actually we only need check for one regular sort from one component, if a similarly named // sort exists in the other. // int nrSorts = c1->nrSorts(); int sortName = c2->sort(1)->id(); for (int i = 0; i < nrSorts; ++i) { if (c1->sort(i)->id() == sortName) return true; } return false; } bool View::typeMatch(const Symbol* s1, const Symbol* s2) { // // s1 and s2 are in different theories but they typeMatch if their respective components all typeMatch. // int nrArgs = s1->arity(); if (s2->arity() != nrArgs) return false; for (int i = 0; i < nrArgs; ++i) { if (!typeMatch(s1->domainComponent(i), s2->domainComponent(i))) return false; } return typeMatch(s1->rangeComponent(), s2->rangeComponent()); } Term* View::getOpMapTerm(Symbol* symbol) const { int id = symbol->id(); const OpTermMap::const_iterator e = opTermMap.end(); for (OpTermMap::const_iterator i = opTermMap.find(id); i != e && i->first == id; ++i) { if (typeMatch(i->second.first->symbol(), symbol)) return i->second.second; } return 0; } bool View::handleOpTermMappings() { LineNumber lineNumber(FileTable::AUTOMATIC); // // Because we have op->term mappings we need to make new modules to parse // these mappings in, in order to exclude any existing variable aliases and // add any new ones. // newFromTheory = new ImportModule(fromTheory->id(), fromTheory->getModuleType(), ImportModule::VIEW_LOCAL, this); newFromTheory->addImport(fromTheory, ImportModule::INCLUDING, lineNumber); finishModule1(newFromTheory); newToModule = new ImportModule(toModule->id(), toModule->getModuleType(), ImportModule::VIEW_LOCAL, this); newToModule->addImport(toModule, ImportModule::INCLUDING, lineNumber); finishModule1(newToModule); if (!varDecls.empty() && !handleVarDecls()) { // // Need to reset the importPhase for any imported modules we touched. // newFromTheory->resetImports(); newToModule->resetImports(); return false; } finishModule2(newFromTheory); finishModule2(newToModule); // // // Now deal with op->term mappings. // FOR_EACH_CONST(i, OpTermList, opTermList) { Term* from = newFromTheory->parseTerm(i->fromBubble); if (from == 0) return false; int argNr = 0; VarMap varMap; for (ArgumentIterator j(*from); j.valid(); j.next()) { VariableTerm* vt = dynamic_cast(j.argument()); if (vt == 0) { IssueWarning(LineNumber(i->fromBubble[0].lineNumber()) << ": lhs of operator mapping has non-variable argument " << QUOTE(j.argument()) << '.'); from->deepSelfDestruct(); return false; } int base = vt->id(); Sort* sort = mapSort(vt->getSort(), newToModule); pair p = varMap.insert(VarMap::value_type(base, make_pair(sort, argNr))); if (!p.second) { IssueWarning(LineNumber(i->fromBubble[0].lineNumber()) << ": using the same variable base name " << QUOTE(Token::name(base)) << " for two left hand side variables in an operator mapping is not allowed."); from->deepSelfDestruct(); return false; } ++argNr; } Symbol* fromSymbol = from->symbol(); if (fromSymbol->arity() != argNr) { Assert(fromSymbol->arity() < argNr, "too few args"); IssueWarning(LineNumber(i->fromBubble[0].lineNumber()) << ": lhs of operator mapping has too many arguments."); from->deepSelfDestruct(); return false; } Term* to = newToModule->parseTerm(i->toBubble, mapComponent(fromSymbol->rangeComponent(), newToModule), 1); if (to == 0) { from->deepSelfDestruct(); return false; } if (!indexRhsVariables(to, varMap, i->toBubble[1].lineNumber())) { from->deepSelfDestruct(); to->deepSelfDestruct(); return false; } opTermMap.insert(OpTermMap::value_type(from->symbol()->id(), make_pair(from, to))); } // // Dispense with bulky parsers. // newFromTheory->economize(); newToModule->economize(); return true; } bool View::checkOps() { // // Now we check that for each operator // f : D1 ... Dn -> R // in fromTheory, there exists (or can be instantiated) an operator // f' : D1' ... Dn' -> R' // in toModule where the prime mappings are obtained from the view. // const Vector& symbols = fromTheory->getSymbols(); int nrUserSymbols = fromTheory->getNrUserSymbols(); for (int i = 0; i < nrUserSymbols; ++i) { Symbol* s = symbols[i]; Assert(fromTheory->getSymbolType(s).getBasicType() != SymbolType::VARIABLE, "didn't expect variable"); Assert(fromTheory->getSymbolType(s).getBasicType() != SymbolType::SORT_TEST, "didn't expect sort test"); // // Translate the name for those operators that have no module declarations. // int id = s->id(); if (fromTheory->moduleDeclared(s)) { if (getOpMapTerm(s) != 0 || renameOp(s) != NONE) { IssueAdvisory(*this << ": op mapping not applied to operator " << QUOTE(s) << " as it has at least one declaration in a module."); } } else { if (getOpMapTerm(s) != 0) continue; // op is being mapped to a term which parses and therefore whose ops must exist int index = renameOp(s); if (index != NONE) id = getOpTo(index); } // // Translate the domain and range components. // int nrArgs = s->arity(); Vector domainComponents(nrArgs); for (int j = 0; j < nrArgs; ++j) domainComponents[j] = mapComponent(s->domainComponent(j), toModule); ConnectedComponent* rangeComponent = mapComponent(s->rangeComponent(), toModule); // // Check to see that a suitable operator exists or can be made in toModule. // Symbol* t = toModule->findSymbol(id, domainComponents, rangeComponent); if (t == 0) { IssueWarning(*this << ": failed to find suitable operator " << QUOTE(Token::name(id)) << " in " << QUOTE(toModule) << " to represent operator " << QUOTE(s) << " from " << QUOTE(fromTheory) << '.'); return false; } // // Need to check that t can actually replace s. This is an issue if s or t are special // symbols used to represent non-algebraic data types. // SymbolType st = fromTheory->getSymbolType(s); SymbolType tt = toModule->getSymbolType(t); if ((st.nonAlgebraic() || tt.nonAlgebraic()) && st.getBasicType() != tt.getBasicType()) { IssueWarning(*this << ": operator " << QUOTE(s) << " from " << QUOTE(fromTheory) << " maps to incompatible operator " << QUOTE(t) << " in " << QUOTE(toModule) << '.'); return false; } } return true; } bool View::checkPolymorphicOps() { // // Now we check that for each polymorphic operator // f : D1 ... Dn -> R // in fromTheory, there exists (or can be instantiated) an operator // f' : D1' ... Dn' -> R' // in toModule where the prime mappings are obtained from the view, and // the null sort maps to the null sort. // int nrPolymorphs = fromTheory->getNrPolymorphs(); for (int i = 0; i < nrPolymorphs; ++i) { // // Translate the name. // int id = fromTheory->getPolymorphName(i).code(); int index = renamePolymorph(id); if (index != NONE) { if (fromTheory->moduleDeclaredPolymorph(i)) { IssueAdvisory(*this << ": op mapping not applied to polymorphic operator " << QUOTE(Token::name(id)) << " as it was declared in a module."); } else id = getOpTo(index); } // // Translate the domain and range components. // const Vector& domainAndRange = fromTheory->getPolymorphDomainAndRange(i); int nrSorts = domainAndRange.size(); Vector newDomainAndRange(nrSorts); for (int j = 0; j < nrSorts; ++j) { Sort* s = domainAndRange[j]; newDomainAndRange[j] = (s == 0) ? 0 : toModule->findSort(renameSort(s->id())); } // // Check to see that a suitable polymorphic operator exists in toModule. // if (toModule->findPolymorphIndex(id, newDomainAndRange) == NONE) { IssueWarning(*this << ": failed to find suitable polymorphic operator " << QUOTE(Token::name(id)) << " in " << QUOTE(toModule) << " to represent polymorphic operator " << QUOTE(fromTheory->getPolymorphName(i)) << " from " << QUOTE(fromTheory) << '.'); return false; } } return true; } bool View::evaluate() { // // See if view needs to be evaluated. // switch (status) { case INITIAL: break; case GOOD: return true; case BAD: return false; case STALE: { IssueAdvisory("reexamining view " << static_cast(this) << '.'); break; } } // // Evaluate from part. // fromTheory = interpreter.makeModule(fromExpr); if (fromTheory != 0) { fromTheory->addUser(this); if (!(fromTheory->isTheory())) { IssueWarning(*this << ": from part of a view must be a theory."); status = BAD; } } else { DebugAdvisory("view " << this << " couldn't make fromTheory"); status = BAD; } // // Evaluate to part. // toModule = interpreter.makeModule(toExpr); if (toModule != 0) { toModule->addUser(this); if (toModule->getNrParameters() > 0) { IssueWarning(*this << ": target of a view cannot have free parameters."); status = BAD; } } else { DebugAdvisory("view " << this << " couldn't make toModule"); status = BAD; } if (status == BAD) return false; if (!checkSorts() || (!opTermList.empty() && !handleOpTermMappings()) || !checkOps() || !checkPolymorphicOps()) { status = BAD; return false; } status = GOOD; return true; } void View::showView(ostream& s) { s << "view " << static_cast(this) << " from " << fromExpr << " to " << toExpr << " is\n"; printRenaming(s, " ", " .\n "); if (getNrSortMappings() > 0 || getNrOpMappings() > 0) s << " .\n"; if (!varDecls.empty()) { bool startNew = true; TypeList::const_iterator j = varDefs.begin(); FOR_EACH_CONST(i, VarDeclList, varDecls) { if (startNew) { s << " var"; if (!(i->lastWithCurrentDef)) s << 's'; startNew = false; } s << ' ' << i->varName; if (i->lastWithCurrentDef) { s << " : " << *j << " .\n"; ++j; startNew = true; } } } FOR_EACH_CONST(i, OpTermMap, opTermMap) s << " op " << i->second.first << " to term " << i->second.second << " .\n"; s << "endv\n"; } Maude-2.6/src/Mixfix/renaming.hh0000644000147300135640000001313110316303473013520 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for renamings. // #ifndef _renaming_hh_ #define _renaming_hh_ #include #include #include "syntaxContainer.hh" #include "ropeStuff.hh" #include "symbolType.hh" class Renaming : public SyntaxContainer { public: void addSortMapping(Token from, Token to); void addLabelMapping(Token from, Token to); void addOpMapping(const Vector& tokens); void addVarDecl(Token varName); void addType(bool kind, const Vector& tokens); void addOpTarget(const Vector& tokens); void setPrec(Token precTok); void setGather(const Vector& gather); void setFormat(const Vector& format); void setLatexMacro(const string& latexMacro); // // These versions are intended for internally generated renamings // rather than those produced by parsing. // void addSortMapping(int from, int to); void addLabelMapping(int from, int to); void addOpMapping(int code); void addType(const ConnectedComponent* component); void addOpTarget(int code); void addOpTargetTerm(Term* term); int getNrSortMappings() const; int getSortFrom(int index) const; int getSortTo(int index) const; int getNrLabelMappings() const; int getLabelFrom(int index) const; int getLabelTo(int index) const; int getNrOpMappings() const; int getOpFrom(int index) const; int getOpTo(int index) const; Term* getOpTargetTerm(int index) const; int getNrTypes(int index) const; int getPrec(int index) const; const Vector& getGather(int index) const; const Vector& getFormat(int index) const; const set& getTypeSorts(int index, int typeNr) const; Renaming* makeCanonicalVersion(ImportModule* module) const; crope makeCanonicalName() const; void addSortAndLabelMappings(const Renaming* original); void addOpMappingPartialCopy(const Renaming* original, int index); int renameSort(int oldId) const; int renameLabel(int oldId) const; int renameOp(Symbol* oldSymbol) const; int renameOp(int id, const Vector& sortNames) const; int renamePolymorph(int oldId) const; void printRenaming(ostream& s, const char* sep, const char* sep2) const; private: typedef set IdSet; struct OpMapping { Vector types; // rename operator with specific arity only int name; // new name Term* term; // for op->term mappings // // Can change syntactic attributes only. // int prec; // < MixfixModule::MIN_PREC if not set Vector gather; // empty if not set Vector format; // empty if not set string latexMacro; // empty if not set int index; }; typedef map IdMap; typedef multimap OpMap; static bool typeMatch(const set& type, const ConnectedComponent* component); static bool typeMatch(const Vector >& types, Symbol* oldSymbol); static bool typeMatch(const Vector >& types, const Vector& sortNames); static void setType(set& type, const ConnectedComponent* component); static crope makeTypeName(const set& type); void printRenamingType(ostream& s, int opMappingNr, int typeNr) const; IdMap sortMap; Vector sortMapIndex; IdMap labelMap; Vector labelMapIndex; OpMap opMap; Vector opMapIndex; OpMap::iterator lastOpMapping; }; inline int Renaming::getNrSortMappings() const { return sortMapIndex.length(); } inline int Renaming::getSortFrom(int index) const { return sortMapIndex[index]->first; } inline int Renaming::getSortTo(int index) const { return sortMapIndex[index]->second; } inline int Renaming::getNrLabelMappings() const { return labelMapIndex.length(); } inline int Renaming::getLabelFrom(int index) const { return labelMapIndex[index]->first; } inline int Renaming::getLabelTo(int index) const { return labelMapIndex[index]->second; } inline int Renaming::getNrOpMappings() const { return opMapIndex.length(); } inline int Renaming::getOpFrom(int index) const { return opMapIndex[index]->first; } inline int Renaming::getOpTo(int index) const { return opMapIndex[index]->second.name; } inline Term* Renaming::getOpTargetTerm(int index) const { return opMapIndex[index]->second.term; } inline int Renaming::getNrTypes(int index) const { return opMapIndex[index]->second.types.length(); } inline const set& Renaming::getTypeSorts(int index, int typeNr) const { return opMapIndex[index]->second.types[typeNr]; } inline int Renaming::getPrec(int index) const { return opMapIndex[index]->second.prec; } inline const Vector& Renaming::getGather(int index) const { return opMapIndex[index]->second.gather; } inline const Vector& Renaming::getFormat(int index) const { return opMapIndex[index]->second.format; } ostream& operator<<(ostream& s, const Renaming* renaming); #endif Maude-2.6/src/Mixfix/view.hh0000644000147300135640000001060411240414274012673 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for views. // #ifndef _view_hh_ #define _view_hh_ #include #include "namedEntity.hh" #include "lineNumber.hh" #include "entity.hh" #include "renaming.hh" class View : public NamedEntity, public LineNumber, public Entity, public Entity::User, public Renaming { public: enum ReturnValues { OP_TERM_MAPPING = -2 }; typedef multimap > OpTermMap; View(Token viewName); ~View(); void addFrom(ModuleExpression* expr); void addTo(ModuleExpression* expr); ModuleExpression* getFrom() const; ModuleExpression* getTo() const; void addOpTermMapping(const Vector& fromOp, const Vector& toTerm); void addVarDecl(Token varName); void addType(bool kind, const Vector& tokens); void finishView(); bool evaluate(); bool isComplete(); void showView(ostream& s); ImportModule* getFromTheory() const; ImportModule* getToModule() const; Term* getOpMapTerm(Symbol* symbol) const; const OpTermMap& getOpTermMap() const; // maybe this exposes too much be we need it for the metalevel private: enum Status { INITIAL, GOOD, BAD, STALE }; struct VarDecl { Token varName; bool lastWithCurrentDef; }; struct BubblePair { Vector fromBubble; Vector toBubble; }; typedef list VarDeclList; typedef list TypeList; typedef list OpTermList; typedef map > VarMap; static bool typeMatch(const ConnectedComponent* c1, const ConnectedComponent* c2); static bool typeMatch(const Symbol* s1, const Symbol* s2); ConnectedComponent* mapComponent(const ConnectedComponent* component, ImportModule* module) const; Sort* mapSort(const Sort* sort, ImportModule* module) const; void regretToInform(Entity* doomedEntity); void finishModule1(ImportModule* module); void finishModule2(ImportModule* module); bool checkSorts(); bool handleVarDecls(); bool indexRhsVariables(Term* term, const VarMap& varMap, int lineNr); bool handleOpTermMappings(); bool checkOps(); bool checkPolymorphicOps(); void clearOpTermMap(); Status status; ModuleExpression* fromExpr; ModuleExpression* toExpr; ImportModule* fromTheory; ImportModule* toModule; ImportModule* newFromTheory; // copy of fromTheory with different variable aliases ImportModule* newToModule; // copy of toModule with different variable aliases VarDeclList varDecls; // list of variable aliases declared TypeList varDefs; // list of sorts used in variable declarations OpTermList opTermList; // list of op->term mappings stored as unparsed bubble pairs OpTermMap opTermMap; // map from op name to op->term mappings stored as term pairs }; inline void View::addFrom(ModuleExpression* expr) { fromExpr = expr; } inline void View::addTo(ModuleExpression* expr) { toExpr = expr; } inline ModuleExpression* View::getFrom() const { return fromExpr; } inline ModuleExpression* View::getTo() const { return toExpr; } inline bool View::isComplete() { return status != INITIAL; } inline ImportModule* View::getFromTheory() const { Assert(status == GOOD, "view status not good"); return fromTheory; } inline ImportModule* View::getToModule() const { Assert(status == GOOD, "view status not good"); return toModule; } inline const View::OpTermMap& View::getOpTermMap() const { return opTermMap; } #ifndef NO_ASSERT inline ostream& operator<<(ostream& s, const View* v) { // // Needed to avoid ambiguity. // s << static_cast(v); return s; } #endif #endif Maude-2.6/src/Mixfix/mixfix.hh0000644000147300135640000000327611145115472013236 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Forward declarations for mixfix frontend classes. // #ifndef _mixfix_hh_ #define _mixfix_hh_ class Timer; class AutoWrapBuffer; class Token; class FileTable; class DirectoryManager; class SyntacticPreModule; class PreModule; class MixfixModule; class ImportModule; class ImportTranslation; class UserLevelRewritingContext; class QuotedIdentifierSymbol; class QuotedIdentifierTerm; class QuotedIdentifierDagNode; class QuotedIdentifierOpSymbol; class LoopSymbol; class SymbolType; class XmlBuffer; class MaudemlBuffer; class Interpreter; class Compiler; class ProfileModule; class MixfixParser; class VisibleModule; class CommonTokens; class MetadataStore; class ModuleExpression; class Renaming; class ModuleCache; class View; class ModuleDatabase; class ViewDatabase; class Entity; class SyntaxContainer; class FreshVariableSource; class PrintAttribute; #endif Maude-2.6/src/Mixfix/viewDatabase.hh0000644000147300135640000000251610217675715014337 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to hold database of views. // #ifndef _viewDatabase_hh_ #define _viewDatabase_hh_ #include class ViewDatabase { NO_COPYING(ViewDatabase); public: ViewDatabase(){} ~ViewDatabase(); bool insertView(int name, View* view); // true if existing view displaced View* getView(int name) const; // 0 if doesn't exist bool deleteView(int name); // true if view deleted void showNamedViews() const; private: typedef map ViewMap; ViewMap viewMap; }; #endif Maude-2.6/src/Mixfix/quotedIdentifierSymbol.cc0000644000147300135640000001207011457445631016413 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class QuotedIdentifierSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "rewritingContext.hh" // mixfix class definitions #include "token.hh" #include "importTranslation.hh" #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierTerm.hh" #include "quotedIdentifierDagNode.hh" QuotedIdentifierSymbol::QuotedIdentifierSymbol(int id) : NA_Symbol(id) { baseSort = 0; constantSort = 0; variableSort = 0; sortSort = 0; kindSort = 0; } bool QuotedIdentifierSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { if (strcmp(purpose, "QuotedIdentifierSymbol") == 0) { if (data.length() == 0) return true; if (data.length() == 1) { const char* subsortName = data[0]; Sort* sort = opDeclaration[0]; if (strcmp(subsortName, "constantQid") == 0) constantSort = sort; else if (strcmp(subsortName, "variableQid") == 0) variableSort = sort; else if (strcmp(subsortName, "sortQid") == 0) sortSort = sort; else if (strcmp(subsortName, "kindQid") == 0) kindSort = sort; else return false; return true; } return false; } return NA_Symbol::attachData(opDeclaration, purpose, data); } #define COPY_SORT(original, name, mapping) \ if (name == 0) \ { \ if (Sort* s = original->name) \ name = (mapping == 0) ? s : mapping->translate(s); \ } void QuotedIdentifierSymbol::copyAttachments(Symbol* original, SymbolMap* map) { QuotedIdentifierSymbol* orig = safeCast(QuotedIdentifierSymbol*, original); ImportTranslation* mapping = safeCast(ImportTranslation*, map); COPY_SORT(orig, constantSort, mapping); COPY_SORT(orig, variableSort, mapping); COPY_SORT(orig, sortSort, mapping); COPY_SORT(orig, kindSort, mapping); NA_Symbol::copyAttachments(original, map); } void QuotedIdentifierSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "QuotedIdentifierSymbol"; data.resize(nrDataAttachments + 1); Vector& d = data[nrDataAttachments]; if (opDeclaration[0] == constantSort) d.append("constantQid"); else if(opDeclaration[0] == variableSort) d.append("variableQid"); else if(opDeclaration[0] == sortSort) d.append("sortQid"); else if(opDeclaration[0] == kindSort) d.append("kindQid"); NA_Symbol::getDataAttachments(opDeclaration, purposes, data); } Sort* QuotedIdentifierSymbol::determineSort(int idIndex) { switch (Token::auxProperty(idIndex)) { case Token::AUX_CONSTANT: { if (constantSort != 0) return constantSort; break; } case Token::AUX_VARIABLE: { if (variableSort != 0) return variableSort; break; } case Token::AUX_KIND: { if (kindSort != 0) return kindSort; break; } case Token::AUX_SORT: case Token::AUX_STRUCTURED_SORT: { if (sortSort != 0) return sortSort; break; } } return baseSort; } void QuotedIdentifierSymbol::fillInSortInfo(Term* subject) { Sort* s = determineSort(static_cast(subject)->getIdIndex()); subject->setSortInfo(s->component(), s->index()); } void QuotedIdentifierSymbol::computeBaseSort(DagNode* subject) { Sort* s = determineSort(static_cast(subject)->getIdIndex()); subject->setSortIndex(s->index()); } bool QuotedIdentifierSymbol::isConstructor(DagNode* /* subject */) { return true; } void QuotedIdentifierSymbol::compileOpDeclarations() { const Vector& opDecls = getOpDeclarations(); int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { Sort* s = opDecls[i].getDomainAndRange()[0]; if (baseSort == 0 || s->index() < baseSort->index()) baseSort = s; // set baseSort to largest (smallest index) declared sort } } Maude-2.6/src/Mixfix/profileModule.cc0000644000147300135640000002267011475306632014533 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ProfileModule. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" // core class definitions #include "sortConstraint.hh" #include "equation.hh" #include "rule.hh" #include "rewritingContext.hh" // front end class definitions #include "profileModule.hh" ProfileModule::ProfileModule(int name) : Module(name) { } ProfileModule::SymbolProfile::SymbolProfile() { nrBuiltinMbRewrites = 0; nrBuiltinEqRewrites = 0; nrBuiltinRlRewrites = 0; nrMemoRewrites = 0; } ProfileModule::FragmentProfile::FragmentProfile() { nrSuccesses = 0; nrFailures = 0; } ProfileModule::StatementProfile::StatementProfile() { nrRewrites = 0; nrConditionStarts = 0; } void ProfileModule::StatementProfile::updateFragmentInfo(int index, bool success) { if (index >= fragmentInfo.length()) fragmentInfo.resize(index + 1); if (success) ++(fragmentInfo[index].nrSuccesses); else ++(fragmentInfo[index].nrFailures); } void ProfileModule::clearProfile() { symbolInfo.clear(); mbInfo.clear(); eqInfo.clear(); rlInfo.clear(); } void ProfileModule::profileMbRewrite(DagNode* redex, const SortConstraint* mb) { if (mb == 0) { int index = redex->symbol()->getIndexWithinModule(); if (index >= symbolInfo.length()) symbolInfo.resize(index + 1); ++(symbolInfo[index].nrBuiltinMbRewrites); } else { int index = mb->getIndexWithinModule(); if (index >= mbInfo.length()) mbInfo.resize(index + 1); ++(mbInfo[index].nrRewrites); } } void ProfileModule::profileEqRewrite(DagNode* redex, const Equation* eq, int type) { if (eq == 0) { int index = redex->symbol()->getIndexWithinModule(); if (index >= symbolInfo.length()) symbolInfo.resize(index + 1); switch (type) { case RewritingContext::BUILTIN: { ++(symbolInfo[index].nrBuiltinEqRewrites); break; } case RewritingContext::MEMOIZED: { ++(symbolInfo[index].nrMemoRewrites); break; } } } else { int index = eq->getIndexWithinModule(); if (index >= eqInfo.length()) eqInfo.resize(index + 1); ++(eqInfo[index].nrRewrites); } } void ProfileModule::profileRlRewrite(DagNode* redex, const Rule* rl) { if (rl == 0) { int index = redex->symbol()->getIndexWithinModule(); if (index >= symbolInfo.length()) symbolInfo.resize(index + 1); ++(symbolInfo[index].nrBuiltinRlRewrites); } else { int index = rl->getIndexWithinModule(); if (index >= rlInfo.length()) rlInfo.resize(index + 1); ++(rlInfo[index].nrRewrites); } } ////////////////////// void ProfileModule::profileMbConditionStart(const SortConstraint* mb) { int index = mb->getIndexWithinModule(); if (index >= mbInfo.length()) mbInfo.resize(index + 1); ++(mbInfo[index].nrConditionStarts); } void ProfileModule::profileEqConditionStart(const Equation* eq) { int index = eq->getIndexWithinModule(); if (index >= eqInfo.length()) eqInfo.resize(index + 1); ++(eqInfo[index].nrConditionStarts); } void ProfileModule::profileRlConditionStart(const Rule* rl) { int index = rl->getIndexWithinModule(); if (index >= rlInfo.length()) rlInfo.resize(index + 1); ++(rlInfo[index].nrConditionStarts); } //////////////////////// void ProfileModule::profileFragment(const PreEquation* preEquation, int fragmentIndex, bool success) { Assert(preEquation->getModule() == this, "module mismatch " << this << " vs " << preEquation->getModule()); int index = preEquation->getIndexWithinModule(); Assert(index != NONE, "index = NONE"); { const Vector& mbs= getSortConstraints(); if (index < mbs.length() && mbs[index] == preEquation) { mbInfo[index].updateFragmentInfo(fragmentIndex, success); return; } } { const Vector& eqs = getEquations(); if (index < eqs.length() && eqs[index] == preEquation) { eqInfo[index].updateFragmentInfo(fragmentIndex, success); return; } } { const Vector& rls = getRules(); if (index < rls.length() && rls[index] == preEquation) { rlInfo[index].updateFragmentInfo(fragmentIndex, success); return; } } // must be a top level pattern fragment } #define PC(n) (n) << " (" << ((100 * n) / floatTotal) << "%)" void ProfileModule::showProfile(ostream& s) const { double floatTotal; { // // First compute a grand total. // Int64 total = 0; int nrSymbols = symbolInfo.length(); for (int i = 0; i < nrSymbols; i++) { const SymbolProfile& p = symbolInfo[i]; total += p.nrBuiltinMbRewrites; total += p.nrBuiltinEqRewrites; total += p.nrBuiltinRlRewrites; total += p.nrMemoRewrites; } int nrMbs = mbInfo.length(); for (int i = 0; i < nrMbs; i++) total += mbInfo[i].nrRewrites; int nrEqs = eqInfo.length(); for (int i = 0; i < nrEqs; i++) total += eqInfo[i].nrRewrites; int nrRls = rlInfo.length(); for (int i = 0; i < nrRls; i++) total += rlInfo[i].nrRewrites; floatTotal = total; } { const Vector& symbols = getSymbols(); int nrSymbols = symbolInfo.length(); for (int i = 0; i < nrSymbols; i++) { const SymbolProfile& p = symbolInfo[i]; if (p.nrBuiltinMbRewrites + p.nrBuiltinEqRewrites + p.nrBuiltinRlRewrites + p.nrMemoRewrites > 0) { showSymbol(s, symbols[i]); const char* g = ""; if (p.nrBuiltinMbRewrites > 0) { s << "built-in mb rewrites: " << PC(p.nrBuiltinMbRewrites); g = "\t"; } if (p.nrBuiltinEqRewrites > 0) { s << g << "built-in eq rewrites: " << PC(p.nrBuiltinEqRewrites); g = "\t"; } if (p.nrBuiltinRlRewrites > 0) { s << g << "built-in rl rewrites: " << PC(p.nrBuiltinRlRewrites); g = "\t"; } if (p.nrMemoRewrites > 0) s << g << "memo rewrites: " << PC(p.nrMemoRewrites); s << "\n\n"; } } } { const Vector& mbs = getSortConstraints(); int nrMbs = mbInfo.length(); for (int i = 0; i < nrMbs; i++) { const StatementProfile& p = mbInfo[i]; if (p.nrConditionStarts > 0) { s << mbs[i] << '\n'; s << "lhs matches: " << p.nrConditionStarts << "\trewrites: " << PC(p.nrRewrites) << '\n'; showFragmentProfile(s, p.fragmentInfo, p.nrConditionStarts); s << '\n'; } else if (p.nrRewrites > 0) { s << mbs[i] << '\n'; s << "rewrites: " << PC(p.nrRewrites) << "\n\n"; } } } { const Vector& eqs = getEquations(); int nrEqs = eqInfo.length(); for (int i = 0; i < nrEqs; i++) { const StatementProfile& p = eqInfo[i]; if (p.nrConditionStarts > 0) { s << eqs[i] << '\n'; s << "lhs matches: " << p.nrConditionStarts << "\trewrites: " << PC(p.nrRewrites) << '\n'; showFragmentProfile(s, p.fragmentInfo, p.nrConditionStarts); s << '\n'; } else if (p.nrRewrites > 0) { s << eqs[i] << '\n'; s << "rewrites: " << PC(p.nrRewrites) << "\n\n"; } } } { const Vector& rls = getRules(); int nrRls = rlInfo.length(); for (int i = 0; i < nrRls; i++) { const StatementProfile& p = rlInfo[i]; if (p.nrConditionStarts > 0) { s << rls[i] << '\n'; s << "lhs matches: " << p.nrConditionStarts << "\trewrites: " << PC(p.nrRewrites) << '\n'; showFragmentProfile(s, p.fragmentInfo, p.nrConditionStarts); s << '\n'; } else if (p.nrRewrites > 0) { s << rls[i] << '\n'; s << "rewrites: " << PC(p.nrRewrites) << "\n\n"; } } } } void ProfileModule::showSymbol(ostream& s, Symbol* op) { s << "op " << op << " : "; int nrArgs = op->arity(); for (int i = 0; i < nrArgs; i++) s << op->domainComponent(i)->sort(Sort::KIND) << ' '; s << "-> " << op->rangeComponent()->sort(Sort::KIND) << " .\n"; } void ProfileModule::showFragmentProfile(ostream& s, const Vector& fragmentInfo, Int64 nrFirsts) { int nrFragments = fragmentInfo.length(); s << "Fragment\tInitial tries\tResolve tries\tSuccesses\tFailures\n"; for (int i = 0; i < nrFragments; i++) { Int64 nrSuccesses = fragmentInfo[i].nrSuccesses; Int64 nrFailures = fragmentInfo[i].nrFailures; Int64 nrAttempts = nrSuccesses + nrFailures; Int64 nrBacktracks = nrAttempts - nrFirsts; s << i + 1 << "\t\t" << nrFirsts << "\t\t" << nrBacktracks << "\t\t" << nrSuccesses << "\t\t" << nrFailures << '\n'; nrFirsts = nrSuccesses; // for next fragment } } Maude-2.6/src/Mixfix/match.cc0000644000147300135640000001176711064051437013020 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for match and xmatch commands. // void Interpreter::printDecisionTime(const Timer& timer) { Int64 real; Int64 virt; Int64 prof; if (getFlag(SHOW_STATS) && getFlag(SHOW_TIMING) && timer.isRunning() && timer.getTimes(real, virt, prof)) { cout << "Decision time: " << prof / 1000 << "ms cpu (" << real / 1000 << "ms real)\n"; } } void Interpreter::match(const Vector& bubble, bool withExtension, Int64 limit) { VisibleModule* fm = currentModule->getFlatModule(); Term* patternTerm; Term* subjectTerm; Vector condition; if (!(fm->parseMatchCommand(bubble, patternTerm, subjectTerm, condition))) return; Pattern* pattern = new Pattern(patternTerm, withExtension, condition); if (!(pattern->getUnboundVariables().empty())) { IssueWarning(*subjectTerm << ": variable " << QUOTE(pattern->index2Variable(pattern->getUnboundVariables().min())) << " is used before it is bound in condition of match command."); subjectTerm->deepSelfDestruct(); delete pattern; return; } DagNode* subjectDag = makeDag(subjectTerm); if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); if (withExtension) cout << 'x'; cout << "match "; if (limit != NONE) cout << '[' << limit << "] "; cout << "in " << currentModule << " : " << pattern->getLhs() << " <=? " << subjectDag; if (condition.length() > 0) { cout << " such that "; MixfixModule::printCondition(cout, condition); } cout << " ." << endl; } // pattern->getLhsAutomaton()->dump(cerr, *pattern, 0); startUsingModule(fm); UserLevelRewritingContext* context = new UserLevelRewritingContext(subjectDag); #ifdef QUANTIFY_REWRITING quantify_start_recording_data(); #endif Timer timer(getFlag(SHOW_TIMING)); subjectDag->computeTrueSort(*context); if (UserLevelRewritingContext::aborted()) { delete context; delete pattern; fm->unprotect(); return; } MatchSearchState* state = new MatchSearchState(context, pattern, MatchSearchState::GC_PATTERN | MatchSearchState::GC_CONTEXT, 0, withExtension ? 0 : NONE); doMatching(timer, fm, state, 0, limit); } void Interpreter::doMatching(Timer& timer, VisibleModule* module, MatchSearchState* state, int solutionCount, int limit) { RewritingContext* context = state->getContext(); VariableInfo* variableInfo = state->getPattern(); int i = 0; for (; i != limit; i++) { bool result = state->findNextMatch(); if (UserLevelRewritingContext::aborted()) break; if (!result) { if (solutionCount == 0) { printDecisionTime(timer); cout << "No match.\n"; } break; } ++solutionCount; if (solutionCount == 1) printDecisionTime(timer); cout << "\nSolution " << solutionCount << '\n'; ExtensionInfo* extensionInfo = state->getExtensionInfo(); if (extensionInfo != 0) { cout << "Matched portion = "; if (extensionInfo->matchedWhole()) cout << "(whole)\n"; else cout << extensionInfo->buildMatchedPortion() << '\n'; } UserLevelRewritingContext::printSubstitution(*context, *variableInfo); if (UserLevelRewritingContext::interrupted()) break; } #ifdef QUANTIFY_REWRITING quantify_stop_recording_data(); #endif clearContinueInfo(); // just in case debugger left info state->getContext()->clearCount(); if (i == limit) // possible to continue { savedMatchSearchState = state; savedSolutionCount = solutionCount; savedModule = module; continueFunc = &Interpreter::matchCont; } else // tidy up { delete state; module->unprotect(); } UserLevelRewritingContext::clearDebug(); MemoryCell::okToCollectGarbage(); } void Interpreter::matchCont(Int64 limit, bool /* debug */) { MatchSearchState* state = savedMatchSearchState; VisibleModule* fm = savedModule; savedMatchSearchState = 0; savedModule = 0; continueFunc = 0; #ifdef QUANTIFY_REWRITING quantify_start_recording_data(); #endif Timer timer(getFlag(SHOW_TIMING)); doMatching(timer, fm, state, savedSolutionCount, limit); } Maude-2.6/src/Mixfix/graphPrint.cc0000644000147300135640000000667007666304134014047 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Routines for pretty printing a dag as a term graph. // void MixfixModule::graphPrint(ostream& s, DagNode* dagNode) { PointerSet visited; Vector counts; graphCount(dagNode, visited, counts); s << "Begin{Graph Representation}\n[Term has " << counts[0] << " operator symbol" << (counts[0] == 1 ? "" : "s") << " while graph has " << visited.cardinality() << " node" << pluralize(visited.cardinality()) << ".]\n"; int nrNodes = visited.cardinality(); for (int i = 0; i < nrNodes; i++) { if (UserLevelRewritingContext::interrupted()) return; s << '#' << i << " = "; DagNode* dagNode = static_cast(visited.index2Pointer(i)); Symbol* symbol = dagNode->symbol(); SymbolType type = symbolInfo[symbol->getIndexWithinModule()].symbolType; switch (type.getBasicType()) { case SymbolType::VARIABLE: { VariableDagNode* v = safeCast(VariableDagNode*, dagNode); printVariable(s, v->id(), safeCast(VariableSymbol*, symbol)->getSort()); break; } case SymbolType::FLOAT: { s << doubleToString(safeCast(FloatDagNode*, dagNode)->getValue()); break; } case SymbolType::STRING: { string strValue; Token::ropeToString(safeCast(StringDagNode*, dagNode)->getValue(), strValue); s << strValue; break; } case SymbolType::QUOTED_IDENTIFIER: { s << '\'' << Token::name(safeCast(QuotedIdentifierDagNode*, dagNode)->getIdIndex()); break; } default: { s << Token::name(symbol->id()); if (type.hasFlag(SymbolType::ITER)) { const mpz_class& number = safeCast(S_DagNode*, dagNode)->getNumber(); if (number > 1) s << '^' << number; } DagArgumentIterator a(*dagNode); if (a.valid()) { s << '('; for (;;) { s << '#' << visited.pointer2Index(a.argument()); a.next(); if (!(a.valid())) break; s << ", "; } s << ')'; } break; } } s << '\n'; } s << "End{Graph Representation}"; } void MixfixModule::graphCount(DagNode* dagNode, PointerSet& visited, Vector& counts) { visited.insert(dagNode); int index = counts.length(); Assert(index == visited.pointer2Index(dagNode), "counts out of step"); counts.append(0); mpz_class count(1); for(DagArgumentIterator a(*dagNode); a.valid(); a.next()) { DagNode* d = a.argument(); if (!(visited.contains(d))) graphCount(d, visited, counts); mpz_class& childsCount = counts[visited.pointer2Index(d)]; Assert(childsCount != 0, "cycle in dag"); count += childsCount; } counts[index] = count; } Maude-2.6/src/Mixfix/lexerAux.hh0000644000147300135640000000402410757442204013523 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Declarations for auxiliary functions needed by lexical analyzer. // //extern int inStackPtr; //extern YY_BUFFER_STATE inStack[]; void getInput(char* buf, int& result, int max_size); void lexerIdMode(); void lexerTokenTreeMode(int terminatingTokens); void lexerCmdMode(); void lexerOpMode(); void lexerInitialMode(); void lexerFileNameMode(); void lexerStringMode(); void lexerLatexMode(); bool includeFile(const string& directory, const string& fileName, bool silent, int lineNr); bool handleEof(); void eatComment(bool firstNonWhite); void cleanUpLexer(); void checkForPending(); void lexBubble(int termination, int minLen); void lexBubble(const Token& first, int termination, int minLen, int pCount = 0); void lexContinueBubble(const Token& next, int termination, int minLen, int pCount = 0); void lexSave(const Token& first); void lexContinueSave(const Token& next); enum TERMINATION_TOKENS { BAR_COLON = 0x1, BAR_COMMA = 0x2, BAR_LEFT_BRACKET = 0x4, BAR_EQUALS = 0x8, BAR_ARROW2 = 0x10, BAR_TO = 0x20, BAR_IF = 0x40, BAR_RIGHT_PAREN = 0x80, BAR_OP_ATTRIBUTE = 0x100, BAR_RIGHT_BRACKET = 0x200, END_STATEMENT = 0x40000000, END_COMMAND = 0x80000000 }; Maude-2.6/src/Mixfix/profileModule.hh0000644000147300135640000000466407666304133014551 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for modules with profiling information. // #ifndef _profileModule_hh_ #define _profileModule_hh_ #include "module.hh" class ProfileModule : public Module { NO_COPYING(ProfileModule); public: ProfileModule(int name); void clearProfile(); void profileMbRewrite(DagNode* redex, const SortConstraint* mb); void profileEqRewrite(DagNode* redex, const Equation* eq, int type); void profileRlRewrite(DagNode* redex, const Rule* rl); void profileMbConditionStart(const SortConstraint* mb); void profileEqConditionStart(const Equation* eq); void profileRlConditionStart(const Rule* rl); void profileFragment(const PreEquation* preEquation, int fragmentIndex, bool success); void showProfile(ostream& s) const; private: struct SymbolProfile { SymbolProfile(); Int64 nrBuiltinMbRewrites; Int64 nrBuiltinEqRewrites; Int64 nrBuiltinRlRewrites; Int64 nrMemoRewrites; }; struct FragmentProfile { FragmentProfile(); Int64 nrSuccesses; Int64 nrFailures; }; struct StatementProfile { StatementProfile(); void updateFragmentInfo(int index, bool success); Int64 nrRewrites; // // Only maintained for conditional statements. // Int64 nrConditionStarts; Vector fragmentInfo; }; static void showSymbol(ostream& s, Symbol* op); static void showFragmentProfile(ostream& s, const Vector& fragmentInfo, Int64 nrFirsts); Vector symbolInfo; Vector mbInfo; Vector eqInfo; Vector rlInfo; }; #endif Maude-2.6/src/Mixfix/bottom.yy0000644000147300135640000000273611350565616013307 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ %% static void yyerror(char *s) { if (!(UserLevelRewritingContext::interrupted())) IssueWarning(LineNumber(lineNumber) << ": " << s); } void cleanUpModuleExpression() { // // Delete pieces of a partly built module expression. // delete currentRenaming; currentRenaming = 0; while (!moduleExpressions.empty()) { moduleExpressions.top()->deepSelfDestruct(); moduleExpressions.pop(); } } void cleanUpParser() { interpreter.makeClean(lineNumber); } void missingSpace(const Token& token) { IssueWarning(LineNumber(token.lineNumber()) << ": missing space between " << QUOTE(token) << " and period."); } Maude-2.6/src/Mixfix/printAttribute.cc0000644000147300135640000000563411053414632014736 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2008 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class PrintAttribute. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // core class definitions #include "substitution.hh" #include "preEquation.hh" #include "conditionFragment.hh" // variable class definitions #include "variableTerm.hh" // mixfix class definitions #include "token.hh" #include "printAttribute.hh" void PrintAttribute::fillOut(const PreEquation& statement, const Vector& names, const Vector& sorts) { Assert(names.size() == sorts.size(), "vector size mismatch"); int nrItems = names.size(); for (int i = 0; i < nrItems; ++i) { int name = names[i]; Sort* sort = sorts[i]; if (sort == 0) items.append(name); // string case else { int index = findVariableIndex(statement, name, sort); if (index == NONE) IssueWarning(statement << ": print attribute variable unbound."); else items.append(-1 - index); } } } int PrintAttribute::findVariableIndex(const VariableInfo& variableInfo, int name, Sort* sort) { int nrVariables = variableInfo.getNrRealVariables(); for (int i = 0; i < nrVariables; ++i) { VariableTerm* v = safeCast(VariableTerm*, variableInfo.index2Variable(i)); if (v->id() == name && v->getSort() == sort) return i; } return NONE; } void PrintAttribute::print(ostream& s, const VariableInfo& variableInfo) const { s << "print"; int nrItems = items.size(); for (int i = 0; i < nrItems; ++i) { s << ' '; int item = items[i]; if (item >= 0) s << Token::name(item); else s << variableInfo.index2Variable(-1 - item); } } void PrintAttribute::print(ostream& s, const Substitution& substitution) const { int nrItems = items.size(); for (int i = 0; i < nrItems; ++i) { int item = items[i]; if (item >= 0) s << Token::codeToRope(item); else s << substitution.value(-1 - item); } } Maude-2.6/src/Mixfix/interact.cc0000644000147300135640000002311711256542111013522 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for handling user interaction. // #include bool UserLevelRewritingContext::interactiveFlag = true; bool UserLevelRewritingContext::ctrlC_Flag = false; bool UserLevelRewritingContext::stepFlag = false; bool UserLevelRewritingContext::abortFlag = false; int UserLevelRewritingContext::debugLevel = 0; int yyparse(void*); void cleanUpParser(); void cleanUpLexer(); void UserLevelRewritingContext::clearDebug() { setTraceStatus(interpreter.getFlag(Interpreter::EXCEPTION_FLAGS)); stepFlag = false; abortFlag = false; } void UserLevelRewritingContext::clearInterrupt() { setTraceStatus(interpreter.getFlag(Interpreter::EXCEPTION_FLAGS)); ctrlC_Flag = false; } void UserLevelRewritingContext::setHandlers(bool handleCtrlC) { if (interactiveFlag && handleCtrlC) { static struct sigaction ctrlC_Handler; ctrlC_Handler.sa_handler = interruptHandler; #ifdef SA_INTERRUPT // // Avoid old BSD semantics which automatically restarts // interrupted system calls. // ctrlC_Handler.sa_flags = SA_INTERRUPT; #endif sigaction(SIGINT, &ctrlC_Handler, 0); } #ifdef NO_ASSERT // // If we're not debugging we handle internal errors and stack overflows. // BddUser::setErrorHandler(internalErrorHandler); // BuDDy detects misuse of BDDs signal(SIGBUS, internalErrorHandler); // misaligned memory access or nonexistent real memeory signal(SIGILL, internalErrorHandler); // illegal instruction #ifdef USE_LIBSIGSEGV // // Stack overflows are reported as SIGSEGV signals and so we need to use the // libsigsegv library to heuristically distinguish the two conditions. // static char altStack[SIGSTKSZ]; sigsegv_install_handler(sigsegvHandler); // illegal memory access or stack overflow stackoverflow_install_handler(stackOverflowHandler, altStack, sizeof(altStack)); #else // // If we can't use the library we will will catch SIGSEGVs but not install // an alternative stack so that that stack overflows will show up as // segmentation faults. // signal(SIGSEGV, internalErrorHandler); #endif #endif // // HACK: this should go somewhere else. // changePrompt(); ioManager.setContPrompt("> "); } #ifdef USE_LIBSIGSEGV void UserLevelRewritingContext::stackOverflowHandler(int emergency, stackoverflow_context_t scp) { // // Assume machine state is bad - so use a system call. // static char message[] = "\nFatal error: stack overflow.\n\ This can happen because you have an infinite computation, say a runaway\n\ recursion, or model checking an infinite model. It can also happen because\n\ the stacksize limit in your environment is set too low for the computation\n\ you are trying to do. You can find the value of your stacksize with the\n\ tcsh command 'limit stacksize' or the bash command 'ulimit -s'.\n\ \n\ Depending on your operating system configuration you may be able to\n\ increase your stacksize with the tcsh command 'unlimit stacksize'\n\ or the bash command 'ulimit -s unlimited'.\n\n"; write(STDERR_FILENO, message, sizeof(message) - 1); _exit(1); // don't call atexit() functions with a bad machine state } int UserLevelRewritingContext::sigsegvHandler(void *fault_address, int serious) { if (serious) // real segmentation fault internalErrorHandler(SIGSEGV); // doesn't return return 0; // must have been a stack overflow } #endif void UserLevelRewritingContext::internalErrorHandler(int /* signalNr */) { // // Assume machine state is bad - so use system calls. // static char message1[] = "\nMaude internal error.\nPlease submit a bug report to: "; static char message2[] = PACKAGE_BUGREPORT; static char message3[] = "\nPlease include the platform details, Maude version, and a file\n\ `crash.maude' that can be loaded to reproduce the crash (it may load\n\ other files). Do not bother trying to simplify your example unless the\n\ runtime to the bug being visible is greater than 10 seconds.\n\n"; write(STDERR_FILENO, message1, sizeof(message1) - 1); write(STDERR_FILENO, message2, sizeof(message2) - 1); write(STDERR_FILENO, message3, sizeof(message3) - 1); _exit(1); // don't call atexit() functions with a bad machine state } void UserLevelRewritingContext::interruptHandler(int) { ctrlC_Flag = true; setTraceStatus(true); } void UserLevelRewritingContext::interruptHandler2(...) { // windowChangedFlag = true; } void UserLevelRewritingContext::changePrompt() { if (debugLevel == 0) ioManager.setPrompt("Maude> "); else { string prompt = "Debug("; prompt += int64ToString(debugLevel); // HACK: fix when we have decent stdc++ lib prompt += ")> "; ioManager.setPrompt(prompt); } } UserLevelRewritingContext::ParseResult UserLevelRewritingContext::commandLoop() { ParseResult parseResult; for(;;) { //cerr << "start of command\n"; RootContainer::dump(cerr); cout.flush(); parseResult = NORMAL; ioManager.startCommand(); bool parseError = yyparse(&parseResult); //cout << "parser result is: " << parseError << endl; if (parseError || ctrlC_Flag) { cout << '\n'; // terminate any partially typed in line setTraceStatus(interpreter.getFlag(Interpreter::EXCEPTION_FLAGS)); cleanUpParser(); cleanUpLexer(); ctrlC_Flag = false; } else { switch (parseResult) { case NORMAL: break; case RESUME: case ABORT: case STEP: case WHERE: { if (debugLevel > 0) return parseResult; IssueWarning("not in debugger."); break; } case QUIT: { // // This is the only normal exit() that can be taken. // cout << "Bye.\n"; #ifndef NO_ASSERT // // Look for memory bugs. // delete &interpreter; #else // // If we are not going to delete the interpreter // in the interests of a quick exit, at least clean // up any XML log we may have started. // interpreter.endXmlLog(); #endif exit(0); } } } } } void UserLevelRewritingContext::setInteractive(bool status) { interactiveFlag = status; } void UserLevelRewritingContext::beginCommand() { if (!interactiveFlag) cout << "==========================================\n"; } bool UserLevelRewritingContext::handleDebug(const DagNode* subject, const PreEquation* pe) { if (abortFlag) return true; bool broken = 0; Symbol* brokenSymbol = 0; if (interpreter.getFlag(Interpreter::BREAK)) { Symbol* s = subject->symbol(); if (interpreter.breakId(s->id())) { broken = true; brokenSymbol = s; } else { if (pe != 0 && interpreter.breakId(pe->getLabel().id())) broken = true; } } if (!(ctrlC_Flag || stepFlag || broken)) return !(interpreter.getFlag(Interpreter::TRACE)); // normal tracing ++debugLevel; changePrompt(); if (ctrlC_Flag) { if (!interactiveFlag) { cout << '\n'; cleanUpLexer(); } ctrlC_Flag = false; } else if (broken) { if (brokenSymbol != 0) cout << "break on symbol: " << brokenSymbol << '\n'; else { if (const SortConstraint* mb = dynamic_cast(pe)) cout << "break on labeled membership axiom:\n" << mb << '\n'; else if (const Equation* eq = dynamic_cast(pe)) cout << "break on labeled equation:\n" << eq << '\n'; else if (const Rule* rl = dynamic_cast(pe)) cout << "break on labeled rule:\n" << rl << '\n'; else CantHappen("unidentified statement"); } } stepFlag = false; setTraceStatus(interpreter.getFlag(Interpreter::EXCEPTION_FLAGS)); for(;;) { switch (commandLoop()) { case RESUME: { --debugLevel; changePrompt(); return !(interpreter.getFlag(Interpreter::TRACE)); } case ABORT: { --debugLevel; changePrompt(); abortFlag = true; setTraceStatus(true); return true; } case STEP: { --debugLevel; changePrompt(); stepFlag = true; setTraceStatus(true); return false; } case WHERE: { where(); break; } default: CantHappen("bad value in case"); } } return true; // never executed } void UserLevelRewritingContext::where() { static const char* purposeString[] = { "which arose while checking a condition during the evaluation of:", "which arose while doing a sort computation during the evaluation of:", "which arose in some unknown manner during the evaluation of:", "which arose while executing a top level command.", "which arose while doing a meta-evaluation requested by:" }; cout << "Current term is:\n"; for (UserLevelRewritingContext* p = this; p != 0; p = p->parent) { cout << p->root() << '\n'; if (ctrlC_Flag) { ctrlC_Flag = false; return; } cout << purposeString[p->purpose] << '\n'; } } bool UserLevelRewritingContext::traceAbort() { return abortFlag; } Maude-2.6/src/Mixfix/strategyPrint.cc0000644000147300135640000001417010524451374014576 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // StrategyExpression* -> ostream& pretty printer. // // It might appear desirable to virtualize this in class StrategyExpression but // the mapping from StrategyExpressions to the strategy language is partial and // it's undesirable for the various classes derived from StrategyExpression to // know about these details. // ostream& operator<<(ostream& s, StrategyExpression* strategy) { (void) MixfixModule::prettyPrint(s, strategy, UNBOUNDED); return s; } bool MixfixModule::prettyPrint(ostream& s, StrategyExpression* strategy, int requiredPrec) { bool needParen = false; bool needSpace = true; if (TrivialStrategy* t = dynamic_cast(strategy)) s << (t->getResult() ? "idle" : "fail"); else if (ApplicationStrategy* a = dynamic_cast(strategy)) { bool top = a->getTop(); if (top) s << "top("; int label = a->getLabel(); if (label == NONE) s << "all"; else { s << Token::name(label); const Vector& variables = a->getVariables(); if (!variables.empty()) { const Vector& values = a->getValues(); s << '['; int nrAssignments = variables.size(); for (int i = 0;;) { s << variables[i] << " <- " << values[i].getTerm(); if (++i == nrAssignments) break; s << ", "; } s << ']'; } const Vector& strategies = a->getStrategies(); if (!strategies.empty()) { s << '{'; int nrStrategies = strategies.size(); for (int i = 0;;) { s << strategies[i]; if (++i == nrStrategies) break; s << ", "; } s << '}'; } } if (top) s << ')'; } else if (ConcatenationStrategy* c = dynamic_cast(strategy)) { needParen = requiredPrec < STRAT_SEQ_PREC; if (needParen) s << '('; const Vector& strategies = c->getStrategies(); int nrStrategies = strategies.size(); for (int i = 0;;) { (void) prettyPrint(s, strategies[i], STRAT_SEQ_PREC); if (++i == nrStrategies) break; s << " ; "; } } else if (UnionStrategy* c = dynamic_cast(strategy)) { needParen = requiredPrec < STRAT_UNION_PREC; if (needParen) s << '('; const Vector& strategies = c->getStrategies(); int nrStrategies = strategies.size(); for (int i = 0;;) { (void) prettyPrint(s, strategies[i], STRAT_UNION_PREC); if (++i == nrStrategies) break; s << " | "; } } else if (IterationStrategy* i = dynamic_cast(strategy)) { if (prettyPrint(s, i->getStrategy(), 0)) s << ' '; s << (i->getZeroAllowed() ? '*' : '+'); } else if (BranchStrategy* b = dynamic_cast(strategy)) { switch (b->getSuccessAction()) { case BranchStrategy::FAIL: { Assert(b->getFailureAction() == BranchStrategy::IDLE && b->getSuccessStrategy() == 0 && b->getFailureStrategy() == 0, "unknown branch strategy"); s << "not(" << b->getInitialStrategy() << ')'; break; } case BranchStrategy::IDLE: { Assert(b->getFailureAction() == BranchStrategy::FAIL && b->getSuccessStrategy() == 0 && b->getFailureStrategy() == 0, "unknown branch strategy"); s << "test(" << b->getInitialStrategy() << ')'; break; } case BranchStrategy::PASS_THRU: { if (b->getFailureAction() == BranchStrategy::IDLE) { Assert(b->getSuccessStrategy() == 0 && b->getFailureStrategy() == 0, "unknown branch strategy"); s << "try(" << b->getInitialStrategy() << ')'; } else { Assert(b->getFailureAction() == BranchStrategy::NEW_STRATEGY && b->getSuccessStrategy() == 0, "unknown branch strategy"); needParen = requiredPrec < STRAT_ORELSE_PREC; if (needParen) s << '('; (void) prettyPrint(s, b->getInitialStrategy(), STRAT_ORELSE_PREC); s << " or-else "; (void) prettyPrint(s, b->getFailureStrategy(), STRAT_ORELSE_PREC); } break; } case BranchStrategy::NEW_STRATEGY: { Assert(b->getFailureAction() == BranchStrategy::NEW_STRATEGY, "unknown branch strategy"); needParen = requiredPrec < STRAT_BRANCH_PREC; if (needParen) s << '('; (void) prettyPrint(s, b->getInitialStrategy(), STRAT_BRANCH_PREC); s << " ? "; (void) prettyPrint(s, b->getSuccessStrategy(), STRAT_BRANCH_PREC); s << " : "; (void) prettyPrint(s, b->getFailureStrategy(), STRAT_BRANCH_PREC); break; } case BranchStrategy::ITERATE: { Assert(b->getFailureAction() == BranchStrategy::IDLE && b->getSuccessStrategy() == 0 && b->getFailureStrategy() == 0, "unknown branch strategy"); if (prettyPrint(s, b->getInitialStrategy(), 0)) s << ' '; s << '!'; break; } default: CantHappen("bad success action"); } } else if (TestStrategy* t = dynamic_cast(strategy)) { int depth = t->getDepth(); if (depth >= 0) s << (depth == 0 ? 'x' : 'a'); s << "match " << t->getPatternTerm(); const Vector& condition = t->getCondition(); if (!condition.empty()) { s << " such that "; printCondition(s, condition); } } if (needParen) { s << ')'; needSpace = false; } return needSpace; } Maude-2.6/src/Mixfix/visibleModule.cc0000644000147300135640000004600010403701707014511 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class VisibleModule. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" #include "binarySymbol.hh" #include "variableSymbol.hh" // core class definitions #include "equation.hh" #include "rule.hh" #include "sortConstraint.hh" // front end class definitions #include "userLevelRewritingContext.hh" #include "visibleModule.hh" VisibleModule::VisibleModule(int name, ModuleType moduleType, Entity::User* parent) : ImportModule(name, moduleType, TEXT, parent) { } void VisibleModule::showSummary(ostream& s) { int nrNonterminals; int nrTerminals; int nrProductions; getParserStats(nrNonterminals, nrTerminals, nrProductions); s << "Grammar:" << "\n\tnonterminals: " << nrNonterminals << "\n\tterminals: " << nrTerminals << "\n\tproductions: " << nrProductions << "\n\n"; int nrKinds = getConnectedComponents().length(); s << "Term rewriting system:" << "\n\tkinds: " << nrKinds << "\n\tsorts: " << getSorts().length() - nrKinds << "\n\tuser symbols: " << getNrUserSymbols() << "\n\ttotal symbols: " << getSymbols().length() << "\n\tpolymorphic operators: " << getNrPolymorphs() << "\n\tmembership axioms: " << getSortConstraints().length() << "\n\tequations: " << getEquations().length() << "\n\trules: " << getRules().length() << '\n'; } void VisibleModule::showKinds(ostream& s) const { const Vector& kinds = getConnectedComponents(); int nrKinds = kinds.length(); for (int i = 0; i < nrKinds; i++) { const ConnectedComponent* c = kinds[i]; s << c->sort(0); if (c->errorFree()) s << " (error free)"; s<< ":\n"; int nrSorts = c->nrSorts(); for (int j = 1; j < nrSorts; j++) s << '\t' << j << '\t' << c->sort(j) << '\n'; if (i + 1 < nrKinds) s << '\n'; } } void VisibleModule::showSortsAndSubsorts(ostream& s) const { const Vector& sorts = getSorts(); int nrUserSorts = getNrUserSorts(); for (int i = 0; i < nrUserSorts; i++) { if (UserLevelRewritingContext::interrupted()) return; const Sort* sort = sorts[i]; s << "sort " << sort << " ."; int index = sort->index(); const ConnectedComponent* c = sort->component(); int nrComponentSorts = c->nrSorts(); int nrSupersorts = 0; for (int j = 1; j < index; j++) { if (leq(sort, j)) ++nrSupersorts; } int nrSubsorts = 0; for (int j = index + 1; j < nrComponentSorts; j++) { if (leq(j, sort)) ++nrSubsorts; } int nrComparableSorts = nrSubsorts + nrSupersorts; if (nrComparableSorts > 0) { s << "\tsubsort"; if (nrComparableSorts > 1) s << 's'; if (nrSubsorts > 0) { for (int j = nrComponentSorts - 1; j > index ; j--) { const Sort* sort2 = c->sort(j); if (leq(sort2, sort)) s << ' ' << sort2; } s << " <"; } s << ' ' << Tty(Tty::MAGENTA) << sorts[i] << Tty(Tty::RESET); if (nrSupersorts > 0) { s << " <"; for (int j = index - 1; j > 0; j--) { const Sort* sort2 = c->sort(j); if (leq(sort, sort2)) s << ' ' << sort2; } } s << " ."; } s << '\n'; } } void VisibleModule::showModule(ostream& s, bool all) const { s << moduleTypeString(getModuleType()) << ' ' << this; int nrParameters = getNrParameters(); if (nrParameters > 0) { s << '{' << Token::name(getParameterName(0)) << " :: " << getParameterTheory(0); for (int i = 1; i < nrParameters; ++i) s << ", " << Token::name(getParameterName(i)) << " :: " << getParameterTheory(i); s << '}'; } s << " is\n"; showSorts1(s, true, all); showSubsorts(s, true, all); showPolymorphs(s, true, all); showOps(s, true, all); showVars(s, true); showMbs(s, true, all); showEqs(s, true, all); showRls(s, true, all); if (UserLevelRewritingContext::interrupted()) return; s << moduleEndString(getModuleType()) << '\n'; } void VisibleModule::showSorts1(ostream& s, bool indent, bool all) const { if (UserLevelRewritingContext::interrupted()) return; int begin = all ? 0 : getNrImportedSorts(); int end = getNrUserSorts(); int nrSorts = end - begin; if (nrSorts > 0) { const Vector& sorts = getSorts(); if (indent) s << " "; s << "sort"; if (nrSorts > 1) s << 's'; for (int i = begin; i < end; i++) s << ' ' << sorts[i]; s << " .\n"; } } void VisibleModule::showSubsorts(ostream& s, bool indent, bool all) const { const char* ind = indent ? " " : ""; const Vector& sorts = getSorts(); int nrUserSorts = getNrUserSorts(); for (int i = 0; i < nrUserSorts; i++) { if (UserLevelRewritingContext::interrupted()) return; int begin = all ? 0 : getNrImportedSubsorts(i); const Sort* sort = sorts[i]; const Vector& subsorts = sort->getSubsorts(); int end = subsorts.length(); int nrSubsorts = end - begin; if (nrSubsorts > 0) { s << ind << "subsort"; if (nrSubsorts > 1) s << 's'; for (int j = begin; j < end; j++) s << ' ' << subsorts[j]; s << " < " << sort << " .\n"; } } } void VisibleModule::showVars(ostream& s, bool indent) const { const char* ind = indent ? " " : ""; const AliasMap& variableAliases = getVariableAliases(); FOR_EACH_CONST(i, AliasMap, variableAliases) { if (UserLevelRewritingContext::interrupted()) return; s << ind << "var " << Token::name(i->first) << " : " << i->second << " .\n"; } } void VisibleModule::showMbs(ostream& s, bool indent, bool all) const { const char* ind = indent ? " " : ""; const Vector& mbs = getSortConstraints(); int nrMbs = all ? mbs.length() : getNrOriginalMembershipAxioms(); for (int i = 0; i < nrMbs; i++) { if (UserLevelRewritingContext::interrupted()) return; s << ind << mbs[i] << '\n'; } } void VisibleModule::showEqs(ostream& s, bool indent, bool all) const { const char* ind = indent ? " " : ""; const Vector& equations = getEquations(); int nrEquations = all ? equations.length() : getNrOriginalEquations(); for (int i = 0; i < nrEquations; i++) { if (UserLevelRewritingContext::interrupted()) return; s << ind << equations[i] << '\n'; } } void VisibleModule::showRls(ostream& s, bool indent, bool all) const { const char* ind = indent ? " " : ""; const Vector& rules = getRules(); int nrRules = all ? rules.length() : getNrOriginalRules(); for (int i = 0; i < nrRules; i++) { if (UserLevelRewritingContext::interrupted()) return; s << ind << rules[i] << '\n'; } } void VisibleModule::showPolymorphAttributes(ostream& s, int index) const { SymbolType st = getPolymorphType(index); if (st.hasFlag(SymbolType::CTOR)) s << " ctor"; // // Theory attributes. // if (st.hasFlag(SymbolType::ASSOC)) s << " assoc"; if (st.hasFlag(SymbolType::COMM)) s << " comm"; if (st.hasFlag(SymbolType::LEFT_ID | SymbolType::RIGHT_ID)) { s << (st.hasFlag(SymbolType::LEFT_ID) ? " left" : " right") << " id: " << getPolymorphIdentity(index); } if (st.hasFlag(SymbolType::IDEM)) s << " idem"; if (st.hasFlag(SymbolType::ITER)) s << " iter"; // // Object-oriented attributes. // if (st.hasFlag(SymbolType::OBJECT)) s << " obj"; if (st.hasFlag(SymbolType::MESSAGE)) s << " msg"; if (st.hasFlag(SymbolType::CONFIG)) s << " config"; // // Semantic attributes. // const Vector& strat = getPolymorphStrategy(index); int stratLen = strat.length(); if (stratLen > 0) { s << " strat ("; for (int k = 0; k < stratLen; k++) { s << strat[k]; if (k + 1 < stratLen) s << ' '; } s << ')'; } if (st.hasFlag(SymbolType::MEMO)) s << " memo"; if (st.hasFlag(SymbolType::FROZEN)) { s << " frozen ("; const NatSet& frozen = getPolymorphFrozen(index); const NatSet::const_iterator e = frozen.end(); for (NatSet::const_iterator i = frozen.begin();;) { s << *i + 1; if (++i == e) break; s << ' '; } s << ')'; } // // Syntactic attributes. // Vector gather; getPolymorphGather(index, gather); int gatherLength = gather.length(); if (st.hasFlag(SymbolType::PREC | SymbolType::GATHER) || gatherLength > 0) { s << " prec " << getPolymorphPrec(index); if (gatherLength > 0) { s << " gather ("; for (int i = 0; i < gatherLength; i++) { if (i != 0) s << ' '; switch (gather[i]) { case GATHER_e: s << 'e'; break; case GATHER_E: s << 'E'; break; case GATHER_AMP: s << '&'; break; } } s << ')'; } } if (st.hasFlag(SymbolType::FORMAT)) { s << " format ("; const Vector& format = getPolymorphFormat(index); int formatLength = format.length(); for (int i = 0; i < formatLength; i++) { if (i != 0) s << ' '; s << Token::name(format[i]); } s << ')'; } int metadata = getPolymorphMetadata(index); if (metadata != NONE) s << " metadata " << Token::name(metadata); if (st.hasSpecial()) { s << " special ("; int purpose; { Vector items; for (int i = 0; getPolymorphDataAttachment(index, i, purpose, items); i++) { s << "\n " << "id-hook " << Token::name(purpose); int nrItems = items.length(); if (nrItems > 0) { for (int j = 0; j < nrItems; j++) s << ((j == 0) ? " (" : " ") << Token::name(items[j]); s << ')'; } } } { Symbol* op; for (int i = 0; getPolymorphSymbolAttachment(index, i, purpose, op); i++) { s << "\n " << "op-hook " << Token::name(purpose) << " (" << op << " : "; const Vector& domainAndRange = op->getOpDeclarations()[0].getDomainAndRange(); int nrSorts = domainAndRange.length() - 1; // // We don't use operator<< for sorts in an op-hook since they // should always be printed as single tokens. // for (int j = 0; j < nrSorts; j++) { Sort* sort = domainAndRange[j]; if (sort->index() == Sort::KIND) sort = sort->component()->sort(1); s << Token::name(sort->id()) << ' '; } Sort* sort = domainAndRange[nrSorts]; if (sort->index() == Sort::KIND) sort = sort->component()->sort(1); s << "~> " << Token::name(sort->id()) << ')'; } } { Term* term; for (int i = 0; getPolymorphTermAttachment(index, i, purpose, term); i++) s << "\n " << "term-hook " << Token::name(purpose) << " (" << term << ")"; } s << ')'; } } void VisibleModule::showPolymorphs(ostream& s, bool indent, bool all) const { int nrPolymorphs = getNrPolymorphs(); int begin = all ? 0 : getNrImportedPolymorphs(); for (int i = begin; i < nrPolymorphs; i++) { if (UserLevelRewritingContext::interrupted()) return; showPolymorphDecl(s, indent, i); } } void VisibleModule::showPolymorphDecl(ostream& s, bool indent, int index) const { const char* ind = indent ? " " : ""; s << ind << "op " << getPolymorphName(index) << " :"; const Vector& domainAndRange = getPolymorphDomainAndRange(index); int nrArgs = domainAndRange.length() - 1; for (int i = 0; i < nrArgs; i++) { if (Sort* sort = domainAndRange[i]) s << ' ' << sort; else s << " Universal"; } if (Sort* sort = domainAndRange[nrArgs]) s << " -> " << sort; else s << " -> Universal"; s << " [poly "; const char* sep = "("; for (int i = 0; i < nrArgs; i++) { if (domainAndRange[i] == 0) { s << sep << i + 1; sep = " "; } } if (domainAndRange[nrArgs] == 0) s << sep << '0'; s << ')'; showPolymorphAttributes(s, index); s << "] .\n"; } void VisibleModule::showOps(ostream& s, bool indent, bool all) const { int begin = all ? 0 : getNrImportedSymbols(); int end = getNrUserSymbols(); for (int i = begin; i < end; i++) { if (UserLevelRewritingContext::interrupted()) return; showDecls(s, indent, i, all); } } void VisibleModule::showDecls(ostream& s, bool indent, int index, bool all) const { const char* ind = indent ? " " : ""; Symbol* symbol = getSymbols()[index]; int begin = all ? 0 : getNrImportedDeclarations(index); int end = getNrUserDeclarations(index); Assert(end > 0, "op " << symbol << " has no declarations"); const Vector& opDecls = symbol->getOpDeclarations(); int nrArgs = symbol->arity(); for (int i = begin; i < end; i++) { if (UserLevelRewritingContext::interrupted()) return; const Vector& dec = opDecls[i].getDomainAndRange(); s << ind << "op " << symbol << " :"; for (int j = 0; j < nrArgs; j++) s << ' ' << dec[j]; s << " -> " << dec[nrArgs]; showAttributes(s, symbol, i); s << " .\n"; } } void VisibleModule::showAttributes(ostream& s, Symbol* symbol, int opDeclIndex) const { Vector gather; getGather(symbol, gather); // there will be a gather whenever there is mixfix syntax and args int gatherLength = gather.length(); SymbolType st = getSymbolType(symbol); const OpDeclaration& decl = symbol->getOpDeclarations()[opDeclIndex]; bool ctor = decl.isConstructor(); int metadata = getMetadata(symbol, opDeclIndex); if (gatherLength == 0 && st.getBasicType() == SymbolType::STANDARD && !(st.hasFlag(SymbolType::ATTRIBUTES)) && !ctor && metadata == NONE) return; // no attributes; const char* space = ""; s << " ["; if (ctor) { s << space << "ctor"; space = " "; } // // Theory attributes. // if (st.hasFlag(SymbolType::ASSOC)) { s << space << "assoc"; space = " "; } if (st.hasFlag(SymbolType::COMM)) { s << space << "comm"; space = " "; } if (st.hasFlag(SymbolType::ITER)) { s << space << "iter"; space = " "; } if (st.hasFlag(SymbolType::LEFT_ID | SymbolType::RIGHT_ID)) { s << space; space = " "; if (!(st.hasFlag(SymbolType::LEFT_ID | SymbolType::COMM))) s << "right "; else if (!(st.hasFlag(SymbolType::RIGHT_ID | SymbolType::COMM))) s << "left "; s << "id: "; Term* id = safeCast(BinarySymbol*, symbol)->getIdentity(); if (id != 0) s << id; } if (st.hasFlag(SymbolType::IDEM)) { s << space << "idem"; space = " "; } // // Object-oriented attributes. // if (st.hasFlag(SymbolType::MESSAGE)) { s << space << "msg"; space = " "; } if (st.hasFlag(SymbolType::OBJECT)) { s << space << "obj"; space = " "; } if (st.hasFlag(SymbolType::CONFIG)) { s << space << "config"; space = " "; } // // Semantic attributes. // const Vector& strat = symbol->getStrategy(); int stratLen = strat.length(); if (stratLen > 0) { s << space << "strat ("; space = " "; for (int k = 0; k < stratLen; k++) { s << strat[k]; if (k + 1 < stratLen) s << ' '; } s << ')'; } if (st.hasFlag(SymbolType::MEMO)) { s << space << "memo"; space = " "; } if (st.hasFlag(SymbolType::FROZEN)) { s << space << "frozen ("; space = " "; const NatSet& frozen = symbol->getFrozen(); const NatSet::const_iterator e = frozen.end(); for (NatSet::const_iterator i = frozen.begin();;) { s << *i + 1; if (++i == e) break; s << ' '; } s << ')'; } // // Syntactic attributes. // if (st.hasFlag(SymbolType::PREC | SymbolType::GATHER) || gatherLength > 0) { s << space << "prec " << getPrec(symbol); space = " "; if (gatherLength > 0) { s << " gather ("; for (int i = 0; i < gatherLength; i++) { if (i != 0) s << ' '; switch (gather[i]) { case GATHER_e: s << 'e'; break; case GATHER_E: s << 'E'; break; case GATHER_AMP: s << '&'; break; } } s << ')'; } } if (st.hasFlag(SymbolType::FORMAT)) { s << space << "format ("; space = " "; const Vector& format = getFormat(symbol); int formatLength = format.length(); for (int i = 0; i < formatLength; i++) { if (i != 0) s << ' '; s << Token::name(format[i]); } s << ')'; } if (metadata != NONE) { s << space << "metadata " << Token::name(metadata); space = " "; } if (st.hasSpecial()) { s << space << "special ("; Vector purposes; { Vector > data; getDataAttachments(symbol, decl.getDomainAndRange(), purposes, data); int nrHooks = purposes.length(); for (int i = 0; i < nrHooks; i++) { s << "\n " << "id-hook " << purposes[i]; const Vector& items = data[i]; int nrItems = items.length(); if (nrItems > 0) { for (int j = 0; j < nrItems; j++) s << ((j == 0) ? " (" : " ") << items[j]; s << ')'; } } } purposes.clear(); { Vector symbols; getSymbolAttachments(symbol, purposes, symbols); int nrHooks = purposes.length(); for (int i = 0; i < nrHooks; i++) { Symbol* op = symbols[i]; s << "\n " << "op-hook " << purposes[i] << " (" << op << " : "; const Vector& domainAndRange = op->getOpDeclarations()[0].getDomainAndRange(); int nrSorts = domainAndRange.length() - 1; // // We don't use operator<< for sorts in an op-hook since they // should always be printed as single tokens. // for (int j = 0; j < nrSorts; j++) { Sort* sort = domainAndRange[j]; if (sort->index() == Sort::KIND) sort = sort->component()->sort(1); s << Token::name(sort->id()) << ' '; } Sort* sort = domainAndRange[nrSorts]; if (sort->index() == Sort::KIND) sort = sort->component()->sort(1); s << "~> " << Token::name(sort->id()) << ')'; } } purposes.clear(); { Vector terms; getTermAttachments(symbol, purposes, terms); int nrHooks = purposes.length(); for (int i = 0; i < nrHooks; i++) s << "\n " << "term-hook " << purposes[i] << " (" << terms[i] << ")"; } s << ')'; } s << ']'; } Maude-2.6/src/Mixfix/lexer.ll0000644000147300135640000003666111442026545013067 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2010 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /* // Lexical analyser */ %{ // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // core class definitions #include "lineNumber.hh" // front end class definitions #include "token.hh" #include "fileTable.hh" #include "directoryManager.hh" //#include "preModule.hh" #include "lexerAux.hh" #include "global.hh" #include "userLevelRewritingContext.hh" #include "interpreter.hh" // bison generated token file #include "surface.h" #define YY_DECL int yylex(YYSTYPE* lvalp) #define YY_INPUT(buf, result, max_size) getInput(buf, result, max_size) #define RETURN(token) \ { lvalp->yyToken.tokenize(yytext, lineNumber); return (token); } #define RETURN_FIX_UP(token) \ { lvalp->yyToken.fixUp(yytext, lineNumber); return (token); } #define SAVE(token) \ { savedToken.tokenize(yytext, lineNumber); savedReturn = token; } #define SAVE_FIX_UP(token) \ { savedToken.fixUp(yytext, lineNumber); savedReturn = token; } #define RETURN_SAVED(token) \ { lvalp->yyToken = savedToken; return (token); } #define STORE \ { Token t; t.tokenize(yytext, lineNumber); lexerBubble.append(t); /*DebugAdvisory("Stored " << t);*/ } #define STORE_FIX_UP \ { Token t; t.fixUp(yytext, lineNumber); lexerBubble.append(t); /*DebugAdvisory("Stored fixUp " << t);*/ } #define EXIT(token) \ { yy_pop_state(); RETURN(token) } Token savedToken; int savedReturn; int braceCount; int parenCount; int terminationSet; string accumulator; string fileName; //int terminationCondition; int minLength; extern Vector lexerBubble; %} stringContent ([^[:cntrl:]"\\]|("\\"[^[:cntrl:]])|(\\\n)|\t) string ("\""{stringContent}*"\"") normal ([^[:cntrl:] ()\[\]{},`_"]|{string}) normalSeq ({normal}("`"{normal})*) special ("_"|("`"[()\[\]{},])) maudeId (({special}|{normalSeq})+) %s ID_MODE %s CMD_MODE %s SEEN_DOT %s BUBBLE_MODE %s END_STATEMENT_MODE %s END_COMMAND_MODE %x FILE_NAME_MODE %x FILE_NAME_QUOTE_MODE %x STRING_MODE %x LATEX_MODE %option stack %option noyywrap %% if (UserLevelRewritingContext::interrupted()) yyterminate(); ("***>"|"--->")[^ \t\n\r\f]* { yyless(0); eatComment(false); } ("***"|"---")[^ \t\n\r\f]* { yyless(3); eatComment(true); } { memo RETURN(KW_MEMO) format RETURN(KW_FORMAT) } { in RETURN(KW_IN) } { th|fth|mod|fmod|smod|obj RETURN(KW_MOD) // need to know which one we saw omod RETURN(KW_OMOD) view RETURN(KW_VIEW); load return KW_LOAD; pwd return KW_PWD; cd return KW_CD; pushd return KW_PUSHD; popd return KW_POPD; ls return KW_LS; quit|q return KW_QUIT; eof return KW_EOF; parse return KW_PARSE; norm|normalize return KW_NORMALIZE; red|reduce return KW_REDUCE; cred|creduce return KW_CREDUCE; sred|sreduce return KW_SREDUCE; rew|rewrite return KW_REWRITE; erew|erewrite return KW_EREWRITE; frew|frewrite return KW_FREWRITE; srew|srewrite return KW_SREWRITE; loop return KW_LOOP; cont|continue return KW_CONTINUE; nar|narrow return KW_NARROW; xg-narrow return KW_XG_NARROW; match return KW_MATCH; xmatch return KW_XMATCH; search return KW_SEARCH; unify return KW_UNIFY; set return KW_SET; show return KW_SHOW; on return KW_ON; off return KW_OFF; trace return KW_TRACE; advise|advisory|advisories return KW_ADVISE; verbose return KW_VERBOSE; do return KW_DO; clear return KW_CLEAR; body return KW_BODY; builtin return KW_BUILTIN; whole return KW_WHOLE; select return KW_SELECT; deselect return KW_DESELECT; conceal return KW_CONCEAL; reveal return KW_REVEAL; cond|condition return KW_CONDITION; subst|substitution return KW_SUBSTITUTION; print return KW_PRINT; attr|attribute return KW_ATTRIBUTE; newline return KW_NEWLINE; color return KW_COLOR; graph return KW_GRAPH; mixfix return KW_MIXFIX; flat|flattened return KW_FLAT; with return KW_WITH; paren|parens|parentheses return KW_PARENS; alias|aliases return KW_ALIASES; gc return KW_GC; time return KW_TIME; stats return KW_STATS; timing return KW_TIMING; cmd|command return KW_CMD; all return KW_ALL; modules return KW_MODULES; module return KW_MODULE; views return KW_VIEWS; sort|sorts return KW_SORTS; op|ops return KW_OPS2; var|vars return KW_VARS; mb|mbs return KW_MBS; eq|eqs return KW_EQS; rl|rls|rule|rules return KW_RLS; summary return KW_SUMMARY; kinds|components return KW_KINDS; compile|compiler return KW_COMPILE; count return KW_COUNT; protect return KW_PROTECT; extend return KW_EXTEND; include return KW_INCLUDE; exclude return KW_EXCLUDE; debug return KW_DEBUG; resume return KW_RESUME; abort return KW_ABORT; step return KW_STEP; where return KW_WHERE; dump return KW_DUMP; break return KW_BREAK; breakdown return KW_BREAKDOWN; path return KW_PATH; label|labels return KW_LABEL; profile return KW_PROFILE; number return KW_NUMBER; rat|rational return KW_RAT; [.\[\]()] return *yytext; 0|([1-9][0-9]*) { bool dummy; lvalp->yyInt64 = stringToInt64(yytext, dummy, 10); return SIMPLE_NUMBER; } {maudeId}|[{},] { IssueWarning(LineNumber(lineNumber) << ": skipped unexpected token: " << QUOTE(yytext)); } } /* * In command mode we only recognize special tokens * "in" "(" ")" "[" "]" ":" "." "," and non-negative numbers. * Everything else is an identifier. Furthermore "." is only recognized * at the end of a line or before a comment (ignoring white space). */ { "."(([ \t\r\f\v]*\n)|([ \t\r\f\v]+("***"|"---"))) { yyless(1); RETURN('.') } [:,()\[\]] RETURN(*yytext) [1-9][0-9]* RETURN(NUMERIC_ID) [.{}] RETURN(IDENTIFIER) {maudeId}"." { SAVE_FIX_UP(ENDS_IN_DOT) BEGIN(SEEN_DOT); } {maudeId} RETURN_FIX_UP(IDENTIFIER) } { (([ \t\r\f\v]*\n)|([ \t\r\f\v]+("***"|"---"))) { yyless(0); BEGIN(CMD_MODE); RETURN_SAVED(savedReturn) } . { yyless(0); BEGIN(CMD_MODE); RETURN_SAVED(IDENTIFIER) } } /* * Id mode is used for scanning modules; a whole bunch of special tokens * are recognized. */ { to RETURN(KW_TO) from RETURN(KW_FROM) label RETURN(KW_LABEL) assoc|associative RETURN(KW_ASSOC) comm|commutative RETURN(KW_COMM) id:|identity: RETURN(KW_ID) idem|idempotent RETURN(KW_IDEM) iter|iterated RETURN(KW_ITER) left RETURN(KW_LEFT) right RETURN(KW_RIGHT) prec|precedence RETURN(KW_PREC) gather RETURN(KW_GATHER) metadata RETURN(KW_METADATA) strat|strategy RETURN(KW_STRAT) frozen RETURN(KW_FROZEN) poly|polymorphic RETURN(KW_POLY) ctor|constructor RETURN(KW_CTOR) latex RETURN(KW_LATEX) special RETURN(KW_SPECIAL) config|configuration RETURN(KW_CONFIG) obj|object RETURN(KW_OBJ) msg|message RETURN(KW_MSG) ditto RETURN(KW_DITTO) id-hook RETURN(KW_ID_HOOK) op-hook RETURN(KW_OP_HOOK) term-hook RETURN(KW_TERM_HOOK) is RETURN(KW_IS) if RETURN(KW_IF) pr|protecting|ex|extending|us|using|inc|including RETURN(KW_IMPORT) sort|sorts RETURN(KW_SORT) subsort|subsorts RETURN(KW_SUBSORT) class RETURN(KW_CLASS) subclass|subclasses RETURN(KW_SUBCLASS) op RETURN(KW_OP) ops RETURN(KW_OPS) msgs RETURN(KW_MSGS) var|vars RETURN(KW_VAR) mb RETURN(KW_MB) cmb RETURN(KW_CMB) eq RETURN(KW_EQ) ceq|cq RETURN(KW_CEQ) rl RETURN(KW_RL) crl RETURN(KW_CRL) end(th|fth|m|fm|sm|om|o)|jbo RETURN(KW_ENDM) endv RETURN(KW_ENDV) "->" RETURN(KW_ARROW) "=>" RETURN(KW_ARROW2) "~>" RETURN(KW_PARTIAL) "::" RETURN(KW_COLON2) [:()\[\]{}.,<=|+*] RETURN(*yytext) {maudeId}"." RETURN_FIX_UP(ENDS_IN_DOT) {maudeId} RETURN_FIX_UP(IDENTIFIER) } /* * Bubble mode squirrels tokens away in lexerBubble until some termination criteria is met. */ { : { if (parenCount == 0 && (terminationSet & BAR_COLON) && lexerBubble.length() >= minLength) EXIT(*yytext) else STORE } , { if (parenCount == 0 && (terminationSet & BAR_COMMA) && lexerBubble.length() >= minLength) EXIT(*yytext) else STORE } \[ { if (parenCount == 0 && (terminationSet & BAR_LEFT_BRACKET) && lexerBubble.length() >= minLength) EXIT(*yytext) else STORE } \] { if (parenCount == 0 && (terminationSet & BAR_RIGHT_BRACKET) && lexerBubble.length() >= minLength) EXIT(*yytext) else STORE } = { if (parenCount == 0 && (terminationSet & BAR_EQUALS) && lexerBubble.length() >= minLength) EXIT(*yytext) else STORE } => { if (parenCount == 0 && (terminationSet & BAR_ARROW2) && lexerBubble.length() >= minLength) EXIT(KW_ARROW2) else STORE } to { if (parenCount == 0 && (terminationSet & BAR_TO) && lexerBubble.length() >= minLength) EXIT(KW_TO) else STORE } if { if (parenCount == 0 && (terminationSet & BAR_IF) && lexerBubble.length() >= minLength) EXIT(KW_IF) else STORE } assoc|associative|comm|commutative|id:|identity:|idem|idempotent|iter|iterated|left|right|prec|precedence|gather|metadata|strat|strategy|frozen|poly|polymorphic|ctor|constructor|latex|special|config|configuration|obj|object|msg|message|ditto|format|memo { if (parenCount == 0 && (terminationSet & BAR_OP_ATTRIBUTE) && lexerBubble.length() >= minLength) { yyless(0); // need to re-lex it to get the correct return value yy_pop_state(); } else STORE } \( { ++parenCount; STORE } \) { if (parenCount == 0) { if ((terminationSet & BAR_RIGHT_PAREN) && lexerBubble.length() >= minLength) EXIT(*yytext) IssueWarning(LineNumber(lineNumber) << ": mismatched parentheses."); } else --parenCount; STORE } [\]{}] STORE \. { if (parenCount == 0 && lexerBubble.length() >= minLength && (terminationSet & (END_STATEMENT | END_COMMAND))) { SAVE(*yytext) BEGIN((terminationSet & END_STATEMENT) ? END_STATEMENT_MODE : END_COMMAND_MODE); } else STORE } {maudeId}"." { if (parenCount == 0 && lexerBubble.length() + 1 >= minLength && (terminationSet & (END_STATEMENT | END_COMMAND))) { SAVE_FIX_UP(ENDS_IN_DOT) BEGIN((terminationSet & END_STATEMENT) ? END_STATEMENT_MODE : END_COMMAND_MODE); } else STORE_FIX_UP } {maudeId} STORE_FIX_UP } /* * We have saved something that looks like a statement terminating period. We now lex the next * token to see if it ends a module or starts a new statement, and if so push the lexed token back * on to the input stream to be re-lexed in a new mode. */ { pr|protecting|ex|extending|us|using|inc|including|sort|sorts|subsort|subsorts|op|ops|var|vars|mb|cmb|eq|cq|ceq|rl|crl|end(th|fth|m|fm|sm|om|o|v)|jbo|msg|msgs|class|classes|subclass|subclasses { yyless(0); // BUG - need to deal with white space and comments after the . yy_pop_state(); RETURN_SAVED(savedReturn) } } { (([ \t\r\f\v]*\n)|([ \t\r\f\v]+("***"|"---"))) { yyless(0); yy_pop_state(); RETURN_SAVED(savedReturn) } } { \. { lexerBubble.append(savedToken); SAVE(*yytext); } {maudeId}"." { lexerBubble.append(savedToken); SAVE_FIX_UP(ENDS_IN_DOT) } {maudeId}|[^ \n\r\f\t\v] { // // We need {maudeId} here so that an identifier such // as .foo doesn't get split by the first rule. // lexerBubble.append(savedToken); yyless(0); BEGIN(BUBBLE_MODE); } } { \" { if (accumulator.empty()) BEGIN(FILE_NAME_QUOTE_MODE); else accumulator += '"'; } \\" " accumulator += ' '; \\\" accumulator += '"'; \\\\ accumulator += '\\'; \\ accumulator += '\\'; [^"\\ \t\n\r\f]+ accumulator += yytext; [ \t\r] { if (!accumulator.empty()) { yy_pop_state(); lvalp->yyString = accumulator.c_str(); eatComment(false); return FILE_NAME_STRING; } } [\n\f] { ++lineNumber; yy_pop_state(); lvalp->yyString = accumulator.c_str(); return FILE_NAME_STRING; } } { ["\t\r] { yy_pop_state(); lvalp->yyString = accumulator.c_str(); eatComment(false); return FILE_NAME_STRING; } [^"\t\n\r\f]+ accumulator += yytext; [\n\f] { ++lineNumber; yy_pop_state(); lvalp->yyString = accumulator.c_str(); return FILE_NAME_STRING; } } { [^\n\r\f]* { yy_pop_state(); lvalp->yyString = yytext; return UNINTERPRETED_STRING; } [\n\r\f] { yyless(0); // so that line numbers will be correct yy_pop_state(); lvalp->yyString = ""; return UNINTERPRETED_STRING; } } { (\\[{}()]{0,1})|([a-zA-Z0-9.:;,?!`'\[\]\-/*@#$%&~_^+=|<> \t]+) accumulator += yytext; \( { if (braceCount == 0) ++parenCount; accumulator += yytext; } \) { if (braceCount == 0) { --parenCount; if (parenCount == 0) { yyless(0); yy_pop_state(); lvalp->yyString = accumulator.c_str(); return LATEX_STRING; } } accumulator += yytext; } \{ { ++braceCount; accumulator += yytext; } \} { --braceCount; accumulator += yytext; } [\n\f] { ++lineNumber; accumulator += yytext; } . yy_pop_state(); // mindless recovery } <> { if (UserLevelRewritingContext::interrupted() || !handleEof()) yyterminate(); } [ \t\r]* ; [\n\f] ++lineNumber; . { IssueWarning(LineNumber(lineNumber) << ": skipped: " << QUOTE(yytext)); } %% #include "lexerAux.cc" Maude-2.6/src/Mixfix/moduleCache.cc0000644000147300135640000002262011453161203014116 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class MetaModuleCache. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // front end class definitions #include "renaming.hh" #include "view.hh" #include "moduleCache.hh" #include "fileTable.hh" ModuleCache::ModuleCache() { } void ModuleCache::regretToInform(Entity* doomedEntity) { ImportModule* doomedModule = static_cast(doomedEntity); ModuleMap::iterator pos = moduleMap.find(doomedModule->id()); Assert(pos != moduleMap.end(), "could find self-destructing module " << doomedModule); DebugAdvisory("removing module " << doomedModule << " from cache"); moduleMap.erase(pos); } ImportModule* ModuleCache::makeRenamedCopy(ImportModule* module, Renaming* renaming) { // // Step 1 // Build a canonical renaming based on modules signature. // If empty, just return ourselves. // Renaming* canonical = renaming->makeCanonicalVersion(module); if (canonical == 0) return module; // // Build the canonical name of the module we want. // crope name; if (module->getOrigin() == ImportModule::SUMMATION) name = '('; name += Token::name(module->id()); if (module->getOrigin() == ImportModule::SUMMATION) name += ')'; name += " * ("; name += canonical->makeCanonicalName() + ")"; int t = Token::encode(name.c_str()); // // Check if we already have a renamed copy in cache. // If so, just return it. // ModuleMap::const_iterator c = moduleMap.find(t); if (c != moduleMap.end()) { DebugAdvisory("using existing copy of " << name); delete canonical; return c->second; } // // Create new module; and insert it in cache. // DebugAdvisory("making renamed copy " << name); ImportModule* copy = module->makeRenamedCopy(t, canonical, this); DebugAdvisory("finish renamed copy " << name); if (copy->isBad()) { // // Renaming a good module can produce a bad module. // // We never want to cache bad modules. // IssueAdvisory(*copy << ": unable to make renamed module " << QUOTE(name) << " due to earlier errors."); copy->removeUser(this); // since we are not adding a bad module to the cache copy->deepSelfDestruct(); return 0; } moduleMap[t] = copy; return copy; } ImportModule* ModuleCache::makeParameterCopy(int parameterName, ImportModule* module) { // // Make the name of the module we want. // crope name(Token::name(parameterName)); name += " :: "; name += Token::name(module->id()); int t = Token::encode(name.c_str()); // // Check if we already have a parameter copy in cache. // If so, just return it. // ModuleMap::const_iterator c = moduleMap.find(t); if (c != moduleMap.end()) { DebugAdvisory("using existing copy of " << name); return c->second; } // // Create new module; and insert it in cache. // DebugAdvisory("making parameter copy " << name); ImportModule* copy = module->makeParameterCopy(t, parameterName, this); DebugAdvisory("finished parameter copy " << name); Assert(!(copy->isBad()), "bad parameter copy"); moduleMap[t] = copy; return copy; } ImportModule* ModuleCache::makeInstatiation(ImportModule* module, const Vector& views, const Vector& parameterArgs) { // // Make the name of the module we want. // crope name; if (module->getOrigin() == ImportModule::RENAMING) name = '('; name += Token::name(module->id()); if (module->getOrigin() == ImportModule::RENAMING) name += ')'; const char* sep = "{"; int nrParameters = views.size(); for (int i = 0; i < nrParameters; ++i) { name += sep; sep = ", "; View* v = views[i]; if (v == 0) { // // Place brackets around parameter arguments so that we don't confuse // them with views having the same name. // name += '['; name += Token::name(parameterArgs[i]); name += ']'; } else name += Token::name(v->id()); } name += "}"; int t = Token::encode(name.c_str()); // // Check if we already have an instantiation in cache. // If so, just return it. // ModuleMap::const_iterator c = moduleMap.find(t); if (c != moduleMap.end()) { DebugAdvisory("using existing copy of " << name); return c->second; } // // Create new module; and insert it in cache. // DebugAdvisory("making instantiation " << name); ImportModule* copy = module->makeInstantiation(t, views, parameterArgs, this); DebugAdvisory("finished instantiation " << name); if (copy->isBad()) { // // It is possible for the instantiation of a non-bad module to be bad; // for example, by an attribute clash between an operator from the module // and one from the to-module in the instantiation; or perhaps the // instantiation of an import went bad. // // We never want to cache bad modules. // IssueAdvisory(*copy << ": unable to make module instantiation " << QUOTE(name) << " due to earlier errors."); copy->removeUser(this); // since we are not adding a bad module to the cache copy->deepSelfDestruct(); return 0; } moduleMap[t] = copy; return copy; } bool ModuleCache::moduleCompare(const ImportModule* m1, const ImportModule* m2) { return m1->id() < m2->id(); } ImportModule* ModuleCache::makeSummation(const Vector& modules) { // // Sort and delete duplicates. // Vector local(modules); sort(local.begin(), local.end(), moduleCompare); const Vector::const_iterator e = unique(local.begin(), local.end()); if (e - local.begin() == 1) return local[0]; // // Make name. // crope name; for (Vector::const_iterator i = local.begin(); i != e; ++i) { if (!name.empty()) name += " + "; name += Token::name((*i)->id()); } int t = Token::encode(name.c_str()); // // Check if it is already in cache. // ModuleMap::const_iterator c = moduleMap.find(t); if (c != moduleMap.end()) { DebugAdvisory("using existing copy of " << name); return c->second; } // // Otherwise build it. // DebugAdvisory("making summation " << name); Vector::const_iterator i = local.begin(); MixfixModule::ModuleType moduleType = (*i)->getModuleType(); for (++i; i != e; ++i) moduleType = MixfixModule::join(moduleType, (*i)->getModuleType()); ImportModule* sum = new ImportModule(t, moduleType, ImportModule::SUMMATION, this); LineNumber lineNumber(FileTable::AUTOMATIC); for (Vector::const_iterator i = local.begin(); i != e; i++) sum->addImport(*i, ImportModule::INCLUDING, lineNumber); sum->importSorts(); sum->closeSortSet(); if (!(sum->isBad())) { sum->importOps(); if (!(sum->isBad())) { sum->closeSignature(); sum->fixUpImportedOps(); if (!(sum->isBad())) { sum->closeFixUps(); // // We have no local statements. // sum->localStatementsComplete(); } } } // // Reset phase counter in each imported module. // sum->resetImports(); DebugAdvisory("finished summation " << name); if (sum->isBad()) { // // Summing good modules can produce a bad module. // // We never want to cache bad modules. // IssueAdvisory(*sum << ": unable to make module summation " << QUOTE(name) << " due to earlier errors."); sum->removeUser(this); // since we are not adding a bad module to the cache sum->deepSelfDestruct(); return 0; } moduleMap[t] = sum; return sum; } void ModuleCache::destructUnusedModules() { // // This O(n^2) solution to finding unused cached modules is slow but // simple. If the number of cached modules grows beyond a few hundred // a more complex O(n) solution based on keeping a linked list of // candidates would be appropriate. We would need a call back from // ImportModule to tell us when a module is down to 1 user (us!). // restart: { FOR_EACH_CONST(i, ModuleMap, moduleMap) { int nrUsers = i->second->getNrUsers(); Assert(nrUsers >= 1, "no users"); // we are a user if (nrUsers == 1) { DebugAdvisory("module " << i->second << " has no other users"); i->second->deepSelfDestruct(); // invalidates i goto restart; } } } } void ModuleCache::showCreatedModules(ostream& s) const { FOR_EACH_CONST(i, ModuleMap, moduleMap) { MixfixModule* m = i->second; s << MixfixModule::moduleTypeString(m->getModuleType()) << ' ' << m << '\n'; } } Maude-2.6/src/Mixfix/trial.cc0000644000147300135640000001072111475314511013025 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for tracing trails of conditional mbs/eqs/rls. // int UserLevelRewritingContext::trialCount = 0; int UserLevelRewritingContext::traceBeginEqTrial(DagNode* subject, const Equation* equation) { Assert(equation != 0, "null equation in trial"); if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileEqConditionStart(equation); } if (handleDebug(subject, equation)) return UNDEFINED; if (!localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_EQ)) || dontTrace(subject, equation)) return UNDEFINED; cout << header << "trial #" << ++trialCount << '\n' << equation << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *equation); return trialCount; } int UserLevelRewritingContext::traceBeginRuleTrial(DagNode* subject, const Rule* rule) { Assert(rule != 0, "null rule in trial"); if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileRlConditionStart(rule); } if (handleDebug(subject, rule)) return UNDEFINED; if (!localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_RL)) || dontTrace(subject, rule)) return UNDEFINED; cout << header << "trial #" << ++trialCount << '\n' << rule << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *rule); return trialCount; } int UserLevelRewritingContext::traceBeginScTrial(DagNode* subject, const SortConstraint* sc) { Assert(sc != 0, "null membership axiom in trial"); if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileMbConditionStart(sc); } if (handleDebug(subject, sc)) return UNDEFINED; if (!localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_MB)) || dontTrace(subject, sc)) return UNDEFINED; cout << header << "trial #" << ++trialCount << '\n' << sc << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *sc); return trialCount; } void UserLevelRewritingContext::traceEndTrial(int trialRef, bool success) { if (!abortFlag && trialRef != UNDEFINED) cout << header << (success ? "success #" : "failure #") << trialRef << '\n'; } void UserLevelRewritingContext::traceExhausted(int trialRef) { if (!abortFlag && trialRef != UNDEFINED) cout << header << "exhausted (#" << trialRef << ")\n"; } void UserLevelRewritingContext::traceBeginFragment(int trialRef, const PreEquation* preEquation, int fragmentIndex, bool firstAttempt) { if (abortFlag || trialRef == UNDEFINED) return; ConditionFragment* fragment = (preEquation->getCondition())[fragmentIndex]; cout << header; if (!firstAttempt) cout << "re-"; cout << "solving condition fragment" << '\n' << fragment << '\n'; } void UserLevelRewritingContext::traceEndFragment(int trialRef, const PreEquation* preEquation, int fragmentIndex, bool success) { if (abortFlag || trialRef == UNDEFINED) return; if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileFragment(preEquation, fragmentIndex, success); } ConditionFragment* fragment = (preEquation->getCondition())[fragmentIndex]; if (success) { cout << header << "success for condition fragment" << '\n' << fragment << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *preEquation); } else cout << header << "failure for condition fragment" << '\n' << fragment << '\n'; } Maude-2.6/src/Mixfix/moduleExpression.cc0000644000147300135640000000721511062337360015262 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ModuleExpression. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "core.hh" #include "interface.hh" #include "mixfix.hh" // front end class definitions #include "token.hh" #include "renaming.hh" #include "moduleExpression.hh" ModuleExpression::ModuleExpression(Token moduleName) : type(MODULE), moduleName(moduleName) { } ModuleExpression::ModuleExpression(ModuleExpression* left, ModuleExpression* right) : type(SUMMATION) { if (right->type == SUMMATION) { modules.swap(right->modules); delete right; } else modules.push_front(right); if (left->type == SUMMATION) { modules.splice(modules.begin(), left->modules); delete left; } else modules.push_front(left); } ModuleExpression::ModuleExpression(ModuleExpression* module, Renaming* renaming) : type(RENAMING), module(module), renaming(renaming) { } ModuleExpression::ModuleExpression(ModuleExpression* module, const Vector& arguments) : type(INSTANTIATION), module(module), arguments(arguments) { } void ModuleExpression::deepSelfDestruct() { switch (type) { case RENAMING: delete renaming; // fall thru case INSTANTIATION: module->deepSelfDestruct(); break; case SUMMATION: { FOR_EACH_CONST(i, list, modules) (*i)->deepSelfDestruct(); break; } case MODULE: ; // nothing to delete - avoid compiler warning } delete this; } ostream& operator<<(ostream& s, const ModuleExpression* expr) { switch (expr->getType()) { case ModuleExpression::MODULE: { s << expr->getModuleName(); break; } case ModuleExpression::SUMMATION: { const list& modules = expr->getModules(); const char* sep = ""; FOR_EACH_CONST(i, list, modules) { s << sep << *i; sep = " + "; } break; } case ModuleExpression::RENAMING: { const ModuleExpression* module = expr->getModule(); if (module->getType() == ModuleExpression::SUMMATION) s << '(' << module << ')'; else s << module; s << " * " << expr->getRenaming(); break; } case ModuleExpression::INSTANTIATION: { const ModuleExpression* module = expr->getModule(); if (module->getType() == ModuleExpression::SUMMATION || module->getType() == ModuleExpression::RENAMING) s << '(' << module << "){"; else s << module << '{'; const Vector& arguments = expr->getArguments(); const Vector::const_iterator e = arguments.end(); for (Vector::const_iterator i = arguments.begin();;) { s << *i; ++i; if (i == e) break; s << ", "; } s << '}'; break; } default: CantHappen("not implemented"); } return s; } Maude-2.6/src/Mixfix/token.hh0000644000147300135640000001472011050702527013044 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for parser tokens. // #ifndef _token_hh_ #define _token_hh_ #include #include "ropeStuff.hh" #include "stringTable.hh" class Token { public: // // Can't have a constructor or destructor because // we want to be in the bison stack union. // enum SpecialProperties { SMALL_NAT, SMALL_NEG, ZERO, QUOTED_IDENTIFIER, STRING, FLOAT, CONTAINS_COLON, ENDS_IN_COLON, ITER_SYMBOL, RATIONAL, LAST_PROPERTY }; enum AuxProperties { AUX_SORT, AUX_STRUCTURED_SORT, AUX_VARIABLE, AUX_CONSTANT, AUX_KIND }; void tokenize(const char* tokenString, int lineNumber); void tokenize(int code, int lineNumber); static int parameterRename(int parameterCode, int originalCode); void fixUp(const char* tokenString, int& lineNumber); void dropChar(const Token& original); void makePrefixName(const Vector& opBubble); const char* name() const; int code() const; int lineNumber() const; int specialProperty() const; int auxProperty() const; bool getInt(int& value) const; static const char* name(int code); static crope sortName(int code); static int specialProperty(int code); static int auxProperty(int code); static int encode(const char* tokenString); static int dotNameCode(int sortNameCode); static int quoteNameCode(int idCode); static int extractMixfix(int prefixNameCode, Vector& mixfixSyntax); static bool specialChar(char c); static int backQuoteSpecials(int code); static int unBackQuoteSpecials(int code); static void printTokenVector(ostream& s, const Vector& tokens, int first, int last, bool fancySpacing); static bool split(int code, int& prefix, int& suffix); static bool split(int code, int& opName, mpz_class& number); static bool splitKind(int code, Vector& codes); static void splitParameterizedSort(int code, Vector& codes); static void splitParameterList(int code, int& header, Vector& parameters); static int joinParameterList(int header, const Vector& parameters); static Int64 codeToInt64(int code); static int int64ToCode(Int64 i); static double codeToDouble(int code); static int doubleToCode(double d); static crope codeToRope(int code); static void ropeToString(const crope& rope, string& result); static int ropeToPrefixNameCode(const crope& r); static int bubbleToPrefixNameCode(const Vector& opBubble); void getRational(mpz_class& numerator, mpz_class& denominator); static void printTokens(ostream& s, const Vector& tokens, const char* seperator); static void peelParens(Vector& tokens); static void peelParen(Vector& tokens); static int flaggedCode(int code); static bool isFlagged(int code); static int unflaggedCode(int code); private: enum SpecialValues { FLAG_BIT = 0x40000000 // we set this bit to create flagged codes }; static void bufferExpandTo(int size); static void reallocateBuffer(int length); static void checkForSpecialProperty(const char* tokenString); static int computeAuxProperty(const char* tokenString); static const char* skipSortName(const char* tokenString, bool& parameterized); static bool looksLikeRational(const char* s); static StringTable stringTable; static Vector specialProperties; static Vector auxProperties; static char* buffer; static int bufferLength; int codeNr; int lineNr; }; inline void Token::makePrefixName(const Vector& opBubble) { codeNr = bubbleToPrefixNameCode(opBubble); lineNr = opBubble[0].lineNr; } inline int Token::encode(const char* tokenString) { int code = stringTable.encode(tokenString); if (code == specialProperties.length()) checkForSpecialProperty(tokenString); return code; } inline int Token::specialProperty() const { return specialProperties[codeNr]; } inline int Token::auxProperty() const { return auxProperties[codeNr]; } inline int Token::specialProperty(int code) { return specialProperties[code]; } inline int Token::auxProperty(int code) { return auxProperties[code]; } inline bool Token::specialChar(char c) { return c == '(' || c == ')' || c == '[' || c == ']' || c == '{' || c == '}' || c == ','; } inline int Token::backQuoteSpecials(int code) { const char* s = stringTable.name(code); char c = s[0]; if (specialChar(s[0]) && s[1] == '\0') { char t[3]; t[0] = '`'; t[1] = c; t[2] = '\0'; return encode(t); } return code; } inline int Token::unBackQuoteSpecials(int code) { const char* s = stringTable.name(code); if (s[0] == '`' && specialChar(s[1]) && s[2] == '\0') return encode(s + 1); return code; } inline void Token::bufferExpandTo(int length) { if (length > bufferLength) reallocateBuffer(length); } inline void Token::tokenize(const char* tokenString, int lineNumber) { codeNr = encode(tokenString); lineNr = lineNumber; } inline void Token::tokenize(int code, int lineNumber) { Assert(code >= 0, "bad code = " << code); codeNr = code; lineNr = lineNumber; } inline const char* Token::name() const { return stringTable.name(codeNr); } inline int Token::code() const { return codeNr; } inline int Token::lineNumber() const { return lineNr; } inline const char* Token::name(int code) { return stringTable.name(code); } inline int Token::flaggedCode(int code) { return code | FLAG_BIT; } inline bool Token::isFlagged(int code) { return code & FLAG_BIT; } inline int Token::unflaggedCode(int code) { return code & ~FLAG_BIT; } ostream& operator<<(ostream& s, const Token& token); ostream& operator<<(ostream& s, const Vector& tokens); #endif Maude-2.6/src/Mixfix/loopSymbol.cc0000644000147300135640000001220707752274562014070 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class LoopSymbol. // // utility stuff #include "macros.hh" #include "vector.hh" //#include "stringTable.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "AU_Theory.hh" #include "NA_Theory.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "rawDagArgumentIterator.hh" #include "rawArgumentIterator.hh" #include "term.hh" // core class definitions #include "dagArgumentIterator.hh" #include "argumentIterator.hh" #include "substitution.hh" #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeDagNode.hh" // AU theory class definitions #include "AU_Symbol.hh" #include "AU_DagNode.hh" // built in class definitions #include "bindingMacros.hh" // front end class definitions #include "token.hh" #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierDagNode.hh" #include "loopSymbol.hh" #include "token.hh" const Vector LoopSymbol::eagerStrategy; LoopSymbol::LoopSymbol(int id) : FreeSymbol(id, 3, eagerStrategy) { qidSymbol = 0; nilQidListSymbol = 0; qidListSymbol = 0; } bool LoopSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { if (strcmp(purpose, "LoopSymbol") == 0) return data.length() == 0; return FreeSymbol::attachData(opDeclaration, purpose, data); } bool LoopSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, qidSymbol, QuotedIdentifierSymbol*); BIND_SYMBOL(purpose, symbol, nilQidListSymbol, Symbol*); BIND_SYMBOL(purpose, symbol, qidListSymbol, AU_Symbol*); return FreeSymbol::attachSymbol(purpose, symbol); } void LoopSymbol::copyAttachments(Symbol* original, SymbolMap* map) { LoopSymbol* orig = safeCast(LoopSymbol*, original); COPY_SYMBOL(orig, qidSymbol, map, QuotedIdentifierSymbol*); COPY_SYMBOL(orig, nilQidListSymbol, map, Symbol*); COPY_SYMBOL(orig, qidListSymbol, map, AU_Symbol*); FreeSymbol::copyAttachments(original, map); } void LoopSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { APPEND_DATA(purposes, data, LoopSymbol); FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void LoopSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, qidSymbol); APPEND_SYMBOL(purposes, symbols, nilQidListSymbol); APPEND_SYMBOL(purposes, symbols, qidListSymbol); FreeSymbol::getSymbolAttachments(purposes, symbols); } DagNode* LoopSymbol::injectInput(DagNode* loopNode, const Vector& bubble) { static Vector args(3); FreeDagNode* f = static_cast(loopNode); args[0] = createQidList(bubble); args[1] = f->getArgument(1); args[2] = new FreeDagNode(nilQidListSymbol); return makeDagNode(args); } DagNode* LoopSymbol::createQidList(const Vector& ids) { int nrIds = ids.length(); if (nrIds == 0) return new FreeDagNode(nilQidListSymbol); if (nrIds == 1) return new QuotedIdentifierDagNode(qidSymbol, ids[0].code()); Vector args(nrIds); for (int i = 0; i < nrIds; i++) args[i] = new QuotedIdentifierDagNode(qidSymbol, Token::backQuoteSpecials(ids[i].code())); return qidListSymbol->makeDagNode(args); } bool LoopSymbol::extractOutput(DagNode* loopNode, Vector& bubble) { FreeDagNode* f = static_cast(loopNode); return extractQidList(f->getArgument(2), bubble); } bool LoopSymbol::extractQid(DagNode* metaQid, int& id) { if (metaQid->symbol() == qidSymbol) { id = Token::unBackQuoteSpecials(static_cast(metaQid)->getIdIndex()); return true; } return false; } bool LoopSymbol::extractQidList(DagNode* metaQidList, Vector& ids) { ids.contractTo(0); Symbol* mq = metaQidList->symbol(); int id; if (mq == qidListSymbol) { for (DagArgumentIterator i(metaQidList); i.valid(); i.next()) { if (!extractQid(i.argument(), id)) return false; ids.append(id); } } else if (extractQid(metaQidList, id)) ids.append(id); else if (mq != nilQidListSymbol) return false; return true; } Maude-2.6/src/Mixfix/importModule.cc0000644000147300135640000003777311452741012014405 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class ImportModule. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" #include "binarySymbol.hh" // core class definitions #include "equation.hh" #include "rule.hh" #include "sortConstraint.hh" #include "conditionFragment.hh" // higher class definitions #include "equalityConditionFragment.hh" #include "sortTestConditionFragment.hh" #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" // front end class definitions #include "renaming.hh" #include "view.hh" #include "importModule.hh" #include "moduleCache.hh" #include "importTranslation.hh" #include "quotedIdentifierSymbol.hh" // our stuff #include "renameModule.cc" #include "parameterization.cc" ImportModule::ImportModule(int name, ModuleType moduleType, Origin origin, Entity::User* parent) : MixfixModule(name, moduleType), origin(origin) { if (parent != 0) addUser(parent); // HACK importPhase = UNVISITED; nrSortsFromParameters = 0; nrSymbolsFromParameters = 0; nrPolymorphsFromParameters = 0; protectCount = 0; canonicalRenaming = 0; baseModule = 0; } ImportModule::~ImportModule() { Assert(canonicalRenaming == 0, "undeleted canonicalRenaming in " << this); } bool ImportModule::parametersBound() const { // // Should only be called on modules that actually have parameters. // Assert(!parameterNames.empty(), "no parameters!"); if (origin == TEXT) return false; if (origin == RENAMING) return baseModule->parametersBound(); Assert(origin == INSTANTIATION, "bad origin " << origin); Assert(!viewArgs.empty(), "viewArgs empty"); return !paramArgs.empty(); // we init this vector iff our parameters are bound } void ImportModule::addImport(ImportModule* importedModule, ImportMode mode, LineNumber lineNumber) { ModuleType t = importedModule->getModuleType(); if (isTheory(t) && mode != INCLUDING) { // // Since we don't use or even store the mode we don't need // to do anything special to recover. // IssueWarning(lineNumber << ": theories may only be imported using the " << QUOTE("including") << " importation mode. Recovering by treating mode as including."); } if (!canImport(getModuleType(), t)) { // // Allowing modules to import theories would allow inconsistancies // to get into the parameterization mechanism. So we just disallow // illegal imports to avoid having to deal with tricky cases. // IssueWarning(lineNumber << ": importation of " << QUOTE(moduleTypeString(t)) << " by " << QUOTE(moduleTypeString(getModuleType())) << " not allowed. Recovering by ignoring import."); return; } importedModules.append(importedModule); importedModule->addUser(this); } void ImportModule::addParameter(const Token parameterName, ImportModule* parameterTheory) { if (findParameterIndex(parameterName.code()) != NONE) { IssueWarning(LineNumber(parameterName.lineNumber()) << ": there is already a parameter called " << QUOTE(parameterName) << ". Recovering by ignoring parameter."); return; } ModuleType t = parameterTheory->getModuleType(); WarningCheck(canHaveAsParameter(getModuleType(), t), LineNumber(parameterName.lineNumber()) << ": parameterization of " << QUOTE(moduleTypeString(getModuleType())) << " by " << QUOTE(moduleTypeString(t)) << " not allowed."); parameterNames.append(parameterName.code()); importedModules.append(parameterTheory); parameterTheory->addUser(this); } int ImportModule::findParameterIndex(int name) const { int nrParameters = parameterNames.size(); for (int i = 0; i < nrParameters; ++i) { if (parameterNames[i] == name) return i; } return NONE; } void ImportModule::closeSortSet() { nrUserSorts = getSorts().length(); // exclude error sorts MixfixModule::closeSortSet(); } void ImportModule::closeSignature() { DebugAdvisory("closeSignature() on " << this); const Vector& symbols = getSymbols(); nrUserSymbols = symbols.length(); // exclude polymorph instances nrUserDecls.expandTo(nrUserSymbols); for (int i = 0; i < nrUserSymbols; i++) nrUserDecls[i] = symbols[i]->getOpDeclarations().length(); // exclude comm completions MixfixModule::closeSignature(); } void ImportModule::regretToInform(Entity* /* doomedEntity */) { // // Something that we depend on is about to disappear - so we must self destruct. // deepSelfDestruct(); } void ImportModule::deepSelfDestruct() { // // First remove ourself from the list of users of each of our imports, parameters, // view arguments and base module. This is so we will not receive a regretToInform() // message after we delete ourself. // { FOR_EACH_CONST(i, Vector, importedModules) (*i)->removeUser(this); } { FOR_EACH_CONST(i, Vector, viewArgs) { if (*i != 0) (*i)->removeUser(this); } } if (baseModule != 0) baseModule->removeUser(this); // // Now we inform all our users of our impending demise. // informUsers(); // // Delete our canonical renaming. // delete canonicalRenaming; #ifndef NO_ASSERT canonicalRenaming = 0; #endif // // And then delete ourself or mark ourself for deletion. // DebugAdvisory("module " << this << " invalidated"); if (protectCount > 0) importPhase = DOOMED; else delete this; } bool ImportModule::unprotect() { --protectCount; if (protectCount == 0 && importPhase == DOOMED) { DebugAdvisory("module " << this << " deleted after delay"); delete this; return true; } return false; } // // Routines for sort and subsort importation. // void ImportModule::importSorts() { int nrParameters = getNrParameters(); int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) { if (i == nrParameters) nrSortsFromParameters = getSorts().size(); importedModules[i]->donateSorts(this); } const Vector sorts = getSorts(); nrImportedSorts = sorts.length(); nrImportedSubsorts.expandTo(nrImportedSorts); for (int i = 0; i < nrImportedSorts; i++) nrImportedSubsorts[i] = sorts[i]->getSubsorts().length(); } void ImportModule::donateSorts(ImportModule* importer) { Assert(!isBad(), "original module bad " << this); if (importPhase == SORTS_IMPORTED) return; Assert(importPhase == UNVISITED, "bad importPhase = " << importPhase); importPhase = SORTS_IMPORTED; // // First handle our own imports. // int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->donateSorts(importer); // // Now handle our sorts. // donateSorts2(importer); } // // Routines for operator importation. // void ImportModule::importOps() { int nrParameters = getNrParameters(); int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) { if (i == nrParameters) { nrSymbolsFromParameters = getSymbols().size(); nrPolymorphsFromParameters = getNrPolymorphs(); } importedModules[i]->donateOps(this); } const Vector& symbols = getSymbols(); nrImportedSymbols = symbols.length(); nrImportedDecls.expandTo(nrImportedSymbols); for (int i = 0; i < nrImportedSymbols; i++) nrImportedDecls[i] = symbols[i]->getOpDeclarations().length(); nrImportedPolymorphs = getNrPolymorphs(); } void ImportModule::donateOps(ImportModule* importer) { Assert(!isBad(), "original module bad " << this); if (importPhase == OPS_IMPORTED) return; Assert(importPhase == SORTS_IMPORTED, "bad importPhase = " << importPhase); importPhase = OPS_IMPORTED; // // First handle our own imports. // int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->donateOps(importer); // // Now handle our operators. // donateOps2(importer); } // // Routines for fixing up imported operations. // void ImportModule::fixUpImportedOps() { int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->fixUpDonatedOps(this); } void ImportModule::fixUpDonatedOps(ImportModule* importer) { if (importPhase == OPS_FIXED_UP) return; Assert(importPhase == OPS_IMPORTED, "bad importPhase = " << importPhase); importPhase = OPS_FIXED_UP; // // First handle our own imports. // int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->fixUpDonatedOps(importer); // // Handle our operators. // fixUpDonatedOps2(importer); } // // Routines for statement importation. // void ImportModule::importStatements() { int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->donateStatements(this); } void ImportModule::deepCopyCondition(ImportTranslation* importTranslation, const Vector& original, Vector& copy) { int nrFragments = original.length(); copy.expandTo(nrFragments); for (int i = 0; i < nrFragments; i++) { ConditionFragment* c = original[i]; ConditionFragment* n; if (EqualityConditionFragment* e = dynamic_cast(c)) { n = new EqualityConditionFragment(e->getLhs()->deepCopy(importTranslation), e->getRhs()->deepCopy(importTranslation)); } else if (SortTestConditionFragment* s = dynamic_cast(c)) { n = new SortTestConditionFragment(s->getLhs()->deepCopy(importTranslation), importTranslation->translate(s->getSort())); } else if(AssignmentConditionFragment* a = dynamic_cast(c)) { n = new AssignmentConditionFragment(a->getLhs()->deepCopy(importTranslation), a->getRhs()->deepCopy(importTranslation)); } else if(RewriteConditionFragment* r = dynamic_cast(c)) { n = new RewriteConditionFragment(r->getLhs()->deepCopy(importTranslation), r->getRhs()->deepCopy(importTranslation)); } else { CantHappen("bad condition fragment"); n = 0; // avoid compiler warning } copy[i] = n; } } void ImportModule::donateStatements(ImportModule* importer) { if (importPhase == STATEMENTS_IMPORTED) return; // // Normally statements are imported on demand after resetting, but in metalevel they can // be imported immediately after the operator fixup phase. // Assert(importPhase == UNVISITED || importPhase == OPS_FIXED_UP, "bad importPhase = " << importPhase); importPhase = STATEMENTS_IMPORTED; // // First handle our own imports. // int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->donateStatements(importer); // // The map from imported module's symbols to importing module's symbols // is built dynamically. // ImportTranslation importTranslation(importer); donateStatements2(importer, importTranslation); } void ImportModule::copyMetadata(ImportModule* importer, ImportTranslation& importTranslation, ItemType itemType, PreEquation* original, PreEquation* copy) { importer->insertMetadata(itemType, copy, getMetadata(itemType, original)); const PrintAttribute* p = getPrintAttribute(itemType, original); if (p != 0) { int nrItems = p->getNrItems(); Vector names(nrItems); Vector sorts(nrItems); for (int i = 0; i < nrItems; ++i) { int code = p->getTokenCode(i); if (code == NONE) { int index = p->getVariableIndex(i); VariableTerm* v = safeCast(VariableTerm*, original->index2Variable(index)); names[i] = v->id(); Sort* sort = v->getSort(); sorts[i] = importTranslation.translate(sort); } else { names[i] = code; sorts[i] = 0; } } importer->insertPrintAttribute(itemType, copy, names, sorts); } } void ImportModule::donateStatements2(ImportModule* importer, ImportTranslation& importTranslation) { if (canonicalRenaming != 0) { importTranslation.push(canonicalRenaming, this); baseModule->donateStatements2(importer, importTranslation); return; } // // Handle our membership axioms. // const Vector& membershipAxioms = getSortConstraints(); for (int i = 0; i < nrOriginalMembershipAxioms; i++) { SortConstraint* ma = membershipAxioms[i]; if (!(ma->isBad())) { int label = importTranslation.translateLabel(ma->getLabel().id()); Term* lhs = ma->getLhs()->deepCopy(&importTranslation); Sort* sort = importTranslation.translate(ma->getSort()); Vector condition; deepCopyCondition(&importTranslation, ma->getCondition(), condition); SortConstraint* copy = new SortConstraint(label, lhs, sort, condition); if (ma->isNonexec()) copy->setNonexec(); copy->setLineNumber(ma->getLineNumber()); importer->insertSortConstraint(copy); copyMetadata(importer, importTranslation, MEMB_AX, ma, copy); //importer->insertMetadata(MEMB_AX, copy, getMetadata(MEMB_AX, ma)); } } // // Now handle our equations. // const Vector& equations = getEquations(); for (int i = 0; i < nrOriginalEquations; i++) { Equation* e = equations[i]; if (!(e->isBad())) { int label = importTranslation.translateLabel(e->getLabel().id()); Term* lhs = e->getLhs()->deepCopy(&importTranslation); Term* rhs = e->getRhs()->deepCopy(&importTranslation); Vector condition; deepCopyCondition(&importTranslation, e->getCondition(), condition); Equation* copy = new Equation(label, lhs, rhs, e->isOwise(), condition); if (e->isNonexec()) copy->setNonexec(); copy->setLineNumber(e->getLineNumber()); importer->insertEquation(copy); copyMetadata(importer, importTranslation, EQUATION, e, copy); //importer->insertMetadata(EQUATION, copy, getMetadata(EQUATION, e)); } } // // Now handle our rules. // const Vector& rules = getRules(); for (int i = 0; i < nrOriginalRules; i++) { Rule* r = rules[i]; if (!(r->isBad())) { int label = importTranslation.translateLabel(r->getLabel().id()); Term* lhs = r->getLhs()->deepCopy(&importTranslation); Term* rhs = r->getRhs()->deepCopy(&importTranslation); Vector condition; deepCopyCondition(&importTranslation, r->getCondition(), condition); Rule* copy = new Rule(label, lhs, rhs, condition); if (r->isNonexec()) copy->setNonexec(); copy->setLineNumber(r->getLineNumber()); importer->insertRule(copy); copyMetadata(importer, importTranslation, RULE, r, copy); //importer->insertMetadata(RULE, copy, getMetadata(RULE, r)); } } } void ImportModule::resetImports() { int nrImportedModules = importedModules.length(); for (int i = 0; i < nrImportedModules; i++) importedModules[i]->resetImportPhase(); } void ImportModule::resetImportPhase() { if (importPhase == UNVISITED) return; importPhase = UNVISITED; resetImports(); } Maude-2.6/src/Mixfix/dagNodePrint.cc0000644000147300135640000003020411350307226014263 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // DagNode* -> ostream& pretty printer. // const char* MixfixModule::computeColor(ColoringInfo& coloringInfo, DagNode* dagNode) { if (interpreter.getPrintFlag(Interpreter::PRINT_COLOR)) { if (dagNode->isReduced()) { int index = coloringInfo.visited.pointer2Index(dagNode); Assert(index != NONE, "didn't visit dag node"); int status = coloringInfo.statusVec[index]; if (!(status & CONSTRUCTOR)) { return Tty((status & STRANGENESS_BELOW) ? Tty::BLUE : Tty::RED).ctrlSequence(); } } else { return Tty(coloringInfo.reducedAbove ? (coloringInfo.reducedDirectlyAbove ? Tty::MAGENTA : Tty::CYAN) : Tty::GREEN).ctrlSequence(); } } return 0; } void MixfixModule::prefix(ostream& s, bool needDisambig, const char* color) { if (needDisambig) s << '('; if (color != 0) s << color; } void MixfixModule::suffix(ostream& s, DagNode* dagNode, bool needDisambig, const char* color) { if (color != 0) s << Tty(Tty::RESET); if (needDisambig) { Symbol* symbol = dagNode->symbol(); int sortIndex = dagNode->getSortIndex(); if (sortIndex <= Sort::ERROR_SORT) sortIndex = chooseDisambiguator(symbol); s << ")." << symbol->rangeComponent()->sort(sortIndex); } } bool MixfixModule::handleIter(ostream& s, ColoringInfo& coloringInfo, DagNode* dagNode, SymbolInfo& si, bool rangeKnown, const char* color) { if (!(si.symbolType.hasFlag(SymbolType::ITER))) return false; if (si.symbolType.getBasicType() == SymbolType::SUCC_SYMBOL && interpreter.getPrintFlag(Interpreter::PRINT_NUMBER)) { SuccSymbol* succSymbol = safeCast(SuccSymbol*, dagNode->symbol()); if (succSymbol->isNat(dagNode)) { const mpz_class& nat = succSymbol->getNat(dagNode); bool needDisambig = !rangeKnown && (kindsWithSucc.size() > 1 || overloadedIntegers.count(nat)); prefix(s, needDisambig, color); s << nat; suffix(s, dagNode, needDisambig, color); return true; } } S_DagNode* sd = safeCast(S_DagNode*, dagNode); const mpz_class& number = sd->getNumber(); if (number == 1) return false; // do default thing // NEED TO FIX: disambig string prefixName; makeIterName(prefixName, dagNode->symbol()->id(), number); if (color != 0) s << color << prefixName << Tty(Tty::RESET); else printPrefixName(s, prefixName.c_str(), si); s << '('; if (interpreter.getPrintFlag(Interpreter::PRINT_COLOR)) { coloringInfo.reducedDirectlyAbove = dagNode->isReduced(); coloringInfo.reducedAbove = coloringInfo.reducedAbove || coloringInfo.reducedDirectlyAbove; } prettyPrint(s, coloringInfo, sd->getArgument(), PREFIX_GATHER, UNBOUNDED, 0, UNBOUNDED, 0, rangeKnown); s << ')'; return true; } bool MixfixModule::handleMinus(ostream& s, DagNode* dagNode, bool rangeKnown, const char* color) { if (interpreter.getPrintFlag(Interpreter::PRINT_NUMBER)) { const MinusSymbol* minusSymbol = safeCast(MinusSymbol*, dagNode->symbol()); if (minusSymbol->isNeg(dagNode)) { mpz_class neg; (void) minusSymbol->getNeg(dagNode, neg); bool needDisambig = !rangeKnown && (kindsWithMinus.size() > 1 || overloadedIntegers.count(neg)); prefix(s, needDisambig, color); s << neg; suffix(s, dagNode, needDisambig, color); return true; } } return false; } bool MixfixModule::handleDivision(ostream& s, DagNode* dagNode, bool rangeKnown, const char* color) { if (interpreter.getPrintFlag(Interpreter::PRINT_RAT)) { const DivisionSymbol* divisionSymbol = safeCast(DivisionSymbol*, dagNode->symbol()); if (divisionSymbol->isRat(dagNode)) { pair rat; rat.second = divisionSymbol->getRat(dagNode, rat.first); bool needDisambig = !rangeKnown && (kindsWithDivision.size() > 1 || overloadedRationals.count(rat)); prefix(s, needDisambig, color); s << rat.first << '/' << rat.second; suffix(s, dagNode, needDisambig, color); return true; } } return false; } void MixfixModule::handleFloat(ostream& s, DagNode* dagNode, bool rangeKnown, const char* color) { double mfValue = safeCast(FloatDagNode*, dagNode)->getValue(); bool needDisambig = !rangeKnown && (floatSymbols.size() > 1 || overloadedFloats.count(mfValue)); prefix(s, needDisambig, color); s << doubleToString(mfValue); suffix(s, dagNode, needDisambig, color); } void MixfixModule::handleString(ostream& s, DagNode* dagNode, bool rangeKnown, const char* color) { string strValue; Token::ropeToString(safeCast(StringDagNode*, dagNode)->getValue(), strValue); bool needDisambig = !rangeKnown && (stringSymbols.size() > 1 || overloadedStrings.count(strValue)); prefix(s, needDisambig, color); s << strValue; suffix(s, dagNode, needDisambig, color); } void MixfixModule::handleQuotedIdentifier(ostream& s, DagNode* dagNode, bool rangeKnown, const char* color) { int qidCode = safeCast(QuotedIdentifierDagNode*, dagNode)->getIdIndex(); bool needDisambig = !rangeKnown && (quotedIdentifierSymbols.size() > 1 || overloadedQuotedIdentifiers.count(qidCode)); prefix(s, needDisambig, color); s << '\'' << Token::name(qidCode); suffix(s, dagNode, needDisambig, color); } void MixfixModule::handleVariable(ostream& s, DagNode* dagNode, bool rangeKnown, const char* color) { VariableDagNode* v = safeCast(VariableDagNode*, dagNode); Sort* sort = safeCast(VariableSymbol*, dagNode->symbol())->getSort(); pair p(v->id(), sort->id()); bool needDisambig = !rangeKnown && overloadedVariables.count(p); // kinds not handled prefix(s, needDisambig, color); printVariable(s, p.first, sort); suffix(s, dagNode, needDisambig, color); } void MixfixModule::prettyPrint(ostream& s, ColoringInfo& coloringInfo, DagNode* dagNode, int requiredPrec, int leftCapture, const ConnectedComponent* leftCaptureComponent, int rightCapture, const ConnectedComponent* rightCaptureComponent, bool rangeKnown) { if (UserLevelRewritingContext::interrupted()) return; #ifndef NO_ASSERT if (dagNode == 0) { s << "!!! NULL POINTER !!!"; return; } #endif const char* color = computeColor(coloringInfo, dagNode); Symbol* symbol = dagNode->symbol(); SymbolInfo& si = symbolInfo[symbol->getIndexWithinModule()]; // // Check for special i/o representation. // if (handleIter(s, coloringInfo, dagNode, si, rangeKnown, color)) return; int basicType = si.symbolType.getBasicType(); switch (basicType) { case SymbolType::MINUS_SYMBOL: { if (handleMinus(s, dagNode, rangeKnown, color)) return; break; } case SymbolType::DIVISION_SYMBOL: { if (handleDivision(s, dagNode, rangeKnown, color)) return; break; } case SymbolType::FLOAT: { handleFloat(s, dagNode, rangeKnown, color); return; } case SymbolType::STRING: { handleString(s, dagNode, rangeKnown, color); return; } case SymbolType::QUOTED_IDENTIFIER: { handleQuotedIdentifier(s, dagNode, rangeKnown, color); return; } case SymbolType::VARIABLE: { handleVariable(s, dagNode, rangeKnown, color); return; } default: break; } // // Default case where no special i/o representation applies. // int iflags = si.iflags; bool needDisambig = !rangeKnown && ambiguous(iflags); bool argRangeKnown = !(iflags & ADHOC_OVERLOADED) || (!(iflags & RANGE_OVERLOADED) && (rangeKnown || needDisambig)); int nrArgs = symbol->arity(); if (interpreter.getPrintFlag(Interpreter::PRINT_COLOR)) { coloringInfo.reducedDirectlyAbove = dagNode->isReduced(); coloringInfo.reducedAbove = coloringInfo.reducedAbove || coloringInfo.reducedDirectlyAbove; } if (needDisambig) s << '('; bool printConceal = interpreter.concealedSymbol(symbol); if ((interpreter.getPrintFlag(Interpreter::PRINT_MIXFIX) && si.mixfixSyntax.length() != 0 && !printConceal) || (basicType == SymbolType::SORT_TEST)) { bool printWithParens = interpreter.getPrintFlag(Interpreter::PRINT_WITH_PARENS); bool needParen = !needDisambig && (printWithParens || requiredPrec < si.prec || ((iflags & LEFT_BARE) && leftCapture <= si.gather[0] && leftCaptureComponent == symbol->domainComponent(0)) || ((iflags & RIGHT_BARE) && rightCapture <= si.gather[nrArgs - 1] && rightCaptureComponent == symbol->domainComponent(nrArgs - 1))); bool needAssocParen = si.symbolType.hasFlag(SymbolType::ASSOC) && (printWithParens || si.gather[1] < si.prec || ((iflags & LEFT_BARE) && (iflags & RIGHT_BARE) && si.prec <= si.gather[0])); if (needParen) s << '('; int nrTails = 1; int pos = 0; DagArgumentIterator a(*dagNode); int moreArgs = a.valid(); for (int arg = 0; moreArgs; arg++) { DagNode* d = a.argument(); a.next(); moreArgs = a.valid(); pos = printTokens(s, si, pos, color); if (arg == nrArgs - 1 && moreArgs) { ++nrTails; arg = 0; if (needAssocParen) s << '('; pos = printTokens(s, si, 0, color); } int lc = UNBOUNDED; const ConnectedComponent* lcc = 0; int rc = UNBOUNDED; const ConnectedComponent* rcc = 0; if (arg == 0 && (iflags & LEFT_BARE)) { rc = si.prec; rcc = symbol->domainComponent(0); if (!needParen && !needDisambig) { lc = leftCapture; lcc = leftCaptureComponent; } } else if (!moreArgs && (iflags & RIGHT_BARE)) { lc = si.prec; lcc = symbol->domainComponent(nrArgs - 1); if (!needParen && !needDisambig) { rc = rightCapture; rcc = rightCaptureComponent; } } prettyPrint(s, coloringInfo, d, si.gather[arg], lc, lcc, rc, rcc, argRangeKnown); if (UserLevelRewritingContext::interrupted()) return; } printTails(s, si, pos, nrTails, needAssocParen, true, color); if (UserLevelRewritingContext::interrupted()) return; if (needParen) s << ')'; } else { const char* prefixName = Token::name(symbol->id()); if (color != 0) s << color << prefixName << Tty(Tty::RESET); else printPrefixName(s, prefixName, si); DagArgumentIterator a(*dagNode); if (a.valid()) { if (printConceal) s << "(...)"; else { int nrTails = 1; s << '('; for (int arg = 0;; arg++) { DagNode* d = a.argument(); a.next(); int moreArgs = a.valid(); if (arg >= nrArgs - 1 && !(interpreter.getPrintFlag(Interpreter::PRINT_FLAT)) && moreArgs) { ++nrTails; if (color != 0) s << color << prefixName << Tty(Tty::RESET); else printPrefixName(s, prefixName, si); s << '('; } prettyPrint(s, coloringInfo, d, PREFIX_GATHER, UNBOUNDED, 0, UNBOUNDED, 0, argRangeKnown); if (UserLevelRewritingContext::interrupted()) return; if (!moreArgs) break; s << ", "; } while (nrTails-- > 0) { if (UserLevelRewritingContext::interrupted()) return; s << ')'; } } } } if (needDisambig) { int sortIndex = dagNode->getSortIndex(); if (sortIndex <= Sort::ERROR_SORT) sortIndex = chooseDisambiguator(symbol); s << ")." << symbol->rangeComponent()->sort(sortIndex); } } Maude-2.6/src/Mixfix/ops.cc0000644000147300135640000002534011145115106012507 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ #define LINE_NUMBER LineNumber(opDef.types[0].tokens[0].lineNumber()) void SyntacticPreModule::addVarDecl(Token varName) { if (!lastSawOpDecl) { int nrOpDefs = opDefs.length(); opDefs.expandBy(1); opDefs[nrOpDefs].symbolType.setBasicType(SymbolType::VARIABLE); } int nrOpDecls = opDecls.length(); opDecls.expandBy(1); opDecls[nrOpDecls].prefixName = varName; opDecls[nrOpDecls].defIndex = opDefs.length() - 1; lastSawOpDecl = true; } void SyntacticPreModule::addOpDecl(const Vector& opName) { if (!lastSawOpDecl) opDefs.expandBy(1); int nrOpDecls = opDecls.length(); opDecls.expandBy(1); opDecls[nrOpDecls].prefixName.makePrefixName(opName); opDecls[nrOpDecls].defIndex = opDefs.length() - 1; lastSawOpDecl = true; } void SyntacticPreModule::addType(bool kind, const Vector& tokens) { OpDef& opDef = opDefs[opDefs.length() - 1]; opDef.types.expandBy(1); Type& type = opDef.types[opDef.types.length() - 1]; type.kind = kind; type.tokens = tokens; // deep copy lastSawOpDecl = false; } void SyntacticPreModule::convertSortsToKinds() { Assert(!lastSawOpDecl, "missing sort specs"); OpDef& opDef = opDefs[opDefs.length() - 1]; int nrTypes = opDef.types.length(); for (int i = 0; i < nrTypes; i++) { if (opDef.types[i].kind) { IssueWarning(LineNumber(opDef.types[i].tokens[0].lineNumber()) << ": superfluous [] notation in operation declaration"); } else opDef.types[i].kind = true; } } void SyntacticPreModule::setIdentity(const Vector& identity) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.identity.empty()) opDef.identity = identity; // deep copy else IssueWarning(LINE_NUMBER << ": multiple identity declarations."); } void SyntacticPreModule::setFlag(int flag) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(flag)) { if (flag & SymbolType::SIMPLE_ATTRIBUTES) IssueWarning(LINE_NUMBER << ": duplicate attributes."); } else opDef.symbolType.setFlags(flag); } void SyntacticPreModule::setPrec(Token precTok) { int prec; if (precTok.getInt(prec) && prec >= MixfixModule::MIN_PREC && prec <= MixfixModule::MAX_PREC) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::PREC)) IssueWarning(LINE_NUMBER << ": multiple precedence attributes."); else { opDef.prec = prec; opDef.symbolType.setFlags(SymbolType::PREC); } } else { IssueWarning(LineNumber(precTok.lineNumber()) << ": bad value " << QUOTE(precTok) << " for prec attribute."); } } void SyntacticPreModule::setGather(const Vector& gather) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::GATHER)) { IssueWarning(LINE_NUMBER << ": multiple gather attributes."); return; } int length = gather.length(); if (length != opDef.types.length() - 1) { IssueWarning(LINE_NUMBER << ": bad gather length."); return; } for (int i = 0; i < length; i++) { const char* string = gather[i].name(); if (string[0] != '\0' && string[1] == '\0') { switch(string[0]) { case '&': opDef.gather.append(MixfixModule::GATHER_AMP); continue; case 'E': opDef.gather.append(MixfixModule::GATHER_E); continue; case 'e': opDef.gather.append(MixfixModule::GATHER_e); continue; } } IssueWarning(LineNumber(gather[i].lineNumber()) << ": bad value " << QUOTE(string) << " in gather attribute. Recovering by ignoring gather attribute."); opDef.gather.clear(); // for safety return; } opDef.symbolType.setFlags(SymbolType::GATHER); } void SyntacticPreModule::setMetadata(Token metaDataTok) { if (metaDataTok.specialProperty() == Token::STRING) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.metadata == NONE) opDef.metadata = metaDataTok.code(); else IssueWarning(LINE_NUMBER << ": multiple metadata attributes."); //opDef.symbolType.setFlags(SymbolType::METADATA); } else { IssueWarning(LineNumber(metaDataTok.lineNumber()) << ": bad value " << QUOTE(metaDataTok) << " for metadata attribute."); } } bool SyntacticPreModule::checkFormatString(const char* string) { if (string[0] == 'd' && string[1] == '\0') return true; for(;;) { switch (*string++) { case '\0': return true; case '+': case '-': case 's': case 't': case 'n': case 'i': #define MACRO(m, t) case m: #include "ansiEscapeSequences.cc" #undef MACRO case 'o': continue; default: return false; } } } void SyntacticPreModule::setFormat(const Vector& format) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::FORMAT)) { IssueWarning(LINE_NUMBER << ": multiple format attributes."); return; } int length = format.length(); for (int i = 0; i < length; i++) { const char* str = format[i].name(); if (checkFormatString(str)) opDef.format.append(format[i].code()); else { IssueWarning(LineNumber(format[i].lineNumber()) << ": bad value " << QUOTE(str) << " in format attribute. Recovering by ignoring format attribute."); opDef.format.clear(); // for safety return; } } opDef.symbolType.setFlags(SymbolType::FORMAT); } void SyntacticPreModule::setFrozen(const Vector& frozen) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::FROZEN)) { IssueWarning(LINE_NUMBER << ": multiple frozen attributes."); return; } int maxArgPos = opDef.types.length() - 1; int length = frozen.length(); if (length == 0) { if (maxArgPos == 0) { IssueWarning("cannot have frozen attribute for constant."); return; } for (int i = 0; i < maxArgPos; i++) opDef.frozen.insert(i); } else { for (int i = 0; i < length; i++) { const char* str = frozen[i].name(); char* pointer; long argPos = strtol(str, &pointer, 10); if (pointer != str && *pointer == '\0' && argPos >= 1 && argPos <= maxArgPos) { WarningCheck(!(opDef.frozen.contains(argPos - 1)), LineNumber(frozen[i].lineNumber()) << ": argument " << QUOTE(argPos) << " mentioned twice in frozen attribute."); opDef.frozen.insert(argPos - 1); } else { IssueWarning(LineNumber(frozen[i].lineNumber()) << ": bad value " << QUOTE(str) << " in frozen attribute. Recovering by ignoring frozen attribute."); opDef.frozen.clear(); // for safety return; } } } opDef.symbolType.setFlags(SymbolType::FROZEN); } void SyntacticPreModule::setStrat(const Vector& strategy) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::STRAT)) { IssueWarning(LINE_NUMBER << ": multiple strategy attributes."); return; } int maxArgPos = opDef.types.length(); int length = strategy.length(); for (int i = 0; i < length; i++) { const char* str = strategy[i].name(); char* pointer; long argPos = strtol(str, &pointer, 10); if (pointer != str && *pointer == '\0' && argPos >= -maxArgPos && argPos <= maxArgPos) opDef.strategy.append(static_cast(argPos)); else { IssueWarning(LineNumber(strategy[i].lineNumber()) << ": bad value " << QUOTE(str) << " in strategy attribute. Recovering by ignoring strategy attribute."); opDef.strategy.clear(); // for safety return; } } opDef.symbolType.setFlags(SymbolType::STRAT); } void SyntacticPreModule::setPoly(const Vector& polyArgs) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::POLY)) { IssueWarning(LINE_NUMBER << ": multiple polymorphic attributes."); return; } int maxArgPos = opDef.types.length(); int length = polyArgs.length(); for (int i = 0; i < length; i++) { const char* str = polyArgs[i].name(); char* pointer; long argPos = strtol(str, &pointer, 10); if (pointer != str && *pointer == '\0' && argPos >= 0 && argPos <= maxArgPos) opDef.polyArgs.insert(argPos); else { IssueWarning(LineNumber(polyArgs[i].lineNumber()) << ": bad value " << QUOTE(str) << " in polymorphic attribute. Recovering by ignoring value."); } } opDef.symbolType.setFlags(SymbolType::POLY); } void SyntacticPreModule::setLatexMacro(const string& latexMacro) { OpDef& opDef = opDefs[opDefs.length() - 1]; if (opDef.symbolType.hasFlag(SymbolType::LATEX)) IssueWarning(LINE_NUMBER << ": multiple latex attributes."); else { opDef.latexMacro = latexMacro; opDef.symbolType.setFlags(SymbolType::LATEX); } } void SyntacticPreModule::addHook(HookType type, Token name, const Vector& details) { int code = name.code(); OpDef& opDef = opDefs[opDefs.length() - 1]; int nrHooks = opDef.special.length(); opDef.special.expandBy(1); Hook& hook = opDef.special[nrHooks]; hook.type = type; hook.name = code; hook.details = details; // deep copy if (type == ID_HOOK) { int b = SymbolType::specialNameToBasicType(name.name()); if (b != SymbolType::STANDARD) opDef.symbolType.setBasicType(b); } } void SyntacticPreModule::makeOpDeclsConsistent() { // // Call if we encounter a syntax error while parsing module to make sure // opDefs/opDecls are left in a good state. // int nrOpDefs = opDefs.length(); if (nrOpDefs == 0) return; int lastDefIndex = nrOpDefs - 1; if(opDefs[lastDefIndex].types.length() == 0) { // // Problem: we have op decls for which op def has not been // properly filled in; quietly delete them and reset // lastSawOpDecl flag // int m = opDecls.length(); while (m > 0 && opDecls[m - 1].defIndex == lastDefIndex) --m; opDecls.contractTo(m); lastSawOpDecl = false; } } Maude-2.6/src/Mixfix/printAttribute.hh0000644000147300135640000000343611053414104014740 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2008 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for holding and printing print attributes. // #ifndef _printAttribute_hh_ #define _printAttribute_hh_ class PrintAttribute { public: void fillOut(const PreEquation& statement, const Vector& names, const Vector& sorts); int getNrItems() const; int getTokenCode(int i) const; int getVariableIndex(int i) const; void print(ostream& s, const VariableInfo& variableInfo) const; // for show void print(ostream& s, const Substitution& substitution) const; // for runtime private: static int findVariableIndex(const VariableInfo& variableInfo, int name, Sort* sort); Vector items; // -ve values are variable indices }; inline int PrintAttribute::getNrItems() const { return items.size(); } inline int PrintAttribute::getTokenCode(int i) const { return items[i] > 0 ? items[i] : NONE; } inline int PrintAttribute::getVariableIndex(int i) const { return items[i] < 0 ? (-1 - items[i]) : NONE; } #endif Maude-2.6/src/Mixfix/maudemlBuffer.cc0000644000147300135640000003545410460030134014467 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class MaudemlBuffer. // // utility stuff #include "macros.hh" #include "vector.hh" #include "pointerSet.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "NA_Theory.hh" #include "S_Theory.hh" #include "higher.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "argumentIterator.hh" #include "dagArgumentIterator.hh" #include "sort.hh" #include "connectedComponent.hh" #include "equation.hh" #include "rule.hh" #include "sortConstraint.hh" #include "conditionFragment.hh" #include "module.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" #include "variableDagNode.hh" // S theory class definitions #include "S_Symbol.hh" #include "S_Term.hh" #include "S_DagNode.hh" // builtin class definitions //#include "sortTestSymbol.hh" #include "floatSymbol.hh" #include "floatTerm.hh" #include "floatDagNode.hh" #include "stringSymbol.hh" #include "stringTerm.hh" #include "stringDagNode.hh" // higher class definitions #include "equalityConditionFragment.hh" #include "sortTestConditionFragment.hh" #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" #include "rewriteSequenceSearch.hh" #include "pattern.hh" // front end class definitions #include "token.hh" #include "timer.hh" #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierTerm.hh" #include "quotedIdentifierDagNode.hh" #include "maudemlBuffer.hh" MaudemlBuffer::MaudemlBuffer(ostream& output) : XmlBuffer(output, 1) { beginElement("maudeml"); } void MaudemlBuffer::generateShowSearchPath(int stateNr) { beginElement("show"); attributePair("item", "search path"); attributePair("state-number", int64ToString(stateNr)); endElement(); } void MaudemlBuffer::generateShowSearchGraph() { beginElement("show"); attributePair("item", "search graph"); endElement(); } void MaudemlBuffer::generateReduce(DagNode* subject) { beginElement("reduce"); attributePair("module", Token::name(subject->symbol()->getModule()->id())); generate(subject); endElement(); } void MaudemlBuffer::generateRewrite(DagNode* subject, Int64 limit) { beginElement("rewrite"); attributePair("module", Token::name(subject->symbol()->getModule()->id())); if (limit != NONE) attributePair("limit", int64ToString(limit)); generate(subject); endElement(); } void MaudemlBuffer::generateFrewrite(DagNode* subject, Int64 limit, Int64 gas) { beginElement("frewrite"); attributePair("module", Token::name(subject->symbol()->getModule()->id())); if (limit != NONE) attributePair("limit", int64ToString(limit)); if (gas != NONE) attributePair("gas", int64ToString(gas)); generate(subject); endElement(); } void MaudemlBuffer::generateErewrite(DagNode* subject, Int64 limit, Int64 gas) { beginElement("erewrite"); attributePair("module", Token::name(subject->symbol()->getModule()->id())); if (limit != NONE) attributePair("limit", int64ToString(limit)); if (gas != NONE) attributePair("gas", int64ToString(gas)); generate(subject); endElement(); } void MaudemlBuffer::generateSearch(DagNode* subject, PreEquation* pattern, const string& searchType, Int64 limit, Int64 depth) { beginElement("search"); attributePair("module", Token::name(subject->symbol()->getModule()->id())); attributePair("search-type", searchType); if (limit != NONE) attributePair("limit", int64ToString(limit)); if (depth != NONE) attributePair("depth", int64ToString(depth)); generate(subject); generate(pattern->getLhs()); if (pattern->hasCondition()) generateCondition(pattern->getCondition()); endElement(); } void MaudemlBuffer::generateContinue(const string& command, Module* module, Int64 limit) { beginElement("continue"); attributePair("command", command); attributePair("module", Token::name(module->id())); if (limit != NONE) attributePair("limit", int64ToString(limit)); endElement(); } void MaudemlBuffer::generateSearchResult(Int64 number, RewriteSequenceSearch* state, const Timer& timer, bool showStats, bool showTiming, bool showBreakdown) { beginElement("search-result"); if (number == NONE) attributePair("solution-number", "NONE"); else { attributePair("solution-number", int64ToString(number)); attributePair("state-number", int64ToString(state->getStateNr())); } if (showStats) { attributePair("total-states", int64ToString(state->getNrStates())); generateStats(*(state->getContext()), timer, showTiming, showBreakdown); } if (number != NONE) generateSubstitution(state->getSubstitution(), state->getGoal()); endElement(); } void MaudemlBuffer::generateSubstitution(const Substitution* substitution, const VariableInfo* varInfo) { beginElement("substitution"); int nrVars = varInfo->getNrRealVariables(); for (int i = 0; i < nrVars; i++) generateAssignment(varInfo->index2Variable(i), substitution->value(i)); endElement(); } void MaudemlBuffer::generateAssignment(Term* variable, DagNode* value) { beginElement("assignment"); generate(variable); if (value == 0) { beginElement("unbound"); endElement(); } else generate(value); endElement(); } void MaudemlBuffer::generate(Term* term) { beginElement("term"); Symbol* symbol = term->symbol(); if (VariableTerm* v = dynamic_cast(term)) { string opName(Token::name(v->id())); opName += ":"; opName += sortString(safeCast(VariableSymbol*, symbol)->getSort()); attributePair("op", opName); } else if (FloatTerm* m = dynamic_cast(term)) attributePair("op", doubleToString(m->getValue())); else if (StringTerm* s = dynamic_cast(term)) { string strValue; Token::ropeToString(s->getValue(), strValue); attributePair("op", strValue); } else if (QuotedIdentifierTerm* q = dynamic_cast(term)) { string opName("'"); opName += Token::name(q->getIdIndex()); attributePair("op", opName); } else { attributePair("op", Token::name(symbol->id())); if (S_Term* s = dynamic_cast(term)) { char* numberStr = mpz_get_str(0, 10, s->getNumber().get_mpz_t()); attributePair("number", numberStr); free(numberStr); } } int sortIndex = term->getSortIndex(); if (sortIndex == Sort::SORT_UNKNOWN) attributePair("kind", kindString(symbol->rangeComponent())); else attributePair("syntactic-sort", sortString(symbol->rangeComponent()->sort(sortIndex))); ArgumentIterator a(*term); while (a.valid()) { generate(a.argument()); a.next(); } endElement(); } void MaudemlBuffer::generate(const ConditionFragment* c) { if (const EqualityConditionFragment* e = dynamic_cast(c)) { beginElement("equality-test"); generate(e->getLhs()); generate(e->getRhs()); endElement(); } else if (const SortTestConditionFragment* t = dynamic_cast(c)) { beginElement("sort-test"); attributePair("sort", sortString(t->getSort())); generate(t->getLhs()); endElement(); } else if(const AssignmentConditionFragment* a = dynamic_cast(c)) { beginElement("assignment-test"); generate(a->getLhs()); generate(a->getRhs()); endElement(); } else if(const RewriteConditionFragment* r = dynamic_cast(c)) { beginElement("rewrite-test"); generate(r->getLhs()); generate(r->getRhs()); endElement(); } } void MaudemlBuffer::generateCondition(const Vector& condition) { beginElement("condition"); int nrFragments = condition.size(); for (int i = 0; i < nrFragments; i++) generate(condition[i]); endElement(); } void MaudemlBuffer::generate(Rule* rule) { beginElement("rule"); int l = rule->getLabel().id(); if (l != NONE) attributePair("label", Token::name(l)); generate(rule->getLhs()); generate(rule->getRhs()); if (rule->hasCondition()) generateCondition(rule->getCondition()); endElement(); } void MaudemlBuffer::generate(DagNode* dagNode, PointerSet* visited) { int index = NONE; if (visited != 0) { index = visited->pointer2Index(dagNode); if (index == NONE) index = visited->insert(dagNode); else { beginElement("backref"); attributePair("ref", "t", index); endElement(); return; } } beginElement("term"); if (index != NONE) attributePair("id", "t", index); Symbol* symbol = dagNode->symbol(); if (VariableDagNode* v = dynamic_cast(dagNode)) { string opName(Token::name(v->id())); opName += ":"; opName += sortString(safeCast(VariableSymbol*, symbol)->getSort()); attributePair("op", opName); } else if (FloatDagNode* m = dynamic_cast(dagNode)) attributePair("op", doubleToString(m->getValue())); else if (StringDagNode* s = dynamic_cast(dagNode)) { string strValue; Token::ropeToString(s->getValue(), strValue); attributePair("op", strValue); } else if (QuotedIdentifierDagNode* q = dynamic_cast(dagNode)) { string opName("'"); opName += Token::name(q->getIdIndex()); attributePair("op", opName); } else { attributePair("op", Token::name(symbol->id())); if (S_DagNode* s = dynamic_cast(dagNode)) { char* numberStr = mpz_get_str(0, 10, s->getNumber().get_mpz_t()); attributePair("number", numberStr); free(numberStr); } } int sortIndex = dagNode->getSortIndex(); if (sortIndex == Sort::SORT_UNKNOWN) attributePair("kind", kindString(symbol->rangeComponent())); else attributePair("sort", sortString(symbol->rangeComponent()->sort(sortIndex))); DagArgumentIterator a(*dagNode); while (a.valid()) { generate(a.argument(), visited); a.next(); } endElement(); } string MaudemlBuffer::sortString(Sort* sort) { if (sort->index() == Sort::KIND) return kindString(sort->component()); else return Token::name(sort->id()); } string MaudemlBuffer::kindString(ConnectedComponent* kind) { string name("["); int n = kind->nrMaximalSorts(); for (int i = 1;; i++) { name += sortString(kind->sort(i)); if (i == n) break; name += ','; } name += ']'; return name; } void MaudemlBuffer::generateResult(RewritingContext& context, const Timer& timer, bool showStats, bool showTiming, bool showBreakdown) { beginElement("result"); if (showStats) generateStats(context, timer, showTiming, showBreakdown); generate(context.root()); endElement(); } void MaudemlBuffer::generateStats(RewritingContext& context, const Timer& timer, bool showTiming, bool showBreakdown) { Int64 total = context.getTotalCount(); attributePair("total-rewrites", int64ToString(total)); if (showBreakdown) { attributePair("mb-rewrites", int64ToString(context.getMbCount())); attributePair("eq-rewrites", int64ToString(context.getEqCount())); attributePair("rl-rewrites", int64ToString(context.getRlCount())); } Int64 real; Int64 virt; Int64 prof; if (showTiming && timer.getTimes(real, virt, prof)) { attributePair("real-time-ms", int64ToString(real / 1000)); attributePair("cpu-time-ms", int64ToString(prof / 1000)); if (prof > 0) attributePair("rewrites-per-second", int64ToString((1000000 * total) / prof)); } } void MaudemlBuffer::generateSearchGraph(RewriteSequenceSearch* graph) { beginElement("graphml"); beginElement("key"); attributePair("id", "term"); attributePair("for", "node"); endElement(); beginElement("key"); attributePair("id", "rule"); attributePair("for", "edge"); endElement(); beginElement("graph"); //attributePair("id", "g1"); attributePair("edgedefault", "directed"); int nrStates = graph->getNrStates(); for (int i = 0; i < nrStates; i++) { beginElement("node"); attributePair("id", "n", i); beginElement("data"); attributePair("key", "term"); generate(graph->getStateDag(i)); endElement(); endElement(); const RewriteSequenceSearch::ArcMap& fwdArcs = graph->getStateFwdArcs(i); for (RewriteSequenceSearch::ArcMap::const_iterator j = fwdArcs.begin(); j != fwdArcs.end(); ++j) { beginElement("edge"); attributePair("source", "n", i); attributePair("target", "n", (*j).first); const set& r = (*j).second; for (set::const_iterator k = r.begin(); k != r.end(); k++) { beginElement("data"); attributePair("key", "rule"); generate(*k); endElement(); } endElement(); } } endElement(); endElement(); } void MaudemlBuffer::generateSearchPath(RewriteSequenceSearch* graph, int stateNr) { beginElement("graphml"); beginElement("key"); attributePair("id", "term"); attributePair("for", "node"); endElement(); beginElement("key"); attributePair("id", "rule"); attributePair("for", "edge"); endElement(); beginElement("graph"); //attributePair("id", "g1"); attributePair("edgedefault", "directed"); int parent; for (int i = stateNr;; i = parent) { beginElement("node"); attributePair("id", "n", i); beginElement("data"); attributePair("key", "term"); generate(graph->getStateDag(i)); endElement(); endElement(); parent = graph->getStateParent(i); if (parent == NONE) break; beginElement("edge"); attributePair("source", "n", parent); attributePair("target", "n", i); beginElement("data"); attributePair("key", "rule"); generate(graph->getStateRule(i)); endElement(); endElement(); } endElement(); endElement(); } Maude-2.6/src/Mixfix/Makefile.in0000644000147300135640000030307611500303155013447 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/Mixfix DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libmixfix_a_AR = $(AR) $(ARFLAGS) libmixfix_a_LIBADD = am__libmixfix_a_SOURCES_DIST = syntaxContainer.cc renaming.cc view.cc \ entity.cc moduleCache.cc moduleExpression.cc importModule.cc \ importTranslation.cc fileTable.cc loopSymbol.cc \ quotedIdentifierSymbol.cc quotedIdentifierDagNode.cc \ quotedIdentifierTerm.cc quotedIdentifierOpSymbol.cc \ mixfixModule.cc token.cc global.cc \ userLevelRewritingContext.cc preModule.cc \ syntacticPreModule.cc symbolType.cc xmlBuffer.cc \ maudemlBuffer.cc interpreter.cc moduleDatabase.cc \ viewDatabase.cc profileModule.cc mixfixParser.cc \ visibleModule.cc sharedTokens.cc metadataStore.cc \ printAttribute.cc banner.cc lexer.cc surface.cc \ freshVariableSource.cc compiler.cc @BUILD_COMPILER_TRUE@am__objects_1 = libmixfix_a-compiler.$(OBJEXT) am_libmixfix_a_OBJECTS = libmixfix_a-syntaxContainer.$(OBJEXT) \ libmixfix_a-renaming.$(OBJEXT) libmixfix_a-view.$(OBJEXT) \ libmixfix_a-entity.$(OBJEXT) libmixfix_a-moduleCache.$(OBJEXT) \ libmixfix_a-moduleExpression.$(OBJEXT) \ libmixfix_a-importModule.$(OBJEXT) \ libmixfix_a-importTranslation.$(OBJEXT) \ libmixfix_a-fileTable.$(OBJEXT) \ libmixfix_a-loopSymbol.$(OBJEXT) \ libmixfix_a-quotedIdentifierSymbol.$(OBJEXT) \ libmixfix_a-quotedIdentifierDagNode.$(OBJEXT) \ libmixfix_a-quotedIdentifierTerm.$(OBJEXT) \ libmixfix_a-quotedIdentifierOpSymbol.$(OBJEXT) \ libmixfix_a-mixfixModule.$(OBJEXT) libmixfix_a-token.$(OBJEXT) \ libmixfix_a-global.$(OBJEXT) \ libmixfix_a-userLevelRewritingContext.$(OBJEXT) \ libmixfix_a-preModule.$(OBJEXT) \ libmixfix_a-syntacticPreModule.$(OBJEXT) \ libmixfix_a-symbolType.$(OBJEXT) \ libmixfix_a-xmlBuffer.$(OBJEXT) \ libmixfix_a-maudemlBuffer.$(OBJEXT) \ libmixfix_a-interpreter.$(OBJEXT) \ libmixfix_a-moduleDatabase.$(OBJEXT) \ libmixfix_a-viewDatabase.$(OBJEXT) \ libmixfix_a-profileModule.$(OBJEXT) \ libmixfix_a-mixfixParser.$(OBJEXT) \ libmixfix_a-visibleModule.$(OBJEXT) \ libmixfix_a-sharedTokens.$(OBJEXT) \ libmixfix_a-metadataStore.$(OBJEXT) \ libmixfix_a-printAttribute.$(OBJEXT) \ libmixfix_a-banner.$(OBJEXT) libmixfix_a-lexer.$(OBJEXT) \ libmixfix_a-surface.$(OBJEXT) \ libmixfix_a-freshVariableSource.$(OBJEXT) $(am__objects_1) libmixfix_a_OBJECTS = $(am_libmixfix_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libmixfix_a_SOURCES) $(EXTRA_libmixfix_a_SOURCES) DIST_SOURCES = $(am__libmixfix_a_SOURCES_DIST) \ $(EXTRA_libmixfix_a_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON = @BISON@ BUDDY_LIB = @BUDDY_LIB@ BUILD_COMPILER_FALSE = @BUILD_COMPILER_FALSE@ BUILD_COMPILER_TRUE = @BUILD_COMPILER_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FLEX = @FLEX@ GMP_LIBS = @GMP_LIBS@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV_LIB = @LIBSIGSEGV_LIB@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TECLA_LIBS = @TECLA_LIBS@ USE_DLMALLOC_FALSE = @USE_DLMALLOC_FALSE@ USE_DLMALLOC_TRUE = @USE_DLMALLOC_TRUE@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_LIBRARIES = libmixfix.a @BUILD_COMPILER_TRUE@COMPILER_SRC = compiler.cc libmixfix_a_CPPFLAGS = \ -I$(top_srcdir)/src/Utility \ -I$(top_srcdir)/src/Temporal \ -I$(top_srcdir)/src/Interface \ -I$(top_srcdir)/src/Core \ -I$(top_srcdir)/src/Variable \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/Higher \ -I$(top_srcdir)/src/CUI_Theory \ -I$(top_srcdir)/src/S_Theory \ -I$(top_srcdir)/src/NA_Theory \ -I$(top_srcdir)/src/FreeTheory \ -I$(top_srcdir)/src/ObjectSystem \ -I$(top_srcdir)/src/Mixfix \ -I$(top_srcdir)/src/BuiltIn \ -I$(top_srcdir)/src/MSCP10 \ -I$(top_srcdir)/src/IO_Stuff \ -I$(top_srcdir)/src/ACU_Persistent \ -I$(top_srcdir)/src/ACU_Theory \ -I$(top_srcdir)/src/AU_Persistent \ -I$(top_srcdir)/src/AU_Theory \ -I$(top_srcdir)/src/Meta \ -I$(top_srcdir)/src/3rdParty \ -I$(top_srcdir)/src/FullCompiler \ -I$(top_srcdir)/src/StrategyLanguage libmixfix_a_SOURCES = \ syntaxContainer.cc \ renaming.cc \ view.cc \ entity.cc \ moduleCache.cc \ moduleExpression.cc \ importModule.cc \ importTranslation.cc \ fileTable.cc \ loopSymbol.cc \ quotedIdentifierSymbol.cc \ quotedIdentifierDagNode.cc \ quotedIdentifierTerm.cc \ quotedIdentifierOpSymbol.cc \ mixfixModule.cc \ token.cc \ global.cc \ userLevelRewritingContext.cc \ preModule.cc \ syntacticPreModule.cc \ symbolType.cc \ xmlBuffer.cc \ maudemlBuffer.cc \ interpreter.cc \ moduleDatabase.cc \ viewDatabase.cc \ profileModule.cc \ mixfixParser.cc \ visibleModule.cc \ sharedTokens.cc \ metadataStore.cc \ printAttribute.cc \ banner.cc \ lexer.cc \ surface.cc \ freshVariableSource.cc \ $(COMPILER_SRC) EXTRA_libmixfix_a_SOURCES = \ compiler.cc BUILT_SOURCES = surface.yy surface.cc surface.h lexer.cc CLEANFILES = surface.yy surface.cc surface.h lexer.cc EXTRA_DIST = \ renameModule.cc \ parameterization.cc \ lexerAux.cc \ process.cc \ fixUp.cc \ ops.cc \ command.cc \ entry.cc \ prettyPrint.cc \ bufferPrint.cc \ specialSymbolTypes.cc \ specialTokens.cc \ doParse.cc \ makeGrammar.cc \ auxProperty.cc \ termPrint.cc \ dagNodePrint.cc \ sharedPrint.cc \ strategyPrint.cc \ interact.cc \ trial.cc \ execute.cc \ loopMode.cc \ search.cc \ srewrite.cc \ erewrite.cc \ match.cc \ unify.cc \ top.yy \ modules.yy \ commands.yy \ bottom.yy \ lexer.ll \ graphPrint.cc \ ansiEscapeSequences.cc noinst_HEADERS = \ renaming.hh \ view.hh \ entity.hh \ moduleCache.hh \ moduleExpression.hh \ sharedTokens.hh \ compiler.hh \ fileTable.hh \ importModule.hh \ importTranslation.hh \ interpreter.hh \ lexerAux.hh \ loopSymbol.hh \ global.hh \ maudemlBuffer.hh \ metadataStore.hh \ printAttribute.hh \ mixfix.hh \ mixfixModule.hh \ mixfixParser.hh \ moduleDatabase.hh \ viewDatabase.hh \ preModule.hh \ syntacticPreModule.hh \ profileModule.hh \ quotedIdentifierDagNode.hh \ quotedIdentifierOpSymbol.hh \ quotedIdentifierSymbol.hh \ quotedIdentifierTerm.hh \ symbolType.hh \ token.hh \ userLevelRewritingContext.hh \ visibleModule.hh \ xmlBuffer.hh \ syntaxContainer.hh \ freshVariableSource.hh all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Mixfix/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Mixfix/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmixfix.a: $(libmixfix_a_OBJECTS) $(libmixfix_a_DEPENDENCIES) -rm -f libmixfix.a $(libmixfix_a_AR) libmixfix.a $(libmixfix_a_OBJECTS) $(libmixfix_a_LIBADD) $(RANLIB) libmixfix.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-banner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-compiler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-entity.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-fileTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-freshVariableSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-global.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-importModule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-importTranslation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-interpreter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-loopSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-maudemlBuffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-metadataStore.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-mixfixModule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-mixfixParser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-moduleCache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-moduleDatabase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-moduleExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-preModule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-printAttribute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-profileModule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-renaming.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-sharedTokens.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-surface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-symbolType.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-syntacticPreModule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-syntaxContainer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-token.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-view.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-viewDatabase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-visibleModule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmixfix_a-xmlBuffer.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` libmixfix_a-syntaxContainer.o: syntaxContainer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-syntaxContainer.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-syntaxContainer.Tpo" -c -o libmixfix_a-syntaxContainer.o `test -f 'syntaxContainer.cc' || echo '$(srcdir)/'`syntaxContainer.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-syntaxContainer.Tpo" "$(DEPDIR)/libmixfix_a-syntaxContainer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-syntaxContainer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='syntaxContainer.cc' object='libmixfix_a-syntaxContainer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-syntaxContainer.o `test -f 'syntaxContainer.cc' || echo '$(srcdir)/'`syntaxContainer.cc libmixfix_a-syntaxContainer.obj: syntaxContainer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-syntaxContainer.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-syntaxContainer.Tpo" -c -o libmixfix_a-syntaxContainer.obj `if test -f 'syntaxContainer.cc'; then $(CYGPATH_W) 'syntaxContainer.cc'; else $(CYGPATH_W) '$(srcdir)/syntaxContainer.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-syntaxContainer.Tpo" "$(DEPDIR)/libmixfix_a-syntaxContainer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-syntaxContainer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='syntaxContainer.cc' object='libmixfix_a-syntaxContainer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-syntaxContainer.obj `if test -f 'syntaxContainer.cc'; then $(CYGPATH_W) 'syntaxContainer.cc'; else $(CYGPATH_W) '$(srcdir)/syntaxContainer.cc'; fi` libmixfix_a-renaming.o: renaming.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-renaming.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-renaming.Tpo" -c -o libmixfix_a-renaming.o `test -f 'renaming.cc' || echo '$(srcdir)/'`renaming.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-renaming.Tpo" "$(DEPDIR)/libmixfix_a-renaming.Po"; else rm -f "$(DEPDIR)/libmixfix_a-renaming.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='renaming.cc' object='libmixfix_a-renaming.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-renaming.o `test -f 'renaming.cc' || echo '$(srcdir)/'`renaming.cc libmixfix_a-renaming.obj: renaming.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-renaming.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-renaming.Tpo" -c -o libmixfix_a-renaming.obj `if test -f 'renaming.cc'; then $(CYGPATH_W) 'renaming.cc'; else $(CYGPATH_W) '$(srcdir)/renaming.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-renaming.Tpo" "$(DEPDIR)/libmixfix_a-renaming.Po"; else rm -f "$(DEPDIR)/libmixfix_a-renaming.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='renaming.cc' object='libmixfix_a-renaming.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-renaming.obj `if test -f 'renaming.cc'; then $(CYGPATH_W) 'renaming.cc'; else $(CYGPATH_W) '$(srcdir)/renaming.cc'; fi` libmixfix_a-view.o: view.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-view.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-view.Tpo" -c -o libmixfix_a-view.o `test -f 'view.cc' || echo '$(srcdir)/'`view.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-view.Tpo" "$(DEPDIR)/libmixfix_a-view.Po"; else rm -f "$(DEPDIR)/libmixfix_a-view.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='view.cc' object='libmixfix_a-view.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-view.o `test -f 'view.cc' || echo '$(srcdir)/'`view.cc libmixfix_a-view.obj: view.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-view.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-view.Tpo" -c -o libmixfix_a-view.obj `if test -f 'view.cc'; then $(CYGPATH_W) 'view.cc'; else $(CYGPATH_W) '$(srcdir)/view.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-view.Tpo" "$(DEPDIR)/libmixfix_a-view.Po"; else rm -f "$(DEPDIR)/libmixfix_a-view.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='view.cc' object='libmixfix_a-view.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-view.obj `if test -f 'view.cc'; then $(CYGPATH_W) 'view.cc'; else $(CYGPATH_W) '$(srcdir)/view.cc'; fi` libmixfix_a-entity.o: entity.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-entity.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-entity.Tpo" -c -o libmixfix_a-entity.o `test -f 'entity.cc' || echo '$(srcdir)/'`entity.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-entity.Tpo" "$(DEPDIR)/libmixfix_a-entity.Po"; else rm -f "$(DEPDIR)/libmixfix_a-entity.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='entity.cc' object='libmixfix_a-entity.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-entity.o `test -f 'entity.cc' || echo '$(srcdir)/'`entity.cc libmixfix_a-entity.obj: entity.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-entity.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-entity.Tpo" -c -o libmixfix_a-entity.obj `if test -f 'entity.cc'; then $(CYGPATH_W) 'entity.cc'; else $(CYGPATH_W) '$(srcdir)/entity.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-entity.Tpo" "$(DEPDIR)/libmixfix_a-entity.Po"; else rm -f "$(DEPDIR)/libmixfix_a-entity.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='entity.cc' object='libmixfix_a-entity.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-entity.obj `if test -f 'entity.cc'; then $(CYGPATH_W) 'entity.cc'; else $(CYGPATH_W) '$(srcdir)/entity.cc'; fi` libmixfix_a-moduleCache.o: moduleCache.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-moduleCache.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-moduleCache.Tpo" -c -o libmixfix_a-moduleCache.o `test -f 'moduleCache.cc' || echo '$(srcdir)/'`moduleCache.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-moduleCache.Tpo" "$(DEPDIR)/libmixfix_a-moduleCache.Po"; else rm -f "$(DEPDIR)/libmixfix_a-moduleCache.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moduleCache.cc' object='libmixfix_a-moduleCache.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-moduleCache.o `test -f 'moduleCache.cc' || echo '$(srcdir)/'`moduleCache.cc libmixfix_a-moduleCache.obj: moduleCache.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-moduleCache.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-moduleCache.Tpo" -c -o libmixfix_a-moduleCache.obj `if test -f 'moduleCache.cc'; then $(CYGPATH_W) 'moduleCache.cc'; else $(CYGPATH_W) '$(srcdir)/moduleCache.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-moduleCache.Tpo" "$(DEPDIR)/libmixfix_a-moduleCache.Po"; else rm -f "$(DEPDIR)/libmixfix_a-moduleCache.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moduleCache.cc' object='libmixfix_a-moduleCache.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-moduleCache.obj `if test -f 'moduleCache.cc'; then $(CYGPATH_W) 'moduleCache.cc'; else $(CYGPATH_W) '$(srcdir)/moduleCache.cc'; fi` libmixfix_a-moduleExpression.o: moduleExpression.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-moduleExpression.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-moduleExpression.Tpo" -c -o libmixfix_a-moduleExpression.o `test -f 'moduleExpression.cc' || echo '$(srcdir)/'`moduleExpression.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-moduleExpression.Tpo" "$(DEPDIR)/libmixfix_a-moduleExpression.Po"; else rm -f "$(DEPDIR)/libmixfix_a-moduleExpression.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moduleExpression.cc' object='libmixfix_a-moduleExpression.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-moduleExpression.o `test -f 'moduleExpression.cc' || echo '$(srcdir)/'`moduleExpression.cc libmixfix_a-moduleExpression.obj: moduleExpression.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-moduleExpression.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-moduleExpression.Tpo" -c -o libmixfix_a-moduleExpression.obj `if test -f 'moduleExpression.cc'; then $(CYGPATH_W) 'moduleExpression.cc'; else $(CYGPATH_W) '$(srcdir)/moduleExpression.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-moduleExpression.Tpo" "$(DEPDIR)/libmixfix_a-moduleExpression.Po"; else rm -f "$(DEPDIR)/libmixfix_a-moduleExpression.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moduleExpression.cc' object='libmixfix_a-moduleExpression.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-moduleExpression.obj `if test -f 'moduleExpression.cc'; then $(CYGPATH_W) 'moduleExpression.cc'; else $(CYGPATH_W) '$(srcdir)/moduleExpression.cc'; fi` libmixfix_a-importModule.o: importModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-importModule.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-importModule.Tpo" -c -o libmixfix_a-importModule.o `test -f 'importModule.cc' || echo '$(srcdir)/'`importModule.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-importModule.Tpo" "$(DEPDIR)/libmixfix_a-importModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-importModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importModule.cc' object='libmixfix_a-importModule.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-importModule.o `test -f 'importModule.cc' || echo '$(srcdir)/'`importModule.cc libmixfix_a-importModule.obj: importModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-importModule.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-importModule.Tpo" -c -o libmixfix_a-importModule.obj `if test -f 'importModule.cc'; then $(CYGPATH_W) 'importModule.cc'; else $(CYGPATH_W) '$(srcdir)/importModule.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-importModule.Tpo" "$(DEPDIR)/libmixfix_a-importModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-importModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importModule.cc' object='libmixfix_a-importModule.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-importModule.obj `if test -f 'importModule.cc'; then $(CYGPATH_W) 'importModule.cc'; else $(CYGPATH_W) '$(srcdir)/importModule.cc'; fi` libmixfix_a-importTranslation.o: importTranslation.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-importTranslation.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-importTranslation.Tpo" -c -o libmixfix_a-importTranslation.o `test -f 'importTranslation.cc' || echo '$(srcdir)/'`importTranslation.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-importTranslation.Tpo" "$(DEPDIR)/libmixfix_a-importTranslation.Po"; else rm -f "$(DEPDIR)/libmixfix_a-importTranslation.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importTranslation.cc' object='libmixfix_a-importTranslation.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-importTranslation.o `test -f 'importTranslation.cc' || echo '$(srcdir)/'`importTranslation.cc libmixfix_a-importTranslation.obj: importTranslation.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-importTranslation.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-importTranslation.Tpo" -c -o libmixfix_a-importTranslation.obj `if test -f 'importTranslation.cc'; then $(CYGPATH_W) 'importTranslation.cc'; else $(CYGPATH_W) '$(srcdir)/importTranslation.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-importTranslation.Tpo" "$(DEPDIR)/libmixfix_a-importTranslation.Po"; else rm -f "$(DEPDIR)/libmixfix_a-importTranslation.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='importTranslation.cc' object='libmixfix_a-importTranslation.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-importTranslation.obj `if test -f 'importTranslation.cc'; then $(CYGPATH_W) 'importTranslation.cc'; else $(CYGPATH_W) '$(srcdir)/importTranslation.cc'; fi` libmixfix_a-fileTable.o: fileTable.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-fileTable.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-fileTable.Tpo" -c -o libmixfix_a-fileTable.o `test -f 'fileTable.cc' || echo '$(srcdir)/'`fileTable.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-fileTable.Tpo" "$(DEPDIR)/libmixfix_a-fileTable.Po"; else rm -f "$(DEPDIR)/libmixfix_a-fileTable.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fileTable.cc' object='libmixfix_a-fileTable.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-fileTable.o `test -f 'fileTable.cc' || echo '$(srcdir)/'`fileTable.cc libmixfix_a-fileTable.obj: fileTable.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-fileTable.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-fileTable.Tpo" -c -o libmixfix_a-fileTable.obj `if test -f 'fileTable.cc'; then $(CYGPATH_W) 'fileTable.cc'; else $(CYGPATH_W) '$(srcdir)/fileTable.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-fileTable.Tpo" "$(DEPDIR)/libmixfix_a-fileTable.Po"; else rm -f "$(DEPDIR)/libmixfix_a-fileTable.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fileTable.cc' object='libmixfix_a-fileTable.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-fileTable.obj `if test -f 'fileTable.cc'; then $(CYGPATH_W) 'fileTable.cc'; else $(CYGPATH_W) '$(srcdir)/fileTable.cc'; fi` libmixfix_a-loopSymbol.o: loopSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-loopSymbol.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-loopSymbol.Tpo" -c -o libmixfix_a-loopSymbol.o `test -f 'loopSymbol.cc' || echo '$(srcdir)/'`loopSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-loopSymbol.Tpo" "$(DEPDIR)/libmixfix_a-loopSymbol.Po"; else rm -f "$(DEPDIR)/libmixfix_a-loopSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='loopSymbol.cc' object='libmixfix_a-loopSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-loopSymbol.o `test -f 'loopSymbol.cc' || echo '$(srcdir)/'`loopSymbol.cc libmixfix_a-loopSymbol.obj: loopSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-loopSymbol.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-loopSymbol.Tpo" -c -o libmixfix_a-loopSymbol.obj `if test -f 'loopSymbol.cc'; then $(CYGPATH_W) 'loopSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/loopSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-loopSymbol.Tpo" "$(DEPDIR)/libmixfix_a-loopSymbol.Po"; else rm -f "$(DEPDIR)/libmixfix_a-loopSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='loopSymbol.cc' object='libmixfix_a-loopSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-loopSymbol.obj `if test -f 'loopSymbol.cc'; then $(CYGPATH_W) 'loopSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/loopSymbol.cc'; fi` libmixfix_a-quotedIdentifierSymbol.o: quotedIdentifierSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierSymbol.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Tpo" -c -o libmixfix_a-quotedIdentifierSymbol.o `test -f 'quotedIdentifierSymbol.cc' || echo '$(srcdir)/'`quotedIdentifierSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierSymbol.cc' object='libmixfix_a-quotedIdentifierSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierSymbol.o `test -f 'quotedIdentifierSymbol.cc' || echo '$(srcdir)/'`quotedIdentifierSymbol.cc libmixfix_a-quotedIdentifierSymbol.obj: quotedIdentifierSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierSymbol.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Tpo" -c -o libmixfix_a-quotedIdentifierSymbol.obj `if test -f 'quotedIdentifierSymbol.cc'; then $(CYGPATH_W) 'quotedIdentifierSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierSymbol.cc' object='libmixfix_a-quotedIdentifierSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierSymbol.obj `if test -f 'quotedIdentifierSymbol.cc'; then $(CYGPATH_W) 'quotedIdentifierSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierSymbol.cc'; fi` libmixfix_a-quotedIdentifierDagNode.o: quotedIdentifierDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierDagNode.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Tpo" -c -o libmixfix_a-quotedIdentifierDagNode.o `test -f 'quotedIdentifierDagNode.cc' || echo '$(srcdir)/'`quotedIdentifierDagNode.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierDagNode.cc' object='libmixfix_a-quotedIdentifierDagNode.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierDagNode.o `test -f 'quotedIdentifierDagNode.cc' || echo '$(srcdir)/'`quotedIdentifierDagNode.cc libmixfix_a-quotedIdentifierDagNode.obj: quotedIdentifierDagNode.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierDagNode.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Tpo" -c -o libmixfix_a-quotedIdentifierDagNode.obj `if test -f 'quotedIdentifierDagNode.cc'; then $(CYGPATH_W) 'quotedIdentifierDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierDagNode.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierDagNode.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierDagNode.cc' object='libmixfix_a-quotedIdentifierDagNode.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierDagNode.obj `if test -f 'quotedIdentifierDagNode.cc'; then $(CYGPATH_W) 'quotedIdentifierDagNode.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierDagNode.cc'; fi` libmixfix_a-quotedIdentifierTerm.o: quotedIdentifierTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierTerm.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Tpo" -c -o libmixfix_a-quotedIdentifierTerm.o `test -f 'quotedIdentifierTerm.cc' || echo '$(srcdir)/'`quotedIdentifierTerm.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierTerm.cc' object='libmixfix_a-quotedIdentifierTerm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierTerm.o `test -f 'quotedIdentifierTerm.cc' || echo '$(srcdir)/'`quotedIdentifierTerm.cc libmixfix_a-quotedIdentifierTerm.obj: quotedIdentifierTerm.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierTerm.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Tpo" -c -o libmixfix_a-quotedIdentifierTerm.obj `if test -f 'quotedIdentifierTerm.cc'; then $(CYGPATH_W) 'quotedIdentifierTerm.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierTerm.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierTerm.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierTerm.cc' object='libmixfix_a-quotedIdentifierTerm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierTerm.obj `if test -f 'quotedIdentifierTerm.cc'; then $(CYGPATH_W) 'quotedIdentifierTerm.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierTerm.cc'; fi` libmixfix_a-quotedIdentifierOpSymbol.o: quotedIdentifierOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierOpSymbol.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Tpo" -c -o libmixfix_a-quotedIdentifierOpSymbol.o `test -f 'quotedIdentifierOpSymbol.cc' || echo '$(srcdir)/'`quotedIdentifierOpSymbol.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierOpSymbol.cc' object='libmixfix_a-quotedIdentifierOpSymbol.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierOpSymbol.o `test -f 'quotedIdentifierOpSymbol.cc' || echo '$(srcdir)/'`quotedIdentifierOpSymbol.cc libmixfix_a-quotedIdentifierOpSymbol.obj: quotedIdentifierOpSymbol.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-quotedIdentifierOpSymbol.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Tpo" -c -o libmixfix_a-quotedIdentifierOpSymbol.obj `if test -f 'quotedIdentifierOpSymbol.cc'; then $(CYGPATH_W) 'quotedIdentifierOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierOpSymbol.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Tpo" "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Po"; else rm -f "$(DEPDIR)/libmixfix_a-quotedIdentifierOpSymbol.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='quotedIdentifierOpSymbol.cc' object='libmixfix_a-quotedIdentifierOpSymbol.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-quotedIdentifierOpSymbol.obj `if test -f 'quotedIdentifierOpSymbol.cc'; then $(CYGPATH_W) 'quotedIdentifierOpSymbol.cc'; else $(CYGPATH_W) '$(srcdir)/quotedIdentifierOpSymbol.cc'; fi` libmixfix_a-mixfixModule.o: mixfixModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-mixfixModule.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-mixfixModule.Tpo" -c -o libmixfix_a-mixfixModule.o `test -f 'mixfixModule.cc' || echo '$(srcdir)/'`mixfixModule.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-mixfixModule.Tpo" "$(DEPDIR)/libmixfix_a-mixfixModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-mixfixModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mixfixModule.cc' object='libmixfix_a-mixfixModule.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-mixfixModule.o `test -f 'mixfixModule.cc' || echo '$(srcdir)/'`mixfixModule.cc libmixfix_a-mixfixModule.obj: mixfixModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-mixfixModule.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-mixfixModule.Tpo" -c -o libmixfix_a-mixfixModule.obj `if test -f 'mixfixModule.cc'; then $(CYGPATH_W) 'mixfixModule.cc'; else $(CYGPATH_W) '$(srcdir)/mixfixModule.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-mixfixModule.Tpo" "$(DEPDIR)/libmixfix_a-mixfixModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-mixfixModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mixfixModule.cc' object='libmixfix_a-mixfixModule.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-mixfixModule.obj `if test -f 'mixfixModule.cc'; then $(CYGPATH_W) 'mixfixModule.cc'; else $(CYGPATH_W) '$(srcdir)/mixfixModule.cc'; fi` libmixfix_a-token.o: token.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-token.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-token.Tpo" -c -o libmixfix_a-token.o `test -f 'token.cc' || echo '$(srcdir)/'`token.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-token.Tpo" "$(DEPDIR)/libmixfix_a-token.Po"; else rm -f "$(DEPDIR)/libmixfix_a-token.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='token.cc' object='libmixfix_a-token.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-token.o `test -f 'token.cc' || echo '$(srcdir)/'`token.cc libmixfix_a-token.obj: token.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-token.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-token.Tpo" -c -o libmixfix_a-token.obj `if test -f 'token.cc'; then $(CYGPATH_W) 'token.cc'; else $(CYGPATH_W) '$(srcdir)/token.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-token.Tpo" "$(DEPDIR)/libmixfix_a-token.Po"; else rm -f "$(DEPDIR)/libmixfix_a-token.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='token.cc' object='libmixfix_a-token.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-token.obj `if test -f 'token.cc'; then $(CYGPATH_W) 'token.cc'; else $(CYGPATH_W) '$(srcdir)/token.cc'; fi` libmixfix_a-global.o: global.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-global.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-global.Tpo" -c -o libmixfix_a-global.o `test -f 'global.cc' || echo '$(srcdir)/'`global.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-global.Tpo" "$(DEPDIR)/libmixfix_a-global.Po"; else rm -f "$(DEPDIR)/libmixfix_a-global.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='global.cc' object='libmixfix_a-global.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-global.o `test -f 'global.cc' || echo '$(srcdir)/'`global.cc libmixfix_a-global.obj: global.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-global.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-global.Tpo" -c -o libmixfix_a-global.obj `if test -f 'global.cc'; then $(CYGPATH_W) 'global.cc'; else $(CYGPATH_W) '$(srcdir)/global.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-global.Tpo" "$(DEPDIR)/libmixfix_a-global.Po"; else rm -f "$(DEPDIR)/libmixfix_a-global.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='global.cc' object='libmixfix_a-global.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-global.obj `if test -f 'global.cc'; then $(CYGPATH_W) 'global.cc'; else $(CYGPATH_W) '$(srcdir)/global.cc'; fi` libmixfix_a-userLevelRewritingContext.o: userLevelRewritingContext.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-userLevelRewritingContext.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Tpo" -c -o libmixfix_a-userLevelRewritingContext.o `test -f 'userLevelRewritingContext.cc' || echo '$(srcdir)/'`userLevelRewritingContext.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Tpo" "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Po"; else rm -f "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='userLevelRewritingContext.cc' object='libmixfix_a-userLevelRewritingContext.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-userLevelRewritingContext.o `test -f 'userLevelRewritingContext.cc' || echo '$(srcdir)/'`userLevelRewritingContext.cc libmixfix_a-userLevelRewritingContext.obj: userLevelRewritingContext.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-userLevelRewritingContext.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Tpo" -c -o libmixfix_a-userLevelRewritingContext.obj `if test -f 'userLevelRewritingContext.cc'; then $(CYGPATH_W) 'userLevelRewritingContext.cc'; else $(CYGPATH_W) '$(srcdir)/userLevelRewritingContext.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Tpo" "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Po"; else rm -f "$(DEPDIR)/libmixfix_a-userLevelRewritingContext.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='userLevelRewritingContext.cc' object='libmixfix_a-userLevelRewritingContext.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-userLevelRewritingContext.obj `if test -f 'userLevelRewritingContext.cc'; then $(CYGPATH_W) 'userLevelRewritingContext.cc'; else $(CYGPATH_W) '$(srcdir)/userLevelRewritingContext.cc'; fi` libmixfix_a-preModule.o: preModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-preModule.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-preModule.Tpo" -c -o libmixfix_a-preModule.o `test -f 'preModule.cc' || echo '$(srcdir)/'`preModule.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-preModule.Tpo" "$(DEPDIR)/libmixfix_a-preModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-preModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='preModule.cc' object='libmixfix_a-preModule.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-preModule.o `test -f 'preModule.cc' || echo '$(srcdir)/'`preModule.cc libmixfix_a-preModule.obj: preModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-preModule.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-preModule.Tpo" -c -o libmixfix_a-preModule.obj `if test -f 'preModule.cc'; then $(CYGPATH_W) 'preModule.cc'; else $(CYGPATH_W) '$(srcdir)/preModule.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-preModule.Tpo" "$(DEPDIR)/libmixfix_a-preModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-preModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='preModule.cc' object='libmixfix_a-preModule.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-preModule.obj `if test -f 'preModule.cc'; then $(CYGPATH_W) 'preModule.cc'; else $(CYGPATH_W) '$(srcdir)/preModule.cc'; fi` libmixfix_a-syntacticPreModule.o: syntacticPreModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-syntacticPreModule.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-syntacticPreModule.Tpo" -c -o libmixfix_a-syntacticPreModule.o `test -f 'syntacticPreModule.cc' || echo '$(srcdir)/'`syntacticPreModule.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-syntacticPreModule.Tpo" "$(DEPDIR)/libmixfix_a-syntacticPreModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-syntacticPreModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='syntacticPreModule.cc' object='libmixfix_a-syntacticPreModule.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-syntacticPreModule.o `test -f 'syntacticPreModule.cc' || echo '$(srcdir)/'`syntacticPreModule.cc libmixfix_a-syntacticPreModule.obj: syntacticPreModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-syntacticPreModule.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-syntacticPreModule.Tpo" -c -o libmixfix_a-syntacticPreModule.obj `if test -f 'syntacticPreModule.cc'; then $(CYGPATH_W) 'syntacticPreModule.cc'; else $(CYGPATH_W) '$(srcdir)/syntacticPreModule.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-syntacticPreModule.Tpo" "$(DEPDIR)/libmixfix_a-syntacticPreModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-syntacticPreModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='syntacticPreModule.cc' object='libmixfix_a-syntacticPreModule.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-syntacticPreModule.obj `if test -f 'syntacticPreModule.cc'; then $(CYGPATH_W) 'syntacticPreModule.cc'; else $(CYGPATH_W) '$(srcdir)/syntacticPreModule.cc'; fi` libmixfix_a-symbolType.o: symbolType.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-symbolType.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-symbolType.Tpo" -c -o libmixfix_a-symbolType.o `test -f 'symbolType.cc' || echo '$(srcdir)/'`symbolType.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-symbolType.Tpo" "$(DEPDIR)/libmixfix_a-symbolType.Po"; else rm -f "$(DEPDIR)/libmixfix_a-symbolType.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='symbolType.cc' object='libmixfix_a-symbolType.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-symbolType.o `test -f 'symbolType.cc' || echo '$(srcdir)/'`symbolType.cc libmixfix_a-symbolType.obj: symbolType.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-symbolType.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-symbolType.Tpo" -c -o libmixfix_a-symbolType.obj `if test -f 'symbolType.cc'; then $(CYGPATH_W) 'symbolType.cc'; else $(CYGPATH_W) '$(srcdir)/symbolType.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-symbolType.Tpo" "$(DEPDIR)/libmixfix_a-symbolType.Po"; else rm -f "$(DEPDIR)/libmixfix_a-symbolType.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='symbolType.cc' object='libmixfix_a-symbolType.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-symbolType.obj `if test -f 'symbolType.cc'; then $(CYGPATH_W) 'symbolType.cc'; else $(CYGPATH_W) '$(srcdir)/symbolType.cc'; fi` libmixfix_a-xmlBuffer.o: xmlBuffer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-xmlBuffer.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-xmlBuffer.Tpo" -c -o libmixfix_a-xmlBuffer.o `test -f 'xmlBuffer.cc' || echo '$(srcdir)/'`xmlBuffer.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-xmlBuffer.Tpo" "$(DEPDIR)/libmixfix_a-xmlBuffer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-xmlBuffer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='xmlBuffer.cc' object='libmixfix_a-xmlBuffer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-xmlBuffer.o `test -f 'xmlBuffer.cc' || echo '$(srcdir)/'`xmlBuffer.cc libmixfix_a-xmlBuffer.obj: xmlBuffer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-xmlBuffer.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-xmlBuffer.Tpo" -c -o libmixfix_a-xmlBuffer.obj `if test -f 'xmlBuffer.cc'; then $(CYGPATH_W) 'xmlBuffer.cc'; else $(CYGPATH_W) '$(srcdir)/xmlBuffer.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-xmlBuffer.Tpo" "$(DEPDIR)/libmixfix_a-xmlBuffer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-xmlBuffer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='xmlBuffer.cc' object='libmixfix_a-xmlBuffer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-xmlBuffer.obj `if test -f 'xmlBuffer.cc'; then $(CYGPATH_W) 'xmlBuffer.cc'; else $(CYGPATH_W) '$(srcdir)/xmlBuffer.cc'; fi` libmixfix_a-maudemlBuffer.o: maudemlBuffer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-maudemlBuffer.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-maudemlBuffer.Tpo" -c -o libmixfix_a-maudemlBuffer.o `test -f 'maudemlBuffer.cc' || echo '$(srcdir)/'`maudemlBuffer.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-maudemlBuffer.Tpo" "$(DEPDIR)/libmixfix_a-maudemlBuffer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-maudemlBuffer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='maudemlBuffer.cc' object='libmixfix_a-maudemlBuffer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-maudemlBuffer.o `test -f 'maudemlBuffer.cc' || echo '$(srcdir)/'`maudemlBuffer.cc libmixfix_a-maudemlBuffer.obj: maudemlBuffer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-maudemlBuffer.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-maudemlBuffer.Tpo" -c -o libmixfix_a-maudemlBuffer.obj `if test -f 'maudemlBuffer.cc'; then $(CYGPATH_W) 'maudemlBuffer.cc'; else $(CYGPATH_W) '$(srcdir)/maudemlBuffer.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-maudemlBuffer.Tpo" "$(DEPDIR)/libmixfix_a-maudemlBuffer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-maudemlBuffer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='maudemlBuffer.cc' object='libmixfix_a-maudemlBuffer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-maudemlBuffer.obj `if test -f 'maudemlBuffer.cc'; then $(CYGPATH_W) 'maudemlBuffer.cc'; else $(CYGPATH_W) '$(srcdir)/maudemlBuffer.cc'; fi` libmixfix_a-interpreter.o: interpreter.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-interpreter.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-interpreter.Tpo" -c -o libmixfix_a-interpreter.o `test -f 'interpreter.cc' || echo '$(srcdir)/'`interpreter.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-interpreter.Tpo" "$(DEPDIR)/libmixfix_a-interpreter.Po"; else rm -f "$(DEPDIR)/libmixfix_a-interpreter.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='interpreter.cc' object='libmixfix_a-interpreter.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-interpreter.o `test -f 'interpreter.cc' || echo '$(srcdir)/'`interpreter.cc libmixfix_a-interpreter.obj: interpreter.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-interpreter.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-interpreter.Tpo" -c -o libmixfix_a-interpreter.obj `if test -f 'interpreter.cc'; then $(CYGPATH_W) 'interpreter.cc'; else $(CYGPATH_W) '$(srcdir)/interpreter.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-interpreter.Tpo" "$(DEPDIR)/libmixfix_a-interpreter.Po"; else rm -f "$(DEPDIR)/libmixfix_a-interpreter.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='interpreter.cc' object='libmixfix_a-interpreter.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-interpreter.obj `if test -f 'interpreter.cc'; then $(CYGPATH_W) 'interpreter.cc'; else $(CYGPATH_W) '$(srcdir)/interpreter.cc'; fi` libmixfix_a-moduleDatabase.o: moduleDatabase.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-moduleDatabase.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-moduleDatabase.Tpo" -c -o libmixfix_a-moduleDatabase.o `test -f 'moduleDatabase.cc' || echo '$(srcdir)/'`moduleDatabase.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-moduleDatabase.Tpo" "$(DEPDIR)/libmixfix_a-moduleDatabase.Po"; else rm -f "$(DEPDIR)/libmixfix_a-moduleDatabase.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moduleDatabase.cc' object='libmixfix_a-moduleDatabase.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-moduleDatabase.o `test -f 'moduleDatabase.cc' || echo '$(srcdir)/'`moduleDatabase.cc libmixfix_a-moduleDatabase.obj: moduleDatabase.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-moduleDatabase.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-moduleDatabase.Tpo" -c -o libmixfix_a-moduleDatabase.obj `if test -f 'moduleDatabase.cc'; then $(CYGPATH_W) 'moduleDatabase.cc'; else $(CYGPATH_W) '$(srcdir)/moduleDatabase.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-moduleDatabase.Tpo" "$(DEPDIR)/libmixfix_a-moduleDatabase.Po"; else rm -f "$(DEPDIR)/libmixfix_a-moduleDatabase.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='moduleDatabase.cc' object='libmixfix_a-moduleDatabase.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-moduleDatabase.obj `if test -f 'moduleDatabase.cc'; then $(CYGPATH_W) 'moduleDatabase.cc'; else $(CYGPATH_W) '$(srcdir)/moduleDatabase.cc'; fi` libmixfix_a-viewDatabase.o: viewDatabase.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-viewDatabase.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-viewDatabase.Tpo" -c -o libmixfix_a-viewDatabase.o `test -f 'viewDatabase.cc' || echo '$(srcdir)/'`viewDatabase.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-viewDatabase.Tpo" "$(DEPDIR)/libmixfix_a-viewDatabase.Po"; else rm -f "$(DEPDIR)/libmixfix_a-viewDatabase.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='viewDatabase.cc' object='libmixfix_a-viewDatabase.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-viewDatabase.o `test -f 'viewDatabase.cc' || echo '$(srcdir)/'`viewDatabase.cc libmixfix_a-viewDatabase.obj: viewDatabase.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-viewDatabase.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-viewDatabase.Tpo" -c -o libmixfix_a-viewDatabase.obj `if test -f 'viewDatabase.cc'; then $(CYGPATH_W) 'viewDatabase.cc'; else $(CYGPATH_W) '$(srcdir)/viewDatabase.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-viewDatabase.Tpo" "$(DEPDIR)/libmixfix_a-viewDatabase.Po"; else rm -f "$(DEPDIR)/libmixfix_a-viewDatabase.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='viewDatabase.cc' object='libmixfix_a-viewDatabase.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-viewDatabase.obj `if test -f 'viewDatabase.cc'; then $(CYGPATH_W) 'viewDatabase.cc'; else $(CYGPATH_W) '$(srcdir)/viewDatabase.cc'; fi` libmixfix_a-profileModule.o: profileModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-profileModule.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-profileModule.Tpo" -c -o libmixfix_a-profileModule.o `test -f 'profileModule.cc' || echo '$(srcdir)/'`profileModule.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-profileModule.Tpo" "$(DEPDIR)/libmixfix_a-profileModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-profileModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='profileModule.cc' object='libmixfix_a-profileModule.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-profileModule.o `test -f 'profileModule.cc' || echo '$(srcdir)/'`profileModule.cc libmixfix_a-profileModule.obj: profileModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-profileModule.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-profileModule.Tpo" -c -o libmixfix_a-profileModule.obj `if test -f 'profileModule.cc'; then $(CYGPATH_W) 'profileModule.cc'; else $(CYGPATH_W) '$(srcdir)/profileModule.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-profileModule.Tpo" "$(DEPDIR)/libmixfix_a-profileModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-profileModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='profileModule.cc' object='libmixfix_a-profileModule.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-profileModule.obj `if test -f 'profileModule.cc'; then $(CYGPATH_W) 'profileModule.cc'; else $(CYGPATH_W) '$(srcdir)/profileModule.cc'; fi` libmixfix_a-mixfixParser.o: mixfixParser.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-mixfixParser.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-mixfixParser.Tpo" -c -o libmixfix_a-mixfixParser.o `test -f 'mixfixParser.cc' || echo '$(srcdir)/'`mixfixParser.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-mixfixParser.Tpo" "$(DEPDIR)/libmixfix_a-mixfixParser.Po"; else rm -f "$(DEPDIR)/libmixfix_a-mixfixParser.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mixfixParser.cc' object='libmixfix_a-mixfixParser.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-mixfixParser.o `test -f 'mixfixParser.cc' || echo '$(srcdir)/'`mixfixParser.cc libmixfix_a-mixfixParser.obj: mixfixParser.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-mixfixParser.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-mixfixParser.Tpo" -c -o libmixfix_a-mixfixParser.obj `if test -f 'mixfixParser.cc'; then $(CYGPATH_W) 'mixfixParser.cc'; else $(CYGPATH_W) '$(srcdir)/mixfixParser.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-mixfixParser.Tpo" "$(DEPDIR)/libmixfix_a-mixfixParser.Po"; else rm -f "$(DEPDIR)/libmixfix_a-mixfixParser.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='mixfixParser.cc' object='libmixfix_a-mixfixParser.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-mixfixParser.obj `if test -f 'mixfixParser.cc'; then $(CYGPATH_W) 'mixfixParser.cc'; else $(CYGPATH_W) '$(srcdir)/mixfixParser.cc'; fi` libmixfix_a-visibleModule.o: visibleModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-visibleModule.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-visibleModule.Tpo" -c -o libmixfix_a-visibleModule.o `test -f 'visibleModule.cc' || echo '$(srcdir)/'`visibleModule.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-visibleModule.Tpo" "$(DEPDIR)/libmixfix_a-visibleModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-visibleModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='visibleModule.cc' object='libmixfix_a-visibleModule.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-visibleModule.o `test -f 'visibleModule.cc' || echo '$(srcdir)/'`visibleModule.cc libmixfix_a-visibleModule.obj: visibleModule.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-visibleModule.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-visibleModule.Tpo" -c -o libmixfix_a-visibleModule.obj `if test -f 'visibleModule.cc'; then $(CYGPATH_W) 'visibleModule.cc'; else $(CYGPATH_W) '$(srcdir)/visibleModule.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-visibleModule.Tpo" "$(DEPDIR)/libmixfix_a-visibleModule.Po"; else rm -f "$(DEPDIR)/libmixfix_a-visibleModule.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='visibleModule.cc' object='libmixfix_a-visibleModule.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-visibleModule.obj `if test -f 'visibleModule.cc'; then $(CYGPATH_W) 'visibleModule.cc'; else $(CYGPATH_W) '$(srcdir)/visibleModule.cc'; fi` libmixfix_a-sharedTokens.o: sharedTokens.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-sharedTokens.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-sharedTokens.Tpo" -c -o libmixfix_a-sharedTokens.o `test -f 'sharedTokens.cc' || echo '$(srcdir)/'`sharedTokens.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-sharedTokens.Tpo" "$(DEPDIR)/libmixfix_a-sharedTokens.Po"; else rm -f "$(DEPDIR)/libmixfix_a-sharedTokens.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sharedTokens.cc' object='libmixfix_a-sharedTokens.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-sharedTokens.o `test -f 'sharedTokens.cc' || echo '$(srcdir)/'`sharedTokens.cc libmixfix_a-sharedTokens.obj: sharedTokens.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-sharedTokens.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-sharedTokens.Tpo" -c -o libmixfix_a-sharedTokens.obj `if test -f 'sharedTokens.cc'; then $(CYGPATH_W) 'sharedTokens.cc'; else $(CYGPATH_W) '$(srcdir)/sharedTokens.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-sharedTokens.Tpo" "$(DEPDIR)/libmixfix_a-sharedTokens.Po"; else rm -f "$(DEPDIR)/libmixfix_a-sharedTokens.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sharedTokens.cc' object='libmixfix_a-sharedTokens.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-sharedTokens.obj `if test -f 'sharedTokens.cc'; then $(CYGPATH_W) 'sharedTokens.cc'; else $(CYGPATH_W) '$(srcdir)/sharedTokens.cc'; fi` libmixfix_a-metadataStore.o: metadataStore.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-metadataStore.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-metadataStore.Tpo" -c -o libmixfix_a-metadataStore.o `test -f 'metadataStore.cc' || echo '$(srcdir)/'`metadataStore.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-metadataStore.Tpo" "$(DEPDIR)/libmixfix_a-metadataStore.Po"; else rm -f "$(DEPDIR)/libmixfix_a-metadataStore.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='metadataStore.cc' object='libmixfix_a-metadataStore.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-metadataStore.o `test -f 'metadataStore.cc' || echo '$(srcdir)/'`metadataStore.cc libmixfix_a-metadataStore.obj: metadataStore.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-metadataStore.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-metadataStore.Tpo" -c -o libmixfix_a-metadataStore.obj `if test -f 'metadataStore.cc'; then $(CYGPATH_W) 'metadataStore.cc'; else $(CYGPATH_W) '$(srcdir)/metadataStore.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-metadataStore.Tpo" "$(DEPDIR)/libmixfix_a-metadataStore.Po"; else rm -f "$(DEPDIR)/libmixfix_a-metadataStore.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='metadataStore.cc' object='libmixfix_a-metadataStore.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-metadataStore.obj `if test -f 'metadataStore.cc'; then $(CYGPATH_W) 'metadataStore.cc'; else $(CYGPATH_W) '$(srcdir)/metadataStore.cc'; fi` libmixfix_a-printAttribute.o: printAttribute.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-printAttribute.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-printAttribute.Tpo" -c -o libmixfix_a-printAttribute.o `test -f 'printAttribute.cc' || echo '$(srcdir)/'`printAttribute.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-printAttribute.Tpo" "$(DEPDIR)/libmixfix_a-printAttribute.Po"; else rm -f "$(DEPDIR)/libmixfix_a-printAttribute.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='printAttribute.cc' object='libmixfix_a-printAttribute.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-printAttribute.o `test -f 'printAttribute.cc' || echo '$(srcdir)/'`printAttribute.cc libmixfix_a-printAttribute.obj: printAttribute.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-printAttribute.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-printAttribute.Tpo" -c -o libmixfix_a-printAttribute.obj `if test -f 'printAttribute.cc'; then $(CYGPATH_W) 'printAttribute.cc'; else $(CYGPATH_W) '$(srcdir)/printAttribute.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-printAttribute.Tpo" "$(DEPDIR)/libmixfix_a-printAttribute.Po"; else rm -f "$(DEPDIR)/libmixfix_a-printAttribute.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='printAttribute.cc' object='libmixfix_a-printAttribute.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-printAttribute.obj `if test -f 'printAttribute.cc'; then $(CYGPATH_W) 'printAttribute.cc'; else $(CYGPATH_W) '$(srcdir)/printAttribute.cc'; fi` libmixfix_a-banner.o: banner.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-banner.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-banner.Tpo" -c -o libmixfix_a-banner.o `test -f 'banner.cc' || echo '$(srcdir)/'`banner.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-banner.Tpo" "$(DEPDIR)/libmixfix_a-banner.Po"; else rm -f "$(DEPDIR)/libmixfix_a-banner.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='banner.cc' object='libmixfix_a-banner.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-banner.o `test -f 'banner.cc' || echo '$(srcdir)/'`banner.cc libmixfix_a-banner.obj: banner.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-banner.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-banner.Tpo" -c -o libmixfix_a-banner.obj `if test -f 'banner.cc'; then $(CYGPATH_W) 'banner.cc'; else $(CYGPATH_W) '$(srcdir)/banner.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-banner.Tpo" "$(DEPDIR)/libmixfix_a-banner.Po"; else rm -f "$(DEPDIR)/libmixfix_a-banner.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='banner.cc' object='libmixfix_a-banner.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-banner.obj `if test -f 'banner.cc'; then $(CYGPATH_W) 'banner.cc'; else $(CYGPATH_W) '$(srcdir)/banner.cc'; fi` libmixfix_a-lexer.o: lexer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-lexer.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-lexer.Tpo" -c -o libmixfix_a-lexer.o `test -f 'lexer.cc' || echo '$(srcdir)/'`lexer.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-lexer.Tpo" "$(DEPDIR)/libmixfix_a-lexer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-lexer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lexer.cc' object='libmixfix_a-lexer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-lexer.o `test -f 'lexer.cc' || echo '$(srcdir)/'`lexer.cc libmixfix_a-lexer.obj: lexer.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-lexer.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-lexer.Tpo" -c -o libmixfix_a-lexer.obj `if test -f 'lexer.cc'; then $(CYGPATH_W) 'lexer.cc'; else $(CYGPATH_W) '$(srcdir)/lexer.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-lexer.Tpo" "$(DEPDIR)/libmixfix_a-lexer.Po"; else rm -f "$(DEPDIR)/libmixfix_a-lexer.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lexer.cc' object='libmixfix_a-lexer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-lexer.obj `if test -f 'lexer.cc'; then $(CYGPATH_W) 'lexer.cc'; else $(CYGPATH_W) '$(srcdir)/lexer.cc'; fi` libmixfix_a-surface.o: surface.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-surface.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-surface.Tpo" -c -o libmixfix_a-surface.o `test -f 'surface.cc' || echo '$(srcdir)/'`surface.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-surface.Tpo" "$(DEPDIR)/libmixfix_a-surface.Po"; else rm -f "$(DEPDIR)/libmixfix_a-surface.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='surface.cc' object='libmixfix_a-surface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-surface.o `test -f 'surface.cc' || echo '$(srcdir)/'`surface.cc libmixfix_a-surface.obj: surface.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-surface.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-surface.Tpo" -c -o libmixfix_a-surface.obj `if test -f 'surface.cc'; then $(CYGPATH_W) 'surface.cc'; else $(CYGPATH_W) '$(srcdir)/surface.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-surface.Tpo" "$(DEPDIR)/libmixfix_a-surface.Po"; else rm -f "$(DEPDIR)/libmixfix_a-surface.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='surface.cc' object='libmixfix_a-surface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-surface.obj `if test -f 'surface.cc'; then $(CYGPATH_W) 'surface.cc'; else $(CYGPATH_W) '$(srcdir)/surface.cc'; fi` libmixfix_a-freshVariableSource.o: freshVariableSource.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-freshVariableSource.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-freshVariableSource.Tpo" -c -o libmixfix_a-freshVariableSource.o `test -f 'freshVariableSource.cc' || echo '$(srcdir)/'`freshVariableSource.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-freshVariableSource.Tpo" "$(DEPDIR)/libmixfix_a-freshVariableSource.Po"; else rm -f "$(DEPDIR)/libmixfix_a-freshVariableSource.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='freshVariableSource.cc' object='libmixfix_a-freshVariableSource.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-freshVariableSource.o `test -f 'freshVariableSource.cc' || echo '$(srcdir)/'`freshVariableSource.cc libmixfix_a-freshVariableSource.obj: freshVariableSource.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-freshVariableSource.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-freshVariableSource.Tpo" -c -o libmixfix_a-freshVariableSource.obj `if test -f 'freshVariableSource.cc'; then $(CYGPATH_W) 'freshVariableSource.cc'; else $(CYGPATH_W) '$(srcdir)/freshVariableSource.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-freshVariableSource.Tpo" "$(DEPDIR)/libmixfix_a-freshVariableSource.Po"; else rm -f "$(DEPDIR)/libmixfix_a-freshVariableSource.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='freshVariableSource.cc' object='libmixfix_a-freshVariableSource.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-freshVariableSource.obj `if test -f 'freshVariableSource.cc'; then $(CYGPATH_W) 'freshVariableSource.cc'; else $(CYGPATH_W) '$(srcdir)/freshVariableSource.cc'; fi` libmixfix_a-compiler.o: compiler.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-compiler.o -MD -MP -MF "$(DEPDIR)/libmixfix_a-compiler.Tpo" -c -o libmixfix_a-compiler.o `test -f 'compiler.cc' || echo '$(srcdir)/'`compiler.cc; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-compiler.Tpo" "$(DEPDIR)/libmixfix_a-compiler.Po"; else rm -f "$(DEPDIR)/libmixfix_a-compiler.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='compiler.cc' object='libmixfix_a-compiler.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-compiler.o `test -f 'compiler.cc' || echo '$(srcdir)/'`compiler.cc libmixfix_a-compiler.obj: compiler.cc @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmixfix_a-compiler.obj -MD -MP -MF "$(DEPDIR)/libmixfix_a-compiler.Tpo" -c -o libmixfix_a-compiler.obj `if test -f 'compiler.cc'; then $(CYGPATH_W) 'compiler.cc'; else $(CYGPATH_W) '$(srcdir)/compiler.cc'; fi`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libmixfix_a-compiler.Tpo" "$(DEPDIR)/libmixfix_a-compiler.Po"; else rm -f "$(DEPDIR)/libmixfix_a-compiler.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='compiler.cc' object='libmixfix_a-compiler.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmixfix_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmixfix_a-compiler.obj `if test -f 'compiler.cc'; then $(CYGPATH_W) 'compiler.cc'; else $(CYGPATH_W) '$(srcdir)/compiler.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LIBRARIES) $(HEADERS) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am surface.yy: \ $(srcdir)/top.yy \ $(srcdir)/modules.yy \ $(srcdir)/commands.yy \ $(srcdir)/bottom.yy cat \ $(srcdir)/top.yy \ $(srcdir)/modules.yy \ $(srcdir)/commands.yy \ $(srcdir)/bottom.yy \ > surface.yy surface.cc surface.h: surface.yy $(BISON) -dv surface.yy -o surface.c mv surface.c surface.cc # According to the manual, automake is supposed to grok # .ll files and do the right thing... but it doesn't # seem to work so... lexer.cc: \ $(srcdir)/lexer.ll surface.h $(FLEX) -t -p -p $(srcdir)/lexer.ll > lexer.cc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Maude-2.6/src/Mixfix/mixfixParser.cc0000644000147300135640000006570411104676373014414 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class MixfixParser. // #define PARSER_DEBUG 0 // utility stuff #include "macros.hh" #include "vector.hh" #include "flagSet.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "higher.hh" #include "freeTheory.hh" #include "S_Theory.hh" #include "NA_Theory.hh" #include "builtIn.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" // core class definitions #include "equation.hh" #include "rule.hh" #include "sortConstraint.hh" #include "conditionFragment.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" // S theory class definitions #include "S_Symbol.hh" #include "S_Term.hh" // builtin class definitions #include "floatTerm.hh" #include "floatSymbol.hh" #include "stringSymbol.hh" #include "stringTerm.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "divisionSymbol.hh" // higher class definitions #include "equalityConditionFragment.hh" #include "sortTestConditionFragment.hh" #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" // strategy languages class definitions #include "trivialStrategy.hh" #include "applicationStrategy.hh" #include "concatenationStrategy.hh" #include "unionStrategy.hh" #include "iterationStrategy.hh" #include "branchStrategy.hh" #include "testStrategy.hh" // front end class definitions #include "mixfixModule.hh" #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierTerm.hh" #include "mixfixParser.hh" #ifdef SCP #define ROOT_NODE (parser.getRootNode()) #else #define ROOT_NODE (0) #endif const IntSet& MixfixParser::getTokenSet() // HACK { return tokens; } MixfixParser::MixfixParser(MixfixModule& client) : client(client), specialTerminals(Token::LAST_PROPERTY) { bubblesAllowed = false; } void MixfixParser::insertProduction(int lhs, const Vector& rhs, int prec, const Vector& gather, int action, int data, int data2) { static Vector rhs2; int rhsLength = rhs.length(); rhs2.resize(rhsLength); for (int i = 0; i < rhsLength; i++) { int s = rhs[i]; rhs2[i] = s < 0 ? s : tokens.insert(s); } #if PARSER_DEBUG cout << "production: " << lhs << " ::= "; for (int i = 0; i < rhs2.length(); i++) cout << rhs2[i] << ' '; cout << "\t\tprec: " << prec << "\tgather: "; for (int i = 0; i < gather.length(); i++) cout << gather[i] << ' '; cout << "(action = " << action << ", data = " << data << ", data2 = " << data2 <<")\n"; #endif parser.insertProd(lhs, rhs2, prec, gather); int nrActions = actions.length(); actions.expandBy(1); Action& a = actions[nrActions]; a.action = action; a.data = data; a.data2 = data2; } void MixfixParser::insertBubbleProduction(int lhs, int lowerBound, int upperBound, int leftParenCode, int rightParenCode, const Vector& excluded, int bubbleSpecIndex) { int left = (leftParenCode >= 0) ? tokens.insert(leftParenCode) : NONE; int right = (rightParenCode >= 0) ? tokens.insert(rightParenCode) : NONE; int nrExcluded = excluded.length(); Vector excludedTerminals(nrExcluded); for (int i = 0; i < nrExcluded; i++) excludedTerminals[i]= tokens.insert(excluded[i]); #if PARSER_DEBUG cout << "insertProd(" << lhs << ", " << lowerBound << ", " << upperBound << ", " << left << ", " << right << ", "; for (int i = 0; i < nrExcluded; i++) cout << excludedTerminals[i] << ' '; cout << ")\n"; #endif parser.insertProd(lhs, lowerBound, upperBound, left, right, excludedTerminals); int nrActions = actions.length(); actions.expandBy(1); Action& a = actions[nrActions]; a.action = MAKE_BUBBLE; a.data = bubbleSpecIndex; a.data2 = NONE; bubblesAllowed = true; } void MixfixParser::insertSpecialTerminal(int tokenProperty, int codeToUse) { specialTerminals[tokenProperty] = tokens.insert(codeToUse); } void MixfixParser::insertVariableTerminal(int sortNameCode, int codeToUse) { variableTerminals[sortNameCode] = tokens.insert(codeToUse); } void MixfixParser::insertIterSymbolTerminal(int iterSymbolNameCode, int codeToUse) { iterSymbolTerminals[iterSymbolNameCode] = tokens.insert(codeToUse); } int MixfixParser::translateSpecialToken(int code) { int sp = Token::specialProperty(code); if (sp == Token::CONTAINS_COLON) { int varName; int sortName; Token::split(code, varName, sortName); IntMap::const_iterator i = variableTerminals.find(sortName); if (i != variableTerminals.end()) return i->second; } else if (sp == Token::ITER_SYMBOL) { int opName; mpz_class dummy; Token::split(code, opName, dummy); IntMap::const_iterator i = iterSymbolTerminals.find(opName); if (i != iterSymbolTerminals.end()) return i->second; } else if (sp != NONE) return specialTerminals[sp]; if (bubblesAllowed) return tokens.cardinality(); return NONE; } int MixfixParser::parseSentence(const Vector& original, int root, int& firstBad, int begin, int nrTokens) { currentSentence = &original; currentOffset = begin; sentence.resize(nrTokens); for (int i = 0; i < nrTokens; i++) { int j = begin + i; int code = original[j].code(); int terminal = tokens.int2Index(code); if (terminal == NONE) { terminal = translateSpecialToken(code); if (terminal == NONE) { firstBad = j; return -1; } } sentence[i] = terminal; } #if PARSER_DEBUG cout << "parse: "; for (int i = 0; i < sentence.length(); i++) cout << sentence[i] << ' '; cout << ", " << root << '\n'; #endif nrParses = parser.parseSentence(sentence, root); DebugAdvisoryCheck(nrParses == 1, "MSCP10 returned " << nrParses << " parses"); if (nrParses < 0) nrParses = INT_MAX; // assume a wrap around error else if (nrParses == 0) // no parse { #ifdef SCP int nrErrors = parser.getNumberOfErrors(); DebugAdvisory("MSCP10 found " << nrErrors << " errors"); if (nrErrors >= 1) { int errorPos = parser.getErrorPosition(1); Assert(errorPos >= 0 && errorPos <= nrTokens, "parser return bad error position " << errorPos); firstBad = begin + errorPos; } else firstBad = begin + nrTokens; // this shouldn't happen but it does :( #else firstBad = begin + nrTokens; // HACK #endif } #if PARSER_DEBUG parser.printCurrentParse(); #endif return nrParses; } void MixfixParser::makeTerms(Term*& first, Term*& second) { Assert(nrParses > 0, "no parses"); int node = ROOT_NODE; first = makeTerm(node); second = 0; if (nrParses > 1) { #ifdef SCP (void) parser.nextAnalysis(); #else (void) parser.extractNextParse(); #endif second = makeTerm(node); } } void MixfixParser::insertStatement() { Assert(nrParses > 0, "no parses"); makeStatement(ROOT_NODE); } void MixfixParser::makeMatchCommand(Term*& pattern, Term*& subject, Vector& condition) { Assert(nrParses > 0, "no parses"); int node = ROOT_NODE; int matchPair = parser.getChild(node, 0); pattern = makeTerm(parser.getChild(matchPair, 0)); subject = makeTerm(parser.getChild(matchPair, 1)); if (actions[parser.getProductionNumber(node)].action == CONDITIONAL_COMMAND) makeCondition(parser.getChild(node, 2), condition); } void MixfixParser::makeUnifyCommand(Vector& lhs, Vector& rhs) { Assert(nrParses > 0, "no parses"); Assert(lhs.empty() && rhs.empty(), "return vectors should be empty"); for (int node = ROOT_NODE;; node = parser.getChild(node, 1)) { int unifyPair = parser.getChild(node, 0); lhs.append(makeTerm(parser.getChild(unifyPair, 0))); rhs.append(makeTerm(parser.getChild(unifyPair, 1))); if (actions[parser.getProductionNumber(node)].action != UNIFY_LIST) break; } } void MixfixParser::makeSearchCommand(Term*& initial, int& searchType, Term*& target, Vector& condition) { Assert(nrParses > 0, "no parses"); int node = ROOT_NODE; int searchPair = parser.getChild(node, 0); initial = makeTerm(parser.getChild(searchPair, 0)); int arrowType = parser.getChild(searchPair, 1); searchType = actions[parser.getProductionNumber(arrowType)].data; target = makeTerm(parser.getChild(searchPair, 2)); if (actions[parser.getProductionNumber(node)].action == CONDITIONAL_COMMAND) makeCondition(parser.getChild(node, 2), condition); } void MixfixParser::makeStrategyCommand(Term*& subject, StrategyExpression*& strategy) { Assert(nrParses > 0, "no parses"); int node = ROOT_NODE; int term = parser.getChild(node, 0); int strat = parser.getChild(node, 1); subject = makeTerm(term); strategy = makeStrategy(strat); } void MixfixParser::makeAssignment(int node, Vector& variables, Vector& values) { Term* var = makeTerm(parser.getChild(node, 0)); if (dynamic_cast(var)) { Term* val = makeTerm(parser.getChild(node, 1)); variables.append(var); values.append(val); } else { IssueWarning(*var << ": " << var << " is not a variable - ignoring assignment."); var->deepSelfDestruct(); } } void MixfixParser::makeSubstitution(int node, Vector& variables, Vector& values) { while (actions[parser.getProductionNumber(node)].action == MAKE_SUBSTITUTION) { makeAssignment(parser.getChild(node, 0), variables, values); node = parser.getChild(node, 1); } Assert(actions[parser.getProductionNumber(node)].action == PASS_THRU, "unexpected action"); makeAssignment(parser.getChild(node, 0), variables, values); } StrategyExpression* MixfixParser::makeStrategy(int node) { StrategyExpression* s; Action& a = actions[parser.getProductionNumber(node)]; switch (a.action) { case PASS_THRU: { return makeStrategy(parser.getChild(node, 0)); } case MAKE_TRIVIAL: { s = new TrivialStrategy(a.data); break; } case MAKE_ALL: { Vector variables; Vector values; Vector strategies; s = new ApplicationStrategy(UNDEFINED, variables, values, strategies); break; } case MAKE_APPLICATION: { int label = actions[parser.getProductionNumber(parser.getChild(node, 0))].data; Vector variables; Vector values; Vector strategies; int child = 1; if (a.data) { makeSubstitution(parser.getChild(node, 1), variables, values); ++child; } if (a.data2) makeStrategyList(parser.getChild(node, child), strategies); s = new ApplicationStrategy(label, variables, values, strategies); break; } case MAKE_TOP: { s = makeStrategy(parser.getChild(node, 0)); if (ApplicationStrategy* a = dynamic_cast(s)) a->setTop(); else { int pos = currentOffset + parser.getFirstPosition(node); IssueWarning(LineNumber((*currentSentence)[pos].lineNumber()) << ": use of top strategy modifier on a non-application strategy ignored."); } break; } case MAKE_CONCATENATION: case MAKE_UNION: { Vector strategies; do { strategies.append(makeStrategy(parser.getChild(node, 0))); node = parser.getChild(node, 1); } while (actions[parser.getProductionNumber(node)].action == a.action); strategies.append(makeStrategy(node)); if (a.action == MAKE_CONCATENATION) s = new ConcatenationStrategy(strategies); else s = new UnionStrategy(strategies); break; } case MAKE_ITERATION: { s = new IterationStrategy(makeStrategy(parser.getChild(node, 0)), actions[parser.getProductionNumber(node)].data); break; } case MAKE_BRANCH: { BranchStrategy::Action successAction = static_cast(actions[parser.getProductionNumber(node)].data); BranchStrategy::Action failureAction = static_cast(actions[parser.getProductionNumber(node)].data2); int child = 0; StrategyExpression* successStrategy = (successAction == BranchStrategy::NEW_STRATEGY) ? makeStrategy(parser.getChild(node, ++child)) : 0; StrategyExpression* failureStrategy = (failureAction == BranchStrategy::NEW_STRATEGY) ? makeStrategy(parser.getChild(node, ++child)) : 0; s = new BranchStrategy(makeStrategy(parser.getChild(node, 0)), successAction, successStrategy, failureAction, failureStrategy); break; } case MAKE_TEST: { Vector condition; if (parser.getNumberOfChildren(node) > 1) // such that clause makeCondition(parser.getChild(node, 2), condition); s = new TestStrategy(makeTerm(parser.getChild(node, 0)), actions[parser.getProductionNumber(node)].data, condition); break; } default: { s = 0; // to avoid uninitialized variable warning CantHappen("bad action " << a.action); } } return s; } void MixfixParser::makeStrategyList(int node, Vector& strategies) { while (actions[parser.getProductionNumber(node)].action == MAKE_STRATEGY_LIST) { strategies.append(makeStrategy(parser.getChild(node, 0))); node = parser.getChild(node, 1); } Assert(actions[parser.getProductionNumber(node)].action == PASS_THRU, "unexpected action"); strategies.append(makeStrategy(parser.getChild(node, 0))); } Sort* MixfixParser::getSort(int node) { return client.getSorts()[actions[parser.getProductionNumber(node)].data]; } Term* MixfixParser::makeTerm(int node) { Term* t; Vector args; int pos = currentOffset + parser.getFirstPosition(node); Action& a = actions[parser.getProductionNumber(node)]; switch (a.action) { case PASS_THRU: { return makeTerm(parser.getChild(node, 0)); } case MAKE_TERM: { Symbol* symbol = client.getSymbols()[a.data]; int nrArgs = symbol->arity(); if (nrArgs > 0) { int t = parser.getChild(node, 0); if (actions[parser.getProductionNumber(t)].action == ASSOC_LIST) { /* do { args.append(makeTerm(parser.getChild(t, 0))); t = parser.getChild(t, 1); } while (actions[parser.getProductionNumber(t)] == ASSOC_LIST); args.append(makeTerm(t)); */ do { args.append(makeTerm(parser.getChild(t, 1))); t = parser.getChild(t, 0); } while (actions[parser.getProductionNumber(t)].action == ASSOC_LIST); args.append(makeTerm(t)); int n = args.length() - 1; for (int i = n / 2; i >= 0; i--) { Term* t = args[i]; args[i] = args[n - i]; args[n - i] = t; } } else { for (int i = 0; i < nrArgs; i++) args.append(makeTerm(parser.getChild(node, i))); } } t = symbol->makeTerm(args); break; } case MAKE_NATURAL: { SuccSymbol* symbol = safeCast(SuccSymbol*, client.getSymbols()[a.data]); mpz_class nat((*currentSentence)[pos].name(), 10); t = symbol->makeNatTerm(nat); break; } case MAKE_INTEGER: { MinusSymbol* symbol = safeCast(MinusSymbol*, client.getSymbols()[a.data]); mpz_class integer((*currentSentence)[pos].name(), 10); t = symbol->makeIntTerm(integer); break; } case MAKE_RATIONAL: { DivisionSymbol* symbol = safeCast(DivisionSymbol*, client.getSymbols()[a.data]); const char* name = (*currentSentence)[pos].name(); char* s = new char[strlen(name) + 1]; strcpy(s, name); char* p = index(s, '/'); Assert(p != 0, "no /"); *p = '\0'; mpz_class numerator(s, 10); mpz_class denominator(p + 1, 10); delete [] s; t = symbol->makeRatTerm(numerator, denominator); break; } case MAKE_FLOAT: { FloatSymbol* symbol = static_cast(client.getSymbols()[a.data]); double value = Token::codeToDouble((*currentSentence)[pos].code()); t = new FloatTerm(symbol, value); break; } case MAKE_STRING: { StringSymbol* symbol = static_cast(client.getSymbols()[a.data]); t = new StringTerm(symbol, Token::codeToRope((*currentSentence)[pos].code())); break; } case MAKE_QUOTED_IDENTIFIER: { QuotedIdentifierSymbol* symbol = static_cast(client.getSymbols()[a.data]); const char* name = (*currentSentence)[pos].name(); t = new QuotedIdentifierTerm(symbol, Token::encode(name + 1)); // strip the quote break; } case MAKE_SORT_TEST: { int colonPair = parser.getChild(node, 0); args.append(makeTerm(parser.getChild(colonPair, 0))); Sort* sort = getSort(parser.getChild(colonPair, 1)); t = client.instantiateSortTest(sort, a.data)->makeTerm(args); break; } case MAKE_VARIABLE: { Sort* sort = client.getSorts()[a.data]; VariableSymbol* symbol = safeCast(VariableSymbol*, client.instantiateVariable(sort)); int varName; int sortName; Token::split((*currentSentence)[pos].code(), varName, sortName); Assert(sortName == NONE || sortName == sort->id() || Token::auxProperty(sort->id()) == Token::AUX_STRUCTURED_SORT, "sort name clash"); t = new VariableTerm(symbol, varName); break; } case MAKE_VARIABLE_FROM_ALIAS: { Sort* sort = client.getSorts()[a.data]; VariableSymbol* symbol = safeCast(VariableSymbol*, client.instantiateVariable(sort)); t = new VariableTerm(symbol, (*currentSentence)[pos].code()); break; } case MAKE_POLYMORPH: { Symbol* symbol = client.instantiatePolymorph(a.data2, a.data); int nrArgs = symbol->arity(); for (int i = 0; i < nrArgs; i++) args.append(makeTerm(parser.getChild(node, i))); t = symbol->makeTerm(args); break; } case MAKE_ITER: { S_Symbol* symbol = safeCast(S_Symbol*, client.getSymbols()[a.data]); int opName; mpz_class number; Token::split((*currentSentence)[pos].code(), opName, number); Assert(opName == symbol->id(), "iter symbol name clash"); Term* arg = makeTerm(parser.getChild(node, 1)); t = new S_Term(symbol, number, arg); break; } #ifdef BUBBLES case MAKE_BUBBLE: { return client.makeBubble(a.data, *currentSentence, currentOffset + parser.getFirstPosition(node), currentOffset + parser.getLastPosition(node) - 1); // HACK last position } #endif default: { CantHappen("bad action"); return 0; // to avoid uninitialized variable warning } } t->setLineNumber((*currentSentence)[pos].lineNumber()); return t; } void MixfixParser::makeCondition(int node, Vector& condition) { while (actions[parser.getProductionNumber(node)].action == FRAGMENT_LIST) { condition.append(makeConditionFragment(parser.getChild(node, 0))); node = parser.getChild(node, 1); } condition.append(makeConditionFragment(parser.getChild(node, 0))); } ConditionFragment* MixfixParser::makeConditionFragment(int node) { ConditionFragment* f; Action& a = actions[parser.getProductionNumber(node)]; switch (a.action) { case PASS_THRU: { f = makeConditionFragment(parser.getChild(node, 0)); break; } case MAKE_TRUE: { f = new EqualityConditionFragment(makeTerm(parser.getChild(node, 0)), client.makeTrueTerm()); break; } case MAKE_EQUALITY: { int equalityPair = parser.getChild(node, 0); f = new EqualityConditionFragment(makeTerm(parser.getChild(equalityPair, 0)), makeTerm(parser.getChild(equalityPair, 1))); break; } case MAKE_SORT_TEST: { int colonPair = parser.getChild(node, 0); f = new SortTestConditionFragment(makeTerm(parser.getChild(colonPair, 0)), getSort(parser.getChild(colonPair, 1))); break; } case MAKE_ASSIGNMENT: { int assignPair = parser.getChild(node, 0); f = new AssignmentConditionFragment(makeTerm(parser.getChild(assignPair, 0)), makeTerm(parser.getChild(assignPair, 1))); break; } case MAKE_REWRITE: { int arrowPair = parser.getChild(node, 0); f = new RewriteConditionFragment(makeTerm(parser.getChild(arrowPair, 0)), makeTerm(parser.getChild(arrowPair, 1))); break; } default: { f = 0; // to avoid uninitialized variable warning CantHappen("bad action"); } } return f; } void MixfixParser::makeStatement(int node) { int label = NONE; int metadata = NONE; FlagSet flags; Vector printNames; Vector printSorts; if (actions[parser.getProductionNumber(node)].action == MAKE_ATTRIBUTE_PART) makeAttributePart(parser.getChild(node, 1), label, metadata, flags, printNames, printSorts); makeStatementPart(parser.getChild(node, 0), label, metadata, flags, printNames, printSorts); } void MixfixParser::makeAttributePart(int node, int& label, int& metadata, FlagSet& flags, Vector& printNames, Vector& printSorts) { for (int listNode = parser.getChild(node, 0);; listNode = parser.getChild(listNode, 1)) { int attrNode = parser.getChild(listNode, 0); switch (actions[parser.getProductionNumber(attrNode)].action) { case MAKE_LABEL_ATTRIBUTE: { int labelNode = parser.getChild(attrNode, 0); label = actions[parser.getProductionNumber(labelNode)].data; break; } case MAKE_METADATA_ATTRIBUTE: { int metaDataNode = parser.getChild(attrNode, 0); int pos = currentOffset + parser.getFirstPosition(metaDataNode); metadata = (*currentSentence)[pos].code(); break; } case MAKE_NONEXEC_ATTRIBUTE: { flags.setFlags(NONEXEC); break; } case MAKE_OWISE_ATTRIBUTE: { flags.setFlags(OWISE); break; } case MAKE_PRINT_ATTRIBUTE: { flags.setFlags(PRINT); if (parser.getNumberOfChildren(attrNode) > 0) // nonempty makePrintList(parser.getChild(attrNode, 0), printNames, printSorts); break; } } if (actions[parser.getProductionNumber(listNode)].action != MAKE_ATTRIBUTE_LIST) break; } } void MixfixParser::makePrintList(int node, Vector& names, Vector& sorts) { typedef pair IntPair; // HACK for (int listNode = node;; listNode = parser.getChild(listNode, 1)) { // // listNode is either // ::= // or // ::= // // printItemNode is either // ::= // or // ::= // int printItemNode = parser.getChild(listNode, 0); switch (actions[parser.getProductionNumber(printItemNode)].action) { case MAKE_STRING: { int pos = currentOffset + parser.getFirstPosition(printItemNode); int code = (*currentSentence)[pos].code(); DebugAdvisory("string = " << (*currentSentence)[pos]); names.append(code); sorts.append(0); break; } case MAKE_VARIABLE: { // // The sort name is embedded in the action but we may have the get // the variable base name by splitting a token. // int variableNode = parser.getChild(printItemNode, 0); DebugAdvisory("variableNode = " << variableNode); Action& a = actions[parser.getProductionNumber(variableNode)]; int pos = currentOffset + parser.getFirstPosition(variableNode); int varName = (*currentSentence)[pos].code(); if (a.action != MAKE_VARIABLE_FROM_ALIAS) { // // Full variable name given, need to split of base. // int baseName; int sortName; Token::split(varName, baseName, sortName); varName = baseName; } names.append(varName); sorts.append(client.getSorts()[a.data]); break; } default: CantHappen("unexpected item in print list"); } if (actions[parser.getProductionNumber(listNode)].action != MAKE_PRINT_LIST) break; } } void MixfixParser::makeStatementPart(int node, int label, int metadata, FlagSet& flags, const Vector& printNames, const Vector& printSorts) { Vector condition; int action = actions[parser.getProductionNumber(node)].action; if (action == MAKE_CMB || action == MAKE_CEQ || action == MAKE_CRL) makeCondition(parser.getChild(node, 1), condition); int bodyNode = parser.getChild(node, 0); int pairNode = parser.getChild(bodyNode, 0); if (actions[parser.getProductionNumber(bodyNode)].action == MAKE_LABEL) { label = actions[parser.getProductionNumber(pairNode)].data; pairNode = parser.getChild(bodyNode, 1); } // // Get line number of statement keyword. // int lineNumber = (*currentSentence)[currentOffset].lineNumber(); switch (action) { case MAKE_MB: case MAKE_CMB: { WarningCheck(!(flags.getFlag(OWISE)), LineNumber(lineNumber) << ": owise attribute not allowed for membership axioms."); Term* lhs = makeTerm(parser.getChild(pairNode, 0)); Sort* sort = getSort(parser.getChild(pairNode, 1)); SortConstraint* sc = new SortConstraint(label, lhs, sort, condition); if (flags.getFlag(NONEXEC)) sc->setNonexec(); sc->setLineNumber(lineNumber); client.insertSortConstraint(sc); if (metadata != NONE) client.insertMetadata(MixfixModule::MEMB_AX, sc, metadata); if (flags.getFlag(PRINT)) client.insertPrintAttribute(MixfixModule::MEMB_AX, sc, printNames, printSorts); break; } case MAKE_EQ: case MAKE_CEQ: { Term* lhs = makeTerm(parser.getChild(pairNode, 0)); Term* rhs = makeTerm(parser.getChild(pairNode, 1)); Equation* eq = new Equation(label, lhs, rhs, flags.getFlag(OWISE), condition); if (flags.getFlag(NONEXEC)) eq->setNonexec(); eq->setLineNumber(lineNumber); client.insertEquation(eq); if (metadata != NONE) client.insertMetadata(MixfixModule::EQUATION, eq, metadata); if (flags.getFlag(PRINT)) client.insertPrintAttribute(MixfixModule::EQUATION, eq, printNames, printSorts); break; } case MAKE_RL: case MAKE_CRL: { WarningCheck(!(flags.getFlag(OWISE)), LineNumber(lineNumber) << ": owise attribute not allowed for rules."); Term* lhs = makeTerm(parser.getChild(pairNode, 0)); Term* rhs = makeTerm(parser.getChild(pairNode, 1)); Rule* rl = new Rule(label, lhs, rhs, condition); if (flags.getFlag(NONEXEC)) rl->setNonexec(); rl->setLineNumber(lineNumber); client.insertRule(rl); if (metadata != NONE) client.insertMetadata(MixfixModule::RULE, rl, metadata); if (flags.getFlag(PRINT)) client.insertPrintAttribute(MixfixModule::RULE, rl, printNames, printSorts); break; } default: CantHappen("bad action"); } } Maude-2.6/src/Mixfix/execute.cc0000644000147300135640000002504111375106766013367 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for commands that do rewriting. // #ifdef QUANTIFY_REWRITING #include "quantify.h" #endif void Interpreter::clearContinueInfo() { delete savedContext; delete savedMatchSearchState; delete savedUnificationProblem; delete savedRewriteSequenceSearch; delete savedStrategicSearch; savedContext = 0; savedMatchSearchState = 0; savedUnificationProblem = 0; savedRewriteSequenceSearch = 0; savedStrategicSearch = 0; continueFunc = 0; if (savedModule != 0) { (void) savedModule->unprotect(); savedModule = 0; } } DagNode* Interpreter::makeDag(Term* subjectTerm) { subjectTerm = subjectTerm->normalize(false); NatSet eagerVariables; Vector problemVariables; subjectTerm->markEager(0, eagerVariables, problemVariables); DagNode* d = subjectTerm->term2Dag(); subjectTerm->deepSelfDestruct(); return d; } DagNode* Interpreter::makeDag(const Vector& subject) { if (Term* s = currentModule->getFlatModule()->parseTerm(subject)) return makeDag(s); return 0; } void Interpreter::startUsingModule(VisibleModule* module) { clearContinueInfo(); UserLevelRewritingContext::clearTrialCount(); if (getFlag(AUTO_CLEAR_MEMO)) module->clearMemo(); if (getFlag(AUTO_CLEAR_PROFILE)) module->clearProfile(); module->protect(); } void Interpreter::beginRewriting(bool debug) { if (debug) UserLevelRewritingContext::setDebug(); #ifdef QUANTIFY_REWRITING quantify_start_recording_data(); #endif } void Interpreter::printModifiers(Int64 number, Int64 number2) { if (number2 != NONE || number2 != NONE) { cout << '['; if (number != NONE) cout << number; if (number2 != NONE) cout << ", " << number2; cout << "] "; } cout << "in " << currentModule << " : "; } void Interpreter::printTiming(Int64 nrRewrites, Int64 cpu, Int64 real) { cout << " in " << cpu / 1000 << "ms cpu (" << real / 1000 << "ms real) ("; if (cpu > 0) cout << (1000000 * nrRewrites) / cpu; else cout << '~'; cout << " rewrites/second)"; } void Interpreter::printStats(const Timer& timer, RewritingContext& context, bool timingFlag) { Int64 nrRewrites = context.getTotalCount(); cout << "rewrites: " << nrRewrites; Int64 real; Int64 virt; Int64 prof; if (timingFlag && timer.getTimes(real, virt, prof)) printTiming(nrRewrites, prof, real); cout << '\n'; if (getFlag(SHOW_BREAKDOWN)) { cout << "mb applications: " << context.getMbCount() << " equational rewrites: " << context.getEqCount() << " rule rewrites: " << context.getRlCount() << '\n'; } } void Interpreter::endRewriting(Timer& timer, UserLevelRewritingContext* context, VisibleModule* module, ContinueFuncPtr cf) { timer.stop(); #ifdef QUANTIFY_REWRITING quantify_stop_recording_data(); #endif clearContinueInfo(); // just in case debugger left info if (UserLevelRewritingContext::aborted()) { delete context; (void) module->unprotect(); } else { if (getFlag(SHOW_STATS)) printStats(timer, *context, getFlag(SHOW_TIMING)); DagNode* r = context->root(); cout << "result " << r->getSort() << ": " << r << '\n'; cout.flush(); if (xmlBuffer != 0) { xmlBuffer->generateResult(*context, timer, getFlag(SHOW_STATS), getFlag(SHOW_TIMING), getFlag(SHOW_BREAKDOWN)); } if (cf == 0) { delete context; (void) module->unprotect(); } else { savedContext = context; savedModule = module; continueFunc = cf; } } UserLevelRewritingContext::clearDebug(); // even if we didn't start in debug mode } #if 1 //int CONVERT_THRESHOLD = 8; //int MERGE_THRESHOLD = 16; void Interpreter::reduce(const Vector& subject, bool debug) { if (DagNode* d = makeDag(subject)) { UserLevelRewritingContext* context = new UserLevelRewritingContext(d); if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); cout << "reduce in " << currentModule << " : " << d << " ." << endl; if (xmlBuffer != 0) xmlBuffer->generateReduce(d); } VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); beginRewriting(debug); Timer timer(getFlag(SHOW_TIMING)); context->reduce(); endRewriting(timer, context, fm); } } #else int CONVERT_THRESHOLD; int MERGE_THRESHOLD; void Interpreter::reduce(const Vector& subject, bool debug) { if (DagNode* d = makeDag(subject)) { for (int i = 0; i < 2; ++i) { for (CONVERT_THRESHOLD = 0; CONVERT_THRESHOLD <= 20; CONVERT_THRESHOLD += 1) { for (MERGE_THRESHOLD = 0; MERGE_THRESHOLD <= 20; MERGE_THRESHOLD += 1) { cout << "CONVERT_THRESHOLD = " << CONVERT_THRESHOLD << "\tMERGE_THRESHOLD = " << MERGE_THRESHOLD << endl; DagNode* d = makeDag(subject); UserLevelRewritingContext* context = new UserLevelRewritingContext(d); VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); beginRewriting(debug); Timer timer(getFlag(SHOW_TIMING)); context->reduce(); endRewriting(timer, context, fm); } } } } } #endif void Interpreter::rewrite(const Vector& subject, Int64 limit, bool debug) { if (DagNode* d = makeDag(subject)) { if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); cout << "rewrite "; if (limit != NONE) cout << '[' << limit << "] "; cout << "in " << currentModule << " : " << d << " ." << endl; if (xmlBuffer != 0) xmlBuffer->generateRewrite(d, limit); } UserLevelRewritingContext* context = new UserLevelRewritingContext(d); VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); if (getFlag(AUTO_CLEAR_RULES)) fm->resetRules(); beginRewriting(debug); Timer timer(getFlag(SHOW_TIMING)); context->ruleRewrite(limit); endRewriting(timer, context, fm, &Interpreter::rewriteCont); } } void Interpreter::rewriteCont(Int64 limit, bool debug) { UserLevelRewritingContext* context = savedContext; VisibleModule* fm = savedModule; savedContext = 0; savedModule = 0; continueFunc = 0; if (xmlBuffer != 0 && getFlag(SHOW_COMMAND)) xmlBuffer->generateContinue("rewrite", fm, limit); context->clearCount(); beginRewriting(debug); Timer timer(getFlag(SHOW_TIMING)); context->ruleRewrite(limit); endRewriting(timer, context, fm, &Interpreter::rewriteCont); } void Interpreter::fRewrite(const Vector& subject, Int64 limit, Int64 gas, bool debug) { if (DagNode* d = makeDag(subject)) { if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); cout << "frewrite "; printModifiers(limit, gas); cout << d << " ." << endl; if (xmlBuffer != 0) xmlBuffer->generateFrewrite(d, limit, gas); } UserLevelRewritingContext* context = new UserLevelRewritingContext(d); context->setObjectMode(ObjectSystemRewritingContext::FAIR); VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); if (getFlag(AUTO_CLEAR_RULES)) fm->resetRules(); beginRewriting(debug); Timer timer(getFlag(SHOW_TIMING)); context->fairRewrite(limit, (gas == NONE) ? 1 : gas); endRewriting(timer, context, fm, &Interpreter::fRewriteCont); } } void Interpreter::fRewriteCont(Int64 limit, bool debug) { UserLevelRewritingContext* context = savedContext; VisibleModule* fm = savedModule; savedContext = 0; savedModule = 0; continueFunc = 0; if (xmlBuffer != 0 && getFlag(SHOW_COMMAND)) xmlBuffer->generateContinue("frewrite", fm, limit); context->clearCount(); beginRewriting(debug); Timer timer(getFlag(SHOW_TIMING)); context->fairContinue(limit); endRewriting(timer, context, fm, &Interpreter::fRewriteCont); } void Interpreter::cont(Int64 limit, bool debug) { if (limit != 0) { if (continueFunc != 0) (this->*continueFunc)(limit, debug); else IssueWarning("can't continue."); } } void Interpreter::creduce(const Vector& subject) { #ifdef COMPILER if (DagNode* d = makeDag(subject)) { if (makeExecutable(currentModule, getFlag(COMPILE_COUNT))) { if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); cout << "creduce in " << currentModule << " : " << d << " ." << endl; } // // Write dag to file, run executable and read result from file. // outputGraph(d); runExecutable(); Int64 nrRewrites; Int64 cpu; Int64 real; DagNode* r = inputGraph(nrRewrites, cpu, real); // // Print number of rewrites, timing and result. // if (getFlag(SHOW_STATS)) { cout << "rewrites: " << nrRewrites; if (getFlag(SHOW_TIMING)) printTiming(nrRewrites, cpu, real); cout << '\n'; } cout << "result " << r->getSort() << ": " << r << '\n'; cout.flush(); } } #endif } void Interpreter::sreduce(const Vector& subject) { if (DagNode* d = makeDag(subject)) { if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); cout << "sreduce in " << currentModule << " : " << d << " ." << endl; } VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); Timer timer(getFlag(SHOW_TIMING)); // // Start of stack based reduction // DagNode* r = d; // HACK - don't have implementation yet int nrRewrites = 0; // // End of stack based reduction. // if (getFlag(SHOW_STATS)) { cout << "rewrites: " << nrRewrites; Int64 real; Int64 virt; Int64 prof; if (getFlag(SHOW_TIMING) && timer.getTimes(real, virt, prof)) printTiming(nrRewrites, prof, real); cout << '\n'; } cout << "result " << r->getSort() << ": " << r << '\n'; cout.flush(); (void) fm->unprotect(); } } Maude-2.6/src/Mixfix/loopSymbol.hh0000644000147300135640000000372307752252040014070 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for symbols for built in loop operation. // #ifndef _loopSymbol_hh_ #define _loopSymbol_hh_ #include "freeSymbol.hh" class LoopSymbol : public FreeSymbol { public: LoopSymbol(int id); bool attachData(const Vector& opDeclaration, const char* purpose, const Vector& data); bool attachSymbol(const char* purpose, Symbol* symbol); void copyAttachments(Symbol* original, SymbolMap* map); void getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data); void getSymbolAttachments(Vector& purposes, Vector& symbols); bool extractOutput(DagNode* loopNode, Vector& bubble); DagNode* injectInput(DagNode* loopNode, const Vector& bubble); private: NO_COPYING(LoopSymbol); DagNode* createQidList(const Vector& ids); bool extractQid(DagNode* metaQid, int& id); bool extractQidList(DagNode* metaQidList, Vector& ids); static const Vector eagerStrategy; QuotedIdentifierSymbol* qidSymbol; Symbol* nilQidListSymbol; AU_Symbol* qidListSymbol; }; #endif Maude-2.6/src/Mixfix/loopMode.cc0000644000147300135640000001174010166651313013472 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for loop mode. // void Interpreter::loop(const Vector& subject) { if (DagNode* d = makeDag(subject)) { savedLoopSubject = subject; // deep copy VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); doLoop(d, fm); } } bool Interpreter::contLoop2(const Vector& input) { if (savedContext != 0) { DagNode* d = savedContext->root(); if (LoopSymbol* l = dynamic_cast(d->symbol())) { VisibleModule* fm = savedModule; delete savedContext; savedContext = 0; savedModule = 0; continueFunc = 0; doLoop(l->injectInput(d, input), fm); return true; } else IssueWarning("bad loop state."); } else IssueWarning("no loop state."); return false; } void Interpreter::contLoop(const Vector& input) { if (!contLoop2(input) && savedLoopSubject.length() != 0) { Vector savedInput(input); // in case input gets overwritten, say in debugger IssueAdvisory("attempting to reinitialize loop."); if (DagNode* d = makeDag(savedLoopSubject)) { VisibleModule* fm = currentModule->getFlatModule(); startUsingModule(fm); doLoop(d, fm); if (contLoop2(savedInput)) return; } IssueAdvisory("unable to reinitialize loop."); } } void Interpreter::doLoop(DagNode* d, VisibleModule* module) { UserLevelRewritingContext* context = new UserLevelRewritingContext(d); if (getFlag(AUTO_CLEAR_RULES)) module->resetRules(); #ifdef QUANTIFY_REWRITING quantify_start_recording_data(); #endif Timer timer(getFlag(SHOW_LOOP_TIMING)); context->ruleRewrite(NONE); timer.stop(); #ifdef QUANTIFY_REWRITING quantify_stop_recording_data(); #endif clearContinueInfo(); if (UserLevelRewritingContext::aborted()) { delete context; (void) module->unprotect(); } else { if (getFlag(SHOW_LOOP_STATS)) printStats(timer, *context, getFlag(SHOW_LOOP_TIMING)); DagNode* r = context->root(); if (LoopSymbol* l = dynamic_cast(r->symbol())) { Vector bubble; l->extractOutput(r, bubble); printBubble(cout, bubble); } else cout << "non-loop result " << r->getSort() << ": " << r << '\n'; cout.flush(); savedContext = context; savedModule = module; continueFunc = &Interpreter::rewriteCont; } UserLevelRewritingContext::clearDebug(); // even if we didn't start in debug mode } void Interpreter::printBubble(ostream& s, const Vector& bubble) { bool ansiActive = false; bool needSpace = false; int nrTokens = bubble.length(); for (int i = 0; i < nrTokens; i++) { const char* n = Token::name(bubble[i]); // // Single character case. // if (n[1] == 0) { switch (n[0]) { case '(': case ')': case '[': case ']': case '{': case '}': case ',': needSpace = false; break; default: if (needSpace) s << ' '; needSpace = true; } s << n[0]; continue; } // // First character backslash case. // if (n[0] == '\\') { if (n[2] == 0) { switch (n[1]) { case 'n': { s << '\n'; needSpace = false; continue; } case 't': { s << '\t'; needSpace = false; continue; } case 's': { s << ' '; needSpace = false; continue; } case '\\': { if (needSpace) s << ' '; s << '\\'; needSpace = true; continue; } // // ANSI stuff. // #define MACRO(m, t) \ case m: { s << Tty(Tty::t); ansiActive = true; continue; } #include "ansiEscapeSequences.cc" #undef MACRO case 'o': { s << Tty(Tty::RESET); ansiActive = false; continue; } } } else if (n[1] == '`' && n[3] == 0) { switch (n[2]) { case '(': case ')': case '[': case ']': case '{': case '}': case ',': if (needSpace) s << ' '; s << n[2]; needSpace = true; continue; } } } // // Normal case. // if (needSpace) s << ' '; s << n; needSpace = true; } if (ansiActive) s << Tty(Tty::RESET); s << '\n'; } Maude-2.6/src/Mixfix/quotedIdentifierDagNode.cc0000644000147300135640000000446207707045434016455 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class QuotedIdentifierDagNode. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // front end class definitions #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierDagNode.hh" #include "token.hh" QuotedIdentifierDagNode::QuotedIdentifierDagNode(QuotedIdentifierSymbol* symbol, int idIndex) : NA_DagNode(symbol), idIndex(idIndex) { } size_t QuotedIdentifierDagNode::getHashValue() { return hash(symbol()->getHashValue(), idIndex); } int QuotedIdentifierDagNode::compareArguments(const DagNode* other) const { int otherIndex = static_cast(other)->idIndex; if (idIndex == otherIndex) return 0; return strcmp(Token::name(idIndex), Token::name(otherIndex)); } void QuotedIdentifierDagNode::overwriteWithClone(DagNode* old) { QuotedIdentifierDagNode* d = new(old) QuotedIdentifierDagNode(safeCast(QuotedIdentifierSymbol*, symbol()), idIndex); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); } DagNode* QuotedIdentifierDagNode::makeClone() { QuotedIdentifierDagNode* d = new QuotedIdentifierDagNode(safeCast(QuotedIdentifierSymbol*, symbol()), idIndex); d->copySetRewritingFlags(this); d->setSortIndex(getSortIndex()); return d; } Maude-2.6/src/Mixfix/xmlBuffer.hh0000644000147300135640000000306207666304134013665 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to handle XML syntax and formatting. // #ifndef _xmlBuffer_hh_ #define _xmlBuffer_hh_ #include #include class XmlBuffer { NO_COPYING(XmlBuffer); public: XmlBuffer(ostream& output, int flushLevel = NONE); ~XmlBuffer(); void beginElement(const string& name); void endElement(); void attributePair(const string& name, const string& value); void attributePair(const string& name, const string& value, int index); void characterData(const string& charData); void comment(const string& text); private: void indent(); void translate(const string& value); ostream& output; const int flushLevel; stack elements; int indentLevel; bool startTagIncomplete; }; #endif Maude-2.6/src/Mixfix/command.cc0000644000147300135640000001731711145135667013347 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for general top level commands. // void SyntacticPreModule::loseFocus() { if (flatModule != 0) { flatModule->clearMemo(); flatModule->reset(); flatModule->economize(); } } void SyntacticPreModule::dump() { #ifdef DUMP getFlatModule()->dump(cout); #endif } void SyntacticPreModule::printSortTokenVector(ostream& s, const Vector& sorts) { int nrTokens = sorts.size(); s << Token::sortName(sorts[0].code()); for (int i = 1; i < nrTokens; ++i) s << ' ' << Token::sortName(sorts[i].code()); } void SyntacticPreModule::showModule(ostream& s) { s << MixfixModule::moduleTypeString(getModuleType()) << ' ' << this; int nrParameters = parameters.size(); if (nrParameters > 0) { s << '{' << parameters[0].name << " :: " << parameters[0].theory; for (int i = 1; i < nrParameters; ++i) s << ", " << parameters[i].name << " :: " << parameters[i].theory; s << '}'; } s << " is\n"; int nrImports = imports.length(); for (int i = 0; i < nrImports; i++) { if (UserLevelRewritingContext::interrupted()) return; s << " " << imports[i].mode << ' ' << imports[i].expr << " .\n"; } int nrSortDecls = sortDecls.length(); for (int i = 0; i < nrSortDecls; i++) { if (UserLevelRewritingContext::interrupted()) return; s << " sorts "; printSortTokenVector(s, sortDecls[i]); s << " .\n"; } int nrSubsortDecls = subsortDecls.length(); for (int i = 0; i < nrSubsortDecls; i++) { if (UserLevelRewritingContext::interrupted()) return; s << " subsorts "; printSortTokenVector(s, subsortDecls[i]); s << " .\n"; } bool follow = false; int nrOpDecls = opDecls.length(); for (int i = 0; i < nrOpDecls; i++) { OpDecl& opDecl = opDecls[i]; int defIndex = opDecl.defIndex; bool newFollow = (i + 1 < nrOpDecls) && (opDecls[i + 1].defIndex == defIndex); if (!follow) { s << ((opDefs[defIndex].symbolType.getBasicType() == SymbolType::VARIABLE) ? " var" : " op") << (newFollow ? "s " : " "); } s << opDecls[i].prefixName << ' '; follow = newFollow; if (!follow) { printOpDef(s, defIndex); if (UserLevelRewritingContext::interrupted()) return; } } int nrStatements = statements.length(); for (int i = 0; i < nrStatements; i++) { if (UserLevelRewritingContext::interrupted()) return; s << " " << statements[i] << " .\n"; } s << MixfixModule::moduleEndString(getModuleType()) << '\n'; } void SyntacticPreModule::printOpDef(ostream&s, int defIndex) { OpDef& opDef = opDefs[defIndex]; s << ": "; if (opDef.symbolType.getBasicType() == SymbolType::VARIABLE) s << opDef.types[0] << ' '; else { int nrArgs = opDef.types.length() - 1; for (int i = 0; i < nrArgs; i++) s << opDef.types[i] << ' '; s << "-> " << opDef.types[nrArgs] << ' '; } printAttributes(s, opDef); s << ".\n"; } void SyntacticPreModule::printAttributes(ostream& s, const OpDef& opDef) { SymbolType st = opDef.symbolType; if (!(st.hasFlag(SymbolType::ATTRIBUTES | SymbolType::CTOR | SymbolType::POLY | SymbolType::DITTO)) && opDef.special.empty() && opDef.metadata == NONE) return; const char* space = ""; s << '['; if (st.hasFlag(SymbolType::POLY)) { s << "poly ("; FOR_EACH_CONST(i, NatSet, opDef.polyArgs) { if (*i != 0) { s << space << *i; space = " "; } } if (opDef.polyArgs.contains(0)) { s << space << '0'; space = " "; } s << ')'; } // // Theory attributes. // if (st.hasFlag(SymbolType::ASSOC)) { s << space << "assoc"; space = " "; } if (st.hasFlag(SymbolType::COMM)) { s << space << "comm"; space = " "; } if (st.hasFlag(SymbolType::ITER)) { s << space << "iter"; space = " "; } if (st.hasFlag(SymbolType::MESSAGE)) { s << space << "msg"; space = " "; } if (st.hasFlag(SymbolType::OBJECT)) { s << space << "obj"; space = " "; } if (st.hasFlag(SymbolType::CONFIG)) { s << space << "config"; space = " "; } if (st.hasFlag(SymbolType::LEFT_ID | SymbolType::RIGHT_ID)) { s << space; space = " "; if (!(st.hasFlag(SymbolType::LEFT_ID))) s << "right "; else if (!(st.hasFlag(SymbolType::RIGHT_ID))) s << "left "; s << "id: " << opDef.identity; } if (st.hasFlag(SymbolType::IDEM)) { s << space << "idem"; space = " "; } // // Semantic attributes. // if (st.hasFlag(SymbolType::STRAT)) { s << space << "strat ("; space = " "; int stratLen = opDef.strategy.length(); for (int i = 0; i < stratLen; i++) s << opDef.strategy[i] << ((i == stratLen - 1) ? ')' : ' '); } if (st.hasFlag(SymbolType::MEMO)) { s << space << "memo"; space = " "; } if (st.hasFlag(SymbolType::FROZEN)) { s << space << "frozen"; space = " "; if (!(opDef.frozen.empty())) { s << " ("; const NatSet::const_iterator e = opDef.frozen.end(); for (NatSet::const_iterator i = opDef.frozen.begin();;) { s << *i + 1; if (++i == e) break; s << ' '; } s << ')'; } } if (st.hasFlag(SymbolType::CTOR)) { s << space << "ctor"; space = " "; } // // Syntactic attributes. // if (st.hasFlag(SymbolType::PREC)) { s << space << "prec " << opDef.prec; space = " "; } if (st.hasFlag(SymbolType::GATHER)) { s << space; space = " "; printGather(s, opDef.gather); } if (st.hasFlag(SymbolType::FORMAT)) { s << space; space = " "; printFormat(s, opDef.format); } if (opDef.metadata != NONE) { s << space << "metadata " << Token::name(opDef.metadata); space = " "; } if (!(opDef.special.empty())) { s << space << "special ("; space = " "; FOR_EACH_CONST(i, Vector, opDef.special) { static const char* hookTypes[] = { "id-hook", "op-hook", "term-hook" }; s << "\n " << hookTypes[i->type] << ' ' << Token::name(i->name) << " (" << i->details << ')'; } s << ')'; } // // Misc attributes. // if (st.hasFlag(SymbolType::DITTO)) { s << space << "ditto"; space = " "; } s << "] "; } void SyntacticPreModule::printGather(ostream& s, const Vector& gather) { static char gatherSymbols[] = {'e', 'E', '&'}; s << "gather ("; int gatherLen = gather.length(); for (int i = 0; i < gatherLen; i++) { s << gatherSymbols[gather[i] - MixfixModule::GATHER_e] << ((i == gatherLen - 1) ? ')' : ' '); } } void SyntacticPreModule::printFormat(ostream& s, const Vector& format) { s << "format ("; int formatLen = format.length(); for (int i = 0; i < formatLen; i++) s << Token::name(format[i]) << ((i == formatLen - 1) ? ')' : ' '); } Maude-2.6/src/Mixfix/symbolType.hh0000644000147300135640000001164711140442051014071 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for holding symbol type info. // #ifndef _symbolType_hh_ #define _symbolType_hh_ class SymbolType { public: // // A symbol type consist of a single basic type combined with // zero or more modification flags. // enum BasicTypes { STANDARD, // // System created symbols. // VARIABLE, SORT_TEST, // // Special properties. // SYSTEM_TRUE, SYSTEM_FALSE, BUBBLE, // // Special symbols that do not deal with attachments. // FLOAT, STRING, // // Special symbols that do deal with attachments. // BRANCH_SYMBOL, EQUALITY_SYMBOL, FLOAT_OP, STRING_OP, QUOTED_IDENTIFIER, QUOTED_IDENTIFIER_OP, MODEL_CHECKER_SYMBOL, SAT_SOLVER_SYMBOL, META_LEVEL_OP_SYMBOL, LOOP_SYMBOL, SUCC_SYMBOL, MINUS_SYMBOL, NUMBER_OP_SYMBOL, ACU_NUMBER_OP_SYMBOL, CUI_NUMBER_OP_SYMBOL, DIVISION_SYMBOL, RANDOM_OP_SYMBOL, MATRIX_OP_SYMBOL, COUNTER_SYMBOL, SOCKET_MANAGER_SYMBOL, INTERPRETER_MANAGER_SYMBOL, END_OF_SYMBOLS_WITH_ATTACHMENTS }; enum Flags { // // Syntactic attributes. // PREC = 0x1, GATHER = 0x2, FORMAT = 0x4, LATEX = 0x8, // // Semantic attributes. // STRAT = 0x10, MEMO = 0x20, FROZEN = 0x40, CTOR = 0x80, // // OO attributes. // CONFIG = 0x100, OBJECT = 0x200, MESSAGE = 0x400, // // Theory attributes. // ASSOC = 0x1000, COMM = 0x2000, LEFT_ID = 0x4000, RIGHT_ID = 0x8000, IDEM = 0x10000, ITER = 0x20000, // // Misc. // POLY = 0x400000, DITTO = 0x800000, // // Conjunctions. // AXIOMS = ASSOC | COMM | LEFT_ID | RIGHT_ID | IDEM, SIMPLE_ATTRIBUTES = ASSOC | COMM | IDEM | MEMO | CTOR | CONFIG | OBJECT | MESSAGE, ATTRIBUTES = PREC | GATHER | FORMAT | LATEX | STRAT | MEMO | FROZEN | CONFIG | OBJECT | MESSAGE | AXIOMS | ITER }; SymbolType(); // SymbolType(const SymbolType& other); int getFlags() const; void setFlags(int flags); void clearFlags(int flags); void assignFlags(int flags, bool value); int getBasicType() const; void setBasicType(int type); bool hasFlag(int flag) const; bool hasAllFlags(int flags) const; // bool hasAxioms() const; bool hasAttachments() const; bool hasSpecial() const; // bool isVariable() const; bool isCreatedOnTheFly() const; bool compatible(SymbolType other) const; bool dittoProblem() const; bool nonAlgebraic() const; static int specialNameToBasicType(const char* name); private: enum BitTwiddling { FLAG_MASK = 0xffffff, TYPE_SHIFT = 24 }; int info; }; inline SymbolType::SymbolType() { info = 0; } inline int SymbolType::getFlags() const { return info & FLAG_MASK; } inline void SymbolType::setFlags(int flags) { info |= flags; } inline void SymbolType::clearFlags(int flags) { info &= ~flags; } inline void SymbolType::assignFlags(int flags, bool value) { if (value) setFlags(flags); else clearFlags(flags); } inline int SymbolType::getBasicType() const { return info >> TYPE_SHIFT; } inline void SymbolType::setBasicType(int type) { info = (info & FLAG_MASK) | type << TYPE_SHIFT; } inline bool SymbolType::hasFlag(int flag) const { return getFlags() & flag; } inline bool SymbolType::hasAllFlags(int flags) const { return (getFlags() & flags) == flags; } inline bool SymbolType::hasAttachments() const { int t = getBasicType(); return (t >= BRANCH_SYMBOL) && (t < END_OF_SYMBOLS_WITH_ATTACHMENTS); } inline bool SymbolType::hasSpecial() const { int t = getBasicType(); return (t >= SYSTEM_TRUE) && (t < END_OF_SYMBOLS_WITH_ATTACHMENTS); } inline bool SymbolType::nonAlgebraic() const { // // These symbols with these types store nonalebraic "hidden" data. // int t = getBasicType(); return t == STRING || t == FLOAT || t == QUOTED_IDENTIFIER; } inline bool SymbolType::isCreatedOnTheFly() const { int t = getBasicType(); return hasFlag(POLY) || t == VARIABLE || t == SORT_TEST; } #ifndef NO_ASSERT ostream& operator<<(ostream& s, SymbolType st); #endif #endif Maude-2.6/src/Mixfix/token.cc0000644000147300135640000004023611431116433013031 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2010 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class Token. // // utility stuff #include "macros.hh" #include "vector.hh" // core stuff #include "lineNumber.hh" // mixfix stuff #include "token.hh" // our stuff #include "auxProperty.cc" StringTable Token::stringTable; Vector Token::specialProperties; Vector Token::auxProperties; char* Token::buffer = 0; int Token::bufferLength = 0; ostream& operator<<(ostream& s, const Token& token) { s << token.name(); return s; } ostream& operator<<(ostream& s, const Vector& tokens) { Token::printTokenVector(s, tokens, 0, tokens.length() - 1, true); return s; } void Token::printTokens(ostream& s, const Vector& tokens, const char* seperator) { const char* sep = ""; int nrTokens = tokens.length(); for (int i = 0; i < nrTokens; i++) { s << sep << tokens[i]; sep = seperator; } } void Token::printTokenVector(ostream& s, const Vector& tokens, int first, int last, bool fancySpacing) { if (fancySpacing) { bool needSpace = false; for (int i = first; i <= last; i++) { bool nextNeedSpace = true; const char* name = tokens[i].name(); char c = name[0]; if (c != '\0' && name[1] == '\0') { if (c == ')' || c == ']' || c == '}' || c == ',') needSpace = false; else if (c == '(' || c == '[' || c == '{') nextNeedSpace = false; } if (needSpace) s << ' '; s << name; needSpace = nextNeedSpace; } } else { for (int i = first; i <= last; i++) { if (i != first) s << ' '; s << tokens[i]; } } } void Token::reallocateBuffer(int length) { length *= 2; // to avoid piecemeal expansion char* newBuffer = new char[length]; (void) memcpy(newBuffer, buffer, bufferLength); delete [] buffer; buffer = newBuffer; bufferLength = length; } int Token::parameterRename(int parameterCode, int originalCode) { string newName(stringTable.name(parameterCode)); newName += '$'; newName += stringTable.name(originalCode); return encode(newName.c_str()); } void Token::fixUp(const char* tokenString, int& lineNumber) { // // This essentially a version of tokenize() that removes // \ newline sequences from the tokenString before tokenizing. // We also convert \t characters to spaces. // int nrBackslashNewlineCombos = 0; int j = 0; for (int i = 0;; i++) { char c = tokenString[i]; if (c == '\\' && tokenString[i + 1] == '\n') { // // Fix up \ newline case. // ++i; ++nrBackslashNewlineCombos; } else { if (c == '\t') { IssueWarning(LineNumber(lineNumber + nrBackslashNewlineCombos) << ": tab character in string literal - replacing it with space"); c = ' '; } bufferExpandTo(j + 1); buffer[j] = c; ++j; if (c == '\0') break; } } codeNr = encode(buffer); lineNr = lineNumber; lineNumber += nrBackslashNewlineCombos; } void Token::dropChar(const Token& original) { string truncated(stringTable.name(original.codeNr)); truncated.resize(truncated.size() - 1); codeNr = encode(truncated.c_str()); lineNr = original.lineNr; } int Token::dotNameCode(int sortNameCode) { string dottedName("."); dottedName += stringTable.name(sortNameCode); return encode(dottedName.c_str()); } int Token::quoteNameCode(int idCode) { string quotedName("'"); quotedName += stringTable.name(idCode); return encode(quotedName.c_str()); } bool Token::getInt(int& value) const { const char* str = name(); char* pointer; value = strtol(str, &pointer, 10); return pointer != str && *pointer == '\0'; } int Token::extractMixfix(int prefixNameCode, Vector& mixfixSyntax) { int sp = specialProperties[prefixNameCode]; if (sp != NONE && sp != CONTAINS_COLON && sp != ENDS_IN_COLON && sp != ITER_SYMBOL) return 0; // regular string literals exit here const char* name = stringTable.name(prefixNameCode); const char* p = name; for (;; p++) { char c = *p; if (c == '\0') return 0; if (c == '`' || c == '_' || c == '"') break; } // // Potentially has mixfix syntax. // int nrUnderscores = 0; bool stringMode = false; bool seenBS = false; string token(name, p - name); for (;; p++) { char c = *p; if (c == '\0') break; if (stringMode) { token += c; if (c == '\\') seenBS = !seenBS; else { if (c == '"' && !seenBS) stringMode = false; seenBS = false; } } else { if (c == '`') { if (!token.empty()) { mixfixSyntax.append(encode(token.c_str())); token.erase(); } continue; } else if (c == '_') ++nrUnderscores; // fall thru to special character code else if (!specialChar(c)) { token += c; if (c == '"') stringMode = true; continue; } // // Special character: terminate current token and add special character as a token. // if (!token.empty()) mixfixSyntax.append(encode(token.c_str())); token = c; mixfixSyntax.append(encode(token.c_str())); token.erase(); } } if (!token.empty()) mixfixSyntax.append(encode(token.c_str())); // // If the mixfix syntax turned out to be a single token, that wasn't different // from the prefix syntax we treat it as not having mixfix syntax in order to // avoid ambiguous parses. // if (mixfixSyntax.size() == 1 && mixfixSyntax[0] == prefixNameCode) { DebugAdvisory("deleting mixfixSyntax for " << name); mixfixSyntax.clear(); } return nrUnderscores; } void Token::checkForSpecialProperty(const char* tokenString) { int tokenNr = specialProperties.length(); specialProperties.expandBy(1); specialProperties[tokenNr] = NONE; auxProperties.expandBy(1); auxProperties[tokenNr] = computeAuxProperty(tokenString); const char* p = tokenString; if (*p == 0) return; // handle null strings correctly if (*p == '\'') { specialProperties[tokenNr] = QUOTED_IDENTIFIER; return; } if (*p == '"') { bool seenBackslash = false; for (p++; *p; p++) { char c = *p; if (c == '\\') seenBackslash = !seenBackslash; else { if (c == '"' && !seenBackslash) { if (*(p + 1) == '\0') specialProperties[tokenNr] = STRING; return; } seenBackslash = false; } } return; } { size_t len = strlen(tokenString); for (size_t i = len - 1; i > 0; --i) { char c = tokenString[i]; if (c == '^') { if (i == len - 1 || tokenString[i + 1] == '0') break; specialProperties[tokenNr] = ITER_SYMBOL; return; } if (!isdigit(c)) break; } } for (++p; *p; ++p) { if (*p == ':') specialProperties[tokenNr] = *(p + 1) ? CONTAINS_COLON : ENDS_IN_COLON; } if (specialProperties[tokenNr] != NONE) return; if (looksLikeFloat(tokenString)) { specialProperties[tokenNr] = FLOAT; return; } mpz_class i; int error = mpz_set_str(i.get_mpz_t(), tokenString, 10); if (error == 0) { specialProperties[tokenNr] = (i == 0) ? ZERO : ((i < 0) ? SMALL_NEG : SMALL_NAT); return; } if (looksLikeRational(tokenString)) { specialProperties[tokenNr] = RATIONAL; return; } } bool Token::looksLikeRational(const char* s) { if (*s == '-') s++; { char c = *s++; if (!isdigit(c) || c == '0') return false; } for (;;) { char c = *s++; if (c == '/') break; if (!isdigit(c)) return false; } { char c = *s++; if (!isdigit(c) || c == '0') return false; } for (;;) { char c = *s++; if (c == '\0') break; if (!isdigit(c)) return false; } return true; } bool Token::split(int code, int& prefix, int& suffix) { const char* p = stringTable.name(code); size_t len = strlen(p); char* t = new char[len + 1]; strcpy(t, p); for (size_t i = len - 1; i > 0; --i) { char c = t[i]; if (c == ':' || c == '.') { t[i] = '\0'; prefix = encode(t); suffix = (i == len - 1) ? NONE : encode(t + i + 1); delete [] t; return true; } } delete [] t; return false; } bool Token::split(int code, int& opName, mpz_class& number) { const char* p = stringTable.name(code); size_t len = strlen(p); char* t = new char[len + 1]; strcpy(t, p); for (size_t i = len - 1; i > 0; --i) { char c = t[i]; if (c == '^') { if (i == len - 1 || t[i + 1] == '0') break; t[i] = '\0'; opName = encode(t); number = t + i + 1; // convert from const char* delete [] t; return true; } if (!isdigit(c)) break; } delete [] t; return false; } bool Token::splitKind(int code, Vector& codes) { codes.clear(); const char* p = stringTable.name(code); size_t len = strlen(p); char* t = new char[len + 1]; p = strcpy(t, p); if (*p++ =='`' && *p++ == '[') { for(;;) { bool dummy; char *p2 = const_cast(skipSortName(p, dummy)); if (p2 != 0 && *p2 == '`') { *p2 = 0; codes.append(encode(p)); p = p2 + 1; switch (*p++) { case ']': { if (*p == '\0') { delete [] t; return true; } } case ',': continue; } } break; } } delete [] t; return false; } Int64 Token::codeToInt64(int code) { bool error; Int64 i = stringToInt64(stringTable.name(code), error, 10); if (error) // HACK { DebugAdvisory("converting out of range integer to 0"); return 0; } Assert(!error, "bad machine integer string"); return i; } int Token::int64ToCode(Int64 i) { int code = stringTable.encode(int64ToString(i, 10)); if (code == specialProperties.length()) { specialProperties.append((i < 0) ? SMALL_NEG : SMALL_NAT); auxProperties.append(AUX_SORT); } return code; } double Token::codeToDouble(int code) { bool error; double d = stringToDouble(stringTable.name(code), error); Assert(!error, "bad float string"); return d; } int Token::doubleToCode(double d) { int code = stringTable.encode(doubleToString(d)); if (code == specialProperties.length()) { specialProperties.append(FLOAT); auxProperties.append(computeAuxProperty(stringTable.name(code))); } return code; } crope Token::codeToRope(int code) { crope result; bool seenBackslash = false; for (const char* p = stringTable.name(code) + 1; *p; p++) { char c = *p; switch (c) { case '\\': { if (!seenBackslash) { seenBackslash = true; continue; } break; } case '"': { if (!seenBackslash) return result; break; } case 'a': { if (seenBackslash) c = '\a'; break; } case 'b': { if (seenBackslash) c = '\b'; break; } case 'f': { if (seenBackslash) c = '\f'; break; } case 'n': { if (seenBackslash) c = '\n'; break; } case 'r': { if (seenBackslash) c = '\r'; break; } case 't': { if (seenBackslash) c = '\t'; break; } case 'v': { if (seenBackslash) c = '\v'; break; } default: { if (seenBackslash && isdigit(c) && c != '8' && c != '9') { int i = c - '0'; c = *(p + 1); if (isdigit(c) && c != '8' && c != '9') { ++p; i = 8 * i + c - '0'; c = *(p + 1); if (isdigit(c) && c != '8' && c != '9') { ++p; i = 8 * i + c - '0'; } } c = i; } } } result.append(c); seenBackslash = false; } CantHappen("bad end to string"); return result; } void Token::ropeToString(const crope& r, string& result) { result = '"'; for (crope::const_iterator i = r.begin(); i != r.end(); ++i) { char c = *i; if (isprint(c)) { if (c == '\\' || c == '"') result += '\\'; result += c; } else { switch (c) { case '\a': { result += "\\a"; break; } case '\b': { result += "\\b"; break; } case '\f': { result += "\\f"; break; } case '\n': { result += "\\n"; break; } case '\r': { result += "\\r"; break; } case '\t': { result += "\\t"; break; } case '\v': { result += "\\v"; break; } default: { result += '\\'; int t = static_cast(c); // +ve int value of char result += '0' + t / 64; result += '0' + (t / 8) % 8; result += '0' + t % 8; } } } } result += '"'; } int Token::ropeToPrefixNameCode(const crope& r) { string result; bool needBQ = false; bool lastCharSpecial = false; bool stringMode = false; bool seenBS = false; for (crope::const_iterator i = r.begin(); i != r.end(); ++i) { char c = *i; if (stringMode) { if(!isprint(c)) return NONE; result += c; if (c == '\\') seenBS = !seenBS; else { if (c == '"' && !seenBS) stringMode = false; seenBS = false; } } else { if (isspace(c) || c == '`') needBQ = !lastCharSpecial && !(result.empty()); else if(!isprint(c)) return NONE; else { lastCharSpecial = specialChar(c) || c == '_'; if ((lastCharSpecial || needBQ) && (c != '_')) result += '`'; result += c; if (c == '"') stringMode = true; needBQ = false; } } } return stringMode ? NONE : encode(result.c_str()); } int Token::bubbleToPrefixNameCode(const Vector& opBubble) { int nrTokens = opBubble.length(); if (nrTokens == 1) { int code = opBubble[0].codeNr; // if (specialProperties[code] == STRING) // return code; // NEED TO FIX QUOTED STRINGS if (!specialChar(stringTable.name(code)[0])) return code; } int pos = 0; bool needBQ = false; for (int i = 0; i < nrTokens; i++) { const char* name = stringTable.name(opBubble[i].codeNr); char c = name[0]; if (specialChar(c)) needBQ = true; else if (c == '_' || c == '`') needBQ = false; if (needBQ) { bufferExpandTo(pos + 1); buffer[pos++] = '`'; } while (*name != '\0') { c = *name++; bufferExpandTo(pos + 1); buffer[pos++] = c; } needBQ = !(specialChar(c) || c == '_'); } bufferExpandTo(pos + 1); buffer[pos] = '\0'; return encode(buffer); } void Token::getRational(mpz_class& numerator, mpz_class& denominator) { const char* name = stringTable.name(codeNr); char* s = new char[strlen(name) + 1]; strcpy(s, name); char* p = index(s, '/'); Assert(p != 0, "no /"); *p = '\0'; mpz_set_str(numerator.get_mpz_t(), s, 10); mpz_set_str(denominator.get_mpz_t(), p + 1, 10); } void Token::peelParens(Vector& tokens) { // // If tokens look like ( ... ) with middle part having balanced parens, peel outer parens. // int len = tokens.size(); if (len <= 2) return; int open = encode("("); int close = encode(")"); if (tokens[0].codeNr != open && tokens[len - 1].codeNr != close) return; int depth = 0; for (int i = 1; i < len - 1; ++i) { int codeNr = tokens[i].codeNr; if (codeNr == open) ++depth; else if (codeNr == close) { --depth; if (depth < 0) return; } } if (depth != 0) return; for (int i = 1; i < len - 1; ++i) tokens[i - 1] = tokens[i]; tokens.resize(len - 2); } Maude-2.6/src/Mixfix/interpreter.hh0000644000147300135640000002426011375073257014302 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to hold interpreter state. // #ifndef _interpreter_hh_ #define _interpreter_hh_ #include #include "environment.hh" #include "moduleDatabase.hh" #include "moduleCache.hh" #include "compiler.hh" #include "viewDatabase.hh" class Interpreter : public Environment, public ModuleDatabase, public ModuleCache, #ifdef COMPILER public Compiler, #endif public ViewDatabase { NO_COPYING(Interpreter); public: enum SearchKind { SEARCH, NARROW, XG_NARROW }; enum Flags { // // Show (information) flags. // SHOW_COMMAND = 0x1, SHOW_STATS = 0x2, SHOW_TIMING = 0x4, SHOW_BREAKDOWN = 0x8, // // Loop mode flags. // SHOW_LOOP_STATS = 0x10, SHOW_LOOP_TIMING = 0x20, // // Memoization flags. // AUTO_CLEAR_MEMO = 0x100, // // Profiler flags. // PROFILE = 0x200, AUTO_CLEAR_PROFILE = 0x400, // // Debugger flags. // BREAK = 0x800, // // Tracer flags. // TRACE = 0x1000, TRACE_CONDITION = 0x2000, TRACE_WHOLE = 0x4000, TRACE_SUBSTITUTION = 0x8000, TRACE_SELECT = 0x10000, TRACE_MB = 0x20000, TRACE_EQ = 0x40000, TRACE_RL = 0x80000, TRACE_REWRITE = 0x100000, TRACE_BODY = 0x200000, TRACE_BUILTIN = 0x400000, // // Print attribute flags // PRINT_ATTRIBUTE = 0x800000, PRINT_ATTRIBUTE_NEWLINE = 0x1000000, /* PRINT_ATTRIBUTE_MB = 0x2000000, PRINT_ATTRIBUTE_EQ = 0x4000000, PRINT_ATTRIBUTE_RL = 0x8000000, */ // // Counter flags. // AUTO_CLEAR_RULES = 0x40000000, // // Compiler flags. // COMPILE_COUNT = 0x80000000, // // Flag groups. // EXCEPTION_FLAGS = TRACE | BREAK | PROFILE | PRINT_ATTRIBUTE, DEFAULT_FLAGS = SHOW_COMMAND | SHOW_STATS | SHOW_TIMING | SHOW_LOOP_TIMING | COMPILE_COUNT | TRACE_CONDITION | TRACE_SUBSTITUTION | TRACE_MB | TRACE_EQ | TRACE_RL | TRACE_REWRITE | TRACE_BODY | TRACE_BUILTIN | AUTO_CLEAR_PROFILE | AUTO_CLEAR_RULES | PRINT_ATTRIBUTE_NEWLINE }; enum PrintFlags { // // General prettyprinter flags. // PRINT_GRAPH = 0x1, // print as a set of DAG nodes PRINT_CONCEAL = 0x2, // respect concealed argument lists PRINT_FORMAT = 0x4, // respect format attribute PRINT_MIXFIX = 0x8, // mixfix notation PRINT_WITH_PARENS = 0x10, // maximal parens PRINT_COLOR = 0x20, // dag node coloring based on ctor/reduced status // // Prettyprinter flags for particular symbol types. // PRINT_WITH_ALIASES = 0x100, // for variables PRINT_FLAT = 0x200, // for assoc symbols PRINT_NUMBER = 0x400, // for nats & ints PRINT_RAT = 0x800, // for rats DEFAULT_PRINT_FLAGS = PRINT_FORMAT | PRINT_MIXFIX | PRINT_WITH_ALIASES | PRINT_FLAT | PRINT_NUMBER | PRINT_RAT }; Interpreter(); ~Interpreter(); void beginXmlLog(const char* fileName); void endXmlLog(); MaudemlBuffer* getXmlBuffer() const; void setFlag(Flags flag, bool polarity); bool getFlag(Flags flag) const; void setPrintFlag(PrintFlags flag, bool polarity); bool getPrintFlag(PrintFlags flag) const; int getPrintFlags() const; SyntacticPreModule* getCurrentModule() const; bool setCurrentModule(const Vector& moduleExpr, int start = 0); void setCurrentModule(SyntacticPreModule* module); void makeClean(int lineNumber); View* getCurrentView() const; bool setCurrentView(const Vector& viewExpr); void setCurrentView(View* view); void parse(const Vector& subject); void reduce(const Vector& subject, bool debug); void creduce(const Vector& subject); void sreduce(const Vector& subject); void rewrite(const Vector& subject, Int64 limit, bool debug); void fRewrite(const Vector& subject, Int64 limit, Int64 gas, bool debug); void eRewrite(const Vector& subject, Int64 limit, Int64 gas, bool debug); void sRewrite(const Vector& subjectAndStrategy, Int64 limit, bool debug); void cont(Int64 limit, bool debug); void match(const Vector& bubble, bool withExtension, Int64 limit); void unify(const Vector& bubble, Int64 limit); void search(const Vector& bubble, Int64 limit, Int64 depth, SearchKind searchKind); void showSearchPath(int stateNr); void showSearchPathLabels(int stateNr); void showSearchGraph(); void loop(const Vector& subject); void contLoop(const Vector& input); void addSelected(const Vector& opName); void traceSelect(bool add); void breakSelect(bool add); void traceExclude(bool add); void printConceal(bool add); bool traceId(int id); bool breakId(int id); bool excludedModule(int id); bool concealedSymbol(Symbol* symbol); void showProfile() const; void showKinds() const; void showSummary() const; void showSortsAndSubsorts() const; void showModule(bool all = true) const; void showModules(bool all) const; void showView() const; void showVars() const; void showOps(bool all = true) const; void showMbs(bool all = true) const; void showEqs(bool all = true) const; void showRls(bool all = true) const; ImportModule* getModuleOrIssueWarning(int name, const LineNumber& lineNumber); ImportModule* makeModule(const ModuleExpression* expr, ImportModule* enclosingModule = 0); private: typedef void (Interpreter::*ContinueFuncPtr)(Int64 limit, bool debug); static DagNode* makeDag(Term* subjectTerm); static void beginRewriting(bool debug); static void printTiming(Int64 nrRewrites, Int64 cpu, Int64 real); static void printBubble(ostream& s, const Vector& bubble); void clearContinueInfo(); DagNode* makeDag(const Vector& subject); void startUsingModule(VisibleModule* module); void printModifiers(Int64 number, Int64 number2); void printStats(const Timer& timer, RewritingContext& context, bool timingFlag); void endRewriting(Timer& timer, UserLevelRewritingContext* context, VisibleModule* module, ContinueFuncPtr cf = 0); void rewriteCont(Int64 limit, bool debug); void fRewriteCont(Int64 limit, bool debug); void eRewriteCont(Int64 limit, bool debug); bool contLoop2(const Vector& input); void doLoop(DagNode* d, VisibleModule* module); void searchCont(Int64 limit, bool debug); void sRewriteCont(Int64 limit, bool debug); void doSearching(Timer& timer, VisibleModule* module, RewriteSequenceSearch* state, int solutionCount, int limit); void doNarrowing(Timer& timer, VisibleModule* module, NarrowingSequenceSearch* state, int solutionCount, int limit); void doExternalRewriting(UserLevelRewritingContext* context, Int64 limit); void doStrategicSearch(Timer& timer, VisibleModule* module, StrategicSearch* state, int solutionCount, int limit); void printDecisionTime(const Timer& timer); void printSearchTiming(const Timer& timer, RewriteSequenceSearch* state); void doMatching(Timer& timer, VisibleModule* module, MatchSearchState* state, int solutionCount, int limit); void matchCont(Int64 limit, bool debug); void doUnification(Timer& timer, VisibleModule* module, UnificationProblem* problem, int solutionCount, int limit); void unifyCont(Int64 limit, bool debug); void updateSet(set& target, bool add); ofstream* xmlLog; MaudemlBuffer* xmlBuffer; int flags; int printFlags; SyntacticPreModule* currentModule; View* currentView; // // Continuation information. // UserLevelRewritingContext* savedContext; MatchSearchState* savedMatchSearchState; UnificationProblem* savedUnificationProblem; RewriteSequenceSearch* savedRewriteSequenceSearch; StrategicSearch* savedStrategicSearch; int savedSolutionCount; VisibleModule* savedModule; ContinueFuncPtr continueFunc; Vector savedLoopSubject; set selected; // temporary for building set of identifiers set traceIds; // names of symbols/labels selected for tracing set breakIds; // names of symbols/labels selected as break points set excludedModules; // names of modules to be excluded from tracing set concealedSymbols; // names of symbols to have their arguments concealed during printing }; inline void Interpreter::traceSelect(bool add) { updateSet(traceIds, add); } inline void Interpreter::breakSelect(bool add) { updateSet(breakIds, add); } inline void Interpreter::traceExclude(bool add) { updateSet(excludedModules, add); } inline void Interpreter::printConceal(bool add) { updateSet(concealedSymbols, add); } inline bool Interpreter::traceId(int id) { return traceIds.find(id) != traceIds.end(); } inline bool Interpreter::breakId(int id) { return breakIds.find(id) != breakIds.end(); } inline bool Interpreter::excludedModule(int id) { return excludedModules.find(id) != excludedModules.end(); } inline MaudemlBuffer* Interpreter::getXmlBuffer() const { return xmlBuffer; } inline bool Interpreter::getFlag(Flags flag) const { return flags & flag; } inline bool Interpreter::getPrintFlag(PrintFlags flag) const { return printFlags & flag; } inline int Interpreter::getPrintFlags() const { return printFlags; } inline SyntacticPreModule* Interpreter::getCurrentModule() const { return currentModule; } inline View* Interpreter::getCurrentView() const { return currentView; } inline void Interpreter::setCurrentView(View* view) { currentView = view; } #endif Maude-2.6/src/Mixfix/syntacticPreModule.hh0000644000147300135640000001514611401557635015555 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for surface syntax of modules. // #ifndef _syntacticPreModule_hh_ #define _syntacticPreModule_hh_ #include #include "preModule.hh" #include "lineNumber.hh" #include "syntaxContainer.hh" #include "sharedTokens.hh" #include "importModule.hh" #include "moduleDatabase.hh" class SyntacticPreModule : public PreModule, public LineNumber, public SyntaxContainer, private SharedTokens { NO_COPYING(SyntacticPreModule); public: enum HookType { ID_HOOK, OP_HOOK, TERM_HOOK }; SyntacticPreModule(Token startToken, Token moduleName); ~SyntacticPreModule(); void loseFocus(); void finishModule(Token endToken); bool isComplete(); void addParameter(Token name, ModuleExpression* theory); void addImport(Token mode, ModuleExpression* expr); void addSortDecl(const Vector& sortDecl); void addSubsortDecl(const Vector& subsortDecl); void addOpDecl(const Vector& opName); void makeOpDeclsConsistent(); void addType(bool kind, const Vector& tokens); void convertSortsToKinds(); void setFlag(int flag); void setPrec(Token range); void setGather(const Vector& gather); void setMetadata(Token metaDataTok); void setFormat(const Vector& format); void setIdentity(const Vector& identity); void setStrat(const Vector& strategy); void setFrozen(const Vector& frozen); void setPoly(const Vector& polyArgs); void setLatexMacro(const string& latexMacro); void addHook(HookType type, Token name, const Vector& details); void addVarDecl(Token varName); void addStatement(const Vector& statement); VisibleModule* getFlatSignature(); VisibleModule* getFlatModule(); const ModuleDatabase::ImportMap& getAutoImports() const; int getNrImports() const; int getImportMode(int index) const; const ModuleExpression* getImport(int index) const; int getNrParameters() const; int getParameterName(int index) const; const ModuleExpression* getParameter(int index) const; void dump(); void showModule(ostream& s = cout); // // Utility functions - maybe they should go elsewhere? // static void printGather(ostream& s, const Vector& gather); static void printFormat(ostream& s, const Vector& format); static bool checkFormatString(const char* string); private: struct Hook { HookType type; int name; Vector details; }; struct OpDecl { Token prefixName; int defIndex; union { Symbol* symbol; int polymorphIndex; }; bool originator; // did we originate this symbol in our flat module? int bubbleSpecIndex; }; struct OpDef { OpDef(); Vector types; Vector identity; Vector special; Vector strategy; NatSet frozen; NatSet polyArgs; int prec; Vector gather; Vector format; int metadata; SymbolType symbolType; string latexMacro; // // Filled out from types after connected components are determined. // Vector domainAndRange; }; struct Parameter { Token name; ModuleExpression* theory; }; struct Import { Token mode; ModuleExpression* expr; }; void process(); static void printAttributes(ostream& s, const OpDef& opDef); static void printSortTokenVector(ostream& s, const Vector& sorts); void regretToInform(Entity* doomedEntity); int findHook(const Vector& hookList, HookType type, int name); Symbol* findHookSymbol(const Vector& fullName); void printOpDef(ostream&s, int defIndex); bool defaultFixUp(OpDef& opDef, Symbol* symbol); bool defaultFixUp(OpDef& opDef, int index); void extractSpecialTerms(const Vector& bubble, int begin, ConnectedComponent* component, Vector& terms); Symbol* extractSpecialSymbol(const Vector& bubble, int& pos); void processImports(); void processSorts(); Sort* getSort(Token token); void checkOpTypes(); void checkType(const Type& type); void computeOpTypes(); Sort* computeType(const Type& type); void processOps(); void fixUpSymbols(); void processStatements(); DagNode* makeDag(Term* subjectTerm); DagNode* makeDag(const Vector& subject); bool compatible(int endTokenCode); int startTokenCode; Bool lastSawOpDecl; Bool isCompleteFlag; Vector parameters; Vector imports; Vector > sortDecls; Vector > subsortDecls; Vector opDecls; Vector opDefs; Vector > statements; set potentialLabels; ModuleDatabase::ImportMap autoImports; VisibleModule* flatModule; }; inline bool SyntacticPreModule::isComplete() { return isCompleteFlag; } inline void SyntacticPreModule::addSortDecl(const Vector& sortDecl) { if (sortDecl.empty()) IssueWarning("skipped empty sort declaration."); // would be nice to have a line number else sortDecls.append(sortDecl); } inline void SyntacticPreModule::addSubsortDecl(const Vector& subsortDecl) { subsortDecls.append(subsortDecl); } inline const ModuleDatabase::ImportMap& SyntacticPreModule::getAutoImports() const { return autoImports; } inline int SyntacticPreModule::getNrImports() const { return imports.length(); } inline int SyntacticPreModule::getImportMode(int index) const { return imports[index].mode.code(); } inline const ModuleExpression* SyntacticPreModule::getImport(int index) const { return imports[index].expr; } inline int SyntacticPreModule::getNrParameters() const { return parameters.length(); } inline int SyntacticPreModule::getParameterName(int index) const { return parameters[index].name.code(); } inline const ModuleExpression* SyntacticPreModule::getParameter(int index) const { return parameters[index].theory; } #endif Maude-2.6/src/Mixfix/unify.cc0000644000147300135640000000663411355213617013056 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for unify and xunify commands. // void Interpreter::unify(const Vector& bubble, Int64 limit) { VisibleModule* fm = currentModule->getFlatModule(); Vector lhs; Vector rhs; if (!(fm->parseUnifyCommand(bubble, lhs, rhs))) return; if (getFlag(SHOW_COMMAND)) { UserLevelRewritingContext::beginCommand(); cout << "unify "; if (limit != NONE) cout << '[' << limit << "] "; cout << "in " << currentModule << " : "; int nrPairs = lhs.size(); for (int i = 0; i < nrPairs; ++i) cout << lhs[i] << " =? " << rhs[i] << ((i == nrPairs - 1) ? " ." : " /\\ "); cout << endl; } startUsingModule(fm); #ifdef QUANTIFY_REWRITING quantify_start_recording_data(); #endif Timer timer(getFlag(SHOW_TIMING)); UnificationProblem* problem = new UnificationProblem(lhs, rhs, new FreshVariableSource(fm)); if (problem->problemOK()) doUnification(timer, fm, problem, 0, limit); else delete problem; #ifdef QUANTIFY_REWRITING else quantify_stop_recording_data(); #endif } void Interpreter::doUnification(Timer& timer, VisibleModule* module, UnificationProblem* problem, int solutionCount, int limit) { int i = 0; for (; i != limit; i++) { if (!problem->findNextUnifier()) { if (solutionCount == 0) { printDecisionTime(timer); cout << "No unifier.\n"; } break; } ++solutionCount; if (solutionCount == 1) printDecisionTime(timer); cout << "\nSolution " << solutionCount << '\n'; UserLevelRewritingContext::printSubstitution(problem->getSolution(), problem->getVariableInfo()); if (UserLevelRewritingContext::interrupted()) break; } #ifdef QUANTIFY_REWRITING quantify_stop_recording_data(); #endif clearContinueInfo(); // just in case debugger left info if (i == limit) // possible to continue { savedUnificationProblem = problem; savedSolutionCount = solutionCount; savedModule = module; continueFunc = &Interpreter::unifyCont; } else // tidy up { delete problem; module->unprotect(); } UserLevelRewritingContext::clearDebug(); MemoryCell::okToCollectGarbage(); } void Interpreter::unifyCont(Int64 limit, bool /* debug */) { UnificationProblem* problem = savedUnificationProblem; VisibleModule* fm = savedModule; savedUnificationProblem = 0; savedModule = 0; continueFunc = 0; #ifdef QUANTIFY_REWRITING quantify_start_recording_data(); #endif Timer timer(getFlag(SHOW_TIMING)); doUnification(timer, fm, problem, savedSolutionCount, limit); } Maude-2.6/src/Mixfix/sharedPrint.cc0000644000147300135640000000303407666304134014203 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Functions shared between 2 or more pretty printers. // bool MixfixModule::ambiguous(int iflags) { if (iflags & DOMAIN_OVERLOADED) return true; if (iflags & PSEUDOS) { if (iflags & PSEUDO_VARIABLE) return true; else if (iflags & PSEUDO_NAT) return !(kindsWithSucc.empty()); else if (iflags & PSEUDO_NEG) return !(kindsWithMinus.empty()); else if (iflags & PSEUDO_RAT) return !(kindsWithDivision.empty()); else if (iflags & PSEUDO_FLOAT) return !(floatSymbols.empty()); else if (iflags & PSEUDO_STRING) return !(stringSymbols.empty()); else if (iflags & PSEUDO_QUOTED_IDENTIFIER) return !(quotedIdentifierSymbols.empty()); } return false; } Maude-2.6/src/Mixfix/importModule.hh0000644000147300135640000003126611227756454014426 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for modules which can import and be imported. // #ifndef _importModule_hh_ #define _importModule_hh_ #include #include #include "mixfixModule.hh" #include "entity.hh" #include "fileTable.hh" class ImportModule : public MixfixModule, public Entity, public Entity::User { NO_COPYING(ImportModule); public: enum ImportMode { PROTECTING, EXTENDING, INCLUDING }; enum Origin { TEXT, SUMMATION, RENAMING, PARAMETER, INSTANTIATION, VIEW_LOCAL }; ImportModule(int name, ModuleType moduleType, Origin origin, Entity::User* parent); ~ImportModule(); void addImport(ImportModule* importedModule, ImportMode mode, LineNumber lineNumber); void addParameter(const Token parameterName, ImportModule* parameterTheory); void closeSortSet(); void closeSignature(); void deepSelfDestruct(); void importSorts(); void importOps(); void fixUpImportedOps(); void importStatements(); void resetImports(); void localStatementsComplete(); void protect(); bool unprotect(); Origin getOrigin() const; int getNrParameters() const; bool parametersBound() const; ImportModule* getParameterTheory(int index) const; int getParameterName(int index) const; int getNrImportedSorts() const; int getNrUserSorts() const; int getNrImportedSubsorts(int sortIndex) const; int getNrImportedSymbols() const; int getNrImportedPolymorphs() const; int getNrUserSymbols() const; int getNrImportedDeclarations(int symbolIndex) const; int getNrUserDeclarations(int symbolIndex) const; int getNrOriginalMembershipAxioms() const; int getNrOriginalEquations() const; int getNrOriginalRules() const; const set& getLabels() const; ImportModule* makeRenamedCopy(int name, Renaming* canonical, ModuleCache* moduleCache); ImportModule* makeParameterCopy(int moduleName, int parameterName, ModuleCache* moduleCache); ImportModule* makeInstantiation(int moduleName, const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache); int findParameterIndex(int name) const; bool moduleDeclared(Sort* sort) const; bool moduleDeclared(Symbol* symbol) const; bool moduleDeclaredPolymorph(int index) const; bool parameterDeclared(Sort* sort) const; bool parameterDeclared(Symbol* symbol) const; bool parameterDeclaredPolymorph(int index) const; private: enum Phase { UNVISITED, SORTS_IMPORTED, OPS_IMPORTED, OPS_FIXED_UP, STATEMENTS_IMPORTED, DOOMED }; typedef map ParameterMap; typedef set ParameterSet; static Sort* localSort(ImportModule* copy, Renaming* renaming, const Sort* sort); static Sort* localSort2(ImportModule* copy, Renaming* renaming, const Sort* sort); static void deepCopyCondition(ImportTranslation* importTranslation, const Vector& original, Vector& copy); static int instantiateSortName(int sortId, const ParameterMap& parameterMap, const ParameterSet& extraParameterSet); static Renaming* instantiateRenaming(const Renaming* original, const ParameterMap& parameterMap, const ParameterSet& extraParameterSet); ImportModule* instantiateBoundParameters(const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache); void regretToInform(Entity* doomedEntity); void donateSorts(ImportModule* importer); void donateSorts2(ImportModule* copy, Renaming* renaming = 0); void donateOps(ImportModule* importer); void donateOps2(ImportModule* copy, Renaming* renaming = 0); void fixUpDonatedOps(ImportModule* importer); void fixUpDonatedOps2(ImportModule* copy, Renaming* renaming = 0); void donateStatements(ImportModule* importer); void donateStatements2(ImportModule* importer, ImportTranslation& importTranslation); void resetImportPhase(); void finishCopy(ImportModule* copy, Renaming* canonical); void copyMetadata(ImportModule* importer, ImportTranslation& importTranslation, ItemType itemType, PreEquation* original, PreEquation* copy); ConnectedComponent* translateComponent(const Renaming* renaming, const ConnectedComponent* component) const; void addOpMappingsFromView(Renaming* canonical, const ImportModule* parameterCopyOfTheory, const View* view) const; // // Because makeInstantiation() is such complex procedure we split out 5 major // subtasks. // void handleInstantiationByParameter(ImportModule* copy, Renaming* canonical, ParameterMap& parameterMap, const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache) const; void handleInstantiationByTheoryView(ImportModule* copy, Renaming* canonical, ParameterMap& parameterMap, ParameterSet& extraParameterSet, const Vector& arguments, ModuleCache* moduleCache) const; void handleInstantiationByModuleView(ImportModule* copy, Renaming* canonical, ParameterMap& parameterMap, const Vector& arguments) const; void handleParameterizedSorts(Renaming* canonical, const ParameterMap& parameterMap, const ParameterSet& extraParameterSet) const; void handleRegularImports(ImportModule* copy, const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache) const; const Origin origin; Phase importPhase; // // These are the theories and modules we directly import. // // 0,..., parameterNames.size() - 1 parameters // parameterNames.size(),..., importedModules.size() - 1 regular imports // Vector parameterNames; Vector importedModules; // // Because for sorts, symbols, and polymorphs, stuff from parameter // theories is inserted first we can keep track of what came from // theories in order to stop it from being renamed. For modules // without parameters these will be set to 0. // int nrSortsFromParameters; int nrSymbolsFromParameters; int nrPolymorphsFromParameters; // // If we are a renaming, parameter copy or instantiation of another // module we need to store this info. // Renaming* canonicalRenaming; ImportModule* baseModule; // // If we are are a instantiation, we keep track of any views that we // a user of and if we have bound parameters, we also keep track // track of the parameter arguments our base module was instantiated // with so we can build a new instantiation when our bound // parameters are instantiated. // Vector viewArgs; Vector paramArgs; // // These data structures are only filled out for theories and record // the indices of any sorts and operators that were declared in an // imported module and are therefore not eligible to be mapped by a // view. // NatSet sortDeclaredInModule; NatSet opDeclaredInModule; NatSet polymorphDeclaredInModule; // // Need to keep track of what parts of MixfixModule actually belong // to us (and need to be donated to our importers) and what parts // we imported or otherwise generated. // // For sorts, symbols and op declarations, imports come first, // then locals, then generated. // // For subsorts, imported subsort (relations) come first, then locals. // The are no generated subsort relations. // // For mbs, eqs, and rls, locals come first, then imports. // The reason for this different order is to avoid imports unless // we ace actually going to do some work in the module. // int nrUserSorts; // total number of user declared sorts int nrImportedSorts; // how many of these were imported Vector nrImportedSubsorts; // for each sort, how many subsorts were imported int nrUserSymbols; // total number of user symbols int nrImportedSymbols; // how many of these were imported // // For each symbol: // Vector nrUserDecls; // total number of user declarations Vector nrImportedDecls; // total number of imported user declarations int nrImportedPolymorphs; // number of polymorphs that were imported int nrOriginalMembershipAxioms; int nrOriginalEquations; int nrOriginalRules; set labels; int protectCount; }; inline void ImportModule::protect() { ++protectCount; } inline ImportModule::Origin ImportModule::getOrigin() const { return origin; } inline int ImportModule::getNrImportedSorts() const { // // Sorts with index < this value were imported. // return nrImportedSorts; } inline int ImportModule::getNrParameters() const { return parameterNames.size(); } inline ImportModule* ImportModule::getParameterTheory(int index) const { Assert(index < getNrParameters(), "bad parameter index " << index << " in module " << (const MixfixModule*) this); return importedModules[index]->baseModule; } inline int ImportModule::getParameterName(int index) const { return parameterNames[index]; } inline int ImportModule::getNrUserSorts() const { // // Sorts with index >= this value were generated (e.g. for kinds). // return nrUserSorts; } inline int ImportModule::getNrImportedSubsorts(int sortIndex) const { // // Subsorts with index < this value were imported. // return (sortIndex < nrImportedSorts) ? nrImportedSubsorts[sortIndex] : 0; } inline int ImportModule::getNrImportedSymbols() const { // // Symbols with index < this value were imported. // return nrImportedSymbols; } inline int ImportModule::getNrImportedPolymorphs() const { // // Symbols with index < this value were imported. // return nrImportedPolymorphs; } inline int ImportModule::getNrUserSymbols() const { // // Symbols with index >= this value were generated (e.g. for polymorph instantiation). // return nrUserSymbols; } inline int ImportModule::getNrImportedDeclarations(int symbolIndex) const { // // Declarations with index < this value were imported. // return (symbolIndex >= nrImportedSymbols) ? 0 : nrImportedDecls[symbolIndex]; } inline int ImportModule::getNrUserDeclarations(int symbolIndex) const { // // Declarations with index >= this value were generated (e.g. for comm completion). // return nrUserDecls[symbolIndex]; } inline int ImportModule::getNrOriginalMembershipAxioms() const { // // Membership axioms with index >= this value were imported. // return nrOriginalMembershipAxioms; } inline int ImportModule::getNrOriginalEquations() const { // // Equations with index >= this value were imported. // return nrOriginalEquations; } inline int ImportModule::getNrOriginalRules() const { // // Rules with index >= this value were imported. // return nrOriginalRules; } inline const set& ImportModule::getLabels() const { return labels; } inline bool ImportModule::moduleDeclared(Sort* sort) const { Assert(sort->getModule() == this, "wrong module"); return sortDeclaredInModule.contains(sort->getIndexWithinModule()); } inline bool ImportModule::moduleDeclared(Symbol* symbol) const { Assert(symbol->getModule() == this, "wrong module"); return opDeclaredInModule.contains(symbol->getIndexWithinModule()); } inline bool ImportModule::moduleDeclaredPolymorph(int index) const { return polymorphDeclaredInModule.contains(index); } inline bool ImportModule::parameterDeclared(Sort* sort) const { Assert(sort->getModule() == this, "wrong module"); return sort->getIndexWithinModule() < nrSortsFromParameters; } inline bool ImportModule::parameterDeclared(Symbol* symbol) const { Assert(symbol->getModule() == this, "wrong module"); return symbol->getIndexWithinModule() < nrSymbolsFromParameters; } inline bool ImportModule::parameterDeclaredPolymorph(int index) const { return index < nrPolymorphsFromParameters; } #ifndef NO_ASSERT inline ostream& operator<<(ostream& s, const ImportModule* m) { // // Needed to avoid ambiguity. // s << static_cast(m); return s; } #endif #endif Maude-2.6/src/Mixfix/modules.yy0000644000147300135640000004161711500275063013443 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ /* * Module expressions. */ moduleExprDot : tokenBarDot expectedDot { moduleExpressions.push(new ModuleExpression($1)); } | endsInDot '.' { moduleExpressions.push(new ModuleExpression($1)); } | parenExpr expectedDot | renameExpr expectedDot | instantExpr expectedDot | moduleExpr '+' moduleExprDot { ModuleExpression* m1 = moduleExpressions.top(); moduleExpressions.pop(); ModuleExpression* m2 = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m1, m2)); } | ENDS_IN_DOT { Token t; t.dropChar($1); missingSpace(t); moduleExpressions.push(new ModuleExpression(t)); } ; moduleExpr : moduleExpr2 | moduleExpr '+' moduleExpr { ModuleExpression* m1 = moduleExpressions.top(); moduleExpressions.pop(); ModuleExpression* m2 = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m1, m2)); } ; moduleExpr2 : moduleExpr3 | renameExpr ; moduleExpr3 : parenExpr | instantExpr | token { moduleExpressions.push(new ModuleExpression($1)); } ; renameExpr : moduleExpr2 '*' renaming { ModuleExpression* m = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m, currentRenaming)); currentRenaming = 0; } ; instantExpr : moduleExpr3 '{' { clear(); } argList '}' { ModuleExpression* m = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m, tokenSequence)); } ; parenExpr : '(' moduleExpr ')' {} ; argList : argList ',' token { store($3); } | token { store($1); } ; /* * Renamings. */ renaming : '(' { oldSyntaxContainer = currentSyntaxContainer; currentSyntaxContainer = currentRenaming = new Renaming; } renaming2 /* must succeed so we can restore currentSyntaxContainer */ { currentSyntaxContainer = oldSyntaxContainer; } ')' ; renaming2 : mappingList | error ; mappingList : mappingList ',' mapping | mapping ; mapping : KW_SORT sortName KW_TO sortName { currentRenaming->addSortMapping($2, $4); } | KW_LABEL token KW_TO token { currentRenaming->addLabelMapping($2, $4); } | KW_OP { lexBubble(BAR_COLON | BAR_TO, 1); } fromSpec KW_TO { lexBubble(BAR_COMMA | BAR_LEFT_BRACKET | BAR_RIGHT_PAREN, 1); } toAttributes {} ; /* * The ':' alternative forces lookahead which allows the lexer to grab the bubble. */ fromSpec : ':' { Token::peelParens(lexerBubble); currentRenaming->addOpMapping(lexerBubble); } typeList arrow typeName {} | { Token::peelParens(lexerBubble); currentRenaming->addOpMapping(lexerBubble); } ; /* * The '[' alternative forces lookahead which allows the lexer to grab the bubble. */ toAttributes : '[' { Token::peelParens(lexerBubble); currentRenaming->addOpTarget(lexerBubble); } toAttributeList ']' {} | { Token::peelParens(lexerBubble); currentRenaming->addOpTarget(lexerBubble); } ; toAttributeList : toAttributeList toAttribute | toAttribute ; toAttribute : KW_PREC IDENTIFIER { currentRenaming->setPrec($2); } | KW_GATHER '(' { clear(); } idList ')' { currentRenaming->setGather(tokenSequence); } | KW_FORMAT '(' { clear(); } idList ')' { currentRenaming->setFormat(tokenSequence); } | KW_LATEX '(' { lexerLatexMode(); } LATEX_STRING ')' { currentRenaming->setLatexMacro($4); } ; /* * Views. */ view : KW_VIEW { lexerIdMode(); } token KW_FROM moduleExpr { fileTable.beginModule($1, $3); interpreter.setCurrentView(new View($3)); currentSyntaxContainer = CV; CV->addFrom(moduleExpressions.top()); moduleExpressions.pop(); } KW_TO moduleExpr { CV->addTo(moduleExpressions.top()); moduleExpressions.pop(); } expectedIs viewDecList KW_ENDV { lexerInitialMode(); fileTable.endModule(lineNumber); interpreter.insertView(($3).code(), CV); CV->finishView(); } ; viewDecList : viewDecList viewDeclaration | ; skipStrayArrow : KW_ARROW { IssueWarning(LineNumber($1.lineNumber()) << ": skipping " << QUOTE("->") << " in variable declaration."); } | ; viewDeclaration : KW_SORT sortName KW_TO sortDot { CV->addSortMapping($2, $4); } | KW_VAR varNameList ':' skipStrayArrow typeDot {} | KW_OP { lexBubble(BAR_COLON | BAR_TO, 1); } viewEndOpMap | error '.' ; sortDot : sortName expectedDot { $$ = $1; } | ENDS_IN_DOT { Token t; t.dropChar($1); missingSpace(t); $$ = t; } ; viewEndOpMap : ':' { // // Specific op->op mapping. // Token::peelParens(lexerBubble); // remove any enclosing parens from op name CV->addOpMapping(lexerBubble); } typeList arrow typeName KW_TO { lexBubble(END_STATEMENT, 1); } endBubble { Token::peelParens(lexerBubble); // remove any enclosing parens from op name CV->addOpTarget(lexerBubble); } | KW_TO { // // At this point we don't know if we have an op->term mapping // or a generic op->op mapping so we save the from description and // press on. // opDescription = lexerBubble; lexBubble(END_STATEMENT, 1) } endBubble { if (lexerBubble[0].code() == Token::encode("term")) { // // Op->term mapping. // CV->addOpTermMapping(opDescription, lexerBubble); } else { // // Generic op->op mapping. // Token::peelParens(opDescription); // remove any enclosing parens from op name CV->addOpMapping(opDescription); Token::peelParens(lexerBubble); // remove any enclosing parens from op name CV->addOpTarget(lexerBubble); } } ; endBubble : '.' {} | ENDS_IN_DOT { Token t; t.dropChar($1); missingSpace(t); lexerBubble.append(t); } ; parenBubble : '(' { lexBubble(BAR_RIGHT_PAREN, 1); } ')' {} ; /* * Modules and theories. */ module : startModule { lexerIdMode(); } token { interpreter.setCurrentModule(new SyntacticPreModule($1, $3)); currentSyntaxContainer = CM; fileTable.beginModule($1, $3); } parameters expectedIs decList KW_ENDM { lexerInitialMode(); fileTable.endModule(lineNumber); CM->finishModule($8); } ; dot : '.' {} | ENDS_IN_DOT { Token t; t.dropChar($1); missingSpace(t); store(t); } ; parameters : '{' parameterList '}' {} | ; parameterList : parameterList ',' parameter | parameter ; parameter : token colon2 moduleExpr { ModuleExpression* me = moduleExpressions.top(); moduleExpressions.pop(); CM->addParameter($1, me); } ; colon2 : KW_COLON2 {} | ':' { IssueWarning(LineNumber($1.lineNumber()) << ": saw " << QUOTE(':') << " instead of " << QUOTE("::") << " in parameter declaration."); } ; badType : ENDS_IN_DOT { singleton[0].dropChar($1); missingSpace(singleton[0]); currentSyntaxContainer->addType(false, singleton); $$ = $1; // needed for line number } ; typeDot : typeName expectedDot | badType {} ; startModule : KW_MOD | KW_OMOD ; decList : decList declaration | ; declaration : KW_IMPORT moduleExprDot { ModuleExpression* me = moduleExpressions.top(); moduleExpressions.pop(); CM->addImport($1, me); } | KW_SORT { clear(); } sortNameList dot { CM->addSortDecl(tokenSequence); } | KW_SUBSORT { clear(); } subsortList dot { CM->addSubsortDecl(tokenSequence); } | KW_OP { lexBubble(BAR_COLON, 1); } ':' { Token::peelParens(lexerBubble); CM->addOpDecl(lexerBubble); } domainRangeAttr {} | KW_OPS opNameList ':' domainRangeAttr {} | KW_VAR varNameList ':' skipStrayArrow typeDot {} | KW_MB { lexBubble($1, BAR_COLON, 1); } ':' { lexContinueBubble($3, END_STATEMENT, 1); } endBubble { CM->addStatement(lexerBubble); } | KW_CMB { lexBubble($1, BAR_COLON, 1); } ':' { lexContinueBubble($3, BAR_IF, 1); } KW_IF { lexContinueBubble($5, END_STATEMENT, 1); } endBubble { CM->addStatement(lexerBubble); } | KW_EQ { lexBubble($1, BAR_EQUALS, 1); } '=' { lexContinueBubble($3, END_STATEMENT, 1); } endBubble { CM->addStatement(lexerBubble); } | KW_CEQ { lexBubble($1, BAR_EQUALS, 1); } '=' { lexContinueBubble($3, BAR_IF, 1); } KW_IF { lexContinueBubble($5, END_STATEMENT, 1); } endBubble { CM->addStatement(lexerBubble); } | KW_RL { lexBubble($1, BAR_ARROW2, 1); } KW_ARROW2 { lexContinueBubble($3, END_STATEMENT, 1); } endBubble { CM->addStatement(lexerBubble); } | KW_CRL { lexBubble($1, BAR_ARROW2, 1); } KW_ARROW2 { lexContinueBubble($3, BAR_IF, 1); } KW_IF { lexContinueBubble($5, END_STATEMENT, 1); } endBubble { CM->addStatement(lexerBubble); } | KW_MSG { lexBubble(BAR_COLON, 1); } ':' { Token::peelParens(lexerBubble); CM->addOpDecl(lexerBubble); } domainRangeAttr { CM->setFlag(SymbolType::MESSAGE); } | KW_MSGS opNameList ':' domainRangeAttr { CM->setFlag(SymbolType::MESSAGE); } | KW_CLASS token { } classDef '.' { } | KW_SUBCLASS { clear(); } subsortList dot { CM->addSubsortDecl(tokenSequence); } | error '.' { // // Fix things that might be in a bad state due // to a partially processed declaration. // cleanUpModuleExpression(); CM->makeOpDeclsConsistent(); } ; classDef : '|' {} | '|' cPairList {} ; cPairList : cPair | cPairList ',' cPair ; cPair : tokenBarDot ':' token { } ; varNameList : varNameList tokenBarColon { currentSyntaxContainer->addVarDecl($2); } | tokenBarColon { currentSyntaxContainer->addVarDecl($1); } ; opNameList : opNameList simpleOpName | simpleOpName ; simpleOpName : tokenBarColon { singleton[0] = $1; CM->addOpDecl(singleton); } | parenBubble { CM->addOpDecl(lexerBubble); } ; domainRangeAttr : typeName typeList dra2 | rangeAttr | badType { IssueWarning(LineNumber(lineNumber) << ": missing " << QUOTE("->") << " in constant declaration."); } ; skipStrayColon : ':' { IssueWarning(LineNumber($1.lineNumber()) << ": skipping stray " << QUOTE(":") << " in operator declaration."); } | ; dra2 : skipStrayColon rangeAttr | '.' { IssueWarning(LineNumber($1.lineNumber()) << ": missing " << QUOTE("->") << " in operator declaration."); } | badType { IssueWarning(LineNumber($1.lineNumber()) << ": missing " << QUOTE("->") << " in operator declaration."); } ; rangeAttr : arrow typeAttr { if ($1) CM->convertSortsToKinds(); } ; typeAttr : typeName attributes expectedDot | badType {} ; arrow : KW_ARROW { $$ = false; } | KW_PARTIAL { $$ = true; } ; typeList : typeList typeName | ; typeName : sortName { singleton[0] = $1; currentSyntaxContainer->addType(false, singleton); } | '[' { clear(); } sortNames ']' { currentSyntaxContainer->addType(true, tokenSequence); } ; sortNames : sortNames ',' sortName { store($3); } | sortName { store($1); } ; attributes : '[' attributeList ']' {} | ; attributeList : attributeList attribute | attribute ; idKeyword : KW_ID { CM->setFlag(SymbolType::LEFT_ID | SymbolType::RIGHT_ID); } | KW_LEFT KW_ID { CM->setFlag(SymbolType::LEFT_ID); } | KW_RIGHT KW_ID { CM->setFlag(SymbolType::RIGHT_ID); } ; attribute : KW_ASSOC { CM->setFlag(SymbolType::ASSOC); } | KW_COMM { CM->setFlag(SymbolType::COMM); } | idKeyword { lexBubble(BAR_RIGHT_BRACKET | BAR_OP_ATTRIBUTE, 1); } identity { CM->setIdentity(lexerBubble); } | KW_IDEM { CM->setFlag(SymbolType::IDEM); } | KW_ITER { CM->setFlag(SymbolType::ITER); } | KW_PREC IDENTIFIER { CM->setPrec($2); } | KW_GATHER '(' { clear(); } idList ')' { CM->setGather(tokenSequence); } | KW_FORMAT '(' { clear(); } idList ')' { CM->setFormat(tokenSequence); } | KW_STRAT '(' { clear(); } idList ')' { CM->setStrat(tokenSequence); } | KW_POLY '(' { clear(); } idList ')' { CM->setPoly(tokenSequence); } | KW_MEMO { CM->setFlag(SymbolType::MEMO); } | KW_CTOR { CM->setFlag(SymbolType::CTOR); } | KW_FROZEN { clear(); CM->setFrozen(tokenSequence); } | KW_FROZEN '(' { clear(); } idList ')' { CM->setFrozen(tokenSequence); } | KW_CONFIG { CM->setFlag(SymbolType::CONFIG); } | KW_OBJ { CM->setFlag(SymbolType::OBJECT); } | KW_MSG { CM->setFlag(SymbolType::MESSAGE); } | KW_METADATA IDENTIFIER { CM->setMetadata($2); } | KW_LATEX '(' { lexerLatexMode(); } LATEX_STRING ')' { CM->setLatexMacro($4); } | KW_SPECIAL '(' hookList ')' {} | KW_DITTO { CM->setFlag(SymbolType::DITTO); } ; /* * The ony point of this rule is to force a one token lookahead and allow the lexer to grab the * bubble corresponding to the identity. We never see a FORCE_LOOKAHEAD token. */ identity : FORCE_LOOKAHEAD | ; idList : idList IDENTIFIER { store($2); } | IDENTIFIER { store($1); } ; hookList : hookList hook | hook ; hook : KW_ID_HOOK token { clear(); CM->addHook(SyntacticPreModule::ID_HOOK, $2, tokenSequence); } | KW_ID_HOOK token parenBubble { CM->addHook(SyntacticPreModule::ID_HOOK, $2, lexerBubble); } | KW_OP_HOOK token parenBubble { CM->addHook(SyntacticPreModule::OP_HOOK, $2, lexerBubble); } | KW_TERM_HOOK token parenBubble { CM->addHook(SyntacticPreModule::TERM_HOOK, $2, lexerBubble); } ; /* * Recovery from missing tokens */ expectedIs : KW_IS {} | { IssueWarning(LineNumber(lineNumber) << ": missing " << QUOTE("is") << " keyword."); } ; expectedDot : '.' {} | { IssueWarning(LineNumber(lineNumber) << ": missing period."); } ; /* * Sort and subsort lists. */ sortNameList : sortNameList sortName { store($2); } | ; subsortList : subsortList sortName { store($2); } | subsortList '<' { store($2); } | sortName { store($1); } sortNameList '<' { store($4); } ; /* * Sort names */ sortName : sortNameFrag { Token t; if (fragments.size() == 1) t = fragments[0]; else t.tokenize(Token::bubbleToPrefixNameCode(fragments), fragments[0].lineNumber()); fragClear(); $$ = t; } ; sortNameFrag : sortToken { fragStore($1); } | sortNameFrag '{' { fragStore($2); } sortNameFrags '}' { fragStore($5); } ; sortNameFrags : sortNameFrags ',' { fragStore($2); } sortNameFrag {} | sortNameFrag {} ; /* * Token types. */ token : identifier | startKeyword | midKeyword | attrKeyword | '.' ; tokenBarDot : inert | ',' | KW_TO | startKeyword | midKeyword | attrKeyword ; tokenBarColon : identifier | startKeyword | attrKeyword | '.' | '<' | KW_ARROW | KW_PARTIAL | '=' | KW_ARROW2 | KW_IF ; sortToken : IDENTIFIER | startKeyword | attrKeyword2 | '=' | '|' | '+' | '*' | KW_ARROW2 | KW_IF | KW_IS | KW_LABEL | KW_TO ; endsInDot : '.' | ENDS_IN_DOT ; /* * Keywords (in id mode). */ inert : IDENTIFIER | '{' | '}' | '+' | '*' | '|' | KW_COLON2 | KW_LABEL | KW_FROM | KW_IS ; identifier : inert | ENDS_IN_DOT | ',' | KW_TO ; startKeyword : KW_MSG | startKeyword2 ; startKeyword2 : KW_IMPORT | KW_SORT | KW_SUBSORT | KW_OP | KW_OPS | KW_VAR | KW_MSGS | KW_CLASS | KW_SUBCLASS | KW_MB | KW_CMB | KW_EQ | KW_CEQ | KW_RL | KW_CRL | KW_ENDM | KW_ENDV ; midKeyword : '<' | ':' | KW_ARROW | KW_PARTIAL | '=' | KW_ARROW2 | KW_IF ; attrKeyword : '[' | ']' | attrKeyword2 ; attrKeyword2 : KW_ASSOC | KW_COMM | KW_ID | KW_IDEM | KW_ITER | KW_LEFT | KW_RIGHT | KW_PREC | KW_GATHER | KW_STRAT | KW_POLY | KW_MEMO | KW_CTOR | KW_LATEX | KW_SPECIAL | KW_FROZEN | KW_METADATA | KW_CONFIG | KW_OBJ | KW_DITTO | KW_FORMAT | KW_ID_HOOK | KW_OP_HOOK | KW_TERM_HOOK ; Maude-2.6/src/Mixfix/bufferPrint.cc0000644000147300135640000003313211344354041014176 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Routines for pretty printing a term into a vector of token codes. // void MixfixModule::bufferPrint(Vector& buffer, Term* term, int printFlags) { globalIndent = 0; // HACK prettyPrint(buffer, term, UNBOUNDED, UNBOUNDED, 0, UNBOUNDED, 0, false, printFlags); } void MixfixModule::handleVariable(Vector& buffer, Term* term, int printFlags) { VariableTerm* v = safeCast(VariableTerm*, term); string fullName(Token::name(v->id())); fullName += ':'; Sort* sort = v->getSort(); if (sort->index() == Sort::KIND) { buffer.append(Token::encode(fullName.c_str())); printKind(buffer, sort, printFlags); } else printVarSort(buffer, fullName, sort, printFlags); } bool MixfixModule::handleIter(Vector& buffer, Term* term, SymbolInfo& si, bool rangeKnown, int printFlags) { if (!(si.symbolType.hasFlag(SymbolType::ITER))) return false; if (si.symbolType.getBasicType() == SymbolType::SUCC_SYMBOL && (printFlags & Interpreter::PRINT_NUMBER)) { SuccSymbol* succSymbol = safeCast(SuccSymbol*, term->symbol()); if (succSymbol->isNat(term)) { char* name = mpz_get_str(0, 10, succSymbol->getNat(term).get_mpz_t()); buffer.append(Token::encode(name)); free(name); return true; } } S_Term* st = safeCast(S_Term*, term); const mpz_class& number = st->getNumber(); if (number == 1) return false; // do default thing string prefixName; makeIterName(prefixName, term->symbol()->id(), number); printPrefixName(buffer, Token::encode(prefixName.c_str()), si, printFlags); buffer.append(leftParen); prettyPrint(buffer, st->getArgument(), PREFIX_GATHER, UNBOUNDED, 0, UNBOUNDED, 0, rangeKnown, printFlags); buffer.append(rightParen); return true; } bool MixfixModule::handleMinus(Vector& buffer, Term* term, SymbolInfo& si, int printFlags) { if (si.symbolType.getBasicType() == SymbolType::MINUS_SYMBOL && (printFlags & Interpreter::PRINT_NUMBER)) { const MinusSymbol* minusSymbol = safeCast(MinusSymbol*, term->symbol()); if (minusSymbol->isNeg(term)) { mpz_class neg; char* name = mpz_get_str(0, 10, minusSymbol->getNeg(term, neg).get_mpz_t()); buffer.append(Token::encode(name)); free(name); return true; } } return false; } bool MixfixModule::handleDivision(Vector& buffer, Term* term, SymbolInfo& si, int printFlags) { if (si.symbolType.getBasicType() == SymbolType::DIVISION_SYMBOL && (printFlags & Interpreter::PRINT_RAT)) { const DivisionSymbol* divisionSymbol = safeCast(DivisionSymbol*, term->symbol()); if (divisionSymbol->isRat(term)) { mpz_class numerator; const mpz_class& denominator = divisionSymbol->getRat(term, numerator); char* nn = mpz_get_str(0, 10, numerator.get_mpz_t()); string prefixName(nn); free(nn); prefixName += '/'; char* dn = mpz_get_str(0, 10, denominator.get_mpz_t()); prefixName += dn; free(dn); buffer.append(Token::encode(prefixName.c_str())); return true; } } return false; } void MixfixModule::prettyPrint(Vector& buffer, Term* term, int requiredPrec, int leftCapture, const ConnectedComponent* leftCaptureComponent, int rightCapture, const ConnectedComponent* rightCaptureComponent, bool rangeKnown, int printFlags) { Symbol* symbol = term->symbol(); int nrArgs = symbol->arity(); int index = symbol->getIndexWithinModule(); SymbolInfo& si = symbolInfo[index]; int basicType = si.symbolType.getBasicType(); int iflags = si.iflags; bool needDisambig = false; double mfValue; string strValue; int qidCode; if (iflags & PSEUDO_VARIABLE) needDisambig = !rangeKnown; else if (basicType == SymbolType::FLOAT) { mfValue = static_cast(term)->getValue(); needDisambig = !rangeKnown && (floatSymbols.size() > 1 || overloadedFloats.count(mfValue)); } else if (iflags & PSEUDO_FLOAT) { needDisambig = !rangeKnown && (floatSymbols.size() > 0 || (iflags & DOMAIN_OVERLOADED)); } else if (basicType == SymbolType::STRING) { Token::ropeToString(static_cast(term)->getValue(), strValue); needDisambig = !rangeKnown && (stringSymbols.size() > 1 || overloadedStrings.count(strValue)); } else if (iflags & PSEUDO_STRING) { needDisambig = !rangeKnown && (stringSymbols.size() > 0 || (iflags & DOMAIN_OVERLOADED)); } else if (basicType == SymbolType::QUOTED_IDENTIFIER) { qidCode = static_cast(term)->getIdIndex(); needDisambig = !rangeKnown && (quotedIdentifierSymbols.size() > 1 || overloadedQuotedIdentifiers.count(qidCode)); } else if (iflags & PSEUDO_QUOTED_IDENTIFIER) { needDisambig = !rangeKnown && (quotedIdentifierSymbols.size() > 0 || (iflags & DOMAIN_OVERLOADED)); } else { needDisambig = !rangeKnown && (iflags & DOMAIN_OVERLOADED); rangeKnown = !(iflags & ADHOC_OVERLOADED) || ((rangeKnown | needDisambig) && !(iflags & RANGE_OVERLOADED)); } if (needDisambig) buffer.append(leftParen); if (basicType == SymbolType::VARIABLE) handleVariable(buffer, term, printFlags); else if (basicType == SymbolType::FLOAT) buffer.append(Token::doubleToCode(mfValue)); else if (basicType == SymbolType::STRING) buffer.append(Token::encode(strValue.c_str())); else if (basicType == SymbolType::QUOTED_IDENTIFIER) buffer.append(Token::quoteNameCode(qidCode)); else if (handleIter(buffer, term, si, rangeKnown, printFlags)) ; else if (handleMinus(buffer, term, si, printFlags)) ; else if (handleDivision(buffer, term, si, printFlags)) ; else if (((printFlags & Interpreter::PRINT_MIXFIX) && si.mixfixSyntax.length() != 0) || (basicType == SymbolType::SORT_TEST)) { bool printWithParens = printFlags & Interpreter::PRINT_WITH_PARENS; bool needParen = !needDisambig && (printWithParens || requiredPrec < si.prec || ((iflags & LEFT_BARE) && leftCapture <= si.gather[0] && leftCaptureComponent == symbol->domainComponent(0)) || ((iflags & RIGHT_BARE) && rightCapture <= si.gather[nrArgs - 1] && rightCaptureComponent == symbol->domainComponent(nrArgs - 1))); bool needAssocParen = si.symbolType.hasFlag(SymbolType::ASSOC) && (printWithParens || si.gather[1] < si.prec || ((iflags & LEFT_BARE) && (iflags & RIGHT_BARE) && si.prec <= si.gather[0])); if (needParen) buffer.append(leftParen); int nrTails = 1; int pos = 0; ArgumentIterator a(*term); int moreArgs = a.valid(); for (int arg = 0; moreArgs; arg++) { Term* t = a.argument(); a.next(); moreArgs = a.valid(); pos = printTokens(buffer, si, pos, printFlags); if (arg == nrArgs - 1 && moreArgs) { ++nrTails; arg = 0; if (needAssocParen) buffer.append(leftParen); pos = printTokens(buffer, si, 0, printFlags); } int lc = UNBOUNDED; const ConnectedComponent* lcc = 0; int rc = UNBOUNDED; const ConnectedComponent* rcc = 0; if (arg == 0 && (iflags & LEFT_BARE)) { rc = si.prec; rcc = symbol->domainComponent(0); if (!needParen && !needDisambig) { lc = leftCapture; lcc = leftCaptureComponent; } } else if (!moreArgs && (iflags & RIGHT_BARE)) { lc = si.prec; lcc = symbol->domainComponent(nrArgs - 1); if (!needParen && !needDisambig) { rc = rightCapture; rcc = rightCaptureComponent; } } prettyPrint(buffer, t, si.gather[arg], lc, lcc, rc, rcc, rangeKnown, printFlags); } printTails(buffer, si, pos, nrTails, needAssocParen, printFlags); if (needParen) buffer.append(rightParen); } else { int id = symbol->id(); printPrefixName(buffer, id, si, printFlags); ArgumentIterator a(*term); if (a.valid()) { int nrTails = 1; buffer.append(leftParen); for (int arg = 0;; arg++) { Term* t = a.argument(); a.next(); int moreArgs = a.valid(); if (arg >= nrArgs - 1 && !(printFlags & Interpreter::PRINT_FLAT) && moreArgs) { ++nrTails; printPrefixName(buffer, id, si, printFlags); buffer.append(leftParen); } prettyPrint(buffer, t, PREFIX_GATHER, UNBOUNDED, 0, UNBOUNDED, 0, rangeKnown, printFlags); if (!moreArgs) break; buffer.append(comma); } while (nrTails-- > 0) buffer.append(rightParen); } } if (needDisambig) { int sortIndex = term->getSortIndex(); if (sortIndex <= Sort::KIND) sortIndex = chooseDisambiguator(symbol); buffer.append(rightParen); // // sortIndex will never be the index of a kind. // printDotSort(buffer, symbol->rangeComponent()->sort(sortIndex), printFlags); } } void MixfixModule::printKind(Vector& buffer, const Sort* kind, int printFlags) { Assert(kind != 0, "null kind"); ConnectedComponent* c = kind->component(); Assert(c != 0, "null conponent"); buffer.append(leftBracket); printSort(buffer, c->sort(1), printFlags); int nrMax = c->nrMaximalSorts(); for (int i = 2; i <= nrMax; i++) { buffer.append(comma); printSort(buffer, c->sort(i), printFlags); } buffer.append(rightBracket); } void MixfixModule::printSort(Vector& buffer, const Sort* sort, int printFlags) { int name = sort->id(); if (Token::auxProperty(name) == Token::AUX_STRUCTURED_SORT && interpreter.getPrintFlag(Interpreter::PRINT_MIXFIX)) { Vector parts; Token::splitParameterizedSort(name, parts); FOR_EACH_CONST(i, Vector, parts) buffer.append(*i); } else buffer.append(name); } void MixfixModule::printDotSort(Vector& buffer, const Sort* sort, int printFlags) { int name = sort->id(); if (Token::auxProperty(name) == Token::AUX_STRUCTURED_SORT && interpreter.getPrintFlag(Interpreter::PRINT_MIXFIX)) { Vector parts; Token::splitParameterizedSort(name, parts); parts[0] = Token::dotNameCode(parts[0]); FOR_EACH_CONST(i, Vector, parts) buffer.append(*i); } else buffer.append(Token::dotNameCode(name)); } void MixfixModule::printVarSort(Vector& buffer, string& fullName, const Sort* sort, int printFlags) { int name = sort->id(); if (Token::auxProperty(name) == Token::AUX_STRUCTURED_SORT && interpreter.getPrintFlag(Interpreter::PRINT_MIXFIX)) { Vector parts; Token::splitParameterizedSort(name, parts); fullName += Token::name(parts[0]); parts[0] = Token::encode(fullName.c_str()); FOR_EACH_CONST(i, Vector, parts) buffer.append(*i); } else { fullName += Token::name(name); buffer.append(Token::encode(fullName.c_str())); } } int MixfixModule::printTokens(Vector& buffer, const SymbolInfo& si, int pos, int printFlags) { bool hasFormat = (printFlags & Interpreter::PRINT_FORMAT) && (si.format.length() > 0); for (;;) { int token = si.mixfixSyntax[pos++]; if (token == underscore) break; if (hasFormat) handleFormat(buffer, si.format[pos - 1]); buffer.append(token); } if (hasFormat) handleFormat(buffer, si.format[pos - 1]); return pos; } void MixfixModule::printTails(Vector& buffer, const SymbolInfo& si, int pos, int nrTails, bool needAssocParen, int printFlags) { bool hasFormat = (printFlags & Interpreter::PRINT_FORMAT) && (si.format.length() > 0); int mixfixLength = si.mixfixSyntax.length(); for (int i = 0;;) { for (int j = pos; j < mixfixLength; j++) { if (hasFormat) handleFormat(buffer, si.format[j]); buffer.append(si.mixfixSyntax[j]); } if (hasFormat) handleFormat(buffer, si.format[mixfixLength]); if (++i == nrTails) break; if (needAssocParen) buffer.append(rightParen); } } void MixfixModule::printPrefixName(Vector& buffer, int prefixName, SymbolInfo& si, int printFlags) { if ((printFlags & Interpreter::PRINT_FORMAT) && (si.format.length() == 2)) { handleFormat(buffer, si.format[0]); buffer.append(prefixName); handleFormat(buffer, si.format[1]); } else buffer.append(prefixName); } void MixfixModule::handleFormat(Vector& buffer, int spaceToken) { for (const char* cmd = Token::name(spaceToken); *cmd; cmd++) { switch (*cmd) { case '+': { ++globalIndent; break; } case '-': { if (globalIndent > 0) --globalIndent; break; } case 'i': { if (globalIndent > 0) { int t = Token::encode("\\s"); for (int i = 0; i < globalIndent; i++) buffer.append(t); } break; } #define MACRO(m, t) case m: #include "ansiEscapeSequences.cc" #undef MACRO case 'o': case 'n': case 't': case 's': { static char strg[3] = "\\!"; // HACK strg[1] = *cmd; buffer.append(Token::encode(strg)); break; } } } } Maude-2.6/src/Mixfix/prettyPrint.cc0000644000147300135640000002713211412502034014250 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for pretty printing all kinds of things. // int MixfixModule::globalIndent = 0; bool MixfixModule::attributeUsed = false; ostream& operator<<(ostream& s, const NamedEntity* e) { return s << ((e == 0) ? "(null)" : Token::name(e->id())); } ostream& operator<<(ostream& s, const Sort* sort) { if (sort == 0) return s << "(sort not calculated)"; ConnectedComponent* c = sort->component(); if (c != 0 && sort->index() == Sort::KIND) { s << '[' << c->sort(1); int nrMax = c->nrMaximalSorts(); for (int i = 2; i <= nrMax; i++) s << ',' << c->sort(i); return s << ']'; } return s << Token::sortName(sort->id()); } ostream& operator<<(ostream& s, const Term* term) { MixfixModule::globalIndent = 0; static_cast(term->symbol()->getModule())-> prettyPrint(s, const_cast(term), UNBOUNDED, UNBOUNDED, 0, UNBOUNDED, 0, false); // HACK if (MixfixModule::attributeUsed) { MixfixModule::attributeUsed = false; s << Tty(Tty::RESET); } return s; } ostream& operator<<(ostream& s, DagNode* dagNode) { MixfixModule::globalIndent = 0; MixfixModule* module = static_cast(dagNode->symbol()->getModule()); if (interpreter.getPrintFlag(Interpreter::PRINT_GRAPH)) module->graphPrint(s, dagNode); else { MixfixModule::ColoringInfo coloringInfo; if (interpreter.getPrintFlag(Interpreter::PRINT_COLOR)) { MixfixModule::computeGraphStatus(dagNode, coloringInfo.visited, coloringInfo.statusVec); coloringInfo.reducedAbove = false; coloringInfo.reducedDirectlyAbove = false; } module->prettyPrint(s, coloringInfo, dagNode, UNBOUNDED, UNBOUNDED, 0, UNBOUNDED, 0, false); } if (MixfixModule::attributeUsed) { MixfixModule::attributeUsed = false; s << Tty(Tty::RESET); } return s; } void MixfixModule::printAttributes(ostream& s, const PreEquation* pe, ItemType itemType) { const Label& l = pe->getLabel(); int id = l.id(); const Equation* eq = dynamic_cast(pe); bool owise = eq != 0 && eq->isOwise(); bool nonexec = pe->isNonexec(); int metadata = getMetadata(itemType, pe); const PrintAttribute* printAttribute = getPrintAttribute(itemType, pe); if (!nonexec && !owise && id == NONE && metadata == NONE && printAttribute == 0) return; s << " ["; const char *space = ""; if (nonexec) { s << "nonexec"; space = " "; } if (owise) { s << "owise"; space = " "; } if (id != NONE) { s << space << "label " << &l; space = " "; } if (metadata != NONE) { s << space << "metadata " << Token::name(metadata); space = " "; } if (printAttribute != 0) { s << space; printAttribute->print(s, *pe); } s << ']'; } ostream& operator<<(ostream& s, const SortConstraint* sc) { if (sc->hasCondition()) s << 'c'; s << "mb "; s << sc->getLhs() << " : " << sc->getSort(); if (sc->hasCondition()) MixfixModule::printCondition(s, sc); MixfixModule* m = safeCast(MixfixModule*, sc->getModule()); m->printAttributes(s, sc, MixfixModule::MEMB_AX); s << " ."; return s; } ostream& operator<<(ostream& s, const Equation* e) { if (e->hasCondition()) s << 'c'; s << "eq "; s << e->getLhs() << " = " << e->getRhs(); if (e->hasCondition()) MixfixModule::printCondition(s, e); MixfixModule* m = safeCast(MixfixModule*, e->getModule()); m->printAttributes(s, e, MixfixModule::EQUATION); s << " ."; return s; } ostream& operator<<(ostream& s, const Rule* r) { if (r->hasCondition()) s << 'c'; s << "rl "; s << r->getLhs() << " => " << r->getRhs(); if (r->hasCondition()) MixfixModule::printCondition(s, r); MixfixModule* m = safeCast(MixfixModule*, r->getModule()); m->printAttributes(s, r, MixfixModule::RULE); s << " ."; return s; } ostream& operator<<(ostream& s, const ConditionFragment* c) { if (const EqualityConditionFragment* e = dynamic_cast(c)) s << e->getLhs() << " = " << e->getRhs(); else if (const SortTestConditionFragment* t = dynamic_cast(c)) s << t->getLhs() << " : " << t->getSort(); else if(const AssignmentConditionFragment* a = dynamic_cast(c)) s << a->getLhs() << " := " << a->getRhs(); else if(const RewriteConditionFragment* r = dynamic_cast(c)) s << r->getLhs() << " => " << r->getRhs(); else CantHappen("bad condition fragment"); return s; } void MixfixModule::printCondition(ostream& s, const Vector& condition) { int nrFragments = condition.length(); for (int i = 0; i < nrFragments; i++) { s << condition[i]; if (i + 1 < nrFragments) s << " /\\ "; } } void MixfixModule::printCondition(ostream& s, const PreEquation* pe) { s << " if "; printCondition(s, pe->getCondition()); } void MixfixModule::printVariable(ostream& s, int name, Sort* sort) const { if (Token::isFlagged(name)) { // // Variables with flagged codes are used internally to distinguish between two variables // with identical names during disjoint unification, and might be seen in a debugging // print statement. // s << "(flagged)"; name = Token::unflaggedCode(name); } s << Token::name(name); if (interpreter.getPrintFlag(Interpreter::PRINT_WITH_ALIASES)) { AliasMap::const_iterator i = variableAliases.find(name); if (i != variableAliases.end() && (*i).second == sort) return; } s << ':' << sort; } void MixfixModule::printPrefixName(ostream& s, const char* prefixName, SymbolInfo& si) { if (interpreter.getPrintFlag(Interpreter::PRINT_FORMAT) && (si.format.length() == 2)) { fancySpace(s, si.format[0]); s << prefixName; fancySpace(s, si.format[1]); } else s << prefixName; } int MixfixModule::printTokens(ostream& s, const SymbolInfo& si, int pos, const char* color) { bool noSpace = (pos == 0); bool hasFormat = interpreter.getPrintFlag(Interpreter::PRINT_FORMAT) && (si.format.length() > 0); for (;;) { int token = si.mixfixSyntax[pos++]; if (token == underscore) break; bool special = (token == leftParen || token == rightParen || token == leftBracket || token == rightBracket || token == leftBrace || token == rightBrace || token == comma); if (!((hasFormat && fancySpace(s, si.format[pos - 1])) || special || noSpace)) s << ' '; noSpace = special; if (color != 0) s << color; s << Token::name(token); if (color != 0) s << Tty(Tty::RESET); } if (!((hasFormat && fancySpace(s, si.format[pos - 1])) || noSpace)) s << ' '; return pos; } void MixfixModule::printTails(ostream& s, const SymbolInfo& si, int pos, int nrTails, bool needAssocParen, bool checkForInterrupt, const char* color) { bool hasFormat = interpreter.getPrintFlag(Interpreter::PRINT_FORMAT) && (si.format.length() > 0); int mixfixLength = si.mixfixSyntax.length(); for (int i = 0;;) { if (checkForInterrupt && UserLevelRewritingContext::interrupted()) return; bool noSpace = (pos == 0); for (int j = pos; j < mixfixLength; j++) { int token = si.mixfixSyntax[j]; bool special = (token == leftParen || token == rightParen || token == leftBracket || token == rightBracket || token == leftBrace || token == rightBrace || token == comma); if (!((hasFormat && fancySpace(s, si.format[j])) || special || noSpace)) s << ' '; noSpace = special; if (color != 0) s << color; s << Token::name(token); if (color != 0) s << Tty(Tty::RESET); } if (hasFormat) (void) fancySpace(s, si.format[mixfixLength]); if (++i == nrTails) break; if (needAssocParen) s << ')'; } } bool MixfixModule::fancySpace(ostream& s, int spaceToken) { bool space = false; for (const char* cmd = Token::name(spaceToken); *cmd; cmd++) { char c = *cmd; switch (c) { case '+': { ++globalIndent; break; } case '-': { if (globalIndent > 0) --globalIndent; break; } case 'n': { s << '\n'; space = true; break; } case 't': { s << '\t'; space = true; break; } case 's': { s << ' '; space = true; break; } case 'i': { if (globalIndent > 0) { for (int i = 0; i < globalIndent; i++) s << ' '; space = true; } break; } default: { if (interpreter.getPrintFlag(Interpreter::PRINT_COLOR)) break; switch (c) { #define MACRO(m, t) \ case m: { s << Tty(Tty::t); attributeUsed = true; break; } #include "ansiEscapeSequences.cc" #undef MACRO case 'o': { s << Tty(Tty::RESET); break; } } break; } } } return space; } int MixfixModule::chooseDisambiguator(Symbol* s) { // // Choose the index of a disambiguating sort for an ad-hoc overloaded symbol. // // Return smallest non-error sort index (largest sort) that the symbol can produce // or 1 if such an index does not exist. // const Vector& opDecls = s->getOpDeclarations(); int nrOpDecls = opDecls.length(); int nrArgs = s->arity(); int chosenIndex = UNBOUNDED; for (int i = 0; i < nrOpDecls; i++) { int index = opDecls[i].getDomainAndRange()[nrArgs]->index(); if (index > Sort::ERROR_SORT && index < chosenIndex) chosenIndex = index; } return (chosenIndex == UNBOUNDED) ? 1 : chosenIndex; } void MixfixModule::makeIterName(string& name, int id, const mpz_class& number) { name = Token::name(id); name += '^'; char* numberStr = mpz_get_str(0, 10, number.get_mpz_t()); name += numberStr; free(numberStr); } int MixfixModule::computeGraphStatus(DagNode* dagNode, PointerSet& visited, Vector& statusVec) { visited.insert(dagNode); int index = statusVec.length(); Assert(index == visited.pointer2Index(dagNode), "statusVec out of step"); statusVec.resize(index + 1); // // We have strangeness below if we are reduced and one of our arguments // (a) has strangeness below // (b) is unreduced // (c) is a non constructor // int status = 0; bool reduced = dagNode->isReduced(); if (reduced && dagNode->symbol()->isConstructor(dagNode)) status |= CONSTRUCTOR; for(DagArgumentIterator a(*dagNode); a.valid(); a.next()) { DagNode* d = a.argument(); int childIndex = visited.pointer2Index(d); int childStatus = (childIndex == NONE) ? computeGraphStatus(d, visited, statusVec) : statusVec[childIndex]; if (reduced && ((childStatus & STRANGENESS_BELOW) || !(d->isReduced()) || !(childStatus & CONSTRUCTOR))) status |= STRANGENESS_BELOW; } statusVec[index] = status; return status; } Maude-2.6/src/Mixfix/xmlBuffer.cc0000644000147300135640000000564207666304134013661 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class XmlBuffer. // // utility stuff #include "macros.hh" #include "xmlBuffer.hh" XmlBuffer::XmlBuffer(ostream& output, int flushLevel) : output(output), flushLevel(flushLevel) { output << "\n"; indentLevel = 0; startTagIncomplete = false; } XmlBuffer::~XmlBuffer() { while (!(elements.empty())) endElement(); } void XmlBuffer::characterData(const string& charData) { if (startTagIncomplete) { output << ">\n"; startTagIncomplete = false; } output << charData; } void XmlBuffer::comment(const string& text) { if (startTagIncomplete) { output << ">\n"; startTagIncomplete = false; } indent(); output << "\n"; } void XmlBuffer::beginElement(const string& name) { if (startTagIncomplete) output << ">\n"; indent(); output << '<' << name; startTagIncomplete = true; ++indentLevel; elements.push(name); } void XmlBuffer::endElement() { Assert(!(elements.empty()), "empty element stack"); --indentLevel; if (startTagIncomplete) { output << "/>\n"; startTagIncomplete = false; } else { indent(); output << "\n"; } if (indentLevel <= flushLevel) output.flush(); elements.pop(); } void XmlBuffer::attributePair(const string& name, const string& value) { output << ' ' << name << "=\""; translate(value); output << '"'; } void XmlBuffer::attributePair(const string& name, const string& value, int index) { output << ' ' << name << "=\""; translate(value); output << index << '"'; } void XmlBuffer::indent() { for (int i = indentLevel; i > 0 ; i--) output << ' '; } void XmlBuffer::translate(const string& value) { const string::const_iterator e = value.end(); for (string::const_iterator i = value.begin(); i != e; ++i) { switch (*i) { case '<': output << "<"; break; case '&': output << "&"; break; case '"': output << """; break; default: output << *i; } } } Maude-2.6/src/Mixfix/parameterization.cc0000644000147300135640000006220511453152112015265 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ ImportModule* ImportModule::makeParameterCopy(int moduleName, int parameterName, ModuleCache* moduleCache) { ImportModule* copy = new ImportModule(moduleName, getModuleType(), PARAMETER, moduleCache); LineNumber lineNumber(FileTable::AUTOMATIC); // // We construct a parameter renaming which will map sorts and labels from us and // our imported theories. // Renaming* canonical = new Renaming; { // // For each sort s declared in us, we add a mapping s -> X$s where X is our parameter name. // const Vector& sorts = getSorts(); for (int i = nrImportedSorts; i < nrUserSorts; ++i) { int sortName = sorts[i]->id(); canonical->addSortMapping(sortName, Token::parameterRename(parameterName, sortName)); } } { // // Technically this is wrong since labels contains labels from our imports // which if from a theory will get added in a later step and if from a module // shouldn't be added at all. // // However addSortAndLabelMappings() will silently ignore dups and renaming // labels from modules is harmess since parameter renamings never get applied to // to modules. There is a certain inelegance and potential inefficiency in carrying // superfluous label mappings around but they will be (very) rare in practice and // doing the right thing would cost a second "local" label set in each ImportModule. // FOR_EACH_CONST(i, set, labels) canonical->addLabelMapping(*i, Token::parameterRename(parameterName, *i)); } { // // We make a parameter copy of imported theories and directly import imported modules. // FOR_EACH_CONST(i, Vector, importedModules) { ImportModule* import = *i; if (import->isTheory()) { ImportModule* importCopy = moduleCache->makeParameterCopy(parameterName, *i); copy->addImport(importCopy, INCLUDING, lineNumber); canonical->addSortAndLabelMappings(importCopy->canonicalRenaming); } else copy->addImport(*i, INCLUDING, lineNumber); // HACK need to fix including } } finishCopy(copy, canonical); return copy; } void ImportModule::handleInstantiationByParameter(ImportModule* copy, Renaming* canonical, ParameterMap& parameterMap, const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache) const { // // First we handle parameters instantiated by parameters from an enclosing module. // These parameters keep their theory but change their name to that of the // parameter from the enclosing module. They also become bound. Multiple parameters // may be instantiated to the same parameter from the enclosing module, in which case // they collapse to a single bound parameter. // int nrParameters = parameterNames.size(); for (int i = 0; i < nrParameters; ++i) { if (arguments[i] == 0) { // // Parameter instantiated by a parameter from an enclosing module. // int parameterName = parameterArgs[i]; // name can change if (copy->findParameterIndex(parameterName) == NONE) { // // We don't already have a (must be bound since we've only added // bound parameters so far) parameter with name we need so add one. // Token t; t.tokenize(parameterName, FileTable::AUTOMATIC); ImportModule* toModule = getParameterTheory(i); // parameter theory stays the same ImportModule* parameterTheory = moduleCache->makeParameterCopy(parameterName, toModule); copy->addParameter(t, parameterTheory); } int oldParameterName = parameterNames[i]; if (oldParameterName != parameterName) { parameterMap[oldParameterName] = parameterName; // // For each Foo -> X$Foo we mapped in the parameter copy of the parameter theory, // we need to have a mapping X$Foo -> Y$Foo where Y is the new parameter name. // const Renaming* parameterRenaming = importedModules[i]->canonicalRenaming; int nrSortMappings = parameterRenaming->getNrSortMappings(); for (int j = 0; j < nrSortMappings; ++j) { int fromName = parameterRenaming->getSortTo(j); // X$Foo int baseName = parameterRenaming->getSortFrom(j); // Foo int toName = Token::parameterRename(parameterName, baseName); // Y$Foo canonical->addSortMapping(fromName, toName); } } } } } void ImportModule::handleInstantiationByTheoryView(ImportModule* copy, Renaming* canonical, ParameterMap& parameterMap, ParameterSet& extraParameterSet, const Vector& arguments, ModuleCache* moduleCache) const { // // Second we handle parameters instantiated by theory-views. These parameters keep // their name but change their theory to that of the view target. // These parameters give rise to an extra parameter list for parameterized sorts. // int nrParameters = parameterNames.size(); for (int i = 0; i < nrParameters; ++i) { View* argumentView = arguments[i]; if (argumentView != 0) { ImportModule* toModule = argumentView->getToModule(); if (toModule->isTheory()) { int parameterName = parameterNames[i]; Assert(copy->findParameterIndex(parameterName) == NONE, "parameter clash"); Token t; t.tokenize(parameterName, FileTable::AUTOMATIC); ImportModule* parameterTheory = moduleCache->makeParameterCopy(parameterName, toModule); copy->addParameter(t, parameterTheory); argumentView->addUser(copy); int viewName = argumentView->id(); if (parameterName != viewName) parameterMap[parameterName] = viewName; extraParameterSet.insert(parameterName); // // For each Foo -> X$Foo we mapped in the parameter copy of the parameter theory, // we need to have a mapping X$Foo -> X$Bar where the view maps Foo -> Bar. // const ImportModule* parameterCopyOfTheory = importedModules[i]; const Renaming* parameterRenaming = parameterCopyOfTheory->canonicalRenaming; int nrSortMappings = parameterRenaming->getNrSortMappings(); for (int j = 0; j < nrSortMappings; ++j) { int oldFromName = parameterRenaming->getSortFrom(j); // Foo int fromName = parameterRenaming->getSortTo(j); // X$Foo int baseName = argumentView->renameSort(oldFromName); // Bar // // Find out what sort we land on in the target theory of the view. // Sort* toModuleSort = toModule->findSort(baseName); int toName = (toModule->moduleDeclared(toModuleSort)) ? baseName : // sorts declared in a module will not get a X$ prefix and stay as Bar Token::parameterRename(parameterName, baseName); // X$Bar DebugAdvisory("adding sort mapping during theory view instantiation: " << Token::name(oldFromName) << " to " << Token::name(fromName) << " becomes " << Token::name(fromName) << " to " << Token::name(toName)); if (fromName != toName) canonical->addSortMapping(fromName, toName); } addOpMappingsFromView(canonical, parameterCopyOfTheory, argumentView); } } } } void ImportModule::handleInstantiationByModuleView(ImportModule* copy, Renaming* canonical, ParameterMap& parameterMap, const Vector& arguments) const { // // Third we handle parameters instantiated by views to modules. // LineNumber lineNumber(FileTable::AUTOMATIC); int nrParameters = parameterNames.size(); for (int i = 0; i < nrParameters; ++i) { View* argumentView = arguments[i]; if (argumentView != 0) { ImportModule* toModule = argumentView->getToModule(); if (!(toModule->isTheory())) { copy->addImport(argumentView->getToModule(), PROTECTING, lineNumber); argumentView->addUser(copy); // // For each Foo -> X$Foo we mapped in the parameter copy of the parameter theory, // we need to have a mapping X$Foo -> Bar where Bar is the target of Foo in our view. // const ImportModule* parameterCopyOfTheory = importedModules[i]; const Renaming* parameterRenaming = parameterCopyOfTheory->canonicalRenaming; int nrSortMappings = parameterRenaming->getNrSortMappings(); for (int j = 0; j < nrSortMappings; ++j) { int fromName = parameterRenaming->getSortTo(j); // X$Foo int toName = argumentView->renameSort(parameterRenaming->getSortFrom(j)); // Bar canonical->addSortMapping(fromName, toName); } addOpMappingsFromView(canonical, parameterCopyOfTheory, argumentView); int oldParameterName = parameterNames[i]; int newParameterName = argumentView->id(); if (oldParameterName != newParameterName) parameterMap[oldParameterName] = newParameterName; } } } } ConnectedComponent* ImportModule::translateComponent(const Renaming* renaming, const ConnectedComponent* component) const { Sort* sort = findSort(renaming->renameSort(component->sort(Sort::FIRST_USER_SORT)->id())); Assert(sort != 0, "no sort translation for " << component->sort(Sort::FIRST_USER_SORT)); return sort->component(); } void ImportModule::addOpMappingsFromView(Renaming* canonical, const ImportModule* parameterCopyOfTheory, const View* view) const { const ImportModule* originalTheory = parameterCopyOfTheory->baseModule; Assert(view->getFromTheory() == originalTheory, "theory clash"); { // // For each operator // f : Foo1 .... Foon -> Bar // in the theory, we need to check if it matches an op mapping in view, // to say, g. If so we need to add an op mapping // f : [Foo1'] ... [Foo1'] -> [Bar'] to g // to canonical, where for each sort s, s' is the translation of s // used in making the parameter copy of the theory. // const Renaming* parameterRenaming = parameterCopyOfTheory->canonicalRenaming; const Vector& symbols = originalTheory->getSymbols(); int nrUserSymbols = originalTheory->getNrUserSymbols(); for (int i = 0; i < nrUserSymbols; ++i) { Symbol* s = symbols[i]; Assert(originalTheory->getSymbolType(s).getBasicType() != SymbolType::VARIABLE, "didn't expect variable"); Assert(originalTheory->getSymbolType(s).getBasicType() != SymbolType::SORT_TEST, "didn't expect sort test"); if (originalTheory->moduleDeclared(s)) continue; // don't map operators with a module declaration Term* toTerm = view->getOpMapTerm(s); if (toTerm != 0) { canonical->addOpMapping(s->id()); int nrArgs = s->arity(); for (int j = 0; j < nrArgs; ++j) canonical->addType(translateComponent(parameterRenaming, s->domainComponent(j))); canonical->addType(translateComponent(parameterRenaming, s->rangeComponent())); canonical->addOpTargetTerm(toTerm); } int index = view->renameOp(s); if (index != NONE) { canonical->addOpMapping(s->id()); int nrArgs = s->arity(); for (int j = 0; j < nrArgs; ++j) canonical->addType(translateComponent(parameterRenaming, s->domainComponent(j))); canonical->addType(translateComponent(parameterRenaming, s->rangeComponent())); canonical->addOpTarget(view->getOpTo(index)); } } } { // // For each polymorph f, check if it matches a generic op mapping f to g in view. // If so we need to add the the generic op mapping to canonical. // int nrPolymorphs = originalTheory->getNrPolymorphs(); for (int i = 0; i < nrPolymorphs; ++i) { if (originalTheory->moduleDeclaredPolymorph(i)) continue; // don't map polymorphs declared in modules int id = originalTheory->getPolymorphName(i).code(); int index = view->renamePolymorph(id); if (index != NONE) { canonical->addOpMapping(id); canonical->addOpTarget(view->getOpTo(index)); } } } } void ImportModule::handleParameterizedSorts(Renaming* canonical, const ParameterMap& parameterMap, const ParameterSet& extraParameterSet) const { // // Check for parameterized sorts declared inside us. // We also need to map sorts delared in parameterized modules that // we import otherwise our use of those sorts will fail. // For the moment we consider all user sorts for mapping. // const Vector& sorts = getSorts(); int nrSorts = getNrUserSorts(); for (int i = 0; i < nrSorts; ++i) { int sortId = sorts[i]->id(); if (Token::auxProperty(sortId) == Token::AUX_STRUCTURED_SORT) { bool mapped = false; int header; Vector parameters; Vector extraParameters; Token::splitParameterList(sortId, header, parameters); int nrSortParameters = parameters.size(); for (int j = 0; j < nrSortParameters; ++j) { int original = parameters[j]; ParameterMap::const_iterator m = parameterMap.find(original); if (m != parameterMap.end()) { parameters[j] = m->second; mapped = true; } if (extraParameterSet.find(original) != extraParameterSet.end()) extraParameters.append(original); } int newSortId = mapped ? Token::joinParameterList(header, parameters) : sortId; if (!extraParameters.empty()) newSortId = Token::joinParameterList(newSortId, extraParameters); if (newSortId != sortId) canonical->addSortMapping(sortId, newSortId); } } } void ImportModule::handleRegularImports(ImportModule* copy, const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache) const { // // Now handle our regular imports. // LineNumber lineNumber(FileTable::AUTOMATIC); int nrImports = importedModules.size(); for (int i = parameterNames.size(); i < nrImports; ++i) { ImportModule* import = importedModules[i]; int nrImportParameters = import->parameterNames.size(); if (nrImportParameters == 0) copy->addImport(import, INCLUDING, lineNumber); // HACK need to fix including else { // // Imported module is itself parameterized; it parameters must all be bound and must be a subset of // our own so we can build an instantiation for them. // Assert(import->parametersBound(), "free parameter in imported module " << import); Vector views(nrImportParameters); Vector names(nrImportParameters); for (int j = 0; j < nrImportParameters; ++j) { int parameterName = import->parameterNames[j]; int indexInUs = findParameterIndex(parameterName); Assert(indexInUs != NONE, "couldn't find bound parameter " << Token::name(parameterName) << " for import " << import << " in " << this); views[j] = arguments[indexInUs]; names[j] = parameterArgs[indexInUs]; } ImportModule* instance = import->instantiateBoundParameters(views, names, moduleCache); if (instance == 0) { DebugAdvisory("handleRegularImports() - instantiateBoundParameters() returned null"); copy->markAsBad(); return; } Assert(instance->getNrParameters() == 0 || instance->parametersBound(), "free parameter in instance " << instance << " of imported module " << import); copy->addImport(instance, INCLUDING, lineNumber); // HACK need to fix including } } } ImportModule* ImportModule::makeInstantiation(int moduleName, const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache) { Assert(!isBad(), "trying to instantiate bad module"); Assert(!parametersBound(), "parameters bound"); Assert(static_cast(arguments.size()) == getNrParameters(), "arguments size mismatch"); Assert(static_cast(parameterArgs.size()) == getNrParameters(), "parameterArgs size mismatch"); // // An instantiation is a renamed copy of an parameterized module with // different imports. // ModuleType moduleType = getModuleType(); if (moduleType == FUNCTIONAL_MODULE) { // // Check views to see if we need to promote a functional module // to a system module. // FOR_EACH_CONST(i, Vector, arguments) { View* v = *i; if (v != 0 && v->getToModule()->getModuleType() == SYSTEM_MODULE) { moduleType = SYSTEM_MODULE; break; } } } ImportModule* copy = new ImportModule(moduleName, moduleType, INSTANTIATION, moduleCache); // // We construct an instantiation renaming which will map sorts and operations // we got from our parameters to those of our view args' targets. Also we // directly import the targets. // Renaming* canonical = new Renaming; ParameterMap parameterMap; // map for parameters in sorts ParameterSet extraParameterSet; // set for generating extra parameter list for parameterized sorts handleInstantiationByParameter(copy, canonical, parameterMap, arguments, parameterArgs, moduleCache); // // All bound parameters have now been added. We keep a copy of our // view args and if we have bound parameters we also keep track of // our parameter args. // copy->viewArgs = arguments; // deep copy if (copy->parameterNames.size() > 0) copy->paramArgs = parameterArgs; // deep copy handleInstantiationByTheoryView(copy, canonical, parameterMap, extraParameterSet, arguments, moduleCache); handleInstantiationByModuleView(copy, canonical, parameterMap, arguments); handleParameterizedSorts(canonical, parameterMap, extraParameterSet); handleRegularImports(copy, arguments, parameterArgs, moduleCache); if (copy->isBad()) { DebugAdvisory("ImportModule::makeInstantiation() - instantiation of " << this << " produced a bad module " << copy); // // Need to delete renaming here since it could be in a bad state and will never // be added to the bad module. // delete canonical; } else finishCopy(copy, canonical); return copy; } ImportModule* ImportModule::instantiateBoundParameters(const Vector& arguments, const Vector& parameterArgs, ModuleCache* moduleCache) { DebugAdvisory("instantiating bound parameters of " << this); // // We are an instantiated (not renamed) module with parameters that have // been bound by a parameterized module that imported us. Now that these // parameters have been been instantiated, we need to make a new instantiated // module that is "like us" except that our bound parameters are // instantiated with the new arguments. // Assert(parametersBound(), "parameters not bound"); Assert(static_cast(arguments.size()) == getNrParameters(), "arguments size bad"); Assert(static_cast(parameterArgs.size()) == getNrParameters(), "parameterArgs size bad"); Assert(baseModule != 0, "no base module"); Assert(viewArgs.size() == paramArgs.size(), "original args are inconsistant"); if (viewArgs.empty()) { Assert(origin == RENAMING, "bad origin"); // // We are a renaming of a module with bound parameters. // The bound parameters will be identical to our own so // we first make a new instantiation of our base module and // then rename it. // ImportModule* newBase = baseModule-> instantiateBoundParameters(arguments, parameterArgs, moduleCache); if (newBase == 0) return 0; // something went wrong ParameterMap parameterMap; ParameterSet extraParameterSet; int nrParameters = parameterNames.size(); for (int i = 0; i < nrParameters; ++i) { int name = parameterNames[i]; View* argumentView = arguments[i]; if (argumentView != 0) { parameterMap[name] = argumentView->id(); ImportModule* toModule = argumentView->getToModule(); if (toModule->isTheory()) extraParameterSet.insert(name); } else parameterMap[name] = parameterArgs[i]; } Renaming* newRenaming = instantiateRenaming(canonicalRenaming, parameterMap, extraParameterSet); ImportModule* instance = moduleCache->makeRenamedCopy(newBase, newRenaming); delete newRenaming; return instance; } Assert(origin == INSTANTIATION, "bad origin"); // // We are an instantiation of a parameterized module so // we build a new set of arguments to instantiate our baseModule on. // int nrFreeParameters = baseModule->getNrParameters(); Assert(nrFreeParameters == static_cast(viewArgs.size()), "nrFreeParameters clash"); Vector newViewArgs(nrFreeParameters); Vector newParamArgs(nrFreeParameters); Vector extraViewArgs; Vector extraParamArgs; for (int i = 0; i < nrFreeParameters; ++i) { // // See what the free parameter was originally instantiated by. // View* v = viewArgs[i]; if (v == 0) { // // The free parameter was originally instantiated by a parameter // from an enclosing module, making it bound in us. So we now look // up its name in our parameters to find the index of its // new instantiation in the argument list we were passed. // int boundParameterName = paramArgs[i]; int index = findParameterIndex(boundParameterName); Assert(index != NONE, "didn't find bound parameter"); View* v2 = arguments[index]; newViewArgs[i] = v2; newParamArgs[i] = parameterArgs[index]; if (v2 != 0 && v2->getToModule()->isTheory()) { // // Instantiating a bound parameter by a theory-view allows it // to escape. This must be recorded so that it can be rebound // in a subsequent instantiation. // DebugAdvisory("bound parameter " << Token::name(boundParameterName) << " escaped to become free parameter " << Token::name(baseModule->getParameterName(i)) << " that will need rebinding"); extraViewArgs.append(0); extraParamArgs.append(boundParameterName); } } else { // // The free parameter was originally instantiated by a view // so this instantiation does not change. // Assert(!v->getToModule()->isTheory(), "unexpected theory-view " << v); newViewArgs[i] = v; newParamArgs[i] = 0; } } if (ImportModule* instance = moduleCache->makeInstatiation(baseModule, newViewArgs, newParamArgs)) { if (!extraParamArgs.empty()) instance = moduleCache->makeInstatiation(instance, extraViewArgs, extraParamArgs); return instance; } return 0; } int ImportModule::instantiateSortName(int sortId, const ParameterMap& parameterMap, const ParameterSet& extraParameterSet) { if (Token::auxProperty(sortId) == Token::AUX_STRUCTURED_SORT) { bool mapped = false; int header; Vector parameters; Vector extraParameters; Token::splitParameterList(sortId, header, parameters); int nrSortParameters = parameters.size(); for (int i = 0; i < nrSortParameters; ++i) { int original = parameters[i]; ParameterMap::const_iterator m = parameterMap.find(original); if (m != parameterMap.end()) { parameters[i] = m->second; mapped = true; } if (extraParameterSet.find(original) != extraParameterSet.end()) extraParameters.append(original); } if (mapped) sortId = Token::joinParameterList(header, parameters); if (!extraParameters.empty()) sortId = Token::joinParameterList(sortId, extraParameters); } return sortId; } Renaming* ImportModule::instantiateRenaming(const Renaming* original, const ParameterMap& parameterMap, const ParameterSet& extraParameterSet) { DebugAdvisory("Original renaming: " << original); Renaming* instance = new Renaming; { int nrSortMappings = original->getNrSortMappings(); for (int i = 0; i < nrSortMappings; i++) { int from = instantiateSortName(original->getSortFrom(i), parameterMap, extraParameterSet); int to = instantiateSortName(original->getSortTo(i), parameterMap, extraParameterSet); instance->addSortMapping(from, to); } } { int nrLabelMappings = original->getNrLabelMappings(); for (int i = 0; i < nrLabelMappings; i++) instance->addLabelMapping(original->getLabelFrom(i), original->getLabelTo(i)); } { Vector token(1); int nrOpMappings = original->getNrOpMappings(); for (int i = 0; i < nrOpMappings; i++) { instance->addOpMappingPartialCopy(original, i); int nrTypes = original->getNrTypes(i); for (int j = 0; j < nrTypes; ++j) { // // Only map one sort from each type. // const set& typeSorts = original->getTypeSorts(i, j); Assert(!typeSorts.empty(), "no sorts"); int sortName = instantiateSortName(*(typeSorts.begin()), parameterMap, extraParameterSet); token[0].tokenize(sortName, FileTable::SYSTEM_CREATED); instance->addType(true, token); } } } DebugAdvisory("Instantiated renaming: " << instance); return instance; } Maude-2.6/src/Mixfix/sharedTokens.cc0000644000147300135640000000245210457242755014357 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class SharedTokens. // // utility stuff #include "macros.hh" #include "vector.hh" // front end class definitions #include "token.hh" #include "sharedTokens.hh" #define MACRO(Name, String) \ int SharedTokens::Name; #include "specialTokens.cc" #undef MACRO SharedTokens::SharedTokens() { if (leftParen == 0) { #define MACRO(Name, String) \ Name = Token::encode(String); #include "specialTokens.cc" #undef MACRO } } Maude-2.6/src/Mixfix/mixfixModule.cc0000644000147300135640000010053011371134262014360 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class MixfixModule. // // utility stuff #include "macros.hh" #include "vector.hh" #include "pointerSet.hh" #include "tty.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "higher.hh" #include "freeTheory.hh" #include "AU_Theory.hh" #include "ACU_Theory.hh" #include "CUI_Theory.hh" #include "S_Theory.hh" #include "NA_Theory.hh" #include "builtIn.hh" #include "temporal.hh" #include "higher.hh" #include "objectSystem.hh" #include "meta.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "lineNumber.hh" #include "argumentIterator.hh" #include "dagArgumentIterator.hh" #include "equation.hh" #include "rule.hh" #include "sortConstraint.hh" #include "conditionFragment.hh" #include "symbolMap.hh" // variable class definitions #include "variableSymbol.hh" #include "variableTerm.hh" #include "variableDagNode.hh" // free theory class definitions #include "freeSymbol.hh" // AU theory class definitions #include "AU_Symbol.hh" // ACU theory class definitions #include "ACU_Symbol.hh" // CUI theory class definitions #include "CUI_Symbol.hh" // S theory class definitions #include "S_Symbol.hh" #include "S_DagNode.hh" #include "S_Term.hh" // builtin class definitions #include "bindingMacros.hh" #include "branchSymbol.hh" #include "equalitySymbol.hh" #include "sortTestSymbol.hh" #include "floatTerm.hh" #include "floatSymbol.hh" #include "floatDagNode.hh" #include "floatOpSymbol.hh" #include "stringSymbol.hh" #include "stringTerm.hh" #include "stringDagNode.hh" #include "stringOpSymbol.hh" #include "succSymbol.hh" #include "minusSymbol.hh" #include "numberOpSymbol.hh" #include "ACU_NumberOpSymbol.hh" #include "CUI_NumberOpSymbol.hh" #include "divisionSymbol.hh" #include "randomOpSymbol.hh" #include "matrixOpSymbol.hh" #include "counterSymbol.hh" // higher class definitions #include "rewriteSequenceSearch.hh" #include "modelCheckerSymbol.hh" #include "satSolverSymbol.hh" #include "equalityConditionFragment.hh" #include "sortTestConditionFragment.hh" #include "assignmentConditionFragment.hh" #include "rewriteConditionFragment.hh" // object system class definitions #include "configSymbol.hh" #include "socketManagerSymbol.hh" // strategy language class definitions #include "trivialStrategy.hh" #include "applicationStrategy.hh" #include "concatenationStrategy.hh" #include "unionStrategy.hh" #include "iterationStrategy.hh" #include "branchStrategy.hh" #include "testStrategy.hh" // metalevel class definitions #include "metaLevelOpSymbol.hh" #include "interpreterManagerSymbol.hh" // front end class definitions #include "mixfixParser.hh" #include "mixfixModule.hh" #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierOpSymbol.hh" #include "quotedIdentifierTerm.hh" #include "quotedIdentifierDagNode.hh" #include "loopSymbol.hh" #include "userLevelRewritingContext.hh" #include "interpreter.hh" #include "global.hh" // HACK shouldn't be accessing global variables Vector MixfixModule::emptyGather; Vector MixfixModule::gatherAny(1); Vector MixfixModule::gatherAnyAny(2); Vector MixfixModule::gatherAnyAnyAny(3); Vector MixfixModule::gatherPrefix(1); Vector MixfixModule::gatherPrefixPrefix(2); Vector MixfixModule::gatherAny0(2); inline int MixfixModule::newNonTerminal() { return --nextNonTerminal; } inline int MixfixModule::domainComponentIndex(const Symbol* symbol, int argNr) { return symbol->domainComponent(argNr)->getIndexWithinModule(); } inline int MixfixModule::nonTerminal(int componentIndex, NonTerminalType type) { return componentNonTerminalBase - componentIndex * NUMBER_OF_TYPES - type; } inline int MixfixModule::nonTerminal(const Sort* sort, NonTerminalType type) { return nonTerminal(sort->component()->getIndexWithinModule(), type); } // our stuff #include "makeGrammar.cc" #include "doParse.cc" #include "entry.cc" #include "prettyPrint.cc" #include "sharedPrint.cc" #include "termPrint.cc" #include "dagNodePrint.cc" #include "bufferPrint.cc" #include "graphPrint.cc" #include "strategyPrint.cc" void MixfixModule::SymbolInfo::revertGather(Vector& gatherSymbols) const { int nrElts = gather.length(); gatherSymbols.resize(nrElts); for (int i = 0; i < nrElts; i++) { int d = gather[i] - prec; gatherSymbols[i] = ((d < 0) ? GATHER_e : ((d == 0) ? GATHER_E : GATHER_AMP)); } } MixfixModule::MixfixModule(int name, ModuleType moduleType) : ProfileModule(name), moduleType(moduleType) { { // HACK gatherAny[0] = ANY; gatherAnyAny[0] = ANY; gatherAnyAny[1] = ANY; gatherAnyAnyAny[0] = ANY; gatherAnyAnyAny[1] = ANY; gatherAnyAnyAny[2] = ANY; gatherPrefix[0] = PREFIX_GATHER; gatherPrefixPrefix[0] = PREFIX_GATHER; gatherPrefixPrefix[1] = PREFIX_GATHER; gatherAny0[0] = ANY; gatherAny0[1] = 0; } trueSymbol = 0; falseSymbol = 0; parser = 0; } MixfixModule::~MixfixModule() { int nrPolymorphs = polymorphs.length(); for (int i = 0; i < nrPolymorphs; i++) { Polymorph& p = polymorphs[i]; if (p.identity != 0) p.identity->deepSelfDestruct(); Vector& termHooks = p.termHooks; int nrTermHooks = termHooks.length(); for (int j = 0; j < nrTermHooks; j++) termHooks[j].term->deepSelfDestruct(); } delete parser; } const char* MixfixModule::moduleTypeString(ModuleType type) { static const char* typeStrings[] = {"fmod", "mod", "fth", "th"}; return typeStrings[type]; } const char* MixfixModule::moduleEndString(ModuleType type) { static const char* typeStrings[] = {"endfm", "endm", "endfth", "endth"}; return typeStrings[type]; } void MixfixModule::closeSignature() { Module::closeSignature(); // compute sort info // // Finalize pretty print info for polymorphs. // int nrPolymorphs = polymorphs.length(); for (int i = 0; i < nrPolymorphs; i++) { Polymorph& p = polymorphs[i]; SymbolInfo& si = p.symbolInfo; if (si.mixfixSyntax.length() > 0) computePrecAndGather(p.domainAndRange.length() - 1, si); } // // Finalize pretty print info for symbols; insert object/message // info for configuration symbols. // const Vector& symbols = getSymbols(); int nrSymbols = symbols.length(); for (int i = 0; i < nrSymbols; i++) { Symbol* s = symbols[i]; SymbolInfo& si = symbolInfo[i]; if (si.mixfixSyntax.length() > 0) computePrecAndGather(s->arity(), si, s); if (ConfigSymbol* cs = dynamic_cast(s)) { cs->addObjects(objectSymbols); cs->addMessages(messageSymbols); } } } void MixfixModule::economize() { delete parser; parser = 0; } Sort* MixfixModule::findSort(int name) const { SortMap::const_iterator i = sortNames.find(name); return (i == sortNames.end()) ? 0 : (*i).second; } Symbol* MixfixModule::findSymbol(int name, const Vector& domainComponents, ConnectedComponent* rangeComponent) { int nrArgs = domainComponents.length(); IntMap::const_iterator first = firstSymbols.find(name); if (first != firstSymbols.end()) { for (int i = first->second; i != NONE; i = symbolInfo[i].next) { Symbol* s = getSymbols()[i]; Assert(s->id() == name, "name lookup error " << Token::name(s->id()) << " vs " << Token::name(name)); if (s->arity() == nrArgs) { const Vector& domainAndRange = s->getOpDeclarations()[0].getDomainAndRange(); bool sameDomain = true; for (int j = 0; j < nrArgs; j++) { if (domainComponents[j] != domainAndRange[j]->component()) { sameDomain = false; break; } } if (sameDomain == true && (rangeComponent == 0 || rangeComponent == domainAndRange[nrArgs]->component())) return s; } else if (nrArgs > 2) { if (symbolInfo[i].symbolType.hasFlag(SymbolType::ASSOC)) { const Vector& domainAndRange = s->getOpDeclarations()[0].getDomainAndRange(); ConnectedComponent* component = domainAndRange[0]->component(); bool sameDomain = true; for (int j = 0; j < nrArgs; j++) { if (domainComponents[j] != component) { sameDomain = false; break; } } if (sameDomain == true && (rangeComponent == 0 || rangeComponent == domainAndRange[2]->component())) return s; } } } } // // See if we can make a suitable symbol by instantiating a polymorph. // int nrPolymorphs = polymorphs.length(); for (int i = 0; i < nrPolymorphs; i++) { Polymorph& p = polymorphs[i]; if (p.name.code() == name && p.domainAndRange.length() - 1 == nrArgs) { // // Check range component. // const ConnectedComponent* c = 0; if (rangeComponent != 0) { const Sort* s = p.domainAndRange[nrArgs]; if (s == 0) c = rangeComponent; else if (s->component() != rangeComponent) continue; } // // Check domain components. // for (int j = 0; j < nrArgs; j++) { const Sort* s = p.domainAndRange[j]; const ConnectedComponent* d = domainComponents[j]; if (s == 0) { if (c == 0) c = d; else { if (c != d) { c = 0; break; } } } else { if (s->component() != d) { c = 0; break; } } } if (c != 0) return instantiatePolymorph(i, c->getIndexWithinModule()); } } // // See if we can make a suitable symbol by instantiating a sort test. // if (trueSymbol != 0 && falseSymbol != 0 && trueSymbol->rangeComponent() == falseSymbol->rangeComponent() && nrArgs == 1) { const char* nameText = Token::name(name); if (*nameText++ == '_' && *nameText++ == ':' && *nameText++ == ':') { bool eager = true; switch (*nameText++) { case ':': { if (*nameText++ != '`') break; eager = false; // fall thru } case '`': { if (Sort* sort = findSort(Token::encode(nameText))) return instantiateSortTest(sort, eager); } } } } /* cerr << "Couldn't find operator " << Token::name(name) << '\n';; for (int i = 0; i < nrArgs; i++) cerr << domainComponents[i]->sort(0) << '\n'; if (rangeComponent != 0) cerr << "\nrange = " << rangeComponent->sort(0) << '\n'; abort(); AdvisoryCheck(false, cerr << "Couldn't find operator " << Token::name(name)); */ return 0; } Symbol* MixfixModule::instantiateVariable(Sort* sort) { int sortIndex = sort->getIndexWithinModule(); int nrVariables = variableBase.length(); if (nrVariables <= sortIndex) { variableBase.expandTo(sortIndex + 1); for (int i = nrVariables; i <= sortIndex; i++) variableBase[i] = 0; } Symbol* symbol = variableBase[sortIndex]; if (symbol == 0) { symbol = new VariableSymbol(sort->id()); static Vector domainAndRange(1); domainAndRange[0] = sort; symbol->addOpDeclaration(domainAndRange, true); // variables are always constructors int nrSymbols = symbolInfo.length(); symbolInfo.expandBy(1); SymbolInfo& si = symbolInfo[nrSymbols]; si.prec = 0; si.symbolType.setBasicType(SymbolType::VARIABLE); si.iflags = 0; si.next = NONE; insertLateSymbol(symbol); variableBase[sortIndex] = symbol; } return symbol; } Symbol* MixfixModule::instantiateSortTest(Sort* sort, bool eager) { int sortIndex = sort->getIndexWithinModule(); Vector& sortTests = eager ? eagerSortTests : lazySortTests; int nrSortTests = sortTests.length(); if (nrSortTests <= sortIndex) { sortTests.expandTo(sortIndex + 1); for (int i = nrSortTests; i <= sortIndex; i++) sortTests[i] = 0; } Symbol* symbol = sortTests[sortIndex]; if (symbol == 0) { string opName(eager ? "_::`" : "_:::`"); opName += Token::name(sort->id()); int prefixCode = Token::encode(opName.c_str()); symbol = new SortTestSymbol(prefixCode, sort, trueSymbol, falseSymbol, eager); static Vector domainAndRange(2); domainAndRange[0] = sort->component()->sort(0); domainAndRange[1] = boolSort; symbol->addOpDeclaration(domainAndRange, false); // sort tests are never constructors int nrSymbols = symbolInfo.length(); symbolInfo.expandBy(1); SymbolInfo& si = symbolInfo[nrSymbols]; (void) Token::extractMixfix(prefixCode, si.mixfixSyntax); si.prec = 0; si.gather.append(ANY); si.symbolType.setBasicType(SymbolType::SORT_TEST); si.iflags = LEFT_BARE; si.next = NONE; insertLateSymbol(symbol); sortTests[sortIndex] = symbol; } return symbol; } bool MixfixModule::domainAndRangeMatch(const Vector& domainAndRange1, const Vector& domainAndRange2) { int nrSorts = domainAndRange1.length(); if (nrSorts != domainAndRange2.length()) return false; for (int i = 0; i < nrSorts; i++) { Sort* s1 = domainAndRange1[i]; Sort* s2 = domainAndRange2[i]; if (s1 == 0) { if (s2 != 0) return false; } else { if (s2 == 0 || s2->component() != s1->component()) return false; } } return true; } int MixfixModule::findPolymorphIndex(int polymorphName, const Vector& domainAndRange) const { // // This is inefficient - but we don't expect to have many // polymorphs in a given module. // int nrPolymorphs = polymorphs.size(); for (int i = 0; i < nrPolymorphs; i++) { if (polymorphs[i].name.code() == polymorphName && domainAndRangeMatch(polymorphs[i].domainAndRange, domainAndRange)) return i; } return NONE; } Term* MixfixModule::makeTrueTerm() { static Vector args; return trueSymbol->makeTerm(args); } Term* MixfixModule::makeBubble(int bubbleSpecIndex, const Vector& tokens, int first, int last) { Vector args; BubbleSpec& b = bubbleSpecs[bubbleSpecIndex]; for (int i = first; i <= last; i++) { int code = tokens[i].code(); if (code == leftParen || code == rightParen || code == leftBracket || code == rightBracket || code == leftBrace || code == rightBrace || code == comma) { static char backQuote[] = "`("; backQuote[1] = Token::name(code)[0]; code = Token::encode(backQuote); } args.append(new QuotedIdentifierTerm(b.qidSymbol, code)); } int bubbleSize = args.length(); if (bubbleSize != b.topSymbol->arity()) { Term* t = bubbleSize == 0 ? b.nilQidListSymbol->makeTerm(args): b.qidListSymbol->makeTerm(args); args.resize(1); args[0] = t; } return b.topSymbol->makeTerm(args); } Symbol* MixfixModule::instantiatePolymorph(int polymorphIndex, int kindIndex) { Polymorph& p = polymorphs[polymorphIndex]; int nrInstantiations = p.instantiations.length(); if (nrInstantiations <= kindIndex) { p.instantiations.expandTo(kindIndex + 1); for (int i = nrInstantiations; i <= kindIndex; i++) p.instantiations[i] = 0; } Symbol* symbol = p.instantiations[kindIndex]; if (symbol == 0) { SymbolType symbolType = p.symbolInfo.symbolType; Vector domainAndRange(p.domainAndRange); { Sort* s = getConnectedComponents()[kindIndex]->sort(Sort::KIND); int len = domainAndRange.length(); for (int i = 0; i < len; i++) { if (domainAndRange[i] == 0) domainAndRange[i] = s; } } symbol = newFancySymbol(p.name, domainAndRange, symbolType, p.strategy); if (symbol == 0) { symbol = FreeSymbol::newFreeSymbol(p.name.code(), domainAndRange.length() - 1, p.strategy, symbolType.hasFlag(SymbolType::MEMO)); symbolType.clearFlags(SymbolType::AXIOMS); } symbol->setLineNumber(p.name.lineNumber()); symbol->addOpDeclaration(domainAndRange, symbolType.hasFlag(SymbolType::CTOR)); // // Deal with fixups. // if (p.identity != 0) { if (BinarySymbol* b = dynamic_cast(symbol)) b->setIdentity(p.identity->deepCopy()); } if (symbolType.hasAttachments()) { { int nrIdHooks = p.idHooks.length(); for (int i = 0; i < nrIdHooks; i++) { const IdHook& idHook = p.idHooks[i]; const char* purpose = Token::name(idHook.purpose); int len = idHook.data.length(); Vector data(len); for (int j = 0; j < len; j++) data[j] = Token::name(idHook.data[j]); if (!(symbol->attachData(domainAndRange, purpose, data))) ; // HACK } } { int nrOpHooks = p.opHooks.length(); for (int i = 0; i < nrOpHooks; i++) { const char* purpose = Token::name(p.opHooks[i].purpose); if (!(symbol->attachSymbol(purpose, p.opHooks[i].symbol))) ; // HACK } } { int nrTermHooks = p.termHooks.length(); for (int i = 0; i < nrTermHooks; i++) { const char* purpose = Token::name(p.termHooks[i].purpose); Term* copy = p.termHooks[i].term->deepCopy(); if (!(symbol->attachTerm(purpose, copy))) ; // HACK } } } int nrSymbols = symbolInfo.length(); symbolInfo.expandBy(1); symbolInfo[nrSymbols] = p.symbolInfo; // deep copy insertLateSymbol(symbol); p.instantiations[kindIndex] = symbol; } return symbol; } QuotedIdentifierSymbol* MixfixModule::findQuotedIdentifierSymbol(const ConnectedComponent* component) const { map::const_iterator i = quotedIdentifierSymbols.find(component->getIndexWithinModule()); return (i == quotedIdentifierSymbols.end()) ? 0 : static_cast((*i).second); } StringSymbol* MixfixModule::findStringSymbol(const ConnectedComponent* component) const { map::const_iterator i = stringSymbols.find(component->getIndexWithinModule()); return (i == stringSymbols.end()) ? 0 : static_cast((*i).second); } FloatSymbol* MixfixModule::findFloatSymbol(const ConnectedComponent* component) const { map::const_iterator i = floatSymbols.find(component->getIndexWithinModule()); return (i == floatSymbols.end()) ? 0 : static_cast((*i).second); } void MixfixModule::addIdentityToPolymorph(int polymorphIndex, Term* identity) { polymorphs[polymorphIndex].identity = identity; } void MixfixModule::addIdHookToPolymorph(int polymorphIndex, int purpose, const Vector& data) { Vector& idHooks = polymorphs[polymorphIndex].idHooks; int nrIdHooks = idHooks.length(); idHooks.resize(nrIdHooks + 1); IdHook& idHook = idHooks[nrIdHooks]; idHook.purpose = purpose; idHook.data = data; // deep copy } void MixfixModule::addOpHookToPolymorph(int polymorphIndex, int purpose, Symbol* symbol) { Vector& opHooks = polymorphs[polymorphIndex].opHooks; int nrOpHooks = opHooks.length(); opHooks.resize(nrOpHooks + 1); OpHook& opHook = opHooks[nrOpHooks]; opHook.purpose = purpose; opHook.symbol = symbol; } void MixfixModule::addTermHookToPolymorph(int polymorphIndex, int purpose, Term* term) { Vector& termHooks = polymorphs[polymorphIndex].termHooks; int nrTermHooks = termHooks.length(); termHooks.resize(nrTermHooks + 1); TermHook& termHook = termHooks[nrTermHooks]; termHook.purpose = purpose; termHook.term = term; } bool MixfixModule::getPolymorphDataAttachment(int index, int nr, int& purpose, Vector& items) const { const Vector& idHooks = polymorphs[index].idHooks; if (nr < idHooks.length()) { const IdHook& idHook = idHooks[nr]; purpose = idHook.purpose; items = idHook.data; // deep copy return true; } return false; } bool MixfixModule::getPolymorphSymbolAttachment(int index, int nr, int& purpose, Symbol*& op) const { const Vector& opHooks = polymorphs[index].opHooks; if (nr < opHooks.length()) { const OpHook& opHook = opHooks[nr]; purpose = opHook.purpose; op = opHook.symbol; return true; } return false; } bool MixfixModule::getPolymorphTermAttachment(int index, int nr, int& purpose, Term*& term) const { const Vector& termHooks = polymorphs[index].termHooks; if (nr < termHooks.length()) { const TermHook& termHook = termHooks[nr]; purpose = termHook.purpose; term = termHook.term; return true; } return false; } void MixfixModule::copyFixUpPolymorph(int polymorphIndex, const MixfixModule* originalModule, int originalPolymorphIndex, SymbolMap* map) { { Term* identity = originalModule->polymorphs[originalPolymorphIndex].identity; polymorphs[polymorphIndex].identity = (identity == 0) ? 0 : identity->deepCopy(map); } { const Vector& originalIdHooks = originalModule->polymorphs[originalPolymorphIndex].idHooks; int nrIdHooks = originalIdHooks.length(); Vector& idHooks = polymorphs[polymorphIndex].idHooks; idHooks.resize(nrIdHooks); for (int i = 0; i < nrIdHooks; i++) idHooks[i] = originalIdHooks[i]; // deep copy } { const Vector& originalOpHooks = originalModule->polymorphs[originalPolymorphIndex].opHooks; int nrOpHooks = originalOpHooks.length(); Vector& opHooks = polymorphs[polymorphIndex].opHooks; opHooks.resize(nrOpHooks); for (int i = 0; i < nrOpHooks; i++) { opHooks[i].purpose = originalOpHooks[i].purpose; opHooks[i].symbol = map->translate(originalOpHooks[i].symbol); } } { const Vector& originalTermHooks = originalModule->polymorphs[originalPolymorphIndex].termHooks; int nrTermHooks = originalTermHooks.length(); Vector& termHooks = polymorphs[polymorphIndex].termHooks; termHooks.resize(nrTermHooks); for (int i = 0; i < nrTermHooks; i++) { termHooks[i].purpose = originalTermHooks[i].purpose; termHooks[i].term = originalTermHooks[i].term->deepCopy(map); } } } int MixfixModule::findBubbleSpecIndex(Symbol* topSymbol) const { int nrBubbleSpecs = bubbleSpecs.length(); int i = 0; for (; i < nrBubbleSpecs; i++) { if (bubbleSpecs[i].topSymbol == topSymbol) break; } return i; } void MixfixModule::copyFixUpBubbleSpec(Symbol* originalSymbol, SymbolMap* map) { MixfixModule* originalModule = safeCast(MixfixModule*, originalSymbol->getModule()); BubbleSpec& ob = originalModule-> bubbleSpecs[originalModule->findBubbleSpecIndex(originalSymbol)]; Symbol* newSymbol = map->translate(originalSymbol); BubbleSpec& b = bubbleSpecs[findBubbleSpecIndex(newSymbol)]; if (b.qidSymbol == 0 && ob.qidSymbol != 0) b.qidSymbol = safeCast(QuotedIdentifierSymbol*, map->translate(ob.qidSymbol)); if (b.nilQidListSymbol == 0 && ob.nilQidListSymbol != 0) b.nilQidListSymbol = map->translate(ob.nilQidListSymbol); if (b.qidListSymbol == 0 && ob.qidListSymbol != 0) b.qidListSymbol = map->translate(ob.qidListSymbol); } void MixfixModule::copyBubbleSpec(Symbol* originalSymbol, Symbol* newSymbol) { MixfixModule* originalModule = safeCast(MixfixModule*, originalSymbol->getModule()); BubbleSpec& ob = originalModule-> bubbleSpecs[originalModule->findBubbleSpecIndex(originalSymbol)]; int nrBubbleSpecs = bubbleSpecs.length(); bubbleSpecs.append(ob); // deep copy BubbleSpec& b = bubbleSpecs[nrBubbleSpecs]; b.topSymbol = newSymbol; b.qidSymbol = 0; b.nilQidListSymbol = 0; b.qidListSymbol = 0; const Vector& domainAndRange = newSymbol->getOpDeclarations()[0].getDomainAndRange(); b.componentIndex = domainAndRange[domainAndRange.length() - 1]->component()->getIndexWithinModule(); bubbleComponents.insert(b.componentIndex); } void MixfixModule::getDataAttachments(Symbol* symbol, const Vector& opDeclaration, Vector& purposes, Vector >& data) const { if (symbol == trueSymbol) { APPEND_DATA(purposes, data, SystemTrue); } else if (symbol == falseSymbol) { APPEND_DATA(purposes, data, SystemFalse); } else { switch (getSymbolType(symbol).getBasicType()) { case SymbolType::BUBBLE: { const BubbleSpec& b = bubbleSpecs[findBubbleSpecIndex(symbol)]; { purposes.append("Bubble"); int nrAttachments = data.length(); data.resize(nrAttachments + 1); Vector& items = data[nrAttachments]; items.append(Token::name(Token::encode(int64ToString(b.lowerBound)))); items.append(Token::name(Token::encode(int64ToString(b.upperBound)))); if (b.leftParenToken != NONE) { items.append(Token::name(b.leftParenToken)); items.append(Token::name(b.rightParenToken)); } } int nrExcluded = b.excludedTokens.length(); if (nrExcluded > 0) { purposes.append("Exclude"); int nrAttachments = data.length(); data.resize(nrAttachments + 1); Vector& items = data[nrAttachments]; items.resize(nrExcluded); for (int i = 0; i < nrExcluded; i++) items[i] = Token::name(b.excludedTokens[i]); } break; } case SymbolType::FLOAT: { APPEND_DATA(purposes, data, FloatSymbol); break; } case SymbolType::STRING: { APPEND_DATA(purposes, data, StringSymbol); break; } default: symbol->getDataAttachments(opDeclaration, purposes, data); } } } void MixfixModule::getSymbolAttachments(Symbol* symbol, Vector& purposes, Vector& symbols) const { if (getSymbolType(symbol).getBasicType() == SymbolType::BUBBLE) { const BubbleSpec& b = bubbleSpecs[findBubbleSpecIndex(symbol)]; if (b.qidSymbol != 0) { purposes.append("qidSymbol"); symbols.append(b.qidSymbol); } if (b.nilQidListSymbol != 0) { purposes.append("nilQidListSymbol"); symbols.append(b.nilQidListSymbol); } if (b.qidListSymbol != 0) { purposes.append("qidListSymbol"); symbols.append(b.qidListSymbol); } } else symbol->getSymbolAttachments(purposes, symbols); } void MixfixModule::getTermAttachments(Symbol* symbol, Vector& purposes, Vector& terms) const { symbol->getTermAttachments(purposes, terms); } void MixfixModule::fixUpBubbleSpec(int bubbleSpecIndex, Symbol* qidSymbol, Symbol* nilQidListSymbol, Symbol* qidListSymbol) { BubbleSpec& b = bubbleSpecs[bubbleSpecIndex]; b.nilQidListSymbol = nilQidListSymbol; b.qidListSymbol = qidListSymbol; // // Check that needed symbols exist and have the right properties/arities/sorts. // if (qidSymbol == 0) { IssueWarning(*(b.topSymbol) << ": qidSymbol hook needed for bubble."); markAsBad(); return; } b.qidSymbol = dynamic_cast(qidSymbol); if (b.qidSymbol == 0) { IssueWarning(*(b.topSymbol) << ": inappropriate symbol " << QUOTE(qidSymbol) << " for qidSymbol hook."); markAsBad(); return; } if (b.lowerBound < 1) { if (nilQidListSymbol == 0) { IssueWarning(*(b.topSymbol) << ": nilQidListSymbol hook needed for bubble."); markAsBad(); } else { if (nilQidListSymbol->arity() != 0 || // not perfect - might be special symbol nilQidListSymbol->rangeComponent() != qidSymbol->rangeComponent()) { IssueWarning(*(b.topSymbol) << ": inappropriate symbol " << QUOTE(nilQidListSymbol) << " for nilQidListSymbol hook."); markAsBad(); } } } if (b.upperBound > 1) { if (qidListSymbol == 0) { IssueWarning(*(b.topSymbol) << ": qidListSymbol hook needed for bubble."); markAsBad(); return; } if (getSymbolType(qidListSymbol).hasFlag(SymbolType::ASSOC)) { if (qidListSymbol->rangeComponent() == qidSymbol->rangeComponent()) return; // OK } else { int nrArgs = qidListSymbol->arity(); if (b.upperBound == nrArgs && (b.upperBound == b.lowerBound || (b.upperBound == 2 && qidListSymbol->rangeComponent() == qidSymbol->rangeComponent()))) { for (int i = 0; i < nrArgs; i++) { if (qidListSymbol->domainComponent(i) != qidSymbol->rangeComponent()) { IssueWarning(*(b.topSymbol) << ": bad domain kind in symbol " << QUOTE(qidListSymbol) << " for qidListSymbol hook."); markAsBad(); return; } } return; // OK } } IssueWarning(*(b.topSymbol) << ": inappropriate symbol " << QUOTE(qidListSymbol) << " for qidListSymbol hook."); markAsBad(); } } int MixfixModule::findMatchingParen(const Vector& tokens, int pos) { if (tokens[pos].code() == leftParen) { int level = 1; int nrTokens = tokens.length(); for (int i = pos + 1; i < nrTokens; i++) { int code = tokens[i].code(); if (code == leftParen) ++level; else if (code == rightParen) { --level; if (level == 0) return i; } } } return pos; } int MixfixModule::mayAssoc(Symbol* symbol, int argNr) { const Vector& opDecls = symbol->getOpDeclarations(); int nrOpDecls = opDecls.length(); if (nrOpDecls == 0) return UNDEFINED; int nrArgs = symbol->arity(); if (opDecls[0].getDomainAndRange()[argNr]->component() != opDecls[0].getDomainAndRange()[nrArgs]->component()) return UNDEFINED; for (int i = 0; i < nrOpDecls; i++) { Sort* argSort = opDecls[i].getDomainAndRange()[argNr]; for (int j = 0; j < nrOpDecls; j++) { if (leq(opDecls[j].getDomainAndRange()[nrArgs], argSort)) return true; } } return false; } void MixfixModule::computePrecAndGather(int nrArgs, SymbolInfo& si, Symbol* symbol) { int nrItems = si.mixfixSyntax.length(); if (si.mixfixSyntax[0] == underscore) si.iflags |= LEFT_BARE; if (si.mixfixSyntax[nrItems - 1] == underscore) si.iflags |= RIGHT_BARE; if (si.prec == DEFAULT) { // // Compute default precedence. // si.prec = 0; if ((si.iflags & LEFT_BARE) || (si.iflags & RIGHT_BARE)) si.prec = (nrArgs == 1) ? UNARY_PREC : INFIX_PREC; } if (si.gather.length() > 0) { Assert(si.gather.length() == nrArgs, "gather length != nrArgs"); for (int i = 0; i < nrArgs; i++) { int g = si.gather[i]; if (g == GATHER_AMP) g = ANY; else { g += si.prec; if (g < 0) g = 0; } si.gather[i] = g; } } else { if (nrArgs > 0) { // // Compute default gather pattern. // if (si.symbolType.hasFlag(SymbolType::ASSOC) && (si.iflags & LEFT_BARE) && (si.iflags & RIGHT_BARE) && si.prec > 0) { // // gather (e E) to right associate infix assoc operator. // si.gather.append(si.prec - 1); si.gather.append(si.prec); } else { for (int i = 0; i < nrItems; i++) { if (si.mixfixSyntax[i] == underscore) { if (i == 0 || si.mixfixSyntax[i - 1] == underscore || i + 1 == nrItems || si.mixfixSyntax[i + 1] == underscore) si.gather.append(si.prec); else si.gather.append(ANY); } } // // Check for exception case where we bias associative grouping // according to sort structure. // if ((si.iflags & LEFT_BARE) && (si.iflags & RIGHT_BARE) && si.prec > 0 && symbol != 0) { int leftAssoc = mayAssoc(symbol, 0); if (leftAssoc != UNDEFINED) { int rightAssoc = mayAssoc(symbol, nrArgs - 1); if (rightAssoc != UNDEFINED) { if (leftAssoc) { if (!rightAssoc) si.gather[nrArgs - 1] = si.prec - 1; // prevent right assoc } else { if (rightAssoc) si.gather[0] = si.prec - 1; // prevent left assoc } } } } } } Assert(si.gather.length() == nrArgs, "gather length != nrArgs"); } } Maude-2.6/src/Mixfix/userLevelRewritingContext.cc0000644000147300135640000002513611256541637017136 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class UserLevelRewritingContext // //#include // HACK // utility stuff #include "macros.hh" #include "vector.hh" #include "pointerSet.hh" #include "bddUser.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "higher.hh" // core class definitions #include "redexPosition.hh" #include "variableSymbol.hh" #include "rewritingContext.hh" #include "conditionFragment.hh" #include "sortConstraint.hh" #include "equation.hh" #include "rule.hh" #include "narrowingVariableInfo.hh" // variable class definitions #include "variableTerm.hh" #include "variableDagNode.hh" // front end class definitions #include "token.hh" #include "userLevelRewritingContext.hh" //#include "preModule.hh" // HACK #include "autoWrapBuffer.hh" #include "interpreter.hh" // HACK #include "global.hh" // HACK shouldn't be accessing global variables // our stuff #include "interact.cc" #include "trial.cc" bool UserLevelRewritingContext::tracePostFlag = false; const char UserLevelRewritingContext::header[] = "*********** "; UserLevelRewritingContext::UserLevelRewritingContext(DagNode* root) : ObjectSystemRewritingContext(root), parent(0), purpose(TOP_LEVEL_EVAL), localTraceFlag(true) { } UserLevelRewritingContext::UserLevelRewritingContext(DagNode* root, UserLevelRewritingContext* parent, int purpose, bool localTraceFlag) : ObjectSystemRewritingContext(root), parent(parent), purpose(purpose), localTraceFlag(localTraceFlag) { } RewritingContext* UserLevelRewritingContext::makeSubcontext(DagNode* root, int purpose) { return new UserLevelRewritingContext(root, this, purpose, localTraceFlag && (purpose != CONDITION_EVAL || interpreter.getFlag(Interpreter::TRACE_CONDITION))); } bool UserLevelRewritingContext::dontTrace(const DagNode* redex, const PreEquation* pe) { Symbol* symbol = redex->symbol(); return (interpreter.getFlag(Interpreter::TRACE_SELECT) && !(interpreter.traceId(symbol->id()) || (pe != 0 && interpreter.traceId(pe->getLabel().id())))) || interpreter.excludedModule(symbol->getModule()->id()) || (pe == 0 && !interpreter.getFlag(Interpreter::TRACE_BUILTIN)); } void UserLevelRewritingContext::checkForPrintAttribute(MixfixModule::ItemType itemType, const PreEquation* item) { if (item != 0) { MixfixModule* m = safeCast(MixfixModule*, item->getModule()); const PrintAttribute* pa = m->getPrintAttribute(itemType, item); if (pa != 0) { pa->print(cout, *this); if (interpreter.getFlag(Interpreter::PRINT_ATTRIBUTE_NEWLINE)) cout << '\n'; } } } void UserLevelRewritingContext::tracePreEqRewrite(DagNode* redex, const Equation* equation, int type) { if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileEqRewrite(redex, equation, type); } if (interpreter.getFlag(Interpreter::PRINT_ATTRIBUTE)) checkForPrintAttribute(MetadataStore::EQUATION, equation); if (handleDebug(redex, equation) || !localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_EQ)) || dontTrace(redex, equation)) { tracePostFlag = false; return; } tracePostFlag = true; if (interpreter.getFlag(Interpreter::TRACE_BODY)) cout << header << "equation\n"; if (equation == 0) { if (type == RewritingContext::BUILTIN) cout << "(built-in equation for symbol " << redex->symbol() << ")\n"; else if (type == RewritingContext::MEMOIZED) cout << "(memo table lookup for symbol " << redex->symbol() << ")\n"; } else { if (interpreter.getFlag(Interpreter::TRACE_BODY)) { cout << equation << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *equation); } else { const Label& label = equation->getLabel(); if (label.id() == NONE) cout << "(unlabeled equation)\n"; else cout << &label << '\n'; } } if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "Old: " << root() << '\n'; if (interpreter.getFlag(Interpreter::TRACE_REWRITE)) cout << redex << "\n--->\n"; } void UserLevelRewritingContext::tracePostEqRewrite(DagNode* replacement) { if (tracePostFlag) { Assert(!abortFlag, "abort flag set"); if (interpreter.getFlag(Interpreter::TRACE_REWRITE)) cout << replacement << '\n'; if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "New: " << root() << '\n'; } } void UserLevelRewritingContext::tracePreRuleRewrite(DagNode* redex, const Rule* rule) { if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileRlRewrite(redex, rule); } if (interpreter.getFlag(Interpreter::PRINT_ATTRIBUTE)) checkForPrintAttribute(MetadataStore::RULE, rule); if (handleDebug(redex, rule) || !localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_RL)) || dontTrace(redex, rule)) { tracePostFlag = false; return; } tracePostFlag = true; if (interpreter.getFlag(Interpreter::TRACE_BODY)) cout << header << "rule\n"; if (rule == 0) cout << "(built-in rule for symbol " << redex->symbol() << ")\n"; else { if (interpreter.getFlag(Interpreter::TRACE_BODY)) { cout << rule << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *rule); } else { const Label& label = rule->getLabel(); if (label.id() == NONE) cout << "(unlabeled rule)\n"; else cout << &label << '\n'; } } if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "Old: " << root() << '\n'; if (interpreter.getFlag(Interpreter::TRACE_REWRITE)) cout << redex << "\n--->\n"; } void UserLevelRewritingContext::tracePostRuleRewrite(DagNode* replacement) { if (tracePostFlag) { if (interpreter.getFlag(Interpreter::TRACE_REWRITE)) cout << replacement << '\n'; if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "New: " << root() << '\n'; } } void UserLevelRewritingContext:: traceNarrowingStep(Rule* rule, DagNode* redex, DagNode* replacement, const NarrowingVariableInfo* variableInfo, const Substitution* substitution, DagNode* newState) { if (handleDebug(redex, rule) || !localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_RL)) || dontTrace(redex, rule)) return; if (interpreter.getFlag(Interpreter::TRACE_BODY)) { cout << Tty(Tty::MAGENTA) << header << "narrowing step\n" << Tty(Tty::RESET) << rule << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) { cout << "Rule variable bindings:\n"; printSubstitution(*substitution, *rule); cout << "Subject variable bindings:\n"; int nrSubjectVariables = variableInfo->getNrVariables(); if (nrSubjectVariables == 0) cout << "empty substitution\n"; else { int variableBase = rule->getModule()->getMinimumSubstitutionSize(); for (int i = 0; i < nrSubjectVariables; ++i) { DagNode* v = variableInfo->index2Variable(i); DagNode* d = substitution->value(variableBase + i); Assert(v != 0, "null variable"); cout << v << " --> "; if (d == 0) cout << "(unbound)\n"; else cout << d << '\n'; } } } } if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "Old: " << root() << '\n'; if (interpreter.getFlag(Interpreter::TRACE_REWRITE)) cout << redex << "\n--->\n" << replacement << '\n'; if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "New: " << newState << '\n'; } void UserLevelRewritingContext::tracePreScApplication(DagNode* subject, const SortConstraint* sc) { if (interpreter.getFlag(Interpreter::PROFILE)) { safeCast(ProfileModule*, root()->symbol()->getModule())-> profileMbRewrite(subject, sc); } if (interpreter.getFlag(Interpreter::PRINT_ATTRIBUTE)) checkForPrintAttribute(MetadataStore::MEMB_AX, sc); if (handleDebug(subject, sc) || !localTraceFlag || !(interpreter.getFlag(Interpreter::TRACE_MB)) || dontTrace(subject, sc)) return; if (interpreter.getFlag(Interpreter::TRACE_BODY)) cout << header << "membership axiom\n"; if (sc == 0) cout << "(built-in membership axiom for symbol " << subject->symbol() << ")\n"; else { if (interpreter.getFlag(Interpreter::TRACE_BODY)) { cout << sc << '\n'; if (interpreter.getFlag(Interpreter::TRACE_SUBSTITUTION)) printSubstitution(*this, *sc); } else { const Label& label = sc->getLabel(); if (label.id() == NONE) cout << "(unlabeled membership axiom)\n"; else cout << &label << '\n'; } } if (interpreter.getFlag(Interpreter::TRACE_WHOLE)) cout << "Whole: " << root() << '\n'; // // Coverity discovered bug - sc could be 0. // if (interpreter.getFlag(Interpreter::TRACE_REWRITE)) cout << subject->getSort() << ": " << subject << " becomes " << sc->getSort() << '\n'; // BUG } void UserLevelRewritingContext::printSubstitution(const Substitution& substitution, const VariableInfo& varInfo) { int nrVars = varInfo.getNrRealVariables(); if (nrVars == 0) cout << "empty substitution\n"; else { for (int i = 0; i < nrVars; i++) { Term* v = varInfo.index2Variable(i); DagNode* d = substitution.value(i); //DebugAdvisory(static_cast(v) << " --> " << // static_cast(d) << " / " << // static_cast(d->symbol())); Assert(v != 0, "null variable"); cout << v << " --> "; if (d == 0) cout << "(unbound)\n"; else cout << d << '\n'; } } } Maude-2.6/src/Mixfix/auxProperty.cc0000644000147300135640000001316110321573020014244 00000000000000const char* Token::skipSortName(const char* tokenString, bool& parameterized) { // // A sort name may contain any characters except for // . : `[ `] `{ `} `, // An exception is made for `{ `} `, iff they occur as part of // a sort name constructed by: // ::= | `{ `} // ::= | `, // // A sort name can be terminated by \0, `, `] `} // If a legal sort name followed by a legal terminator is seen, the // addess of the first terminator charater is returned otherwise 0 is // returned. // In the first case, parameterized is true iff the sort name contained `{ // In the second case, parameterized is undefined. // parameterized = false; int depth = 0; bool seenName = false; for (const char* p = tokenString;; p++) { switch (*p) { case '\0': return (seenName && depth == 0) ? p : 0; case '.': case ':': return 0; case '`': { switch (*(p + 1)) { case ']': return (seenName && depth == 0) ? p : 0; case '{': { if (seenName) { parameterized = true; ++depth; seenName = false; ++p; } else return 0; break; } case ',': { if (seenName) { if (depth == 0) return p; else { seenName = false; ++p; } } else return 0; break; } case '}': { if (seenName && depth > 0) { --depth; ++p; } else return 0; break; } case '[': case '\0': return 0; default: { seenName = true; ++p; break; } } break; } default: { seenName = true; break; } } } } int Token::computeAuxProperty(const char* tokenString) { { // // Check for kind or sort. // const char* p = tokenString; if (*p++ == '`' && *p == '[') { for(;;) { bool dummy; p = skipSortName(p, dummy); if (p != 0 && *p++ == '`') { switch (*p++) { case ']': { if (*p == '\0') return AUX_KIND; break; } case ',': continue; } } break; } } else { bool parameterized; const char* p = skipSortName(tokenString, parameterized); if (p != 0 && *p == '\0') return parameterized ? AUX_STRUCTURED_SORT : AUX_SORT; } } { // // Check for constant or variable. // int len = strlen(tokenString); for (int i = len - 1; i > 0; i--) { char c = tokenString[i]; if (c == '.') { int t = computeAuxProperty(tokenString + i + 1); if (t == AUX_SORT || t == AUX_STRUCTURED_SORT || t == AUX_KIND) return AUX_CONSTANT; break; } else if (c == ':') { int t = computeAuxProperty(tokenString + i + 1); if (t == AUX_SORT || t == AUX_STRUCTURED_SORT || t == AUX_KIND) return AUX_VARIABLE; break; } } } return NONE; } crope Token::sortName(int code) { const char* name = stringTable.name(code); if (auxProperty(code) != AUX_STRUCTURED_SORT) return crope(name); crope acc; for (;; ++name) { char c = *(name); switch (c) { case '\0': return acc; case '`': { c = *(++name); if (c != '{' && c != ',' && c != '}') acc += '`'; break; } } acc += c; } } void Token::splitParameterizedSort(int code, Vector& codes) { Assert(auxProperty(code) == AUX_STRUCTURED_SORT, "called on " << stringTable.name(code)); codes.clear(); const char* name = stringTable.name(code); char* t = new char[strlen(name) + 1]; char* p = strcpy(t, name); for (char* i = p;; ++i) { switch (*i) { case '\0': { Assert(p == i, "surplus characters " << p); delete [] t; return; } case '`': { const char* sep; switch (*(i + 1)) { case '{': { sep = "{"; break; } case ',': { sep = ","; break; } case '}': { sep = "}"; break; } default: continue; } if (i != p) { *i = 0; codes.append(encode(p)); } codes.append(encode(sep)); ++i; p = i + 1; } } } } void Token::splitParameterList(int code, int& header, Vector& parameters) { Assert(auxProperty(code) == AUX_STRUCTURED_SORT, "called on " << stringTable.name(code)); parameters.clear(); const char* n = name(code); int len = strlen(n); char* t = new char[len + 1]; char* p = strcpy(t, n); // // Search backwards for the '{' that marks the start of parameter list. // Assert(t[len - 1] == '}', "missing }"); Assert(t[len - 2] == '`', "missing `"); int depth = 1; for(p += len - 3;; --p) { Assert(p > t, "missing {"); // first character is never '{' if (*p == '{') { --depth; if (depth == 0) break; } else if (*p == '}') ++depth; } // // Now split out header and parameters. // Assert(*(p - 1) == '`', "missing `"); *(p - 1) = '\0'; header = encode(t); do { ++p; char* s = p; for (p += 2;; ++p) { if (*p == '{') ++depth; else if (*p == ',' && depth == 0) break; else if (*p == '}') { if (depth == 0) break; else --depth; } } Assert(*(p - 1) == '`', "missing `"); *(p - 1) = '\0'; parameters.append(encode(s)); } while (*p != '}'); delete [] t; } int Token::joinParameterList(int header, const Vector& parameters) { crope n(name(header)); const char* sep = "`{"; FOR_EACH_CONST(i, Vector, parameters) { n += sep; sep = "`,"; n += name(*i); } n += "`}"; return encode(n.c_str()); } Maude-2.6/src/Mixfix/quotedIdentifierOpSymbol.cc0000644000147300135640000001430607752302357016716 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class QuotedIdentifierOpSymbol. // #include // utility stuff #include "macros.hh" #include "vector.hh" #include "stringTable.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "freeTheory.hh" #include "NA_Theory.hh" #include "builtIn.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // core class definitions #include "dagArgumentIterator.hh" #include "substitution.hh" #include "rewritingContext.hh" #include "symbolMap.hh" // free theory class definitions #include "freeDagNode.hh" // built in class definitions #include "stringSymbol.hh" #include "stringDagNode.hh" #include "bindingMacros.hh" // front end class definitions #include "userLevelRewritingContext.hh" #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierDagNode.hh" #include "quotedIdentifierOpSymbol.hh" #include "token.hh" #ifdef MOS int QuotedIdentifierOpSymbol::counter = 1; #endif QuotedIdentifierOpSymbol::QuotedIdentifierOpSymbol(int id, int nrArgs) : FreeSymbol(id, nrArgs) { op = NONE; quotedIdentifierSymbol = 0; stringSymbol = 0; } bool QuotedIdentifierOpSymbol::attachData(const Vector& opDeclaration, const char* purpose, const Vector& data) { BIND_OP(purpose, QuotedIdentifierOpSymbol, op, data); return FreeSymbol::attachData(opDeclaration, purpose, data); } bool QuotedIdentifierOpSymbol::attachSymbol(const char* purpose, Symbol* symbol) { BIND_SYMBOL(purpose, symbol, quotedIdentifierSymbol, QuotedIdentifierSymbol*); BIND_SYMBOL(purpose, symbol, stringSymbol, StringSymbol*); return FreeSymbol::attachSymbol(purpose, symbol); } void QuotedIdentifierOpSymbol::copyAttachments(Symbol* original, SymbolMap* map) { QuotedIdentifierOpSymbol* orig = safeCast(QuotedIdentifierOpSymbol*, original); op = orig->op; COPY_SYMBOL(orig, quotedIdentifierSymbol, map, QuotedIdentifierSymbol*); COPY_SYMBOL(orig, stringSymbol, map, StringSymbol*); FreeSymbol::copyAttachments(original, map); } void QuotedIdentifierOpSymbol::getDataAttachments(const Vector& opDeclaration, Vector& purposes, Vector >& data) { int nrDataAttachments = purposes.length(); purposes.resize(nrDataAttachments + 1); purposes[nrDataAttachments] = "QuotedIdentifierOpSymbol"; data.resize(nrDataAttachments + 1); data[nrDataAttachments].resize(1); const char*& d = data[nrDataAttachments][0]; switch (op) { CODE_CASE(d, 's', 't', "string") CODE_CASE(d, 'q', 'i', "qid") #ifdef MOS CODE_CASE(d, 'm', 'o', "mo") #endif default: CantHappen("bad qid op"); } FreeSymbol::getDataAttachments(opDeclaration, purposes, data); } void QuotedIdentifierOpSymbol::getSymbolAttachments(Vector& purposes, Vector& symbols) { APPEND_SYMBOL(purposes, symbols, quotedIdentifierSymbol); APPEND_SYMBOL(purposes, symbols, stringSymbol); FreeSymbol::getSymbolAttachments(purposes, symbols); } bool QuotedIdentifierOpSymbol::eqRewrite(DagNode* subject, RewritingContext& context) { Assert(this == subject->symbol(), "bad symbol"); FreeDagNode* d = safeCast(FreeDagNode*, subject); // // Evaluate our arguments. // DagNode* a1 = d->getArgument(0); a1->reduce(context); switch (op) { case CODE('s', 't'): { if (a1->symbol() == quotedIdentifierSymbol) { QuotedIdentifierDagNode* d1 = static_cast(a1); bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) StringDagNode(stringSymbol, Token::name(d1->getIdIndex())); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } break; } case CODE('q', 'i'): { if (a1->symbol() == stringSymbol) { int idIndex = Token::ropeToPrefixNameCode(static_cast(a1)->getValue()); if (idIndex != NONE) { bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) QuotedIdentifierDagNode(quotedIdentifierSymbol, idIndex); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } } break; } #ifdef MOS case CODE('m', 'o'): { if (a1->symbol() == quotedIdentifierSymbol) { QuotedIdentifierDagNode* d1 = static_cast(a1); const char* s1 = Token::name(d1->getIdIndex()); if (strcmp(s1, "RESET") == 0) counter = 0; ostringstream ost(s1); ost << counter; ++counter; int idIndex = Token::encode(ost.str().c_str()); bool trace = RewritingContext::getTraceStatus(); if (trace) { context.tracePreEqRewrite(subject, 0, RewritingContext::BUILTIN); if (context.traceAbort()) return false; } (void) new(subject) QuotedIdentifierDagNode(quotedIdentifierSymbol, idIndex); context.incrementEqCount(); if (trace) context.tracePostEqRewrite(subject); return true; } break; } #endif } return FreeSymbol::eqRewrite(subject, context); } Maude-2.6/src/Mixfix/entity.hh0000644000147300135640000000416311064002662013236 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Base class for entities that must inform their users just before they // are deleted or otherwise invalidated. // #ifndef _entity_hh_ #define _entity_hh_ #include class Entity { public: #ifndef NO_ASSERT // // We give ourself a virtual destructor so that debugging code can // use dynamic_cast<>s to figure out what derived object we are. // virtual ~Entity() {} #endif class User { public: virtual void regretToInform(Entity* doomedEntity) = 0; }; void addUser(User* user); void removeUser(User* user); int getNrUsers() const; void informUsers(); private: struct UserLt { bool operator()(const User* user1, const User* user2) { // // Direct < comparison of unrelated pointers is undefined. But since the casting // to a large enough integer is invertable, it must be injective and so we can // get a total ordering by comparing the integers. // return reinterpret_cast(user1) < reinterpret_cast(user2); } }; typedef set UserSet; UserSet users; }; inline int Entity::getNrUsers() const { return users.size(); // inefficient } #ifndef NO_ASSERT ostream& operator<<(ostream& s, const Entity* e); ostream& operator<<(ostream& s, const Entity::User* u); #endif #endif Maude-2.6/src/Mixfix/fileTable.cc0000644000147300135640000001436207666304134013615 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class FileTable. // // utility stuff #include "macros.hh" #include "vector.hh" #include "fileTable.hh" #ifdef EXPLICIT_TEMPLATES template class Vector; #endif FileTable::FileTable() { firstSilent = NONE; } void FileTable::openFile(int lineNumber, const char* name, bool silent) { if (silent && firstSilent == NONE) firstSilent = fileStack.length(); if (firstSilent == NONE && fileStack.length() > 0) cout << "Reading in file: \"" << name << "\"\n"; int nrFileChanges = fileChanges.length(); fileChanges.expandBy(1); Entry& fc = fileChanges[nrFileChanges]; fc.absoluteLineNumber = lineNumber; fc.fileNameIndex = fileNames.encode(name); fc.relativeLineNumber = 1; fileStack.append(nrFileChanges); } void FileTable::closeFile(int lineNumber) { int topOfStack = fileStack.length() - 1; int matchingOpen = fileStack[topOfStack]; if (firstSilent == NONE && topOfStack > 0) { cout << "Done reading in file: \"" << fileNames.name(fileChanges[matchingOpen].fileNameIndex) << "\"\n"; } if (firstSilent == topOfStack) firstSilent = NONE; int prevFileNameIndex = NONE; int prevLineNumberDiff = 0; if (matchingOpen > 0) { Entry& fe = fileChanges[matchingOpen - 1]; prevFileNameIndex = fe.fileNameIndex; prevLineNumberDiff = fe.absoluteLineNumber - fe.relativeLineNumber; } int nrFileChanges = fileChanges.length(); fileChanges.expandBy(1); Entry& fc = fileChanges[nrFileChanges]; fc.absoluteLineNumber = lineNumber; fc.fileNameIndex = prevFileNameIndex; fc.relativeLineNumber = fileChanges[matchingOpen].absoluteLineNumber - prevLineNumberDiff; fileStack.contractTo(topOfStack); } void FileTable::beginModule(Token type, Token name) { int nrModuleChanges = moduleChanges.length(); moduleChanges.expandBy(1); Entry& mc = moduleChanges[nrModuleChanges]; mc.absoluteLineNumber = type.lineNumber(); mc.moduleNameIndex = name.code(); mc.moduleTypeIndex = type.code(); moduleStack.append(nrModuleChanges); if (outputLine()) cout << type << ' ' << name << '\n'; } bool FileTable::outputLine() { if (firstSilent == NONE && fileStack.length() > 0) { cout << "==========================================\n"; return true; } return false; } void FileTable::endModule(int lineNumber) { int topOfStack = moduleStack.length() - 1; int matchingOpen = moduleStack[topOfStack]; int nrModuleChanges = moduleChanges.length(); moduleChanges.expandBy(1); Entry& mc = moduleChanges[nrModuleChanges]; mc.absoluteLineNumber = lineNumber; if (matchingOpen > 0) { mc.moduleNameIndex = moduleChanges[matchingOpen - 1].moduleNameIndex; mc.moduleTypeIndex = moduleChanges[matchingOpen - 1].moduleTypeIndex; } else { mc.moduleNameIndex = NONE; mc.moduleTypeIndex = NONE; } moduleStack.contractTo(topOfStack); } void FileTable::abortEverything(int lineNumber) { // // Revert to top level file. // if (fileStack.length() > 0) { int matchingOpen = fileStack[0]; int prevLineNumberDiff = 0; if (matchingOpen > 0) { Entry& fe = fileChanges[matchingOpen - 1]; prevLineNumberDiff = fe.absoluteLineNumber - fe.relativeLineNumber; } int nrFileChanges = fileChanges.length(); fileChanges.expandBy(1); Entry& fc = fileChanges[nrFileChanges]; fc.absoluteLineNumber = lineNumber; fc.fileNameIndex = NONE; fc.relativeLineNumber = fileChanges[matchingOpen].absoluteLineNumber - prevLineNumberDiff; fileStack.contractTo(0); firstSilent = NONE; } // // End all modules. // if (moduleStack.length() > 0) { int nrModuleChanges = moduleChanges.length(); moduleChanges.expandBy(1); Entry& mc = moduleChanges[nrModuleChanges]; mc.absoluteLineNumber = lineNumber; mc.moduleNameIndex = NONE; mc.moduleTypeIndex = NONE; moduleStack.contractTo(0); } } int FileTable::binarySearch(Vector& table, int lineNumber) { // // Find index of entry with largest absoluteLineNumber that is <= lineNumber. // Return -1 if no such entry exists. // int max = table.length() - 1; int min = 0; while (max >= min) { int probe = (max + min) / 2; int n = table[probe].absoluteLineNumber; if (n == lineNumber) return probe; else if (n > lineNumber) max = probe - 1; else min = probe + 1; } return min - 1; } void FileTable::printLineNumber(ostream& s, int lineNumber) { switch (lineNumber) { case SYSTEM_CREATED: { s << ""; break; } case META_LEVEL_CREATED: { s << ""; break; } case COMMAND_LINE: { s << ""; break; } default: { int fileEntry = binarySearch(fileChanges, lineNumber); if (fileEntry == -1) s << ", line " << lineNumber; else { Entry& fe = fileChanges[fileEntry]; if (fe.fileNameIndex == NONE) s << ""; else s << '"' << fileNames.name(fe.fileNameIndex) << '"'; s << ", line " << fe.relativeLineNumber + (lineNumber - fe.absoluteLineNumber); } int moduleEntry = binarySearch(moduleChanges, lineNumber); if (moduleEntry == -1 || moduleChanges[moduleEntry].moduleTypeIndex == NONE) break; Entry& me = moduleChanges[moduleEntry]; s << " (" << Token::name(me.moduleTypeIndex) << ' ' << Token::name(me.moduleNameIndex) << ')'; } } } Maude-2.6/src/Mixfix/metadataStore.hh0000644000147300135640000000351111053422426014515 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for keeping track of metadata attached to ModuleItems. // #ifndef _metadataStore_hh_ #define _metadataStore_hh_ #include #include "printAttribute.hh" class MetadataStore { public: enum ItemType { MEMB_AX = 0x10000000, EQUATION = 0x20000000, RULE = 0x30000000 }; void insertMetadata(ItemType itemType, const ModuleItem* item, int metadata); int getMetadata(ItemType itemType, const ModuleItem* item) const; void insertMetadata(ModuleItem* symbol, int opDeclIndex, int metadata); int getMetadata(ModuleItem* symbol, int opDeclIndex) const; void insertPrintAttribute(ItemType itemType, const PreEquation* statement, const Vector& names, const Vector& sorts); const PrintAttribute* getPrintAttribute(ItemType itemType, const ModuleItem* item) const; private: typedef map MetadataMap; typedef map PrintAttributeMap; MetadataMap metadataMap; PrintAttributeMap printAttributeMap; }; #endif Maude-2.6/src/Mixfix/interpreter.cc0000644000147300135640000003145711453160715014267 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class Interpreter. // // utility stuff #include "macros.hh" #include "vector.hh" #include "tty.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "variable.hh" #include "AU_Theory.hh" #include "higher.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" #include "extensionInfo.hh" // core class definitions #include "unificationProblem.hh" // higher class definitions #include "pattern.hh" #include "matchSearchState.hh" #include "rewriteSequenceSearch.hh" #include "unificationProblem.hh" #include "narrowingSequenceSearch.hh" // object system class definitions #include "pseudoThread.hh" // strategy languages definitions #include "strategyExpression.hh" #include "strategicSearch.hh" // front end class definitions #include "timer.hh" #include "userLevelRewritingContext.hh" #include "maudemlBuffer.hh" #include "syntacticPreModule.hh" #include "view.hh" #include "visibleModule.hh" #include "loopSymbol.hh" #include "freshVariableSource.hh" #include "moduleExpression.hh" #include "interpreter.hh" // our stuff #include "execute.cc" #include "match.cc" #include "unify.cc" #include "search.cc" #include "loopMode.cc" #include "erewrite.cc" #include "srewrite.cc" Interpreter::Interpreter() { xmlLog = 0; xmlBuffer = 0; flags = DEFAULT_FLAGS; printFlags = DEFAULT_PRINT_FLAGS; currentModule = 0; currentView = 0; savedContext = 0; savedMatchSearchState = 0; savedUnificationProblem = 0; savedRewriteSequenceSearch = 0; savedStrategicSearch = 0; savedModule = 0; continueFunc = 0; } Interpreter::~Interpreter() { // // Must delete modules before other destruction takes place to avoid // accessing free'd stuff. // deleteNamedModules(); delete xmlBuffer; delete xmlLog; } void Interpreter::setFlag(Flags flag, bool polarity) { if (polarity) flags |= flag; else flags &= ~flag; RewritingContext::setTraceStatus(flags & EXCEPTION_FLAGS); } void Interpreter::setPrintFlag(PrintFlags flag, bool polarity) { if (polarity) printFlags |= flag; else printFlags &= ~flag; } void Interpreter::showProfile() const { currentModule->getFlatModule()->showProfile(cout); } void Interpreter::beginXmlLog(const char* fileName) { delete xmlBuffer; delete xmlLog; xmlLog = new ofstream(fileName); xmlBuffer = new MaudemlBuffer(*xmlLog); } void Interpreter::endXmlLog() { delete xmlBuffer; xmlBuffer = 0; delete xmlLog; xmlLog = 0; } bool Interpreter::setCurrentModule(const Vector& moduleExpr, int start) { SyntacticPreModule* m; int nrTokens = moduleExpr.length() - start; if (moduleExpr.length() == 0) { if (currentModule == 0) { IssueWarning("no module expression provided and no last module."); return false; } else if (currentModule->getFlatSignature()->isBad()) m = currentModule; else return true; } else { if (nrTokens == 1) { m = safeCast(SyntacticPreModule*, getModule(moduleExpr[start].code())); // HACK if (m != 0) { if (m->getFlatSignature()->isBad()) goto bad; setCurrentModule(m); return true; } IssueWarning(LineNumber(moduleExpr[start].lineNumber()) << ": no module " << QUOTE(moduleExpr[start]) << '.'); } else { IssueWarning(LineNumber(moduleExpr[start].lineNumber()) << ": module expressions not supported in commands."); } return false; } bad: IssueWarning(*m << ": module " << QUOTE(m) << " is unusable due to unpatchable errors."); return false; } void Interpreter::setCurrentModule(SyntacticPreModule* module) { if (currentModule != module) { if (currentModule != 0) { clearContinueInfo(); currentModule->loseFocus(); } currentModule = module; } } bool Interpreter::setCurrentView(const Vector& viewExpr) { switch (viewExpr.size()) { case 0: { if (currentView == 0) { IssueWarning("no view expression provided and no last view."); return false; } return true; } case 1: { if (View* v = getView(viewExpr[0].code())) { setCurrentView(v); return true; } // fall thru } default: { IssueWarning(LineNumber(viewExpr[0].lineNumber()) << ": no view " << QUOTE(viewExpr) << '.'); } } return false; } void Interpreter::makeClean(int lineNumber) { if (currentModule != 0 && !(currentModule->isComplete())) { IssueAdvisory(LineNumber(lineNumber) << ": discarding incomplete module."); delete currentModule; currentModule = 0; } else if (currentView != 0 && !(currentView->isComplete())) { IssueAdvisory(LineNumber(lineNumber) << ": discarding incomplete view."); delete currentView; currentView = 0; } } void Interpreter::addSelected(const Vector& opName) { selected.insert(Token::bubbleToPrefixNameCode(opName)); // opName.contractTo(0); } void Interpreter::updateSet(set& target, bool add) { if (add) target.insert(selected.begin(), selected.end()); else { FOR_EACH_CONST(i, set, selected) target.erase(*i); } selected.clear(); } bool Interpreter::concealedSymbol(Symbol* symbol) { return getPrintFlag(PRINT_CONCEAL) && concealedSymbols.find(symbol->id()) != concealedSymbols.end(); } void Interpreter::parse(const Vector& subject) { // // We need can't use getFlatSignature() since sort info // is not computed until module is flattened. // Term *s = currentModule->getFlatModule()->parseTerm(subject); if (s != 0) { if (s->getSortIndex() == Sort::SORT_UNKNOWN) s->symbol()->fillInSortInfo(s); cout << s->getSort() << ": " << s << '\n'; s->deepSelfDestruct(); } } void Interpreter::showSortsAndSubsorts() const { currentModule->getFlatModule()->showSortsAndSubsorts(cout); } void Interpreter::showModule(bool all) const { currentModule->getFlatModule()->showModule(cout, all); } void Interpreter::showView() const { currentView->showView(cout); } void Interpreter::showModules(bool all) const { showNamedModules(cout); if (all) showCreatedModules(cout); } void Interpreter::showOps(bool all) const { currentModule->getFlatModule()->showPolymorphs(cout, false, all); currentModule->getFlatModule()->showOps(cout, false, all); } void Interpreter::showVars() const { currentModule->getFlatModule()->showVars(cout, false); } void Interpreter::showMbs(bool all) const { currentModule->getFlatModule()->showMbs(cout, false, all); } void Interpreter::showEqs(bool all) const { currentModule->getFlatModule()->showEqs(cout, false, all); } void Interpreter::showRls(bool all) const { currentModule->getFlatModule()->showRls(cout, false, all); } void Interpreter::showKinds() const { currentModule->getFlatModule()->showKinds(cout); } void Interpreter::showSummary() const { currentModule->getFlatModule()->showSummary(cout); } ImportModule* Interpreter::getModuleOrIssueWarning(int name, const LineNumber& lineNumber) { if (PreModule* m = getModule(name)) { if (ImportModule* fm = m->getFlatSignature()) { // // We might have had to build a parser for this // module in order to deal with local statements, // term hooks and identities. // We delete the parser since we don't // have any further use for it. // fm->economize(); if (fm->isBad()) { IssueWarning(lineNumber << ": unable to use module " << QUOTE(m) << " due to unpatchable errors."); } else return fm; } else { IssueWarning(lineNumber << ": mutually recursive import of module " << QUOTE(m) << " ignored."); } } else { IssueWarning(lineNumber << ": module " << QUOTE(Token::name(name)) << " does not exist."); } return 0; } ImportModule* Interpreter::makeModule(const ModuleExpression* expr, ImportModule* enclosingModule) { switch (expr->getType()) { case ModuleExpression::MODULE: { Token name = expr->getModuleName(); if (ImportModule* fm = getModuleOrIssueWarning(name.code(), name.lineNumber())) return fm; break; } case ModuleExpression::RENAMING: { if (ImportModule* fm = makeModule(expr->getModule(), enclosingModule)) { /* if (fm->parametersBound()) // NEED TO FIX { IssueWarning("renamed module " << fm << " has bound parameters."); return 0; } */ return makeRenamedCopy(fm, expr->getRenaming()); } break; } case ModuleExpression::SUMMATION: { const list& modules = expr->getModules(); Vector fms; FOR_EACH_CONST(i, list, modules) { if (ImportModule* fm = makeModule(*i, enclosingModule)) { if (fm->getNrParameters() > 0) { IssueWarning("summand module " << fm << " has parameters."); return 0; } fms.append(fm); } } if (!fms.empty()) return makeSummation(fms); break; } case ModuleExpression::INSTANTIATION: { if (ImportModule* fm = makeModule(expr->getModule(), enclosingModule)) { int nrParameters = fm->getNrParameters(); const Vector& arguments = expr->getArguments(); int nrArguments = arguments.size(); if (nrArguments != nrParameters) { IssueWarning("wrong number of parameters in module instantiation " << QUOTE(expr) << "; " << nrParameters << " expected."); break; } Vector views(nrParameters); Vector names(nrParameters); bool hasTheoryView = false; bool hasPEM = false; for (int i = 0; i < nrParameters; ++i) { Token name = arguments[i]; int code = name.code(); if (enclosingModule != 0) { int index = enclosingModule->findParameterIndex(code); if (index != NONE) { // // Parameters from an enclosing module occlude views. // ImportModule* enclosingModuleParameterTheory = enclosingModule->getParameterTheory(index); ImportModule* requiredParameterTheory = fm->getParameterTheory(i); if (enclosingModuleParameterTheory != requiredParameterTheory) { IssueWarning("In argument " << i + 1 << " of module instantiation " << QUOTE(expr) << ", parameter " << QUOTE(name) << " from enclosing module " << QUOTE(enclosingModule) << " has theory " << QUOTE(enclosingModuleParameterTheory) << " whereas theory " << QUOTE(requiredParameterTheory) << " is required."); return 0; } views[i] = 0; names[i] = code; hasPEM = true; continue; } } if (View* v = getView(code)) { // // Instantiation argument is a view. // if (!(v->evaluate())) { IssueWarning("unusable view " << QUOTE(name) << " while evaluating module instantiation " << QUOTE(expr) << '.'); return 0; } ImportModule* fromTheory = v->getFromTheory(); ImportModule* requiredParameterTheory = fm->getParameterTheory(i); if (fromTheory != requiredParameterTheory) { IssueWarning("In argument " << i + 1 << " of module instantiation " << QUOTE(expr) << ", view " << QUOTE(static_cast(v)) << " is from theory " << QUOTE(fromTheory) << " whereas theory " << QUOTE(requiredParameterTheory) << " is required."); return 0; } views[i] = v; names[i] = 0; if (v->getToModule()->isTheory()) hasTheoryView = true; } else { IssueWarning("In argument " << i + 1 << " of module instantiation " << QUOTE(expr) << " could not find a parameter or view " << QUOTE(name) << "."); return 0; } } if (hasTheoryView && hasPEM) { IssueWarning("Instantiation " << QUOTE(expr) << " uses both a theory-view and a parameter from enclosing module " << QUOTE(enclosingModule) << '.'); return 0; } return makeInstatiation(fm, views, names); // may return null but never has bad flag set } break; } default: CantHappen("bad module expression"); } return 0; } Maude-2.6/src/Mixfix/metadataStore.cc0000644000147300135640000000530611053422477014515 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class MetadataStore. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" //#include "variable.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" // core class definitions #include "preEquation.hh" // front end class definitions #include "metadataStore.hh" void MetadataStore::insertMetadata(ItemType itemType, const ModuleItem* item, int metadata) { if (metadata != NONE) metadataMap[itemType | item->getIndexWithinModule()] = metadata; } int MetadataStore::getMetadata(ItemType itemType, const ModuleItem* item) const { MetadataMap::const_iterator i = metadataMap.find(itemType | item->getIndexWithinModule()); if (i == metadataMap.end()) return NONE; return (*i).second; } void MetadataStore::insertMetadata(ModuleItem* symbol, int opDeclIndex, int metadata) { if (metadata != NONE) metadataMap[(static_cast(opDeclIndex) << 32) | symbol->getIndexWithinModule()] = metadata; } int MetadataStore::getMetadata(ModuleItem* symbol, int opDeclIndex) const { MetadataMap::const_iterator i = metadataMap.find((static_cast(opDeclIndex) << 32) | symbol->getIndexWithinModule()); if (i == metadataMap.end()) return NONE; return (*i).second; } void MetadataStore::insertPrintAttribute(ItemType itemType, const PreEquation* statement, const Vector& names, const Vector& sorts) { printAttributeMap[itemType | statement->getIndexWithinModule()].fillOut(*statement, names, sorts); } const PrintAttribute* MetadataStore::getPrintAttribute(ItemType itemType, const ModuleItem* item) const { PrintAttributeMap::const_iterator i = printAttributeMap.find(itemType | item->getIndexWithinModule()); if (i == printAttributeMap.end()) return 0; return &(*i).second; } Maude-2.6/src/Mixfix/entry.cc0000644000147300135640000006254211350563425013065 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Code for entering stuff into a MixfixModule. // Sort* MixfixModule::addSort(int name) { Assert(findSort(name) == 0, "redeclaration of sort" << Token::name(name)); Sort* s = new Sort(name); Module::insertSort(s); (void) sortNames.insert(SortMap::value_type(name, s)); return s; } bool MixfixModule::hasSameDomain(const Vector& domainAndRange1, bool assoc1, const Vector& domainAndRange2, bool assoc2) { int nrArgs1 = domainAndRange1.length() - 1; int nrArgs2 = domainAndRange2.length() - 1; if (nrArgs1 == nrArgs2) { for (int i = 0; i < nrArgs1; i++) { if (domainAndRange1[i]->component() != domainAndRange2[i]->component()) return false; } } else if (assoc1) { Assert(nrArgs1 == 2 && nrArgs2 > 2, "shouldn't have been called"); for (int i = 0; i < nrArgs2; i++) { if (domainAndRange1[0]->component() != domainAndRange2[i]->component()) return false; } } else { Assert(assoc2 && nrArgs2 == 2 && nrArgs1 > 2, "shouldn't have been called"); for (int i = 0; i < nrArgs1; i++) { if (domainAndRange1[i]->component() != domainAndRange2[0]->component()) return false; } } return true; } Symbol* MixfixModule::addOpDeclaration(Token prefixName, const Vector& domainAndRange, SymbolType symbolType, const Vector& strategy, const NatSet& frozen, int prec, const Vector& gather, const Vector& format, int metadata, bool& firstDecl) { Assert(symbolType.getBasicType() != SymbolType::VARIABLE, "we don't handle variables anymore"); if (symbolType.dittoProblem()) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for " << QUOTE(prefixName) << " combines ditto with attributes other than ctor."); } int nrArgs = domainAndRange.length() - 1; int name = prefixName.code(); int iflags = 0; IntMap::const_iterator first = firstSymbols.find(name); if (first != firstSymbols.end()) { // // Examine all existing symbols with same name. // for (int i = first->second; i != NONE; i = symbolInfo[i].next) { Symbol* s = getSymbols()[i]; int iNrArgs = s->arity(); bool assoc = symbolType.hasFlag(SymbolType::ASSOC); bool iAssoc = symbolInfo[i].symbolType.hasFlag(SymbolType::ASSOC); if (nrArgs == iNrArgs || (assoc && nrArgs == 2 && iNrArgs > 2) || (iAssoc && nrArgs > 2)) { // // We have the same name and could appear to have // the same number of arguments. Thus ambiguity is possible // and we have to rely on context or actual arguments for // disambiguation. // const Vector& iDomainAndRange = s->getOpDeclarations()[0].getDomainAndRange(); bool sameDomain = hasSameDomain(domainAndRange, assoc, iDomainAndRange, iAssoc); bool sameRange = (domainAndRange[nrArgs]->component() == iDomainAndRange[iNrArgs]->component()); int overloadType; if (sameDomain) { if (sameRange) { if (nrArgs == iNrArgs) { firstDecl = false; if (!(symbolType.hasFlag(SymbolType::DITTO)) && !(getSymbolType(s).compatible(symbolType))) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for " << QUOTE(s) << " has different attributes from declaration on " << *s << '.'); DebugAdvisory("orginal symbol type: " << getSymbolType(s) << "\tnew symbol type: " << symbolType << "\tflag difference: " << (getSymbolType(s).getFlags() ^ symbolType.getFlags())); markAsBad(); } if (metadata != NONE) insertMetadata(s, s->getOpDeclarations().length(), metadata); s->addOpDeclaration(domainAndRange, symbolType.hasFlag(SymbolType::CTOR)); return s; } else { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for " << QUOTE(s) << " clashes with declaration on " << *s << " because of associativity."); overloadType = ADHOC_OVERLOADED | DOMAIN_OVERLOADED | RANGE_OVERLOADED; } } else { if (nrArgs > 0) { if (nrArgs == iNrArgs) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for " << QUOTE(s) << " has the same domain kinds as the declaration on " << *s << " but a different range kind."); } else { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for " << QUOTE(s) << " clashes with declaration on " << *s << ", which has a different range kind, because of associativity."); } } overloadType = ADHOC_OVERLOADED | DOMAIN_OVERLOADED; } } else { overloadType = sameRange ? (ADHOC_OVERLOADED | RANGE_OVERLOADED) : ADHOC_OVERLOADED; } iflags |= overloadType; symbolInfo[s->getIndexWithinModule()].iflags |= overloadType; } } } // // Need to create a new symbol. // if (symbolType.hasFlag(SymbolType::DITTO)) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for " << QUOTE(prefixName) << " uses ditto without a previous declaration to refer to."); symbolType.clearFlags(SymbolType::DITTO); } Symbol* symbol = newFancySymbol(prefixName, domainAndRange, symbolType, strategy); if (symbol == 0) { symbol = FreeSymbol::newFreeSymbol(name, nrArgs, strategy, symbolType.hasFlag(SymbolType::MEMO)); symbolType.clearFlags(SymbolType::AXIOMS); } if (symbolType.hasFlag(SymbolType::FROZEN)) symbol->setFrozen(frozen); symbol->setLineNumber(prefixName.lineNumber()); // // Fill in symbolInfo entry with syntactic info. // if (nrArgs == 0) { int sp = prefixName.specialProperty(); if (sp == Token::CONTAINS_COLON) { pair p; Token::split(prefixName.code(), p.first, p.second); if (findSort(p.second)) // not perfect since we don't handle kinds { WarningCheck(domainAndRange[0]->id() != p.second, LineNumber(prefixName.lineNumber()) << ": operator " << QUOTE(prefixName) << " is indistinguishable from a variable."); overloadedVariables.insert(p); iflags |= PSEUDO_VARIABLE; } } else if (sp == Token::FLOAT) { // // Maybe we should check that it's actually in canonical form before we // insert it. Maybe we could store strings rather than doubles. // Either way we always need to set the PSEUDO_FLOAT flag. // overloadedFloats.insert(Token::codeToDouble(prefixName.code())); iflags |= PSEUDO_FLOAT; } else if (sp == Token::STRING) { // // Maybe we should check that it's actually in canonical form before we // insert it. Either way we always need to set the PSEUDO_STRING flag. // overloadedStrings.insert(prefixName.name()); iflags |= PSEUDO_STRING; } else if (sp == Token::QUOTED_IDENTIFIER) { overloadedQuotedIdentifiers.insert(Token::encode(prefixName.name() + 1)); iflags |= PSEUDO_QUOTED_IDENTIFIER; } else if (sp == Token::SMALL_NAT) { mpz_class nat(prefixName.name(), 10); overloadedIntegers.insert(nat); iflags |= PSEUDO_NAT; } else if (sp == Token::SMALL_NEG) { mpz_class neg(prefixName.name(), 10); overloadedIntegers.insert(neg); iflags |= PSEUDO_NEG; } else if (sp == Token::RATIONAL) { pair rat; prefixName.getRational(rat.first, rat.second); overloadedRationals.insert(rat); iflags |= PSEUDO_RAT; } } int nrSymbols = symbolInfo.length(); symbolInfo.expandBy(1); SymbolInfo& si = symbolInfo[nrSymbols]; int nrUnderscores = Token::extractMixfix(name, si.mixfixSyntax); if (si.mixfixSyntax.length() == 0) { si.prec = 0; WarningCheck(!(symbolType.hasFlag(SymbolType::PREC)), *symbol << ": prec attribute without mixfix syntax for operator " << QUOTE(symbol) << '.'); WarningCheck(!(symbolType.hasFlag(SymbolType::GATHER)), *symbol << ": gather attribute without mixfix syntax for operator " << QUOTE(symbol) << '.'); symbolType.clearFlags(SymbolType::PREC | SymbolType::GATHER); if (symbolType.hasFlag(SymbolType::FORMAT)) { if (format.length() == 2) si.format = format; // deep copy else { IssueWarning(LineNumber(prefixName.lineNumber()) << ": bad format length of " << format.length() << ", should be 2."); symbolType.clearFlags(SymbolType::FORMAT); } } } else { if (si.mixfixSyntax.length() == 1 && nrUnderscores == 1) { IssueWarning(*symbol << ": empty syntax not allowed for single argument operators."); si.mixfixSyntax.contractTo(0); si.prec = 0; symbolType.clearFlags(SymbolType::PREC | SymbolType::GATHER | SymbolType::FORMAT); } if (nrArgs != nrUnderscores) { IssueWarning(*symbol << ": number of underscores (" << nrUnderscores << ") does not match " << "number of arguments (" << nrArgs << ") for operator " << QUOTE(symbol) << '.'); si.mixfixSyntax.contractTo(0); si.prec = 0; symbolType.clearFlags(SymbolType::PREC | SymbolType::GATHER | SymbolType::FORMAT); } else { si.prec = prec; si.gather = gather; // deep copy if (symbolType.hasFlag(SymbolType::FORMAT)) { if (si.mixfixSyntax.length() + 1 != format.length()) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": bad format length of " << format.length() << ", should be " << si.mixfixSyntax.length() + 1 << '.'); symbolType.clearFlags(SymbolType::FORMAT); } else si.format = format; // deep copy } } } si.symbolType = symbolType; si.symbolType.clearFlags(SymbolType::CTOR); // don't store ctor flag in per-symbol struct si.iflags = iflags; si.next = (first == firstSymbols.end()) ? NONE : first->second; firstSymbols[name] = nrSymbols; Module::insertSymbol(symbol); if (metadata != NONE) insertMetadata(symbol, symbol->getOpDeclarations().length(), metadata); symbol->addOpDeclaration(domainAndRange, symbolType.hasFlag(SymbolType::CTOR)); firstDecl = true; switch (symbolType.getBasicType()) { case SymbolType::SYSTEM_TRUE: { if (trueSymbol == 0) { trueSymbol = safeCast(FreeSymbol*, symbol); // HACK boolSort = domainAndRange[0]; } else { IssueWarning(*symbol << ": declaration for SystemTrue symbol " << QUOTE(symbol) << " conflicts with SystemTrue symbol " << QUOTE(trueSymbol) << " on " << *trueSymbol << '.'); } break; } case SymbolType::SYSTEM_FALSE: { if (falseSymbol == 0) { falseSymbol = safeCast(FreeSymbol*, symbol); // HACK boolSort = domainAndRange[0]; } else { IssueWarning(*symbol << ": declaration for SystemFalse symbol " << QUOTE(symbol) << " conflicts with SystemFalse symbol " << QUOTE(falseSymbol) << " on " << *falseSymbol << '.'); } break; } // if (flags & BUBBLE) // bubbleComponents.insert(domainAndRange[nrArgs]->component()->indexWithinModule()); case SymbolType::FLOAT: { ConnectedComponent* c = domainAndRange[nrArgs]->component(); floatSymbols[c->getIndexWithinModule()] = symbol; break; } case SymbolType::STRING: { ConnectedComponent* c = domainAndRange[nrArgs]->component(); stringSymbols[c->getIndexWithinModule()] = symbol; break; } case SymbolType::QUOTED_IDENTIFIER: { ConnectedComponent* c = domainAndRange[nrArgs]->component(); quotedIdentifierSymbols[c->getIndexWithinModule()] = symbol; break; } } if (symbolType.hasFlag(SymbolType::CONFIG)) { if (dynamic_cast(symbol) == 0) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": operator " << BEGIN_QUOTE << symbol << END_QUOTE << " cannot take config attribute."); } } if (symbolType.hasFlag(SymbolType::OBJECT)) { WarningCheck(!(symbolType.hasFlag(SymbolType::MESSAGE)), LineNumber(prefixName.lineNumber()) << ": operator " << BEGIN_QUOTE << symbol << END_QUOTE << " is not allowed to have both object and msg attributes."); if (nrArgs == 0) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": object attribute for operator " << BEGIN_QUOTE << symbol << END_QUOTE << " which lacks arguments."); } else objectSymbols.insert(symbol->getIndexWithinModule()); } else { if (symbolType.hasFlag(SymbolType::MESSAGE)) { if (nrArgs == 0) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": msg attribute for operator " << BEGIN_QUOTE << symbol << END_QUOTE << " which lacks arguments."); } else messageSymbols.insert(symbol->getIndexWithinModule()); } } return symbol; } void MixfixModule::addVariableAlias(Token name, Sort* sort) { pair r = variableAliases.insert(AliasMap::value_type(name.code(), sort)); WarningCheck(r.second, LineNumber(name.lineNumber()) << ": redeclaration of variable alias " << QUOTE(name) << '.'); } Symbol* MixfixModule::newFancySymbol(Token prefixName, const Vector& domainAndRange, SymbolType symbolType, const Vector& strategy) { int name = prefixName.code(); int nrArgs = domainAndRange.length() - 1; int kindIndex = domainAndRange[nrArgs]->component()->getIndexWithinModule(); switch (symbolType.getBasicType()) { case SymbolType::BRANCH_SYMBOL: return new BranchSymbol(name, nrArgs); case SymbolType::EQUALITY_SYMBOL: return new EqualitySymbol(name, strategy); case SymbolType::FLOAT: return new FloatSymbol(name); case SymbolType::STRING: return new StringSymbol(name); case SymbolType::QUOTED_IDENTIFIER: return new QuotedIdentifierSymbol(name); case SymbolType::LOOP_SYMBOL: return new LoopSymbol(name); case SymbolType::FLOAT_OP: return new FloatOpSymbol(name, nrArgs); case SymbolType::STRING_OP: return new StringOpSymbol(name, nrArgs); case SymbolType::QUOTED_IDENTIFIER_OP: return new QuotedIdentifierOpSymbol(name, nrArgs); case SymbolType::META_LEVEL_OP_SYMBOL: return new MetaLevelOpSymbol(name, nrArgs, strategy); case SymbolType::MODEL_CHECKER_SYMBOL: return new ModelCheckerSymbol(name); case SymbolType::SAT_SOLVER_SYMBOL: return new SatSolverSymbol(name); case SymbolType::SUCC_SYMBOL: { pair::iterator, bool> p = kindsWithSucc.insert(kindIndex); if (!(p.second)) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": multiple SuccSymbols in same kind will cause pretty printing problems."); } return new SuccSymbol(name); } case SymbolType::MINUS_SYMBOL: { pair::iterator, bool> p = kindsWithMinus.insert(kindIndex); if (!(p.second)) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": multiple MinusSymbols in same kind will cause pretty printing problems."); } return new MinusSymbol(name); } case SymbolType::NUMBER_OP_SYMBOL: return new NumberOpSymbol(name, nrArgs); case SymbolType::ACU_NUMBER_OP_SYMBOL: return new ACU_NumberOpSymbol(name); case SymbolType::DIVISION_SYMBOL: { pair::iterator, bool> p = kindsWithDivision.insert(kindIndex); if (!(p.second)) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": multiple DivisionSymbols in same kind will cause pretty printing problems."); } return new DivisionSymbol(name); } case SymbolType::RANDOM_OP_SYMBOL: return new RandomOpSymbol(name); case SymbolType::MATRIX_OP_SYMBOL: return new MatrixOpSymbol(name, nrArgs); case SymbolType::COUNTER_SYMBOL: return new CounterSymbol(name); case SymbolType::SOCKET_MANAGER_SYMBOL: return new SocketManagerSymbol(name); case SymbolType::INTERPRETER_MANAGER_SYMBOL: return new InterpreterManagerSymbol(name); } int lineNr = prefixName.lineNumber(); if (symbolType.hasFlag(SymbolType::ASSOC)) { if (nrArgs == 2) { bool leftOK = domainAndRange[0]->component() == domainAndRange[2]->component(); if (leftOK && domainAndRange[1]->component() == domainAndRange[2]->component()) { if (symbolType.hasFlag(SymbolType::COMM)) { if (symbolType.hasFlag(SymbolType::CONFIG)) return new ConfigSymbol(name, strategy, symbolType.hasFlag(SymbolType::MEMO)); else return new ACU_Symbol(name, strategy, symbolType.hasFlag(SymbolType::MEMO)); } else { return new AU_Symbol(name, strategy, symbolType.hasFlag(SymbolType::MEMO), symbolType.hasFlag(SymbolType::LEFT_ID), symbolType.hasFlag(SymbolType::RIGHT_ID)); } } else { IssueWarning(LineNumber(lineNr) << ": assoc operator " << QUOTE(prefixName) << " has a domain sort " << QUOTE((leftOK ? domainAndRange[1] : domainAndRange[0])) << " in a different connected component from its range sort " << QUOTE(domainAndRange[2]) << '.'); } } else { IssueWarning(LineNumber(lineNr) << ": assoc operator " << QUOTE(prefixName) << " has " << nrArgs << " rather than 2 domain sorts."); } } else if (symbolType.hasFlag(SymbolType::ITER)) { if (nrArgs == 1) return new S_Symbol(name, strategy, symbolType.hasFlag(SymbolType::MEMO)); else { IssueWarning(LineNumber(lineNr) << ": iter operator " << QUOTE(prefixName) << " has " << QUOTE(nrArgs) << " domain sorts rather than 1."); } } else if (symbolType.hasFlag(SymbolType::AXIOMS)) { if (nrArgs == 2) { int axioms = 0; if (symbolType.hasFlag(SymbolType::COMM)) { if (domainAndRange[0]->component() == domainAndRange[1]->component()) axioms |= CUI_Symbol::COMM; else { IssueWarning(LineNumber(lineNr) << ": comm operator " << QUOTE(prefixName) << " has a domain sorts " << QUOTE(domainAndRange[0]) << " and " << QUOTE(domainAndRange[1]) << " in different connected components."); return 0; } } if (symbolType.hasFlag(SymbolType::IDEM)) { bool leftOK = domainAndRange[0]->component() == domainAndRange[2]->component(); if (leftOK && domainAndRange[1]->component() == domainAndRange[2]->component()) axioms |= CUI_Symbol::IDEM; else { IssueWarning(LineNumber(lineNr) << ": idem operator " << QUOTE(prefixName) << " has a domain sort " << QUOTE((leftOK ? domainAndRange[1] : domainAndRange[0])) << " in a different connected component from its range sort " << QUOTE(domainAndRange[2]) << '.'); return 0; } } if (symbolType.hasFlag(SymbolType::LEFT_ID) || (symbolType.hasAllFlags(SymbolType::RIGHT_ID | SymbolType::COMM))) { if (domainAndRange[1]->component() == domainAndRange[2]->component()) axioms |= CUI_Symbol::LEFT_ID; else { IssueWarning(LineNumber(lineNr) << ": id operator " << QUOTE(prefixName) << " has a domain sort " << QUOTE(domainAndRange[1]) << " in a different connected component from its range sort " << QUOTE(domainAndRange[2]) << '.'); return 0; } } if (symbolType.hasFlag(SymbolType::RIGHT_ID) || (symbolType.hasAllFlags(SymbolType::LEFT_ID | SymbolType::COMM))) { if (domainAndRange[0]->component() == domainAndRange[2]->component()) axioms |= CUI_Symbol::RIGHT_ID; else { IssueWarning(LineNumber(lineNr) << ": id operator " << QUOTE(prefixName) << " has a domain sort " << QUOTE(domainAndRange[0]) << " in a different connected component from its range sort " << domainAndRange[2] << '.'); return 0; } } return (symbolType.getBasicType() == SymbolType::CUI_NUMBER_OP_SYMBOL) ? new CUI_NumberOpSymbol(name, static_cast(axioms)) : new CUI_Symbol(name, strategy, symbolType.hasFlag(SymbolType::MEMO), static_cast(axioms)); } else IssueWarning(LineNumber(lineNr) << ": " << (symbolType.hasFlag(SymbolType::COMM) ? "comm" : (symbolType.hasFlag(SymbolType::IDEM) ? "idem" : "id")) << " operator " << QUOTE(prefixName) << " has " << nrArgs << " rather than 2 domain sorts."); } return 0; } int MixfixModule::addPolymorph(Token prefixName, const Vector& domainAndRange, SymbolType symbolType, const Vector& strategy, const NatSet& frozen, int prec, const Vector& gather, const Vector& format, int metadata) { int index = findPolymorphIndex(prefixName.code(), domainAndRange); if (index != NONE) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": declaration for polymorphic operator " << QUOTE(prefixName) << " duplicates declaration on " << LineNumber(polymorphs[index].name.lineNumber()) << '.'); return index; } int nrPolymorphs = polymorphs.length(); polymorphs.expandBy(1); Polymorph& p = polymorphs[nrPolymorphs]; p.name = prefixName; p.domainAndRange = domainAndRange; // deep copy p.strategy = strategy; // deep copy p.frozen = frozen; // deep copy p.identity = 0; p.metadata = metadata; int nrUnderscores = Token::extractMixfix(prefixName.code(), p.symbolInfo.mixfixSyntax); if (p.symbolInfo.mixfixSyntax.length() == 0) { p.symbolInfo.prec = 0; WarningCheck(!(symbolType.hasFlag(SymbolType::PREC)), LineNumber(prefixName.lineNumber()) << ": prec attribute without mixfix syntax for operator " << QUOTE(prefixName) << '.'); WarningCheck(!(symbolType.hasFlag(SymbolType::GATHER)), LineNumber(prefixName.lineNumber()) << ": gather attribute without mixfix syntax for operator " << QUOTE(prefixName) << '.'); symbolType.clearFlags(SymbolType::PREC | SymbolType::GATHER); if (symbolType.hasFlag(SymbolType::FORMAT)) { if (format.length() == 2) p.symbolInfo.format = format; // deep copy else { IssueWarning(LineNumber(prefixName.lineNumber()) << ": bad format length of " << format.length() << ", should be 2."); symbolType.clearFlags(SymbolType::FORMAT); } } } else { if (domainAndRange.length() - 1 != nrUnderscores) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": number of underscores does not match (" << nrUnderscores << ") number of arguments (" << domainAndRange.length() - 1 << ") for operator " << QUOTE(prefixName) << '.'); p.symbolInfo.mixfixSyntax.contractTo(0); p.symbolInfo.prec = 0; symbolType.clearFlags(SymbolType::PREC | SymbolType::GATHER | SymbolType::FORMAT); } else { p.symbolInfo.prec = prec; p.symbolInfo.gather = gather; // deep copy if (symbolType.hasFlag(SymbolType::FORMAT)) { if (p.symbolInfo.mixfixSyntax.length() + 1 != format.length()) { IssueWarning(LineNumber(prefixName.lineNumber()) << ": bad format length of " << format.length() << ", should be " << p.symbolInfo.mixfixSyntax.length() + 1 << '.'); symbolType.clearFlags(SymbolType::FORMAT); } else p.symbolInfo.format = format; // deep copy } } } p.symbolInfo.symbolType = symbolType; p.symbolInfo.next = NONE; { p.symbolInfo.iflags = ADHOC_OVERLOADED | DOMAIN_OVERLOADED; int nrArgs = domainAndRange.length() - 1; for (int i = 0; i < nrArgs; i++) { if (domainAndRange[i] == 0) { p.symbolInfo.iflags &= ~DOMAIN_OVERLOADED; break; } } if (domainAndRange[nrArgs] != 0) p.symbolInfo.iflags |= RANGE_OVERLOADED; } return nrPolymorphs; } int MixfixModule::addBubbleSpec(Symbol* topSymbol, int lowerBound, int upperBound, int leftParenToken, int rightParenToken, const Vector& excludedTokens) { int nrBubbleSpecs = bubbleSpecs.length(); bubbleSpecs.expandBy(1); BubbleSpec& b = bubbleSpecs[nrBubbleSpecs]; b.topSymbol = topSymbol; b.lowerBound = lowerBound; b.upperBound = upperBound; b.leftParenToken = leftParenToken; b.rightParenToken = rightParenToken; b.excludedTokens = excludedTokens; const Vector& domainAndRange = topSymbol->getOpDeclarations()[0].getDomainAndRange(); b.componentIndex = domainAndRange[domainAndRange.length() - 1]->component()->getIndexWithinModule(); bubbleComponents.insert(b.componentIndex); return nrBubbleSpecs; } Maude-2.6/src/Mixfix/moduleCache.hh0000644000147300135640000000333310334017420014126 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to hold cache of modules that are created for module expressions. // #ifndef _moduleCache_hh_ #define _moduleCache_hh_ #include #include "importModule.hh" class ModuleCache : public Entity::User { NO_COPYING(ModuleCache); public: ModuleCache(); ImportModule* makeRenamedCopy(ImportModule* module, Renaming* renaming); ImportModule* makeSummation(const Vector& modules); ImportModule* makeParameterCopy(int parameterName, ImportModule* module); ImportModule* makeInstatiation(ImportModule* module, const Vector& views, const Vector& parameterArgs); void destructUnusedModules(); void showCreatedModules(ostream& s) const; private: typedef map ModuleMap; static bool moduleCompare(const ImportModule* m1, const ImportModule* m2); void regretToInform(Entity* doomedEntity); ModuleMap moduleMap; }; #endif Maude-2.6/src/Mixfix/compiler.cc0000644000147300135640000001654511145123122013524 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class Compiler. // #include #include // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "fullCompiler.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" // core class definitions #include "dagArgumentIterator.hh" // full compiler definitions #include "compilationContext.hh" // front end class definitions #include "visibleModule.hh" #include "syntacticPreModule.hh" #include "compiler.hh" Compiler::Compiler() { currentExecutable = 0; } Compiler::~Compiler() { if (currentExecutable != 0) /* unlink(makeBaseName().c_str()) */; // not safe - baseName already destructed } const string& Compiler::makeBaseName() { static string baseName; if (baseName.empty()) { static ostringstream buffer; const char* tmpDir = getenv("TMPDIR"); if (tmpDir == 0) tmpDir = (access("/usr/tmp", W_OK) == 0) ? "/usr/tmp" : "/tmp"; buffer << tmpDir << "/maude" << getpid(); baseName = buffer.str(); // deep copy } return baseName; } bool Compiler::fullCompile(SyntacticPreModule* module, bool countRewrites) { IssueAdvisory("compiling module " << QUOTE(module) << '.'); string hhName(makeBaseName() + ".hh"); string ccName(makeBaseName() + ".cc"); ofstream hhFile(hhName.c_str()); ofstream ccFile(ccName.c_str()); CompilationContext context(hhFile, ccFile, countRewrites); ccFile << "#include \"runtime.hh\"\n"; ccFile << "#include \"" << hhName << "\"\n\n"; ccFile << "const char outFileName[] = \"" << makeBaseName() << ".out\";\n"; ccFile << "const char inFileName[] = \"" << makeBaseName() << ".in\";\n\n"; VisibleModule* fm = module->getFlatModule(); const Vector& symbols = fm->getSymbols(); int nrSymbols = symbols.length(); // // Generate arity table. // (eventually this will be more than arities and probably moved // into CompilationContext). // ccFile << "int arity[] =\n{"; for (int i = 0; i < nrSymbols; i++) { if (i % 16 == 0) ccFile << "\n "; ccFile << ' ' << symbols[i]->arity(); if (i + 1 < nrSymbols) ccFile << ','; } ccFile << "\n};\n\n"; // // Generate symbol comparison table. // ccFile << "int comparison[] =\n{"; for (int i = 0; i < nrSymbols; i++) { if (i % 8 == 0) ccFile << "\n "; ccFile << ' ' << symbols[i]->getHashValue(); // HACK if (i + 1 < nrSymbols) ccFile << ','; } ccFile << "\n};\n\n"; // // Generate inline functions for all pure constructors. // for (int i = 0; i < nrSymbols; i++) { Symbol* s = symbols[i]; if (s->equationFree()) s->fullCompile(context, true); } // // Generate normal functions for remaining operators. // for (int i = 0; i < nrSymbols; i++) { Symbol* s = symbols[i]; if (!(s->equationFree())) s->fullCompile(context, false); } context.generateSortVectors(fm); context.generateEval(fm); hhFile.flush(); ccFile.flush(); static const char defaultOptFlags[] = #ifdef SOLARIS "-O2 -mcpu=v8 -mtune=ultrasparc -mflat"; #elif LINUX "-O2 -mcpu=pentiumpro -mpreferred-stack-boundary=2 -fomit-frame-pointer"; #elif ALPHA "-O2 -fomit-frame-pointer"; #elif FREE_BSD "-O2 -mcpu=pentiumpro -mpreferred-stack-boundary=2 -fomit-frame-pointer"; #else "-O2"; #endif string cmd("g++-3.2 "); const char* optFlags = getenv("MAUDE_GCC_FLAGS"); if (optFlags == 0) optFlags = defaultOptFlags; cmd += optFlags; if (const char* incDir = getenv("MAUDE_INCLUDE")) { cmd += " -I"; cmd += incDir; } else return false; if (const char* libDir = getenv("MAUDE_RUNTIME")) { cmd += " -L"; cmd += libDir; } else return false; cmd += ' '; cmd += ccName; cmd += " -lruntime -o "; cmd += makeBaseName(); int status = system(cmd.c_str()); cout << status << '\n' << cmd.c_str() << '\n'; cout.flush(); #ifndef ANNOTATE unlink(hhName.c_str()); unlink(ccName.c_str()); #endif return status == 0; } bool Compiler::makeExecutable(SyntacticPreModule* module, bool countRewrites) { int nrSymbols = module->getFlatModule()->getSymbols().length(); if (currentExecutable == module && compiledWithCount == countRewrites && currentNrSymbols == nrSymbols) return true; // use existing executable if(!(fullCompile(module, countRewrites))) { IssueWarning("compilation failed."); currentExecutable = 0; // assume corrupted return false; } currentExecutable = module; compiledWithCount = countRewrites; currentNrSymbols = nrSymbols; return true; } void Compiler::outputGraph(DagNode* dagNode) { string outName(makeBaseName() + ".out"); ofstream ofile(outName.c_str()); PointerSet visited; depthFirstTraversal(dagNode, visited); int nrNodes = visited.cardinality(); for (int i = 0; i < nrNodes; i++) { DagNode* d = static_cast(visited.index2Pointer(i)); ofile << d->symbol()->getIndexWithinModule(); for(DagArgumentIterator a(*d); a.valid(); a.next()) ofile << ' ' << visited.pointer2Index(a.argument()); ofile << '\n'; } } void Compiler::depthFirstTraversal(DagNode* dagNode, PointerSet& visited) { for(DagArgumentIterator a(*dagNode); a.valid(); a.next()) { DagNode* d = a.argument(); if (!(visited.contains(d))) depthFirstTraversal(d, visited); } visited.insert(dagNode); } DagNode* Compiler::inputGraph(Int64& nrRewrites, Int64& cpu, Int64& real) { const Vector& symbols = currentExecutable->getFlatSignature()->getSymbols(); string inName(makeBaseName() + ".in"); ifstream ifile(inName.c_str()); Vector built; Vector args; ifile >> nrRewrites; ifile >> cpu; ifile >> real; int sortIndex; ifile >> sortIndex; for(;;) { int index; if(!(ifile >> index)) break; Symbol* s = symbols[index]; int nrArgs = s->arity(); args.contractTo(0); for (int i = 0; i < nrArgs; i++) { int t; ifile >> t; args.append(built[t]); } built.append(s->makeDagNode(args)); } DagNode* top = built[built.length() - 1]; top->setSortIndex(sortIndex); unlink((makeBaseName() + ".out").c_str()); unlink(inName.c_str()); return top; } void Compiler::runExecutable() { system(makeBaseName().c_str()); } void Compiler::invalidate(SyntacticPreModule* module) { if (currentExecutable == module) { currentExecutable = 0; unlink(makeBaseName().c_str()); } } Maude-2.6/src/Mixfix/global.hh0000644000147300135640000000255710511561076013174 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Global variables // extern int lineNumber; extern FileTable fileTable; extern DirectoryManager directoryManager; extern Interpreter& interpreter; #include "IO_Manager.hh" // HACK extern IO_Manager ioManager; extern string executableDirectory; #define PRELUDE_NAME "prelude.maude" #define MAUDE_LIB "MAUDE_LIB" bool findPrelude(string& directory, string& fileName); bool findFile(const string& userFileName, string& directory, string& fileName, int lineNr); bool findExecutableDirectory(string& directory, string& executable); Maude-2.6/src/Mixfix/ansiEscapeSequences.cc0000644000147300135640000000303207666304134015645 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // List of ANSI Escape sequences - used to generate branching // code in various places. Format is // MACRO(Maude name, class Tty name) // We don't include reset because it is special. // MACRO('!', BRIGHT) MACRO('?', DIM) MACRO('u', UNDERLINE) MACRO('f', BLINK) MACRO('x', REVERSE) MACRO('h', HIDDEN) MACRO('p', BLACK) // pitch black - b is for blue MACRO('r', RED) MACRO('g', GREEN) MACRO('y', YELLOW) MACRO('b', BLUE) MACRO('m', MAGENTA) MACRO('c', CYAN) MACRO('w', WHITE) MACRO('P', BKGD_BLACK) MACRO('R', BKGD_RED) MACRO('G', BKGD_GREEN) MACRO('Y', BKGD_YELLOW) MACRO('B', BKGD_BLUE) MACRO('M', BKGD_MAGENTA) MACRO('C', BKGD_CYAN) MACRO('W', BKGD_WHITE) Maude-2.6/src/Mixfix/surface.cc0000644000147300135640000057206211500302131013335 00000000000000 /* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program 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 of the License, or (at your option) any later version. This program 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 this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ /* Line 189 of yacc.c */ #line 27 "surface.yy" #include #include // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "higher.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // core class definitions #include "lineNumber.hh" // front end class definitions #include "token.hh" #include "renaming.hh" #include "view.hh" #include "moduleExpression.hh" #include "fileTable.hh" #include "directoryManager.hh" #include "syntacticPreModule.hh" #include "visibleModule.hh" // HACK #include "userLevelRewritingContext.hh" #include "interpreter.hh" #include "global.hh" #define clear() tokenSequence.clear(); #define store(token) tokenSequence.append(token) #define fragClear() fragments.contractTo(0); #define fragStore(token) fragments.append(token) #define YYPARSE_PARAM parseResult #define PARSE_RESULT (*((UserLevelRewritingContext::ParseResult*) parseResult)) #define CM interpreter.getCurrentModule() #define CV interpreter.getCurrentView() #include "lexerAux.hh" /* void lexerInitialMode(); void lexerIdMode(); void lexerCmdMode(); void lexerFileNameMode(); void lexerStringMode(); void lexerLatexMode(); bool handleEof(); bool includeFile(const string& directory, const string& fileName, bool silent, int lineNr); //void eatComment(bool firstNonWhite); */ Vector singleton(1); Vector tokenSequence; Vector lexerBubble; Vector fragments; Vector moduleExpr; Vector opDescription; stack moduleExpressions; Renaming* currentRenaming = 0; SyntaxContainer* currentSyntaxContainer = 0; SyntaxContainer* oldSyntaxContainer = 0; Int64 number; Int64 number2; static void yyerror(char *s); void cleanUpModuleExpression(); void cleanUpParser(); void missingSpace(const Token& token); /* Line 189 of yacc.c */ #line 148 "surface.c" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { FILE_NAME_STRING = 258, UNINTERPRETED_STRING = 259, LATEX_STRING = 260, KW_MOD = 261, KW_OMOD = 262, KW_VIEW = 263, KW_PARSE = 264, KW_NORMALIZE = 265, KW_REDUCE = 266, KW_REWRITE = 267, KW_LOOP = 268, KW_NARROW = 269, KW_XG_NARROW = 270, KW_MATCH = 271, KW_XMATCH = 272, KW_UNIFY = 273, KW_EREWRITE = 274, KW_FREWRITE = 275, KW_SREWRITE = 276, KW_CONTINUE = 277, KW_SEARCH = 278, KW_SET = 279, KW_SHOW = 280, KW_ON = 281, KW_OFF = 282, KW_TRACE = 283, KW_BODY = 284, KW_BUILTIN = 285, KW_WHOLE = 286, KW_SELECT = 287, KW_DESELECT = 288, KW_CONDITION = 289, KW_SUBSTITUTION = 290, KW_PRINT = 291, KW_GRAPH = 292, KW_MIXFIX = 293, KW_FLAT = 294, KW_ATTRIBUTE = 295, KW_NEWLINE = 296, KW_WITH = 297, KW_PARENS = 298, KW_ALIASES = 299, KW_GC = 300, KW_TIME = 301, KW_STATS = 302, KW_TIMING = 303, KW_CMD = 304, KW_BREAKDOWN = 305, KW_BREAK = 306, KW_PATH = 307, KW_MODULE = 308, KW_MODULES = 309, KW_VIEWS = 310, KW_ALL = 311, KW_SORTS = 312, KW_OPS2 = 313, KW_VARS = 314, KW_MBS = 315, KW_EQS = 316, KW_RLS = 317, KW_SUMMARY = 318, KW_KINDS = 319, KW_ADVISE = 320, KW_VERBOSE = 321, KW_DO = 322, KW_CLEAR = 323, KW_PROTECT = 324, KW_EXTEND = 325, KW_INCLUDE = 326, KW_EXCLUDE = 327, KW_CONCEAL = 328, KW_REVEAL = 329, KW_COMPILE = 330, KW_COUNT = 331, KW_DEBUG = 332, KW_RESUME = 333, KW_ABORT = 334, KW_STEP = 335, KW_WHERE = 336, KW_CREDUCE = 337, KW_SREDUCE = 338, KW_DUMP = 339, KW_PROFILE = 340, KW_NUMBER = 341, KW_RAT = 342, KW_COLOR = 343, SIMPLE_NUMBER = 344, KW_PWD = 345, KW_CD = 346, KW_PUSHD = 347, KW_POPD = 348, KW_LS = 349, KW_LOAD = 350, KW_QUIT = 351, KW_EOF = 352, KW_ENDM = 353, KW_IMPORT = 354, KW_ENDV = 355, KW_SORT = 356, KW_SUBSORT = 357, KW_OP = 358, KW_OPS = 359, KW_MSGS = 360, KW_VAR = 361, KW_CLASS = 362, KW_SUBCLASS = 363, KW_MB = 364, KW_CMB = 365, KW_EQ = 366, KW_CEQ = 367, KW_RL = 368, KW_CRL = 369, KW_IS = 370, KW_FROM = 371, KW_ARROW = 372, KW_ARROW2 = 373, KW_PARTIAL = 374, KW_IF = 375, KW_LABEL = 376, KW_TO = 377, KW_COLON2 = 378, KW_ASSOC = 379, KW_COMM = 380, KW_ID = 381, KW_IDEM = 382, KW_ITER = 383, KW_LEFT = 384, KW_RIGHT = 385, KW_PREC = 386, KW_GATHER = 387, KW_METADATA = 388, KW_STRAT = 389, KW_POLY = 390, KW_MEMO = 391, KW_FROZEN = 392, KW_CTOR = 393, KW_LATEX = 394, KW_SPECIAL = 395, KW_CONFIG = 396, KW_OBJ = 397, KW_MSG = 398, KW_DITTO = 399, KW_FORMAT = 400, KW_ID_HOOK = 401, KW_OP_HOOK = 402, KW_TERM_HOOK = 403, KW_IN = 404, IDENTIFIER = 405, NUMERIC_ID = 406, ENDS_IN_DOT = 407, FORCE_LOOKAHEAD = 408 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 214 of yacc.c */ #line 103 "surface.yy" bool yyBool; Int64 yyInt64; const char* yyString; Token yyToken; ImportModule::ImportMode yyImportMode; Interpreter::Flags yyFlags; Interpreter::PrintFlags yyPrintFlags; Interpreter::SearchKind yySearchKind; /* Line 214 of yacc.c */ #line 350 "surface.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ #line 114 "surface.yy" int yylex(YYSTYPE* lvalp); /* Line 264 of yacc.c */ #line 367 "surface.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 111 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2316 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 168 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 241 /* YYNRULES -- Number of rules. */ #define YYNRULES 609 /* YYNRULES -- Number of states. */ #define YYNSTATES 911 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 408 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 123, 124, 135, 134, 129, 2, 125, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 121, 2, 126, 122, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 127, 2, 128, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 136, 130, 137, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 131, 132, 133, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 6, 8, 10, 12, 14, 15, 19, 20, 24, 26, 27, 31, 32, 36, 38, 39, 43, 45, 47, 50, 53, 56, 59, 62, 66, 68, 70, 74, 76, 78, 80, 82, 84, 88, 89, 95, 99, 103, 105, 106, 107, 113, 115, 117, 121, 123, 128, 133, 134, 135, 142, 143, 149, 150, 151, 156, 157, 160, 162, 165, 166, 172, 173, 179, 180, 186, 187, 188, 189, 202, 205, 206, 208, 209, 214, 220, 221, 225, 228, 231, 233, 234, 235, 244, 245, 249, 251, 253, 254, 258, 259, 260, 269, 271, 273, 277, 278, 282, 284, 288, 290, 292, 294, 297, 299, 301, 303, 306, 307, 310, 311, 316, 317, 322, 323, 324, 330, 335, 341, 342, 343, 349, 350, 351, 352, 360, 361, 362, 368, 369, 370, 371, 379, 380, 381, 387, 388, 389, 390, 398, 399, 400, 406, 411, 412, 418, 419, 424, 427, 429, 432, 434, 438, 442, 445, 447, 450, 452, 454, 456, 460, 462, 464, 466, 467, 470, 472, 474, 477, 481, 483, 485, 487, 490, 491, 493, 494, 499, 503, 505, 509, 510, 513, 515, 517, 520, 523, 525, 527, 528, 532, 534, 536, 539, 540, 546, 547, 553, 554, 560, 561, 567, 569, 571, 573, 574, 580, 582, 584, 586, 589, 590, 596, 601, 603, 605, 606, 609, 611, 614, 616, 619, 623, 627, 631, 633, 634, 636, 637, 640, 641, 644, 647, 648, 653, 655, 657, 658, 664, 665, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 877, 881, 882, 886, 887, 891, 892, 896, 897, 901, 902, 907, 908, 913, 914, 919, 920, 925, 926, 931, 932, 936, 937, 941, 942, 946, 951, 952, 956, 958, 959, 964, 965, 970, 971, 976, 977, 982, 987, 988, 993, 994, 999, 1000, 1005, 1006, 1011, 1015, 1019, 1020, 1025, 1026, 1031, 1032, 1037, 1038, 1043, 1044, 1049, 1050, 1055, 1056, 1061, 1062, 1067, 1072, 1078, 1083, 1084, 1089, 1095, 1101, 1108, 1114, 1120, 1127, 1133, 1139, 1145, 1151, 1158, 1164, 1169, 1170, 1171, 1179, 1180, 1181, 1190, 1195, 1201, 1207, 1213, 1218, 1224, 1227, 1230, 1233, 1236, 1242, 1247, 1248, 1252, 1254, 1256, 1259, 1262, 1264, 1266, 1268, 1270, 1272, 1274, 1275, 1277, 1279, 1281, 1283, 1285, 1287, 1289, 1291, 1293, 1295, 1297, 1299, 1301, 1303, 1305, 1307, 1309, 1311, 1313, 1315, 1317, 1319, 1321, 1323, 1324, 1326, 1327, 1329, 1331, 1333, 1335, 1336, 1340, 1341, 1345, 1347, 1348, 1352, 1354, 1355, 1359, 1360, 1364, 1365, 1369, 1371, 1372, 1376, 1377, 1381, 1383, 1384, 1388, 1390, 1391, 1395, 1396, 1400, 1401, 1405, 1406, 1410, 1412, 1413, 1417, 1418, 1422, 1423, 1427, 1429, 1430, 1434, 1435, 1439, 1441, 1442, 1446, 1447, 1451, 1453, 1454, 1458, 1459, 1463, 1465, 1466, 1470, 1471, 1475, 1477, 1478, 1482, 1484, 1485, 1489, 1490, 1494, 1496, 1498, 1500, 1502, 1504, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1536, 1538, 1540, 1542, 1544, 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1560, 1562, 1564, 1566, 1569, 1571, 1573, 1575, 1577, 1580, 1582, 1584, 1586, 1588, 1590, 1592, 1594, 1596, 1598 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 169, 0, -1, 170, -1, -1, 219, -1, 203, -1, 171, -1, 308, -1, -1, 163, 172, 3, -1, -1, 95, 173, 3, -1, 90, -1, -1, 91, 174, 3, -1, -1, 92, 175, 3, -1, 93, -1, -1, 94, 176, 4, -1, 96, -1, 97, -1, 297, 287, -1, 300, 125, -1, 184, 287, -1, 181, 287, -1, 182, 287, -1, 178, 134, 177, -1, 166, -1, 179, -1, 178, 134, 178, -1, 180, -1, 181, -1, 184, -1, 182, -1, 296, -1, 179, 135, 186, -1, -1, 180, 136, 183, 185, 137, -1, 123, 178, 124, -1, 185, 129, 296, -1, 296, -1, -1, -1, 123, 187, 189, 188, 124, -1, 190, -1, 1, -1, 190, 129, 191, -1, 191, -1, 101, 291, 132, 291, -1, 131, 296, 132, 296, -1, -1, -1, 103, 192, 194, 132, 193, 196, -1, -1, 121, 195, 267, 266, 268, -1, -1, -1, 127, 197, 198, 128, -1, -1, 198, 199, -1, 199, -1, 145, 164, -1, -1, 146, 123, 200, 283, 124, -1, -1, 159, 123, 201, 283, 124, -1, -1, 153, 123, 202, 5, 124, -1, -1, -1, -1, 8, 204, 296, 116, 178, 205, 132, 178, 206, 286, 207, 100, -1, 207, 209, -1, -1, 117, -1, -1, 101, 291, 132, 211, -1, 106, 258, 121, 208, 228, -1, -1, 103, 210, 212, -1, 1, 125, -1, 291, 287, -1, 166, -1, -1, -1, 121, 213, 267, 266, 268, 132, 214, 216, -1, -1, 132, 215, 216, -1, 125, -1, 166, -1, -1, 123, 218, 124, -1, -1, -1, 229, 220, 296, 221, 223, 286, 230, 98, -1, 125, -1, 166, -1, 136, 224, 137, -1, -1, 224, 129, 225, -1, 225, -1, 296, 226, 178, -1, 133, -1, 121, -1, 166, -1, 268, 287, -1, 227, -1, 6, -1, 7, -1, 230, 231, -1, -1, 99, 177, -1, -1, 101, 232, 288, 222, -1, -1, 102, 233, 289, 222, -1, -1, -1, 103, 234, 121, 235, 261, -1, 104, 259, 121, 261, -1, 106, 258, 121, 208, 228, -1, -1, -1, 109, 236, 121, 237, 216, -1, -1, -1, -1, 110, 238, 121, 239, 120, 240, 216, -1, -1, -1, 111, 241, 122, 242, 216, -1, -1, -1, -1, 112, 243, 122, 244, 120, 245, 216, -1, -1, -1, 113, 246, 118, 247, 216, -1, -1, -1, -1, 114, 248, 118, 249, 120, 250, 216, -1, -1, -1, 157, 251, 121, 252, 261, -1, 105, 259, 121, 261, -1, -1, 107, 296, 253, 255, 125, -1, -1, 108, 254, 289, 222, -1, 1, 125, -1, 130, -1, 130, 256, -1, 257, -1, 256, 129, 257, -1, 297, 121, 296, -1, 258, 298, -1, 298, -1, 259, 260, -1, 260, -1, 298, -1, 217, -1, 268, 267, 263, -1, 264, -1, 227, -1, 121, -1, -1, 262, 264, -1, 125, -1, 227, -1, 266, 265, -1, 268, 271, 287, -1, 227, -1, 117, -1, 119, -1, 267, 268, -1, -1, 291, -1, -1, 127, 269, 270, 128, -1, 270, 129, 291, -1, 291, -1, 127, 272, 128, -1, -1, 272, 274, -1, 274, -1, 140, -1, 143, 140, -1, 144, 140, -1, 138, -1, 139, -1, -1, 273, 275, 282, -1, 141, -1, 142, -1, 145, 164, -1, -1, 146, 123, 276, 283, 124, -1, -1, 159, 123, 277, 283, 124, -1, -1, 148, 123, 278, 283, 124, -1, -1, 149, 123, 279, 283, 124, -1, 150, -1, 152, -1, 151, -1, -1, 151, 123, 280, 283, 124, -1, 155, -1, 156, -1, 157, -1, 147, 164, -1, -1, 153, 123, 281, 5, 124, -1, 154, 123, 284, 124, -1, 158, -1, 167, -1, -1, 283, 164, -1, 164, -1, 284, 285, -1, 285, -1, 160, 296, -1, 160, 296, 217, -1, 161, 296, 217, -1, 162, 296, 217, -1, 115, -1, -1, 125, -1, -1, 288, 291, -1, -1, 289, 291, -1, 289, 126, -1, -1, 291, 290, 288, 126, -1, 292, -1, 299, -1, -1, 292, 136, 293, 294, 137, -1, -1, 294, 129, 295, 292, -1, 292, -1, 302, -1, 303, -1, 305, -1, 306, -1, 125, -1, 301, -1, 129, -1, 132, -1, 303, -1, 305, -1, 306, -1, 302, -1, 303, -1, 306, -1, 125, -1, 126, -1, 117, -1, 119, -1, 122, -1, 118, -1, 120, -1, 164, -1, 303, -1, 307, -1, 122, -1, 130, -1, 134, -1, 135, -1, 118, -1, 120, -1, 115, -1, 131, -1, 132, -1, 125, -1, 166, -1, 164, -1, 136, -1, 137, -1, 134, -1, 135, -1, 130, -1, 133, -1, 131, -1, 116, -1, 115, -1, 301, -1, 166, -1, 129, -1, 132, -1, 157, -1, 304, -1, 99, -1, 101, -1, 102, -1, 103, -1, 104, -1, 106, -1, 105, -1, 107, -1, 108, -1, 109, -1, 110, -1, 111, -1, 112, -1, 113, -1, 114, -1, 98, -1, 100, -1, 126, -1, 121, -1, 117, -1, 119, -1, 122, -1, 118, -1, 120, -1, 127, -1, 128, -1, 307, -1, 138, -1, 139, -1, 140, -1, 141, -1, 142, -1, 143, -1, 144, -1, 145, -1, 146, -1, 148, -1, 149, -1, 150, -1, 152, -1, 153, -1, 154, -1, 151, -1, 147, -1, 155, -1, 156, -1, 158, -1, 159, -1, 160, -1, 161, -1, 162, -1, -1, 32, 309, 216, -1, -1, 84, 310, 216, -1, -1, 9, 311, 356, -1, -1, 82, 312, 356, -1, -1, 83, 313, 356, -1, -1, 353, 11, 314, 356, -1, -1, 353, 12, 315, 360, -1, -1, 353, 19, 316, 369, -1, -1, 353, 20, 317, 369, -1, -1, 353, 21, 318, 360, -1, -1, 351, 319, 369, -1, -1, 352, 320, 360, -1, -1, 18, 321, 360, -1, 353, 22, 354, 125, -1, -1, 13, 322, 356, -1, 217, -1, -1, 28, 348, 323, 403, -1, -1, 28, 349, 324, 403, -1, -1, 51, 348, 325, 403, -1, -1, 36, 350, 326, 403, -1, 67, 68, 150, 125, -1, -1, 25, 6, 327, 216, -1, -1, 25, 53, 328, 216, -1, -1, 25, 56, 329, 216, -1, -1, 25, 8, 330, 216, -1, 25, 54, 125, -1, 25, 55, 125, -1, -1, 25, 57, 331, 216, -1, -1, 25, 58, 332, 216, -1, -1, 25, 59, 333, 216, -1, -1, 25, 60, 334, 216, -1, -1, 25, 61, 335, 216, -1, -1, 25, 62, 336, 216, -1, -1, 25, 63, 337, 216, -1, -1, 25, 64, 338, 216, -1, 25, 52, 89, 125, -1, 25, 52, 131, 89, 125, -1, 25, 23, 37, 125, -1, -1, 25, 85, 339, 216, -1, 24, 25, 65, 347, 125, -1, 24, 25, 47, 347, 125, -1, 24, 25, 13, 47, 347, 125, -1, 24, 25, 48, 347, 125, -1, 24, 25, 50, 347, 125, -1, 24, 25, 13, 48, 347, 125, -1, 24, 25, 49, 347, 125, -1, 24, 25, 45, 347, 125, -1, 24, 36, 345, 347, 125, -1, 24, 36, 40, 347, 125, -1, 24, 36, 40, 41, 347, 125, -1, 24, 28, 346, 347, 125, -1, 24, 51, 347, 125, -1, -1, -1, 24, 355, 340, 408, 341, 347, 125, -1, -1, -1, 24, 7, 71, 342, 408, 343, 347, 125, -1, 24, 66, 347, 125, -1, 24, 68, 150, 347, 125, -1, 24, 68, 62, 347, 125, -1, 24, 75, 76, 347, 125, -1, 24, 85, 347, 125, -1, 24, 68, 85, 347, 125, -1, 78, 125, -1, 79, 125, -1, 80, 125, -1, 81, 125, -1, 24, 45, 25, 347, 125, -1, 24, 47, 347, 125, -1, -1, 1, 344, 125, -1, 38, -1, 39, -1, 42, 44, -1, 42, 43, -1, 37, -1, 73, -1, 86, -1, 87, -1, 88, -1, 159, -1, -1, 34, -1, 31, -1, 35, -1, 32, -1, 60, -1, 61, -1, 62, -1, 12, -1, 29, -1, 30, -1, 26, -1, 27, -1, 32, -1, 33, -1, 72, -1, 71, -1, 73, -1, 74, -1, 14, -1, 15, -1, 23, -1, 17, -1, 16, -1, 77, -1, -1, 89, -1, -1, 69, -1, 70, -1, 71, -1, 394, -1, -1, 397, 357, 216, -1, -1, 121, 359, 216, -1, 216, -1, -1, 127, 361, 363, -1, 394, -1, -1, 398, 362, 216, -1, -1, 165, 364, 366, -1, -1, 399, 365, 216, -1, 392, -1, -1, 128, 367, 356, -1, -1, 400, 368, 216, -1, 392, -1, -1, 127, 370, 372, -1, 394, -1, -1, 398, 371, 216, -1, -1, 165, 373, 376, -1, -1, 129, 374, 386, -1, -1, 401, 375, 216, -1, 392, -1, -1, 128, 377, 356, -1, -1, 129, 378, 380, -1, -1, 402, 379, 216, -1, 392, -1, -1, 165, 381, 383, -1, -1, 399, 382, 216, -1, 392, -1, -1, 128, 384, 356, -1, -1, 400, 385, 216, -1, 392, -1, -1, 165, 387, 389, -1, -1, 399, 388, 216, -1, 392, -1, -1, 128, 390, 356, -1, -1, 400, 391, 216, -1, 392, -1, -1, 123, 393, 216, -1, 216, -1, -1, 123, 395, 216, -1, -1, 163, 396, 358, -1, 166, -1, 164, -1, 165, -1, 127, -1, 128, -1, 121, -1, 125, -1, 129, -1, 164, -1, 165, -1, 128, -1, 121, -1, 125, -1, 129, -1, 164, -1, 127, -1, 128, -1, 163, -1, 121, -1, 129, -1, 164, -1, 165, -1, 127, -1, 163, -1, 121, -1, 129, -1, 164, -1, 127, -1, 128, -1, 163, -1, 121, -1, 164, -1, 165, -1, 127, -1, 163, -1, 121, -1, 406, 404, -1, 405, -1, 125, -1, 405, -1, 166, -1, 406, 407, -1, 407, -1, 408, -1, 217, -1, 164, -1, 165, -1, 127, -1, 128, -1, 163, -1, 121, -1, 129, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 232, 232, 234, 239, 240, 241, 242, 248, 248, 258, 258, 268, 272, 272, 283, 283, 294, 305, 305, 310, 315, 348, 352, 356, 357, 358, 359, 367, 376, 377, 387, 388, 391, 392, 393, 400, 409, 409, 418, 421, 422, 429, 434, 428, 440, 441, 444, 445, 448, 452, 456, 457, 456, 463, 463, 465, 471, 471, 473, 476, 477, 480, 481, 481, 483, 483, 485, 485, 492, 494, 502, 492, 515, 516, 519, 524, 527, 531, 532, 532, 534, 537, 538, 548, 556, 547, 565, 564, 597, 598, 607, 607, 614, 616, 614, 629, 630, 639, 640, 643, 644, 647, 655, 656, 664, 673, 674, 677, 677, 680, 681, 684, 691, 691, 694, 694, 697, 698, 697, 701, 703, 705, 706, 705, 709, 710, 711, 709, 714, 715, 714, 718, 719, 720, 718, 723, 724, 723, 727, 728, 729, 727, 732, 733, 732, 736, 742, 741, 748, 748, 751, 762, 763, 766, 767, 770, 775, 776, 779, 780, 783, 784, 787, 788, 789, 796, 802, 805, 806, 811, 818, 825, 826, 829, 830, 833, 834, 837, 842, 842, 849, 850, 853, 854, 857, 858, 861, 865, 869, 875, 879, 883, 883, 885, 889, 893, 894, 894, 896, 896, 898, 898, 900, 900, 902, 906, 910, 915, 915, 917, 921, 925, 929, 933, 933, 935, 936, 946, 947, 950, 951, 954, 955, 958, 959, 960, 961, 967, 969, 975, 977, 985, 986, 989, 990, 991, 991, 998, 1010, 1011, 1011, 1015, 1015, 1017, 1023, 1023, 1023, 1023, 1023, 1026, 1026, 1026, 1027, 1027, 1027, 1030, 1030, 1030, 1030, 1031, 1031, 1031, 1031, 1031, 1031, 1034, 1034, 1034, 1035, 1035, 1035, 1035, 1036, 1036, 1036, 1036, 1036, 1039, 1039, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1049, 1049, 1049, 1049, 1052, 1052, 1055, 1055, 1055, 1055, 1055, 1055, 1056, 1056, 1056, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1063, 1063, 1063, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1067, 1067, 1067, 1067, 1067, 1067, 1068, 1068, 1068, 1068, 1069, 1069, 1069, 1069, 1070, 1070, 1070, 1097, 1097, 1102, 1102, 1109, 1108, 1121, 1120, 1133, 1132, 1145, 1144, 1157, 1156, 1169, 1168, 1182, 1181, 1195, 1194, 1207, 1206, 1220, 1219, 1232, 1231, 1243, 1248, 1247, 1258, 1264, 1264, 1270, 1270, 1276, 1276, 1282, 1282, 1288, 1296, 1296, 1302, 1302, 1308, 1308, 1314, 1314, 1320, 1324, 1328, 1328, 1334, 1334, 1340, 1340, 1346, 1346, 1352, 1352, 1358, 1358, 1364, 1364, 1370, 1370, 1376, 1380, 1384, 1388, 1388, 1397, 1401, 1405, 1409, 1413, 1417, 1421, 1425, 1429, 1433, 1437, 1441, 1445, 1449, 1450, 1449, 1455, 1456, 1455, 1461, 1465, 1469, 1473, 1477, 1481, 1488, 1492, 1496, 1500, 1507, 1511, 1518, 1518, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1550, 1551, 1554, 1555, 1558, 1559, 1562, 1563, 1568, 1569, 1570, 1573, 1574, 1577, 1578, 1581, 1582, 1585, 1586, 1587, 1596, 1597, 1597, 1601, 1601, 1603, 1613, 1613, 1615, 1616, 1616, 1621, 1621, 1623, 1623, 1625, 1629, 1629, 1631, 1631, 1633, 1646, 1646, 1648, 1649, 1649, 1658, 1658, 1660, 1660, 1662, 1662, 1664, 1672, 1672, 1674, 1674, 1676, 1676, 1678, 1686, 1686, 1688, 1688, 1690, 1699, 1698, 1705, 1705, 1707, 1715, 1715, 1717, 1717, 1719, 1727, 1727, 1729, 1729, 1731, 1734, 1734, 1736, 1740, 1740, 1742, 1742, 1744, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1758, 1758, 1758, 1758, 1758, 1758, 1762, 1762, 1762, 1762, 1762, 1762, 1766, 1766, 1766, 1766, 1766, 1766, 1770, 1770, 1770, 1770, 1770, 1774, 1774, 1774, 1774, 1774, 1780, 1781, 1784, 1785, 1788, 1795, 1796, 1799, 1804, 1811, 1811, 1811, 1811, 1811, 1811, 1811 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "FILE_NAME_STRING", "UNINTERPRETED_STRING", "LATEX_STRING", "KW_MOD", "KW_OMOD", "KW_VIEW", "KW_PARSE", "KW_NORMALIZE", "KW_REDUCE", "KW_REWRITE", "KW_LOOP", "KW_NARROW", "KW_XG_NARROW", "KW_MATCH", "KW_XMATCH", "KW_UNIFY", "KW_EREWRITE", "KW_FREWRITE", "KW_SREWRITE", "KW_CONTINUE", "KW_SEARCH", "KW_SET", "KW_SHOW", "KW_ON", "KW_OFF", "KW_TRACE", "KW_BODY", "KW_BUILTIN", "KW_WHOLE", "KW_SELECT", "KW_DESELECT", "KW_CONDITION", "KW_SUBSTITUTION", "KW_PRINT", "KW_GRAPH", "KW_MIXFIX", "KW_FLAT", "KW_ATTRIBUTE", "KW_NEWLINE", "KW_WITH", "KW_PARENS", "KW_ALIASES", "KW_GC", "KW_TIME", "KW_STATS", "KW_TIMING", "KW_CMD", "KW_BREAKDOWN", "KW_BREAK", "KW_PATH", "KW_MODULE", "KW_MODULES", "KW_VIEWS", "KW_ALL", "KW_SORTS", "KW_OPS2", "KW_VARS", "KW_MBS", "KW_EQS", "KW_RLS", "KW_SUMMARY", "KW_KINDS", "KW_ADVISE", "KW_VERBOSE", "KW_DO", "KW_CLEAR", "KW_PROTECT", "KW_EXTEND", "KW_INCLUDE", "KW_EXCLUDE", "KW_CONCEAL", "KW_REVEAL", "KW_COMPILE", "KW_COUNT", "KW_DEBUG", "KW_RESUME", "KW_ABORT", "KW_STEP", "KW_WHERE", "KW_CREDUCE", "KW_SREDUCE", "KW_DUMP", "KW_PROFILE", "KW_NUMBER", "KW_RAT", "KW_COLOR", "SIMPLE_NUMBER", "KW_PWD", "KW_CD", "KW_PUSHD", "KW_POPD", "KW_LS", "KW_LOAD", "KW_QUIT", "KW_EOF", "KW_ENDM", "KW_IMPORT", "KW_ENDV", "KW_SORT", "KW_SUBSORT", "KW_OP", "KW_OPS", "KW_MSGS", "KW_VAR", "KW_CLASS", "KW_SUBCLASS", "KW_MB", "KW_CMB", "KW_EQ", "KW_CEQ", "KW_RL", "KW_CRL", "KW_IS", "KW_FROM", "KW_ARROW", "KW_ARROW2", "KW_PARTIAL", "KW_IF", "':'", "'='", "'('", "')'", "'.'", "'<'", "'['", "']'", "','", "'|'", "KW_LABEL", "KW_TO", "KW_COLON2", "'+'", "'*'", "'{'", "'}'", "KW_ASSOC", "KW_COMM", "KW_ID", "KW_IDEM", "KW_ITER", "KW_LEFT", "KW_RIGHT", "KW_PREC", "KW_GATHER", "KW_METADATA", "KW_STRAT", "KW_POLY", "KW_MEMO", "KW_FROZEN", "KW_CTOR", "KW_LATEX", "KW_SPECIAL", "KW_CONFIG", "KW_OBJ", "KW_MSG", "KW_DITTO", "KW_FORMAT", "KW_ID_HOOK", "KW_OP_HOOK", "KW_TERM_HOOK", "KW_IN", "IDENTIFIER", "NUMERIC_ID", "ENDS_IN_DOT", "FORCE_LOOKAHEAD", "$accept", "top", "item", "directive", "$@1", "$@2", "$@3", "$@4", "$@5", "moduleExprDot", "moduleExpr", "moduleExpr2", "moduleExpr3", "renameExpr", "instantExpr", "$@6", "parenExpr", "argList", "renaming", "$@7", "$@8", "renaming2", "mappingList", "mapping", "$@9", "$@10", "fromSpec", "$@11", "toAttributes", "$@12", "toAttributeList", "toAttribute", "$@13", "$@14", "$@15", "view", "$@16", "$@17", "$@18", "viewDecList", "skipStrayArrow", "viewDeclaration", "$@19", "sortDot", "viewEndOpMap", "$@20", "$@21", "$@22", "endBubble", "parenBubble", "$@23", "module", "$@24", "$@25", "dot", "parameters", "parameterList", "parameter", "colon2", "badType", "typeDot", "startModule", "decList", "declaration", "$@26", "$@27", "$@28", "$@29", "$@30", "$@31", "$@32", "$@33", "$@34", "$@35", "$@36", "$@37", "$@38", "$@39", "$@40", "$@41", "$@42", "$@43", "$@44", "$@45", "$@46", "$@47", "$@48", "classDef", "cPairList", "cPair", "varNameList", "opNameList", "simpleOpName", "domainRangeAttr", "skipStrayColon", "dra2", "rangeAttr", "typeAttr", "arrow", "typeList", "typeName", "$@49", "sortNames", "attributes", "attributeList", "idKeyword", "attribute", "$@50", "$@51", "$@52", "$@53", "$@54", "$@55", "$@56", "identity", "idList", "hookList", "hook", "expectedIs", "expectedDot", "sortNameList", "subsortList", "$@57", "sortName", "sortNameFrag", "$@58", "sortNameFrags", "$@59", "token", "tokenBarDot", "tokenBarColon", "sortToken", "endsInDot", "inert", "identifier", "startKeyword", "startKeyword2", "midKeyword", "attrKeyword", "attrKeyword2", "command", "$@60", "$@61", "$@62", "$@63", "$@64", "$@65", "$@66", "$@67", "$@68", "$@69", "$@70", "$@71", "$@72", "$@73", "$@74", "$@75", "$@76", "$@77", "$@78", "$@79", "$@80", "$@81", "$@82", "$@83", "$@84", "$@85", "$@86", "$@87", "$@88", "$@89", "$@90", "$@91", "$@92", "$@93", "$@94", "$@95", "printOption", "traceOption", "polarity", "select", "exclude", "conceal", "search", "match", "optDebug", "optNumber", "importMode", "moduleAndTerm", "$@96", "inEnd", "$@97", "numberModuleTerm", "$@98", "$@99", "numberModuleTerm1", "$@100", "$@101", "numberModuleTerm2", "$@102", "$@103", "numbersModuleTerm", "$@104", "$@105", "numbersModuleTerm1", "$@106", "$@107", "$@108", "numbersModuleTerm2", "$@109", "$@110", "$@111", "numbersModuleTerm3", "$@112", "$@113", "numbersModuleTerm4", "$@114", "$@115", "numbersModuleTerm5", "$@116", "$@117", "numbersModuleTerm6", "$@118", "$@119", "miscEndBubble", "$@120", "initialEndBubble", "$@121", "$@122", "cTokenBarIn", "cTokenBarLeftIn", "cTokenBarDotNumber", "cTokenBarDotRight", "cTokenBarDotCommaNumber", "cTokenBarDotCommaRight", "opSelect", "endSelect", "badSelect", "cOpNameList", "cSimpleOpName", "cSimpleTokenBarDot", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 58, 61, 40, 41, 46, 60, 91, 93, 44, 124, 376, 377, 378, 43, 42, 123, 125, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 168, 169, 169, 170, 170, 170, 170, 172, 171, 173, 171, 171, 174, 171, 175, 171, 171, 176, 171, 171, 171, 177, 177, 177, 177, 177, 177, 177, 178, 178, 179, 179, 180, 180, 180, 181, 183, 182, 184, 185, 185, 187, 188, 186, 189, 189, 190, 190, 191, 191, 192, 193, 191, 195, 194, 194, 197, 196, 196, 198, 198, 199, 200, 199, 201, 199, 202, 199, 204, 205, 206, 203, 207, 207, 208, 208, 209, 209, 210, 209, 209, 211, 211, 213, 214, 212, 215, 212, 216, 216, 218, 217, 220, 221, 219, 222, 222, 223, 223, 224, 224, 225, 226, 226, 227, 228, 228, 229, 229, 230, 230, 231, 232, 231, 233, 231, 234, 235, 231, 231, 231, 236, 237, 231, 238, 239, 240, 231, 241, 242, 231, 243, 244, 245, 231, 246, 247, 231, 248, 249, 250, 231, 251, 252, 231, 231, 253, 231, 254, 231, 231, 255, 255, 256, 256, 257, 258, 258, 259, 259, 260, 260, 261, 261, 261, 262, 262, 263, 263, 263, 264, 265, 265, 266, 266, 267, 267, 268, 269, 268, 270, 270, 271, 271, 272, 272, 273, 273, 273, 274, 274, 275, 274, 274, 274, 274, 276, 274, 277, 274, 278, 274, 279, 274, 274, 274, 274, 280, 274, 274, 274, 274, 274, 281, 274, 274, 274, 282, 282, 283, 283, 284, 284, 285, 285, 285, 285, 286, 286, 287, 287, 288, 288, 289, 289, 290, 289, 291, 292, 293, 292, 295, 294, 294, 296, 296, 296, 296, 296, 297, 297, 297, 297, 297, 297, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 300, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 302, 302, 302, 302, 303, 303, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 305, 305, 305, 305, 305, 305, 305, 306, 306, 306, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 309, 308, 310, 308, 311, 308, 312, 308, 313, 308, 314, 308, 315, 308, 316, 308, 317, 308, 318, 308, 319, 308, 320, 308, 321, 308, 308, 322, 308, 308, 323, 308, 324, 308, 325, 308, 326, 308, 308, 327, 308, 328, 308, 329, 308, 330, 308, 308, 308, 331, 308, 332, 308, 333, 308, 334, 308, 335, 308, 336, 308, 337, 308, 338, 308, 308, 308, 308, 339, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 340, 341, 308, 342, 343, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 344, 308, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 347, 347, 348, 348, 349, 349, 350, 350, 351, 351, 351, 352, 352, 353, 353, 354, 354, 355, 355, 355, 356, 357, 356, 359, 358, 358, 361, 360, 360, 362, 360, 364, 363, 365, 363, 363, 367, 366, 368, 366, 366, 370, 369, 369, 371, 369, 373, 372, 374, 372, 375, 372, 372, 377, 376, 378, 376, 379, 376, 376, 381, 380, 382, 380, 380, 384, 383, 385, 383, 383, 387, 386, 388, 386, 386, 390, 389, 391, 389, 389, 393, 392, 392, 395, 394, 396, 394, 394, 397, 397, 397, 397, 397, 397, 397, 398, 398, 398, 398, 398, 398, 399, 399, 399, 399, 399, 399, 400, 400, 400, 400, 400, 400, 401, 401, 401, 401, 401, 402, 402, 402, 402, 402, 403, 403, 404, 404, 405, 406, 406, 407, 407, 408, 408, 408, 408, 408, 408, 408 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 1, 1, 1, 1, 0, 3, 0, 3, 1, 0, 3, 0, 3, 1, 0, 3, 1, 1, 2, 2, 2, 2, 2, 3, 1, 1, 3, 1, 1, 1, 1, 1, 3, 0, 5, 3, 3, 1, 0, 0, 5, 1, 1, 3, 1, 4, 4, 0, 0, 6, 0, 5, 0, 0, 4, 0, 2, 1, 2, 0, 5, 0, 5, 0, 5, 0, 0, 0, 12, 2, 0, 1, 0, 4, 5, 0, 3, 2, 2, 1, 0, 0, 8, 0, 3, 1, 1, 0, 3, 0, 0, 8, 1, 1, 3, 0, 3, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 0, 2, 0, 4, 0, 4, 0, 0, 5, 4, 5, 0, 0, 5, 0, 0, 0, 7, 0, 0, 5, 0, 0, 0, 7, 0, 0, 5, 0, 0, 0, 7, 0, 0, 5, 4, 0, 5, 0, 4, 2, 1, 2, 1, 3, 3, 2, 1, 2, 1, 1, 1, 3, 1, 1, 1, 0, 2, 1, 1, 2, 3, 1, 1, 1, 2, 0, 1, 0, 4, 3, 1, 3, 0, 2, 1, 1, 2, 2, 1, 1, 0, 3, 1, 1, 2, 0, 5, 0, 5, 0, 5, 0, 5, 1, 1, 1, 0, 5, 1, 1, 1, 2, 0, 5, 4, 1, 1, 0, 2, 1, 2, 1, 2, 3, 3, 3, 1, 0, 1, 0, 2, 0, 2, 2, 0, 4, 1, 1, 0, 5, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 3, 0, 3, 0, 3, 4, 0, 3, 1, 0, 4, 0, 4, 0, 4, 0, 4, 4, 0, 4, 0, 4, 0, 4, 0, 4, 3, 3, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 4, 5, 4, 0, 4, 5, 5, 6, 5, 5, 6, 5, 5, 5, 5, 6, 5, 4, 0, 0, 7, 0, 0, 8, 4, 5, 5, 5, 4, 5, 2, 2, 2, 2, 5, 4, 0, 3, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 3, 0, 3, 1, 0, 3, 1, 0, 3, 0, 3, 0, 3, 1, 0, 3, 0, 3, 1, 0, 3, 1, 0, 3, 0, 3, 0, 3, 0, 3, 1, 0, 3, 0, 3, 0, 3, 1, 0, 3, 0, 3, 1, 0, 3, 0, 3, 1, 0, 3, 0, 3, 1, 0, 3, 0, 3, 1, 0, 3, 1, 0, 3, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 0, 448, 108, 109, 69, 351, 374, 479, 480, 483, 482, 371, 481, 0, 0, 0, 347, 0, 0, 0, 484, 0, 0, 0, 0, 353, 355, 349, 12, 13, 15, 17, 18, 10, 20, 21, 91, 8, 0, 2, 6, 5, 376, 4, 93, 7, 367, 369, 0, 0, 0, 0, 0, 0, 0, 0, 460, 0, 0, 0, 0, 0, 0, 488, 489, 490, 0, 0, 430, 386, 392, 0, 0, 388, 0, 0, 390, 396, 398, 400, 402, 404, 406, 408, 410, 415, 473, 474, 476, 475, 377, 379, 0, 477, 478, 383, 381, 0, 442, 443, 444, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 357, 359, 361, 363, 365, 487, 449, 311, 296, 312, 297, 298, 299, 300, 302, 301, 303, 304, 305, 306, 307, 308, 309, 310, 289, 288, 315, 318, 316, 319, 314, 317, 249, 313, 320, 321, 292, 285, 287, 293, 286, 283, 284, 281, 282, 323, 324, 325, 326, 327, 328, 329, 330, 331, 339, 332, 333, 334, 338, 335, 336, 337, 340, 341, 294, 342, 343, 344, 345, 346, 280, 291, 0, 290, 245, 246, 295, 247, 248, 322, 563, 554, 564, 561, 562, 565, 556, 559, 560, 558, 352, 491, 492, 375, 569, 570, 497, 568, 571, 566, 567, 372, 499, 500, 433, 0, 0, 0, 0, 0, 0, 0, 468, 469, 470, 462, 464, 461, 463, 465, 466, 467, 0, 454, 450, 451, 0, 0, 455, 456, 457, 458, 459, 0, 0, 471, 472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 394, 395, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 90, 348, 0, 0, 0, 354, 356, 350, 14, 16, 19, 11, 92, 9, 94, 512, 368, 514, 515, 370, 0, 0, 0, 0, 0, 486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 453, 452, 0, 0, 447, 429, 436, 0, 0, 0, 0, 440, 608, 605, 606, 609, 607, 603, 604, 431, 387, 393, 414, 412, 0, 389, 391, 397, 399, 401, 403, 405, 407, 409, 411, 416, 598, 602, 378, 595, 0, 600, 601, 380, 384, 382, 385, 99, 0, 0, 358, 360, 362, 364, 366, 373, 0, 70, 29, 31, 32, 34, 33, 35, 555, 494, 496, 557, 493, 576, 551, 573, 574, 577, 575, 572, 502, 553, 498, 506, 504, 501, 434, 0, 0, 424, 418, 420, 423, 421, 417, 428, 0, 426, 425, 446, 438, 441, 437, 439, 0, 413, 596, 594, 597, 599, 0, 229, 588, 585, 586, 519, 587, 584, 517, 513, 523, 521, 516, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 419, 422, 427, 0, 0, 101, 0, 228, 111, 0, 0, 0, 39, 30, 0, 42, 36, 0, 495, 552, 582, 580, 507, 583, 581, 578, 579, 503, 511, 509, 505, 0, 432, 0, 98, 104, 103, 0, 0, 541, 520, 545, 543, 593, 591, 524, 526, 592, 589, 590, 518, 530, 528, 522, 71, 0, 0, 41, 0, 0, 435, 100, 102, 0, 95, 0, 113, 115, 117, 0, 0, 0, 0, 149, 122, 125, 129, 132, 136, 139, 143, 110, 0, 0, 0, 0, 0, 229, 46, 0, 51, 0, 43, 45, 48, 0, 38, 508, 510, 151, 249, 251, 252, 28, 112, 0, 231, 231, 231, 231, 0, 250, 253, 254, 255, 233, 0, 0, 261, 264, 262, 265, 263, 259, 260, 162, 0, 160, 161, 256, 257, 258, 0, 0, 158, 147, 0, 0, 0, 0, 0, 0, 0, 0, 546, 542, 550, 548, 544, 525, 531, 527, 535, 533, 529, 74, 275, 273, 274, 269, 270, 276, 277, 271, 272, 266, 0, 238, 239, 267, 268, 56, 0, 0, 0, 40, 0, 230, 25, 26, 24, 22, 23, 0, 0, 236, 118, 0, 159, 0, 76, 157, 0, 0, 123, 126, 130, 133, 137, 140, 144, 0, 0, 0, 0, 0, 0, 240, 54, 0, 0, 44, 47, 27, 30, 96, 97, 114, 232, 235, 116, 234, 233, 0, 174, 175, 179, 105, 165, 120, 164, 0, 177, 178, 146, 75, 0, 152, 0, 150, 0, 0, 0, 0, 0, 0, 0, 547, 549, 536, 532, 540, 538, 534, 0, 72, 0, 79, 0, 73, 49, 0, 177, 52, 50, 0, 119, 0, 173, 171, 184, 167, 107, 121, 231, 251, 252, 153, 154, 0, 250, 253, 254, 255, 148, 124, 127, 131, 134, 138, 141, 145, 0, 0, 81, 0, 0, 0, 244, 0, 0, 59, 237, 0, 182, 0, 231, 166, 169, 170, 0, 163, 176, 106, 0, 0, 0, 0, 0, 537, 539, 0, 84, 87, 80, 76, 242, 241, 0, 57, 53, 180, 0, 190, 191, 187, 194, 195, 0, 0, 0, 0, 0, 0, 0, 205, 207, 206, 0, 0, 210, 211, 212, 217, 0, 0, 192, 186, 172, 168, 155, 156, 128, 135, 142, 83, 77, 231, 177, 0, 0, 0, 55, 0, 181, 188, 189, 196, 197, 213, 201, 203, 208, 214, 0, 199, 183, 185, 219, 82, 0, 88, 78, 243, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 0, 218, 193, 0, 62, 63, 67, 65, 58, 60, 221, 0, 0, 0, 0, 0, 224, 0, 0, 216, 222, 0, 0, 0, 0, 0, 198, 220, 202, 204, 209, 215, 225, 226, 227, 200, 85, 0, 0, 0, 0, 64, 68, 66, 86 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 38, 39, 40, 110, 108, 105, 106, 107, 560, 384, 385, 386, 387, 388, 473, 389, 512, 472, 511, 629, 548, 549, 550, 627, 757, 665, 718, 786, 829, 854, 855, 889, 891, 890, 41, 50, 448, 543, 661, 692, 715, 752, 822, 780, 824, 906, 825, 404, 364, 109, 43, 112, 374, 673, 434, 460, 461, 493, 684, 729, 44, 494, 537, 571, 572, 573, 679, 593, 696, 594, 697, 772, 595, 698, 596, 699, 773, 597, 700, 598, 701, 774, 599, 702, 648, 592, 694, 733, 734, 589, 582, 583, 685, 766, 767, 686, 725, 687, 727, 688, 723, 759, 762, 811, 812, 813, 844, 856, 866, 857, 858, 859, 860, 868, 877, 864, 865, 464, 634, 639, 640, 678, 689, 623, 717, 755, 827, 390, 565, 584, 624, 566, 188, 189, 625, 191, 192, 193, 194, 45, 92, 104, 51, 102, 103, 302, 303, 304, 305, 306, 113, 114, 53, 52, 279, 280, 285, 284, 261, 266, 269, 262, 270, 271, 272, 273, 274, 275, 276, 277, 278, 260, 427, 315, 455, 49, 248, 237, 252, 90, 91, 95, 46, 47, 48, 308, 68, 205, 312, 394, 451, 216, 313, 314, 405, 453, 454, 483, 514, 515, 298, 375, 376, 442, 466, 465, 467, 506, 540, 541, 542, 607, 659, 660, 706, 748, 749, 496, 538, 539, 601, 657, 658, 406, 452, 206, 310, 311, 207, 218, 407, 485, 444, 508, 365, 430, 366, 367, 368, 369 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -725 static const yytype_int16 yypact[] = { 624, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 392, 325, 18, -725, -6, 55, -29, -725, -65, -55, -34, 27, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 104, -725, -725, -725, -725, -725, -725, -725, -725, -725, 508, 51, 1063, 118, 118, 369, 122, 264, 440, 279, 164, 140, 140, 140, -27, -725, -725, -725, 120, 140, -725, -725, -725, 168, -37, -725, 93, 97, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -81, -725, -725, -725, -725, 78, -725, -725, -725, -725, 118, 118, -81, 241, 249, 255, 252, 138, 286, -725, 1063, 389, 369, -725, -725, -725, -725, -725, 187, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 184, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 275, 140, 140, 140, 140, 140, 140, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 140, -725, -725, -725, 35, 293, -725, -725, -725, -725, -725, 140, 140, -725, -725, 153, 177, 183, 140, 140, 140, 140, 190, -64, -81, -81, 202, 209, 254, -81, -725, -725, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 2150, 2150, -725, -725, -725, 2150, 2150, 239, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 118, 369, 389, 389, 369, -725, 250, 787, -81, -80, -81, 415, -81, -64, 140, 140, 269, 276, 280, 289, 290, 291, 294, 140, 296, -725, -725, 297, 298, -725, -725, -725, 300, 301, 304, 307, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 309, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 435, -725, -725, -725, -725, -725, -725, 223, 447, -81, -725, -725, -725, -725, -725, -725, 787, 170, 227, 282, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 310, 311, -725, -725, -725, -725, -725, -725, -725, 315, -725, -725, -725, -725, -725, -725, -725, 140, -725, -725, -725, -725, -725, 1063, 285, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 9, 787, 321, 318, -725, -81, -81, 612, -81, 140, -725, -725, -725, 317, 127, -725, -62, -725, -725, 645, 661, -81, -725, -725, 787, -725, -725, 1063, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 322, -725, 1063, -725, -725, -725, 787, 650, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 170, 5, 162, -725, 118, -81, -725, -725, 170, 329, -725, 856, -725, -725, -725, 1132, 1132, 1339, 1063, -725, -725, -725, -725, -725, -725, -725, -725, -725, 670, -81, 118, 2132, -81, 285, -725, 2090, -725, 1063, -725, 326, -725, 1063, -725, -725, -725, -725, 331, 215, 222, 26, -725, 323, 39, 102, 115, 334, 341, 234, 237, 262, 273, -725, 2090, 347, -725, -725, -725, -725, -725, -725, -725, -725, 925, -725, -725, -725, -725, -725, 994, 1201, -725, -725, 2090, 352, 355, 357, 358, 363, 368, 372, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 367, 353, -725, -725, -725, 374, 371, 381, 111, -725, 856, -725, -725, -725, -725, -725, -725, 1615, 1546, -725, -725, 1408, -725, 1408, 396, -725, 376, 1546, -725, -725, -725, -725, -725, -725, -725, 118, -81, 2141, -81, 41, 2090, -725, -725, 377, 1063, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 1408, -725, -725, -725, -725, -725, -725, -725, 1684, -725, -725, -725, -725, 1684, 1822, 390, -725, -81, 401, -81, 402, -81, 403, 1408, -725, -725, -725, -725, -725, -725, -725, 399, -725, 2090, -725, 1339, -725, -725, 2090, -725, -725, -725, 1956, -725, 2090, -725, -725, 404, 1477, -725, -725, 334, -725, -725, 408, -725, 420, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 118, -81, -725, 416, 37, 1270, 353, 169, 1889, 422, -725, 225, -725, 722, 334, -725, -725, -725, 156, -725, -725, -725, 1822, 1063, -81, -81, -81, -725, -725, 1753, -725, -725, -725, 396, -725, -725, 2023, -725, -725, -725, 2090, -725, -725, -725, -725, -725, 407, 410, 387, 434, 395, 438, 442, -725, 443, -725, 448, 450, -725, -725, -725, -725, 454, 700, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 334, -725, -81, 1684, 2090, -725, -21, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 251, -725, -725, -725, 417, -725, 1889, -725, -725, 353, 419, 462, 463, 464, 179, -725, 426, 426, 426, 426, 586, 1063, 1063, 1063, -42, -725, 426, -725, -725, 2023, -725, -725, -725, -725, -725, -725, -725, -69, -68, -19, -11, 468, 470, 470, 470, -725, -725, -10, 465, 426, 589, 426, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -9, 471, -7, -81, -725, -725, -725, -725 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -725, -725, -725, -725, -725, -725, -725, -725, -725, -36, -372, -725, -725, -506, -504, -725, -497, -725, -725, -725, -725, -725, -725, -28, -725, -725, -725, -725, -725, -725, -725, -251, -725, -725, -725, -725, -725, -725, -725, -725, -177, -725, -725, -725, -725, -725, -725, -725, -91, 0, -725, -725, -725, -725, -503, -725, -725, 117, -725, -678, -212, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -155, -98, 91, -432, -605, -725, -725, -148, -725, -724, -693, -654, -725, -725, -725, -725, -725, -192, -725, -725, -725, -725, -725, -725, -725, -725, -563, -725, -244, 79, -536, -57, 36, -725, -433, -687, -725, -725, -725, -40, -659, -523, -725, -725, -516, -479, -43, -725, -498, -505, -382, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -24, 609, -725, -725, -725, -725, -725, -725, -725, -49, -725, -725, -725, -95, -725, -725, -725, -725, -725, -725, -725, -725, 87, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -373, -725, -35, -725, -725, -725, -101, -434, -530, -725, -725, 62, -725, 267, -725, 287, -234 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -486 static const yytype_int16 yytable[] = { 42, 283, 443, 208, 590, 567, 544, 190, 603, 724, 187, 446, 300, 289, 728, 562, 570, 563, 217, 301, 587, 587, 587, 569, 564, 756, 346, 635, 636, 637, 754, 498, 784, 726, 735, 255, 253, 254, 730, 97, 690, 392, 710, 259, 281, 281, 585, 585, 585, 765, 86, 87, 264, 287, 288, 892, 894, 339, 256, 491, 98, 250, 251, 340, 341, 342, 647, 93, 94, 190, 99, 492, 296, 768, 722, 469, 325, 587, 299, 217, 484, 409, 885, 587, 587, 282, 282, 86, 87, 88, 89, 100, 497, 507, 265, 893, 893, 747, 510, 343, 344, 345, 768, 585, 111, 895, 545, 609, 546, 585, 585, 735, 622, 896, 901, 907, 567, 909, 861, 862, 863, 518, 869, 257, 850, 851, 562, 570, 563, 708, 828, 846, 852, 468, 569, 564, 547, 676, 853, 641, 849, 711, 712, 447, 713, 893, 695, 714, 728, 561, 644, -279, 101, 893, 893, 893, 644, 893, 778, 641, -291, -291, -291, 626, 633, 602, 250, 251, 608, 779, 347, 348, 730, -32, -32, 352, 121, 736, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 739, 249, 626, 590, 768, 219, 769, 738, 258, 318, 319, 320, 321, 322, 323, 300, 300, 263, 674, 677, 378, 587, 626, 381, 545, 324, 546, 888, 677, 326, 267, 391, 393, 395, 268, 408, 329, 330, 814, 633, 286, 716, 647, 334, 335, 336, 337, 585, -34, -34, -34, 195, 633, 196, 547, 197, 290, 198, 199, 200, 587, -33, -33, -33, 291, 377, 736, 293, 489, 626, 626, 292, 670, 626, 294, 626, 490, 739, 190, 626, 217, 299, 299, 217, 738, 680, 585, 681, 307, 220, 331, 751, 626, 201, 202, 203, 204, 445, 707, 845, 674, 295, 760, 551, 410, 411, 878, 879, 880, 626, 782, 552, 309, 419, 332, 887, 447, 626, 783, 874, 333, 221, 626, 222, 223, 224, 225, 338, 238, 239, 240, 241, 626, 242, 316, 317, 850, 851, 903, 349, 905, 226, 626, 69, 852, 70, 350, 626, 327, 328, 853, 626, 190, 626, 370, 351, 823, 626, 371, 372, 71, -292, -292, -292, 243, 787, 788, 830, -293, -293, -293, 433, 474, 475, 449, 486, 373, 244, 245, 246, -290, -290, -290, -246, -246, -246, 626, 382, 509, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 190, 379, 380, 462, 412, 626, -247, -247, -247, 54, 463, 413, 626, 459, 190, 414, 626, -248, -248, -248, 85, 861, 862, 863, 415, 416, 417, 55, 450, 418, 56, 420, 421, 422, 554, 423, 424, 190, 57, 425, 190, 487, 426, 513, 428, 456, 457, 58, 247, 59, 458, 471, 488, 60, 626, 626, 190, 516, 604, 462, 190, 610, 227, 470, 555, 630, -278, 632, 61, 633, 62, 63, 64, 65, 626, 553, 638, 66, 642, 228, 229, 230, 231, 650, 232, 233, 651, 67, 568, 652, 653, 654, 586, 586, 586, 190, 655, 626, 591, 663, 209, 605, 196, 656, 210, 664, 211, 212, 213, 662, 234, 235, 236, 666, 190, 667, 693, 628, 190, 719, 209, 631, 196, 691, 210, 740, 297, 212, 213, 115, 116, 742, 744, 746, 750, 581, 581, 117, 118, 119, 120, 761, 201, 214, 215, 204, 396, 770, 397, 586, 281, 771, 398, 399, 400, 586, 586, 831, 777, 785, 832, 833, 201, 214, 215, 204, 339, 834, 36, 835, 429, 836, 340, 341, 342, 837, 838, 704, 435, 709, 397, 839, 281, 840, 436, 437, 438, 841, 401, 402, 403, 282, 581, 870, 867, 871, 872, 873, 581, 568, 876, 881, 897, 36, 904, 908, 669, 902, 343, 344, 345, 363, 668, 875, 826, 741, 517, 743, 703, 745, 439, 440, 441, 282, 848, 816, 753, 588, 815, 843, 886, 721, 611, 190, -3, 1, 720, 96, 649, 0, 2, 3, 4, 5, 431, -485, -485, 6, 7, 8, 9, 10, 11, -485, -485, -485, -485, 12, 13, 14, 737, 519, 15, 0, 432, 0, 16, 0, 776, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 586, 0, 0, 0, 18, 0, 0, 0, 0, 0, 818, 819, 820, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 775, 0, 20, 21, 22, 23, 24, 25, 26, 27, 0, 586, 0, 0, 0, 28, 29, 30, 31, 32, 33, 34, 35, 0, 0, 0, 0, 0, 737, 190, 0, 0, 817, 0, 476, 847, 397, 0, 281, 0, 477, 478, 479, 0, 0, 0, 0, 0, 36, 520, 521, 0, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 0, 396, 0, 397, 0, 281, 0, 398, 399, 400, 480, 481, 482, 282, 0, 0, 0, 499, 0, 397, 0, 281, 37, 500, 501, 502, 476, 0, 397, 0, 281, 0, 477, 600, 479, 0, 0, 0, 0, 0, 0, 0, 536, 401, 402, 495, 282, 0, 0, 0, 910, 0, 0, 190, 190, 190, 882, 883, 884, 503, 504, 505, 282, 842, 0, 0, 0, 0, 480, 481, 482, 282, 0, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 898, 899, 900, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 383, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 383, 0, 556, 148, 149, 150, 557, 152, 153, 558, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 559, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 574, 575, 576, 577, 643, 578, 36, 0, 579, 580, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 574, 575, 576, 577, 645, 578, 36, 0, 579, 580, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 574, 575, 576, 577, 0, 578, 36, 0, 579, 580, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 574, 575, 576, 577, 646, 578, 0, 0, 579, 580, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 574, 575, 576, 577, 781, 578, 0, 0, 579, 580, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 574, 575, 576, 577, 0, 578, 0, 0, 579, 580, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 0, 186, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 680, 613, 681, 614, 0, 615, 0, 0, 0, 0, 682, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 0, 683, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 763, 615, 0, 0, 764, 0, 682, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 0, 683, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 671, 675, 0, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 0, 672, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 671, 0, 0, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 0, 672, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 0, 0, 682, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 0, 683, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 0, 0, 0, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 0, 821, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 0, 0, 0, 148, 149, 150, 731, 152, 153, 732, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 185, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 680, 613, 681, 614, 0, 615, 0, 0, 0, 0, 682, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 0, 758, 0, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 0, 0, 682, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 0, 621, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 612, 0, 0, 613, 0, 614, 0, 615, 0, 0, 0, 0, 0, 0, 0, 616, 617, 618, 0, 619, 620, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 396, 621, 397, 0, 281, 0, 398, 399, 400, 476, 0, 397, 0, 281, 0, 477, 705, 479, 339, 0, 36, 0, 0, 0, 340, 341, 342, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 401, 402, 606, 282, 0, 0, 0, 0, 0, 480, 481, 482, 282, 0, 0, 0, 0, 0, 343, 344, 345, 363 }; static const yytype_int16 yycheck[] = { 0, 92, 375, 52, 527, 521, 1, 50, 538, 687, 50, 383, 113, 104, 692, 521, 521, 521, 53, 114, 525, 526, 527, 521, 521, 718, 260, 563, 564, 565, 717, 465, 756, 687, 693, 62, 60, 61, 692, 68, 645, 121, 1, 67, 125, 125, 525, 526, 527, 727, 32, 33, 89, 102, 103, 124, 124, 121, 85, 121, 125, 26, 27, 127, 128, 129, 589, 73, 74, 112, 125, 133, 112, 727, 679, 447, 41, 582, 113, 114, 453, 315, 124, 588, 589, 166, 166, 32, 33, 71, 72, 125, 465, 466, 131, 164, 164, 702, 470, 163, 164, 165, 756, 582, 0, 124, 101, 541, 103, 588, 589, 770, 545, 124, 124, 124, 632, 124, 160, 161, 162, 493, 846, 150, 145, 146, 632, 632, 632, 659, 784, 824, 153, 124, 632, 632, 131, 640, 159, 572, 827, 100, 101, 134, 103, 164, 649, 106, 826, 521, 582, 125, 125, 164, 164, 164, 588, 164, 121, 592, 134, 135, 136, 545, 125, 538, 26, 27, 541, 132, 261, 262, 826, 134, 135, 266, 125, 693, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 693, 25, 572, 714, 846, 71, 730, 693, 76, 221, 222, 223, 224, 225, 226, 304, 305, 37, 639, 640, 303, 714, 592, 306, 101, 237, 103, 869, 649, 241, 125, 310, 311, 312, 125, 314, 248, 249, 762, 125, 150, 662, 753, 255, 256, 257, 258, 714, 134, 135, 136, 121, 125, 123, 131, 125, 3, 127, 128, 129, 753, 134, 135, 136, 3, 302, 770, 3, 129, 639, 640, 4, 632, 643, 124, 645, 137, 770, 309, 649, 303, 304, 305, 306, 770, 117, 753, 119, 89, 13, 125, 712, 662, 163, 164, 165, 166, 376, 659, 823, 721, 3, 723, 129, 316, 317, 857, 858, 859, 679, 129, 137, 116, 325, 125, 866, 134, 687, 137, 128, 125, 45, 692, 47, 48, 49, 50, 125, 37, 38, 39, 40, 702, 42, 47, 48, 145, 146, 889, 125, 891, 65, 712, 6, 153, 8, 125, 717, 43, 44, 159, 721, 383, 723, 280, 89, 777, 727, 284, 285, 23, 134, 135, 136, 73, 128, 129, 788, 134, 135, 136, 136, 451, 452, 135, 454, 125, 86, 87, 88, 134, 135, 136, 134, 135, 136, 756, 125, 467, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 433, 304, 305, 433, 125, 777, 134, 135, 136, 7, 115, 125, 784, 427, 447, 125, 788, 134, 135, 136, 85, 160, 161, 162, 125, 125, 125, 25, 136, 125, 28, 125, 125, 125, 515, 125, 125, 470, 36, 125, 473, 455, 125, 473, 125, 125, 125, 45, 159, 47, 125, 123, 125, 51, 826, 827, 489, 125, 539, 489, 493, 542, 12, 132, 125, 129, 125, 134, 66, 125, 68, 69, 70, 71, 846, 514, 125, 75, 121, 29, 30, 31, 32, 121, 34, 35, 121, 85, 521, 122, 122, 118, 525, 526, 527, 528, 118, 869, 528, 136, 121, 540, 123, 121, 125, 121, 127, 128, 129, 132, 60, 61, 62, 132, 547, 124, 130, 547, 551, 132, 121, 551, 123, 117, 125, 125, 127, 128, 129, 11, 12, 120, 120, 120, 125, 525, 526, 19, 20, 21, 22, 127, 163, 164, 165, 166, 121, 129, 123, 582, 125, 121, 127, 128, 129, 588, 589, 140, 132, 127, 140, 164, 163, 164, 165, 166, 121, 123, 123, 164, 125, 123, 127, 128, 129, 123, 123, 658, 121, 660, 123, 123, 125, 123, 127, 128, 129, 123, 163, 164, 165, 166, 582, 164, 167, 123, 123, 123, 588, 632, 164, 5, 124, 123, 5, 124, 632, 132, 163, 164, 165, 166, 630, 854, 781, 696, 489, 698, 657, 700, 163, 164, 165, 166, 826, 770, 714, 526, 766, 811, 864, 678, 543, 666, 0, 1, 666, 18, 592, -1, 6, 7, 8, 9, 367, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 693, 1, 28, -1, 367, -1, 32, -1, 749, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 714, -1, -1, -1, 51, -1, -1, -1, -1, -1, 772, 773, 774, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, 748, -1, 77, 78, 79, 80, 81, 82, 83, 84, -1, 753, -1, -1, -1, 90, 91, 92, 93, 94, 95, 96, 97, -1, -1, -1, -1, -1, 770, 771, -1, -1, 771, -1, 121, 825, 123, -1, 125, -1, 127, 128, 129, -1, -1, -1, -1, -1, 123, 98, 99, -1, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, 121, -1, 123, -1, 125, -1, 127, 128, 129, 163, 164, 165, 166, -1, -1, -1, 121, -1, 123, -1, 125, 163, 127, 128, 129, 121, -1, 123, -1, 125, -1, 127, 128, 129, -1, -1, -1, -1, -1, -1, -1, 157, 163, 164, 165, 166, -1, -1, -1, 906, -1, -1, 861, 862, 863, 861, 862, 863, 163, 164, 165, 166, 128, -1, -1, -1, -1, 163, 164, 165, 166, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 882, 883, 884, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, -1, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, -1, 122, 123, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, -1, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, -1, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, -1, 122, -1, -1, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, 117, 118, 119, 120, -1, 122, -1, -1, -1, -1, 127, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, 121, 122, -1, -1, 125, -1, 127, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, 125, 126, -1, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, 125, -1, -1, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, -1, -1, 127, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, -1, -1, -1, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, -1, 166, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, -1, -1, -1, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, 117, 118, 119, 120, -1, 122, -1, -1, -1, -1, 127, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, -1, 126, -1, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, -1, -1, 127, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, -1, 164, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -1, -1, 118, -1, 120, -1, 122, -1, -1, -1, -1, -1, -1, -1, 130, 131, 132, -1, 134, 135, -1, -1, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 121, 164, 123, -1, 125, -1, 127, 128, 129, 121, -1, 123, -1, 125, -1, 127, 128, 129, 121, -1, 123, -1, -1, -1, 127, 128, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, 164, 165, 166, -1, -1, -1, -1, -1, 163, 164, 165, 166, -1, -1, -1, -1, -1, 163, 164, 165, 166 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 1, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 23, 24, 25, 28, 32, 36, 51, 67, 77, 78, 79, 80, 81, 82, 83, 84, 90, 91, 92, 93, 94, 95, 96, 97, 123, 163, 169, 170, 171, 203, 217, 219, 229, 308, 351, 352, 353, 344, 204, 311, 322, 321, 7, 25, 28, 36, 45, 47, 51, 66, 68, 69, 70, 71, 75, 85, 355, 6, 8, 23, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 85, 32, 33, 71, 72, 348, 349, 309, 73, 74, 350, 348, 68, 125, 125, 125, 125, 312, 313, 310, 174, 175, 176, 173, 218, 172, 0, 220, 319, 320, 11, 12, 19, 20, 21, 22, 125, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 166, 296, 301, 302, 303, 304, 305, 306, 307, 121, 123, 125, 127, 128, 129, 163, 164, 165, 166, 356, 394, 397, 356, 121, 125, 127, 128, 129, 164, 165, 360, 394, 398, 71, 13, 45, 47, 48, 49, 50, 65, 12, 29, 30, 31, 32, 34, 35, 60, 61, 62, 346, 37, 38, 39, 40, 42, 73, 86, 87, 88, 159, 345, 25, 26, 27, 347, 347, 347, 62, 85, 150, 76, 347, 340, 327, 330, 37, 89, 131, 328, 125, 125, 329, 331, 332, 333, 334, 335, 336, 337, 338, 339, 323, 324, 125, 166, 216, 326, 325, 150, 356, 356, 216, 3, 3, 4, 3, 124, 3, 296, 127, 369, 394, 398, 360, 314, 315, 316, 317, 318, 89, 354, 116, 395, 396, 357, 361, 362, 342, 47, 48, 347, 347, 347, 347, 347, 347, 347, 41, 347, 43, 44, 347, 347, 125, 125, 125, 347, 347, 347, 347, 125, 121, 127, 128, 129, 163, 164, 165, 408, 216, 216, 125, 125, 89, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 166, 217, 403, 405, 406, 407, 408, 403, 403, 403, 125, 221, 370, 371, 356, 360, 369, 369, 360, 125, 123, 178, 179, 180, 181, 182, 184, 296, 216, 121, 216, 358, 216, 121, 123, 127, 128, 129, 163, 164, 165, 216, 363, 392, 399, 216, 408, 347, 347, 125, 125, 125, 125, 125, 125, 125, 347, 125, 125, 125, 125, 125, 125, 125, 341, 125, 125, 404, 405, 407, 136, 223, 121, 127, 128, 129, 163, 164, 165, 372, 392, 401, 216, 178, 134, 205, 135, 136, 359, 393, 364, 365, 343, 125, 125, 125, 347, 224, 225, 296, 115, 286, 374, 373, 375, 124, 178, 132, 123, 186, 183, 216, 216, 121, 127, 128, 129, 163, 164, 165, 366, 392, 400, 216, 347, 125, 129, 137, 121, 133, 226, 230, 165, 386, 392, 399, 121, 127, 128, 129, 163, 164, 165, 376, 392, 402, 216, 178, 187, 185, 296, 367, 368, 125, 225, 178, 1, 98, 99, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 157, 231, 387, 388, 377, 378, 379, 206, 1, 101, 103, 131, 189, 190, 191, 129, 137, 356, 216, 125, 125, 129, 132, 166, 177, 178, 181, 182, 184, 297, 300, 301, 303, 305, 306, 232, 233, 234, 117, 118, 119, 120, 122, 125, 126, 217, 259, 260, 298, 302, 303, 306, 259, 258, 298, 296, 254, 236, 238, 241, 243, 246, 248, 251, 128, 389, 392, 400, 216, 356, 165, 380, 392, 399, 216, 286, 115, 118, 120, 122, 130, 131, 132, 134, 135, 164, 291, 292, 299, 303, 307, 192, 296, 188, 129, 296, 134, 125, 287, 287, 287, 287, 125, 288, 289, 291, 121, 121, 260, 121, 121, 298, 253, 289, 121, 121, 122, 122, 118, 118, 121, 390, 391, 381, 382, 207, 132, 136, 121, 194, 132, 124, 191, 177, 178, 125, 166, 222, 291, 126, 222, 291, 290, 235, 117, 119, 127, 166, 227, 261, 264, 266, 268, 291, 261, 117, 208, 130, 255, 222, 237, 239, 242, 244, 247, 249, 252, 356, 216, 128, 383, 392, 400, 216, 1, 100, 101, 103, 106, 209, 291, 293, 195, 132, 296, 288, 261, 269, 227, 265, 268, 267, 227, 228, 268, 129, 132, 256, 257, 297, 301, 303, 305, 306, 125, 216, 120, 216, 120, 216, 120, 261, 384, 385, 125, 291, 210, 258, 292, 294, 267, 193, 126, 270, 291, 127, 271, 121, 125, 227, 262, 263, 268, 287, 129, 121, 240, 245, 250, 356, 216, 132, 121, 132, 212, 121, 129, 137, 266, 127, 196, 128, 129, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 272, 273, 274, 287, 264, 257, 296, 216, 216, 216, 166, 211, 291, 213, 215, 208, 295, 268, 197, 291, 140, 140, 164, 123, 164, 123, 123, 123, 123, 123, 123, 128, 274, 275, 287, 267, 216, 228, 292, 145, 146, 153, 159, 198, 199, 276, 278, 279, 280, 281, 160, 161, 162, 284, 285, 277, 167, 282, 266, 164, 123, 123, 123, 128, 199, 164, 283, 283, 283, 283, 5, 296, 296, 296, 124, 285, 283, 268, 200, 202, 201, 124, 164, 124, 124, 124, 124, 217, 217, 217, 124, 132, 283, 5, 283, 214, 124, 124, 124, 216 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else # define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* Line 1455 of yacc.c */ #line 232 "surface.yy" { YYACCEPT; ;} break; case 3: /* Line 1455 of yacc.c */ #line 234 "surface.yy" { PARSE_RESULT = UserLevelRewritingContext::QUIT; ;} break; case 8: /* Line 1455 of yacc.c */ #line 248 "surface.yy" { lexerFileNameMode(); ;} break; case 9: /* Line 1455 of yacc.c */ #line 250 "surface.yy" { int lineNr = lineNumber; //eatComment(false); // eat \n so that line number is correct string directory; string fileName; if (findFile((yyvsp[(3) - (3)].yyString), directory, fileName, lineNr)) includeFile(directory, fileName, false, lineNr); ;} break; case 10: /* Line 1455 of yacc.c */ #line 258 "surface.yy" { lexerFileNameMode(); ;} break; case 11: /* Line 1455 of yacc.c */ #line 260 "surface.yy" { int lineNr = lineNumber; //eatComment(false); // eat \n so that line number is correct string directory; string fileName; if (findFile((yyvsp[(3) - (3)].yyString), directory, fileName, lineNr)) includeFile(directory, fileName, true, lineNr); ;} break; case 12: /* Line 1455 of yacc.c */ #line 269 "surface.yy" { cout << directoryManager.getCwd() << '\n'; ;} break; case 13: /* Line 1455 of yacc.c */ #line 272 "surface.yy" { lexerFileNameMode(); ;} break; case 14: /* Line 1455 of yacc.c */ #line 274 "surface.yy" { string directory; directoryManager.realPath((yyvsp[(3) - (3)].yyString), directory); if (!directoryManager.cd(directory)) { IssueWarning(LineNumber(lineNumber) << ": cd failed"); } ;} break; case 15: /* Line 1455 of yacc.c */ #line 283 "surface.yy" { lexerFileNameMode(); ;} break; case 16: /* Line 1455 of yacc.c */ #line 285 "surface.yy" { string directory; directoryManager.realPath((yyvsp[(3) - (3)].yyString), directory); if (directoryManager.pushd(directory) == UNDEFINED) { IssueWarning(LineNumber(lineNumber) << ": pushd failed"); } ;} break; case 17: /* Line 1455 of yacc.c */ #line 295 "surface.yy" { const char* path = directoryManager.popd(); if (path != 0) cout << path << '\n'; else { IssueWarning(LineNumber(lineNumber) << ": popd failed"); } ;} break; case 18: /* Line 1455 of yacc.c */ #line 305 "surface.yy" { lexerStringMode(); ;} break; case 19: /* Line 1455 of yacc.c */ #line 307 "surface.yy" { system((string("ls") + (yyvsp[(3) - (3)].yyString)).c_str()); ;} break; case 20: /* Line 1455 of yacc.c */ #line 311 "surface.yy" { PARSE_RESULT = UserLevelRewritingContext::QUIT; YYACCEPT; ;} break; case 21: /* Line 1455 of yacc.c */ #line 316 "surface.yy" { if(!handleEof()) { PARSE_RESULT = UserLevelRewritingContext::QUIT; } ;} break; case 22: /* Line 1455 of yacc.c */ #line 349 "surface.yy" { moduleExpressions.push(new ModuleExpression((yyvsp[(1) - (2)].yyToken))); ;} break; case 23: /* Line 1455 of yacc.c */ #line 353 "surface.yy" { moduleExpressions.push(new ModuleExpression((yyvsp[(1) - (2)].yyToken))); ;} break; case 27: /* Line 1455 of yacc.c */ #line 360 "surface.yy" { ModuleExpression* m1 = moduleExpressions.top(); moduleExpressions.pop(); ModuleExpression* m2 = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m1, m2)); ;} break; case 28: /* Line 1455 of yacc.c */ #line 368 "surface.yy" { Token t; t.dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(t); moduleExpressions.push(new ModuleExpression(t)); ;} break; case 30: /* Line 1455 of yacc.c */ #line 378 "surface.yy" { ModuleExpression* m1 = moduleExpressions.top(); moduleExpressions.pop(); ModuleExpression* m2 = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m1, m2)); ;} break; case 35: /* Line 1455 of yacc.c */ #line 394 "surface.yy" { moduleExpressions.push(new ModuleExpression((yyvsp[(1) - (1)].yyToken))); ;} break; case 36: /* Line 1455 of yacc.c */ #line 401 "surface.yy" { ModuleExpression* m = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m, currentRenaming)); currentRenaming = 0; ;} break; case 37: /* Line 1455 of yacc.c */ #line 409 "surface.yy" { clear(); ;} break; case 38: /* Line 1455 of yacc.c */ #line 411 "surface.yy" { ModuleExpression* m = moduleExpressions.top(); moduleExpressions.pop(); moduleExpressions.push(new ModuleExpression(m, tokenSequence)); ;} break; case 39: /* Line 1455 of yacc.c */ #line 418 "surface.yy" {;} break; case 40: /* Line 1455 of yacc.c */ #line 421 "surface.yy" { store((yyvsp[(3) - (3)].yyToken)); ;} break; case 41: /* Line 1455 of yacc.c */ #line 422 "surface.yy" { store((yyvsp[(1) - (1)].yyToken)); ;} break; case 42: /* Line 1455 of yacc.c */ #line 429 "surface.yy" { oldSyntaxContainer = currentSyntaxContainer; currentSyntaxContainer = currentRenaming = new Renaming; ;} break; case 43: /* Line 1455 of yacc.c */ #line 434 "surface.yy" { currentSyntaxContainer = oldSyntaxContainer; ;} break; case 49: /* Line 1455 of yacc.c */ #line 449 "surface.yy" { currentRenaming->addSortMapping((yyvsp[(2) - (4)].yyToken), (yyvsp[(4) - (4)].yyToken)); ;} break; case 50: /* Line 1455 of yacc.c */ #line 453 "surface.yy" { currentRenaming->addLabelMapping((yyvsp[(2) - (4)].yyToken), (yyvsp[(4) - (4)].yyToken)); ;} break; case 51: /* Line 1455 of yacc.c */ #line 456 "surface.yy" { lexBubble(BAR_COLON | BAR_TO, 1); ;} break; case 52: /* Line 1455 of yacc.c */ #line 457 "surface.yy" { lexBubble(BAR_COMMA | BAR_LEFT_BRACKET | BAR_RIGHT_PAREN, 1); ;} break; case 53: /* Line 1455 of yacc.c */ #line 458 "surface.yy" {;} break; case 54: /* Line 1455 of yacc.c */ #line 463 "surface.yy" { Token::peelParens(lexerBubble); currentRenaming->addOpMapping(lexerBubble); ;} break; case 55: /* Line 1455 of yacc.c */ #line 464 "surface.yy" {;} break; case 56: /* Line 1455 of yacc.c */ #line 465 "surface.yy" { Token::peelParens(lexerBubble); currentRenaming->addOpMapping(lexerBubble); ;} break; case 57: /* Line 1455 of yacc.c */ #line 471 "surface.yy" { Token::peelParens(lexerBubble); currentRenaming->addOpTarget(lexerBubble); ;} break; case 58: /* Line 1455 of yacc.c */ #line 472 "surface.yy" {;} break; case 59: /* Line 1455 of yacc.c */ #line 473 "surface.yy" { Token::peelParens(lexerBubble); currentRenaming->addOpTarget(lexerBubble); ;} break; case 62: /* Line 1455 of yacc.c */ #line 480 "surface.yy" { currentRenaming->setPrec((yyvsp[(2) - (2)].yyToken)); ;} break; case 63: /* Line 1455 of yacc.c */ #line 481 "surface.yy" { clear(); ;} break; case 64: /* Line 1455 of yacc.c */ #line 482 "surface.yy" { currentRenaming->setGather(tokenSequence); ;} break; case 65: /* Line 1455 of yacc.c */ #line 483 "surface.yy" { clear(); ;} break; case 66: /* Line 1455 of yacc.c */ #line 484 "surface.yy" { currentRenaming->setFormat(tokenSequence); ;} break; case 67: /* Line 1455 of yacc.c */ #line 485 "surface.yy" { lexerLatexMode(); ;} break; case 68: /* Line 1455 of yacc.c */ #line 486 "surface.yy" { currentRenaming->setLatexMacro((yyvsp[(4) - (5)].yyString)); ;} break; case 69: /* Line 1455 of yacc.c */ #line 492 "surface.yy" { lexerIdMode(); ;} break; case 70: /* Line 1455 of yacc.c */ #line 494 "surface.yy" { fileTable.beginModule((yyvsp[(1) - (5)].yyToken), (yyvsp[(3) - (5)].yyToken)); interpreter.setCurrentView(new View((yyvsp[(3) - (5)].yyToken))); currentSyntaxContainer = CV; CV->addFrom(moduleExpressions.top()); moduleExpressions.pop(); ;} break; case 71: /* Line 1455 of yacc.c */ #line 502 "surface.yy" { CV->addTo(moduleExpressions.top()); moduleExpressions.pop(); ;} break; case 72: /* Line 1455 of yacc.c */ #line 507 "surface.yy" { lexerInitialMode(); fileTable.endModule(lineNumber); interpreter.insertView(((yyvsp[(3) - (12)].yyToken)).code(), CV); CV->finishView(); ;} break; case 75: /* Line 1455 of yacc.c */ #line 520 "surface.yy" { IssueWarning(LineNumber((yyvsp[(1) - (1)].yyToken).lineNumber()) << ": skipping " << QUOTE("->") << " in variable declaration."); ;} break; case 77: /* Line 1455 of yacc.c */ #line 528 "surface.yy" { CV->addSortMapping((yyvsp[(2) - (4)].yyToken), (yyvsp[(4) - (4)].yyToken)); ;} break; case 78: /* Line 1455 of yacc.c */ #line 531 "surface.yy" {;} break; case 79: /* Line 1455 of yacc.c */ #line 532 "surface.yy" { lexBubble(BAR_COLON | BAR_TO, 1); ;} break; case 82: /* Line 1455 of yacc.c */ #line 537 "surface.yy" { (yyval.yyToken) = (yyvsp[(1) - (2)].yyToken); ;} break; case 83: /* Line 1455 of yacc.c */ #line 539 "surface.yy" { Token t; t.dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(t); (yyval.yyToken) = t; ;} break; case 84: /* Line 1455 of yacc.c */ #line 548 "surface.yy" { // // Specific op->op mapping. // Token::peelParens(lexerBubble); // remove any enclosing parens from op name CV->addOpMapping(lexerBubble); ;} break; case 85: /* Line 1455 of yacc.c */ #line 556 "surface.yy" { lexBubble(END_STATEMENT, 1); ;} break; case 86: /* Line 1455 of yacc.c */ #line 560 "surface.yy" { Token::peelParens(lexerBubble); // remove any enclosing parens from op name CV->addOpTarget(lexerBubble); ;} break; case 87: /* Line 1455 of yacc.c */ #line 565 "surface.yy" { // // At this point we don't know if we have an op->term mapping // or a generic op->op mapping so we save the from description and // press on. // opDescription = lexerBubble; lexBubble(END_STATEMENT, 1) ;} break; case 88: /* Line 1455 of yacc.c */ #line 575 "surface.yy" { if (lexerBubble[0].code() == Token::encode("term")) { // // Op->term mapping. // CV->addOpTermMapping(opDescription, lexerBubble); } else { // // Generic op->op mapping. // Token::peelParens(opDescription); // remove any enclosing parens from op name CV->addOpMapping(opDescription); Token::peelParens(lexerBubble); // remove any enclosing parens from op name CV->addOpTarget(lexerBubble); } ;} break; case 89: /* Line 1455 of yacc.c */ #line 597 "surface.yy" {;} break; case 90: /* Line 1455 of yacc.c */ #line 599 "surface.yy" { Token t; t.dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(t); lexerBubble.append(t); ;} break; case 91: /* Line 1455 of yacc.c */ #line 607 "surface.yy" { lexBubble(BAR_RIGHT_PAREN, 1); ;} break; case 92: /* Line 1455 of yacc.c */ #line 608 "surface.yy" {;} break; case 93: /* Line 1455 of yacc.c */ #line 614 "surface.yy" { lexerIdMode(); ;} break; case 94: /* Line 1455 of yacc.c */ #line 616 "surface.yy" { interpreter.setCurrentModule(new SyntacticPreModule((yyvsp[(1) - (3)].yyToken), (yyvsp[(3) - (3)].yyToken))); currentSyntaxContainer = CM; fileTable.beginModule((yyvsp[(1) - (3)].yyToken), (yyvsp[(3) - (3)].yyToken)); ;} break; case 95: /* Line 1455 of yacc.c */ #line 622 "surface.yy" { lexerInitialMode(); fileTable.endModule(lineNumber); CM->finishModule((yyvsp[(8) - (8)].yyToken)); ;} break; case 96: /* Line 1455 of yacc.c */ #line 629 "surface.yy" {;} break; case 97: /* Line 1455 of yacc.c */ #line 631 "surface.yy" { Token t; t.dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(t); store(t); ;} break; case 98: /* Line 1455 of yacc.c */ #line 639 "surface.yy" {;} break; case 102: /* Line 1455 of yacc.c */ #line 648 "surface.yy" { ModuleExpression* me = moduleExpressions.top(); moduleExpressions.pop(); CM->addParameter((yyvsp[(1) - (3)].yyToken), me); ;} break; case 103: /* Line 1455 of yacc.c */ #line 655 "surface.yy" {;} break; case 104: /* Line 1455 of yacc.c */ #line 657 "surface.yy" { IssueWarning(LineNumber((yyvsp[(1) - (1)].yyToken).lineNumber()) << ": saw " << QUOTE(':') << " instead of " << QUOTE("::") << " in parameter declaration."); ;} break; case 105: /* Line 1455 of yacc.c */ #line 665 "surface.yy" { singleton[0].dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(singleton[0]); currentSyntaxContainer->addType(false, singleton); (yyval.yyToken) = (yyvsp[(1) - (1)].yyToken); // needed for line number ;} break; case 107: /* Line 1455 of yacc.c */ #line 674 "surface.yy" {;} break; case 112: /* Line 1455 of yacc.c */ #line 685 "surface.yy" { ModuleExpression* me = moduleExpressions.top(); moduleExpressions.pop(); CM->addImport((yyvsp[(1) - (2)].yyToken), me); ;} break; case 113: /* Line 1455 of yacc.c */ #line 691 "surface.yy" { clear(); ;} break; case 114: /* Line 1455 of yacc.c */ #line 692 "surface.yy" { CM->addSortDecl(tokenSequence); ;} break; case 115: /* Line 1455 of yacc.c */ #line 694 "surface.yy" { clear(); ;} break; case 116: /* Line 1455 of yacc.c */ #line 695 "surface.yy" { CM->addSubsortDecl(tokenSequence); ;} break; case 117: /* Line 1455 of yacc.c */ #line 697 "surface.yy" { lexBubble(BAR_COLON, 1); ;} break; case 118: /* Line 1455 of yacc.c */ #line 698 "surface.yy" { Token::peelParens(lexerBubble); CM->addOpDecl(lexerBubble); ;} break; case 119: /* Line 1455 of yacc.c */ #line 699 "surface.yy" {;} break; case 120: /* Line 1455 of yacc.c */ #line 701 "surface.yy" {;} break; case 121: /* Line 1455 of yacc.c */ #line 703 "surface.yy" {;} break; case 122: /* Line 1455 of yacc.c */ #line 705 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_COLON, 1); ;} break; case 123: /* Line 1455 of yacc.c */ #line 706 "surface.yy" { lexContinueBubble((yyvsp[(3) - (3)].yyToken), END_STATEMENT, 1); ;} break; case 124: /* Line 1455 of yacc.c */ #line 707 "surface.yy" { CM->addStatement(lexerBubble); ;} break; case 125: /* Line 1455 of yacc.c */ #line 709 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_COLON, 1); ;} break; case 126: /* Line 1455 of yacc.c */ #line 710 "surface.yy" { lexContinueBubble((yyvsp[(3) - (3)].yyToken), BAR_IF, 1); ;} break; case 127: /* Line 1455 of yacc.c */ #line 711 "surface.yy" { lexContinueBubble((yyvsp[(5) - (5)].yyToken), END_STATEMENT, 1); ;} break; case 128: /* Line 1455 of yacc.c */ #line 712 "surface.yy" { CM->addStatement(lexerBubble); ;} break; case 129: /* Line 1455 of yacc.c */ #line 714 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_EQUALS, 1); ;} break; case 130: /* Line 1455 of yacc.c */ #line 715 "surface.yy" { lexContinueBubble((yyvsp[(3) - (3)].yyToken), END_STATEMENT, 1); ;} break; case 131: /* Line 1455 of yacc.c */ #line 716 "surface.yy" { CM->addStatement(lexerBubble); ;} break; case 132: /* Line 1455 of yacc.c */ #line 718 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_EQUALS, 1); ;} break; case 133: /* Line 1455 of yacc.c */ #line 719 "surface.yy" { lexContinueBubble((yyvsp[(3) - (3)].yyToken), BAR_IF, 1); ;} break; case 134: /* Line 1455 of yacc.c */ #line 720 "surface.yy" { lexContinueBubble((yyvsp[(5) - (5)].yyToken), END_STATEMENT, 1); ;} break; case 135: /* Line 1455 of yacc.c */ #line 721 "surface.yy" { CM->addStatement(lexerBubble); ;} break; case 136: /* Line 1455 of yacc.c */ #line 723 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_ARROW2, 1); ;} break; case 137: /* Line 1455 of yacc.c */ #line 724 "surface.yy" { lexContinueBubble((yyvsp[(3) - (3)].yyToken), END_STATEMENT, 1); ;} break; case 138: /* Line 1455 of yacc.c */ #line 725 "surface.yy" { CM->addStatement(lexerBubble); ;} break; case 139: /* Line 1455 of yacc.c */ #line 727 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_ARROW2, 1); ;} break; case 140: /* Line 1455 of yacc.c */ #line 728 "surface.yy" { lexContinueBubble((yyvsp[(3) - (3)].yyToken), BAR_IF, 1); ;} break; case 141: /* Line 1455 of yacc.c */ #line 729 "surface.yy" { lexContinueBubble((yyvsp[(5) - (5)].yyToken), END_STATEMENT, 1); ;} break; case 142: /* Line 1455 of yacc.c */ #line 730 "surface.yy" { CM->addStatement(lexerBubble); ;} break; case 143: /* Line 1455 of yacc.c */ #line 732 "surface.yy" { lexBubble(BAR_COLON, 1); ;} break; case 144: /* Line 1455 of yacc.c */ #line 733 "surface.yy" { Token::peelParens(lexerBubble); CM->addOpDecl(lexerBubble); ;} break; case 145: /* Line 1455 of yacc.c */ #line 734 "surface.yy" { CM->setFlag(SymbolType::MESSAGE); ;} break; case 146: /* Line 1455 of yacc.c */ #line 737 "surface.yy" { CM->setFlag(SymbolType::MESSAGE); ;} break; case 147: /* Line 1455 of yacc.c */ #line 742 "surface.yy" { ;} break; case 148: /* Line 1455 of yacc.c */ #line 745 "surface.yy" { ;} break; case 149: /* Line 1455 of yacc.c */ #line 748 "surface.yy" { clear(); ;} break; case 150: /* Line 1455 of yacc.c */ #line 749 "surface.yy" { CM->addSubsortDecl(tokenSequence); ;} break; case 151: /* Line 1455 of yacc.c */ #line 752 "surface.yy" { // // Fix things that might be in a bad state due // to a partially processed declaration. // cleanUpModuleExpression(); CM->makeOpDeclsConsistent(); ;} break; case 152: /* Line 1455 of yacc.c */ #line 762 "surface.yy" {;} break; case 153: /* Line 1455 of yacc.c */ #line 763 "surface.yy" {;} break; case 156: /* Line 1455 of yacc.c */ #line 771 "surface.yy" { ;} break; case 157: /* Line 1455 of yacc.c */ #line 775 "surface.yy" { currentSyntaxContainer->addVarDecl((yyvsp[(2) - (2)].yyToken)); ;} break; case 158: /* Line 1455 of yacc.c */ #line 776 "surface.yy" { currentSyntaxContainer->addVarDecl((yyvsp[(1) - (1)].yyToken)); ;} break; case 161: /* Line 1455 of yacc.c */ #line 783 "surface.yy" { singleton[0] = (yyvsp[(1) - (1)].yyToken); CM->addOpDecl(singleton); ;} break; case 162: /* Line 1455 of yacc.c */ #line 784 "surface.yy" { CM->addOpDecl(lexerBubble); ;} break; case 165: /* Line 1455 of yacc.c */ #line 790 "surface.yy" { IssueWarning(LineNumber(lineNumber) << ": missing " << QUOTE("->") << " in constant declaration."); ;} break; case 166: /* Line 1455 of yacc.c */ #line 797 "surface.yy" { IssueWarning(LineNumber((yyvsp[(1) - (1)].yyToken).lineNumber()) << ": skipping stray " << QUOTE(":") << " in operator declaration."); ;} break; case 169: /* Line 1455 of yacc.c */ #line 807 "surface.yy" { IssueWarning(LineNumber((yyvsp[(1) - (1)].yyToken).lineNumber()) << ": missing " << QUOTE("->") << " in operator declaration."); ;} break; case 170: /* Line 1455 of yacc.c */ #line 812 "surface.yy" { IssueWarning(LineNumber((yyvsp[(1) - (1)].yyToken).lineNumber()) << ": missing " << QUOTE("->") << " in operator declaration."); ;} break; case 171: /* Line 1455 of yacc.c */ #line 819 "surface.yy" { if ((yyvsp[(1) - (2)].yyBool)) CM->convertSortsToKinds(); ;} break; case 173: /* Line 1455 of yacc.c */ #line 826 "surface.yy" {;} break; case 174: /* Line 1455 of yacc.c */ #line 829 "surface.yy" { (yyval.yyBool) = false; ;} break; case 175: /* Line 1455 of yacc.c */ #line 830 "surface.yy" { (yyval.yyBool) = true; ;} break; case 178: /* Line 1455 of yacc.c */ #line 838 "surface.yy" { singleton[0] = (yyvsp[(1) - (1)].yyToken); currentSyntaxContainer->addType(false, singleton); ;} break; case 179: /* Line 1455 of yacc.c */ #line 842 "surface.yy" { clear(); ;} break; case 180: /* Line 1455 of yacc.c */ #line 844 "surface.yy" { currentSyntaxContainer->addType(true, tokenSequence); ;} break; case 181: /* Line 1455 of yacc.c */ #line 849 "surface.yy" { store((yyvsp[(3) - (3)].yyToken)); ;} break; case 182: /* Line 1455 of yacc.c */ #line 850 "surface.yy" { store((yyvsp[(1) - (1)].yyToken)); ;} break; case 183: /* Line 1455 of yacc.c */ #line 853 "surface.yy" {;} break; case 187: /* Line 1455 of yacc.c */ #line 862 "surface.yy" { CM->setFlag(SymbolType::LEFT_ID | SymbolType::RIGHT_ID); ;} break; case 188: /* Line 1455 of yacc.c */ #line 866 "surface.yy" { CM->setFlag(SymbolType::LEFT_ID); ;} break; case 189: /* Line 1455 of yacc.c */ #line 870 "surface.yy" { CM->setFlag(SymbolType::RIGHT_ID); ;} break; case 190: /* Line 1455 of yacc.c */ #line 876 "surface.yy" { CM->setFlag(SymbolType::ASSOC); ;} break; case 191: /* Line 1455 of yacc.c */ #line 880 "surface.yy" { CM->setFlag(SymbolType::COMM); ;} break; case 192: /* Line 1455 of yacc.c */ #line 883 "surface.yy" { lexBubble(BAR_RIGHT_BRACKET | BAR_OP_ATTRIBUTE, 1); ;} break; case 193: /* Line 1455 of yacc.c */ #line 884 "surface.yy" { CM->setIdentity(lexerBubble); ;} break; case 194: /* Line 1455 of yacc.c */ #line 886 "surface.yy" { CM->setFlag(SymbolType::IDEM); ;} break; case 195: /* Line 1455 of yacc.c */ #line 890 "surface.yy" { CM->setFlag(SymbolType::ITER); ;} break; case 196: /* Line 1455 of yacc.c */ #line 893 "surface.yy" { CM->setPrec((yyvsp[(2) - (2)].yyToken)); ;} break; case 197: /* Line 1455 of yacc.c */ #line 894 "surface.yy" { clear(); ;} break; case 198: /* Line 1455 of yacc.c */ #line 895 "surface.yy" { CM->setGather(tokenSequence); ;} break; case 199: /* Line 1455 of yacc.c */ #line 896 "surface.yy" { clear(); ;} break; case 200: /* Line 1455 of yacc.c */ #line 897 "surface.yy" { CM->setFormat(tokenSequence); ;} break; case 201: /* Line 1455 of yacc.c */ #line 898 "surface.yy" { clear(); ;} break; case 202: /* Line 1455 of yacc.c */ #line 899 "surface.yy" { CM->setStrat(tokenSequence); ;} break; case 203: /* Line 1455 of yacc.c */ #line 900 "surface.yy" { clear(); ;} break; case 204: /* Line 1455 of yacc.c */ #line 901 "surface.yy" { CM->setPoly(tokenSequence); ;} break; case 205: /* Line 1455 of yacc.c */ #line 903 "surface.yy" { CM->setFlag(SymbolType::MEMO); ;} break; case 206: /* Line 1455 of yacc.c */ #line 907 "surface.yy" { CM->setFlag(SymbolType::CTOR); ;} break; case 207: /* Line 1455 of yacc.c */ #line 911 "surface.yy" { clear(); CM->setFrozen(tokenSequence); ;} break; case 208: /* Line 1455 of yacc.c */ #line 915 "surface.yy" { clear(); ;} break; case 209: /* Line 1455 of yacc.c */ #line 916 "surface.yy" { CM->setFrozen(tokenSequence); ;} break; case 210: /* Line 1455 of yacc.c */ #line 918 "surface.yy" { CM->setFlag(SymbolType::CONFIG); ;} break; case 211: /* Line 1455 of yacc.c */ #line 922 "surface.yy" { CM->setFlag(SymbolType::OBJECT); ;} break; case 212: /* Line 1455 of yacc.c */ #line 926 "surface.yy" { CM->setFlag(SymbolType::MESSAGE); ;} break; case 213: /* Line 1455 of yacc.c */ #line 930 "surface.yy" { CM->setMetadata((yyvsp[(2) - (2)].yyToken)); ;} break; case 214: /* Line 1455 of yacc.c */ #line 933 "surface.yy" { lexerLatexMode(); ;} break; case 215: /* Line 1455 of yacc.c */ #line 934 "surface.yy" { CM->setLatexMacro((yyvsp[(4) - (5)].yyString)); ;} break; case 216: /* Line 1455 of yacc.c */ #line 935 "surface.yy" {;} break; case 217: /* Line 1455 of yacc.c */ #line 937 "surface.yy" { CM->setFlag(SymbolType::DITTO); ;} break; case 220: /* Line 1455 of yacc.c */ #line 950 "surface.yy" { store((yyvsp[(2) - (2)].yyToken)); ;} break; case 221: /* Line 1455 of yacc.c */ #line 951 "surface.yy" { store((yyvsp[(1) - (1)].yyToken)); ;} break; case 224: /* Line 1455 of yacc.c */ #line 958 "surface.yy" { clear(); CM->addHook(SyntacticPreModule::ID_HOOK, (yyvsp[(2) - (2)].yyToken), tokenSequence); ;} break; case 225: /* Line 1455 of yacc.c */ #line 959 "surface.yy" { CM->addHook(SyntacticPreModule::ID_HOOK, (yyvsp[(2) - (3)].yyToken), lexerBubble); ;} break; case 226: /* Line 1455 of yacc.c */ #line 960 "surface.yy" { CM->addHook(SyntacticPreModule::OP_HOOK, (yyvsp[(2) - (3)].yyToken), lexerBubble); ;} break; case 227: /* Line 1455 of yacc.c */ #line 961 "surface.yy" { CM->addHook(SyntacticPreModule::TERM_HOOK, (yyvsp[(2) - (3)].yyToken), lexerBubble); ;} break; case 228: /* Line 1455 of yacc.c */ #line 967 "surface.yy" {;} break; case 229: /* Line 1455 of yacc.c */ #line 969 "surface.yy" { IssueWarning(LineNumber(lineNumber) << ": missing " << QUOTE("is") << " keyword."); ;} break; case 230: /* Line 1455 of yacc.c */ #line 975 "surface.yy" {;} break; case 231: /* Line 1455 of yacc.c */ #line 977 "surface.yy" { IssueWarning(LineNumber(lineNumber) << ": missing period."); ;} break; case 232: /* Line 1455 of yacc.c */ #line 985 "surface.yy" { store((yyvsp[(2) - (2)].yyToken)); ;} break; case 234: /* Line 1455 of yacc.c */ #line 989 "surface.yy" { store((yyvsp[(2) - (2)].yyToken)); ;} break; case 235: /* Line 1455 of yacc.c */ #line 990 "surface.yy" { store((yyvsp[(2) - (2)].yyToken)); ;} break; case 236: /* Line 1455 of yacc.c */ #line 991 "surface.yy" { store((yyvsp[(1) - (1)].yyToken)); ;} break; case 237: /* Line 1455 of yacc.c */ #line 992 "surface.yy" { store((yyvsp[(4) - (4)].yyToken)); ;} break; case 238: /* Line 1455 of yacc.c */ #line 999 "surface.yy" { Token t; if (fragments.size() == 1) t = fragments[0]; else t.tokenize(Token::bubbleToPrefixNameCode(fragments), fragments[0].lineNumber()); fragClear(); (yyval.yyToken) = t; ;} break; case 239: /* Line 1455 of yacc.c */ #line 1010 "surface.yy" { fragStore((yyvsp[(1) - (1)].yyToken)); ;} break; case 240: /* Line 1455 of yacc.c */ #line 1011 "surface.yy" { fragStore((yyvsp[(2) - (2)].yyToken)); ;} break; case 241: /* Line 1455 of yacc.c */ #line 1012 "surface.yy" { fragStore((yyvsp[(5) - (5)].yyToken)); ;} break; case 242: /* Line 1455 of yacc.c */ #line 1015 "surface.yy" { fragStore((yyvsp[(2) - (2)].yyToken)); ;} break; case 243: /* Line 1455 of yacc.c */ #line 1016 "surface.yy" {;} break; case 244: /* Line 1455 of yacc.c */ #line 1017 "surface.yy" {;} break; case 347: /* Line 1455 of yacc.c */ #line 1097 "surface.yy" { lexBubble(END_COMMAND, 1) ;} break; case 348: /* Line 1455 of yacc.c */ #line 1099 "surface.yy" { interpreter.setCurrentModule(lexerBubble); ;} break; case 349: /* Line 1455 of yacc.c */ #line 1102 "surface.yy" { lexBubble(END_COMMAND, 1) ;} break; case 350: /* Line 1455 of yacc.c */ #line 1104 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) CM->dump(); ;} break; case 351: /* Line 1455 of yacc.c */ #line 1109 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); ;} break; case 352: /* Line 1455 of yacc.c */ #line 1114 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.parse(lexerBubble); ;} break; case 353: /* Line 1455 of yacc.c */ #line 1121 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); ;} break; case 354: /* Line 1455 of yacc.c */ #line 1126 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.creduce(lexerBubble); ;} break; case 355: /* Line 1455 of yacc.c */ #line 1133 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); ;} break; case 356: /* Line 1455 of yacc.c */ #line 1138 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.sreduce(lexerBubble); ;} break; case 357: /* Line 1455 of yacc.c */ #line 1145 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); ;} break; case 358: /* Line 1455 of yacc.c */ #line 1150 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.reduce(lexerBubble, (yyvsp[(1) - (4)].yyBool)); ;} break; case 359: /* Line 1455 of yacc.c */ #line 1157 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; ;} break; case 360: /* Line 1455 of yacc.c */ #line 1163 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.rewrite(lexerBubble, number, (yyvsp[(1) - (4)].yyBool)); ;} break; case 361: /* Line 1455 of yacc.c */ #line 1169 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; number2 = NONE; ;} break; case 362: /* Line 1455 of yacc.c */ #line 1176 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.eRewrite(lexerBubble, number, number2, (yyvsp[(1) - (4)].yyBool)); ;} break; case 363: /* Line 1455 of yacc.c */ #line 1182 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; number2 = NONE; ;} break; case 364: /* Line 1455 of yacc.c */ #line 1189 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.fRewrite(lexerBubble, number, number2, (yyvsp[(1) - (4)].yyBool)); ;} break; case 365: /* Line 1455 of yacc.c */ #line 1195 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; ;} break; case 366: /* Line 1455 of yacc.c */ #line 1201 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.sRewrite(lexerBubble, number, (yyvsp[(1) - (4)].yyBool)); ;} break; case 367: /* Line 1455 of yacc.c */ #line 1207 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; number2 = NONE; ;} break; case 368: /* Line 1455 of yacc.c */ #line 1214 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.search(lexerBubble, number, number2, (yyvsp[(1) - (3)].yySearchKind)); ;} break; case 369: /* Line 1455 of yacc.c */ #line 1220 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; ;} break; case 370: /* Line 1455 of yacc.c */ #line 1226 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.match(lexerBubble, (yyvsp[(1) - (3)].yyBool), number); ;} break; case 371: /* Line 1455 of yacc.c */ #line 1232 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); number = NONE; ;} break; case 372: /* Line 1455 of yacc.c */ #line 1238 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.unify(lexerBubble, number); ;} break; case 373: /* Line 1455 of yacc.c */ #line 1244 "surface.yy" { interpreter.cont((yyvsp[(3) - (4)].yyInt64), (yyvsp[(1) - (4)].yyBool)); ;} break; case 374: /* Line 1455 of yacc.c */ #line 1248 "surface.yy" { lexerCmdMode(); moduleExpr.contractTo(0); ;} break; case 375: /* Line 1455 of yacc.c */ #line 1253 "surface.yy" { lexerInitialMode(); if (interpreter.setCurrentModule(moduleExpr, 1)) interpreter.loop(lexerBubble); ;} break; case 376: /* Line 1455 of yacc.c */ #line 1259 "surface.yy" { moduleExpr.contractTo(0); if (interpreter.setCurrentModule(moduleExpr)) // HACK interpreter.contLoop(lexerBubble); ;} break; case 377: /* Line 1455 of yacc.c */ #line 1264 "surface.yy" { lexerCmdMode(); ;} break; case 378: /* Line 1455 of yacc.c */ #line 1266 "surface.yy" { lexerInitialMode(); interpreter.traceSelect((yyvsp[(2) - (4)].yyBool)); ;} break; case 379: /* Line 1455 of yacc.c */ #line 1270 "surface.yy" { lexerCmdMode(); ;} break; case 380: /* Line 1455 of yacc.c */ #line 1272 "surface.yy" { lexerInitialMode(); interpreter.traceExclude((yyvsp[(2) - (4)].yyBool)); ;} break; case 381: /* Line 1455 of yacc.c */ #line 1276 "surface.yy" { lexerCmdMode(); ;} break; case 382: /* Line 1455 of yacc.c */ #line 1278 "surface.yy" { lexerInitialMode(); interpreter.breakSelect((yyvsp[(2) - (4)].yyBool)); ;} break; case 383: /* Line 1455 of yacc.c */ #line 1282 "surface.yy" { lexerCmdMode(); ;} break; case 384: /* Line 1455 of yacc.c */ #line 1284 "surface.yy" { lexerInitialMode(); interpreter.printConceal((yyvsp[(2) - (4)].yyBool)); ;} break; case 385: /* Line 1455 of yacc.c */ #line 1289 "surface.yy" { if (CM != 0) // HACK CM->getFlatSignature()->clearMemo(); ;} break; case 386: /* Line 1455 of yacc.c */ #line 1296 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 387: /* Line 1455 of yacc.c */ #line 1298 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) CM->showModule(); ;} break; case 388: /* Line 1455 of yacc.c */ #line 1302 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 389: /* Line 1455 of yacc.c */ #line 1304 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) CM->showModule(); ;} break; case 390: /* Line 1455 of yacc.c */ #line 1308 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 391: /* Line 1455 of yacc.c */ #line 1310 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showModule(true); ;} break; case 392: /* Line 1455 of yacc.c */ #line 1314 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 393: /* Line 1455 of yacc.c */ #line 1316 "surface.yy" { if (interpreter.setCurrentView(lexerBubble)) interpreter.showView(); ;} break; case 394: /* Line 1455 of yacc.c */ #line 1321 "surface.yy" { interpreter.showModules(true); ;} break; case 395: /* Line 1455 of yacc.c */ #line 1325 "surface.yy" { interpreter.showNamedViews(); ;} break; case 396: /* Line 1455 of yacc.c */ #line 1328 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 397: /* Line 1455 of yacc.c */ #line 1330 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showSortsAndSubsorts(); ;} break; case 398: /* Line 1455 of yacc.c */ #line 1334 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 399: /* Line 1455 of yacc.c */ #line 1336 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showOps(); ;} break; case 400: /* Line 1455 of yacc.c */ #line 1340 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 401: /* Line 1455 of yacc.c */ #line 1342 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showVars(); ;} break; case 402: /* Line 1455 of yacc.c */ #line 1346 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 403: /* Line 1455 of yacc.c */ #line 1348 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showMbs(); ;} break; case 404: /* Line 1455 of yacc.c */ #line 1352 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 405: /* Line 1455 of yacc.c */ #line 1354 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showEqs(); ;} break; case 406: /* Line 1455 of yacc.c */ #line 1358 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 407: /* Line 1455 of yacc.c */ #line 1360 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showRls(); ;} break; case 408: /* Line 1455 of yacc.c */ #line 1364 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 409: /* Line 1455 of yacc.c */ #line 1366 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showSummary(); ;} break; case 410: /* Line 1455 of yacc.c */ #line 1370 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 411: /* Line 1455 of yacc.c */ #line 1372 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showKinds(); ;} break; case 412: /* Line 1455 of yacc.c */ #line 1377 "surface.yy" { interpreter.showSearchPath((yyvsp[(3) - (4)].yyInt64)); ;} break; case 413: /* Line 1455 of yacc.c */ #line 1381 "surface.yy" { interpreter.showSearchPathLabels((yyvsp[(4) - (5)].yyInt64)); ;} break; case 414: /* Line 1455 of yacc.c */ #line 1385 "surface.yy" { interpreter.showSearchGraph(); ;} break; case 415: /* Line 1455 of yacc.c */ #line 1388 "surface.yy" { lexBubble(END_COMMAND, 0); ;} break; case 416: /* Line 1455 of yacc.c */ #line 1390 "surface.yy" { if (interpreter.setCurrentModule(lexerBubble)) interpreter.showProfile(); ;} break; case 417: /* Line 1455 of yacc.c */ #line 1398 "surface.yy" { globalAdvisoryFlag = (yyvsp[(4) - (5)].yyBool); ;} break; case 418: /* Line 1455 of yacc.c */ #line 1402 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_STATS, (yyvsp[(4) - (5)].yyBool)); ;} break; case 419: /* Line 1455 of yacc.c */ #line 1406 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_LOOP_STATS, (yyvsp[(5) - (6)].yyBool)); ;} break; case 420: /* Line 1455 of yacc.c */ #line 1410 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_TIMING, (yyvsp[(4) - (5)].yyBool)); ;} break; case 421: /* Line 1455 of yacc.c */ #line 1414 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_BREAKDOWN, (yyvsp[(4) - (5)].yyBool)); ;} break; case 422: /* Line 1455 of yacc.c */ #line 1418 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_LOOP_TIMING, (yyvsp[(5) - (6)].yyBool)); ;} break; case 423: /* Line 1455 of yacc.c */ #line 1422 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_COMMAND, (yyvsp[(4) - (5)].yyBool)); ;} break; case 424: /* Line 1455 of yacc.c */ #line 1426 "surface.yy" { MemoryCell::setShowGC((yyvsp[(4) - (5)].yyBool)); ;} break; case 425: /* Line 1455 of yacc.c */ #line 1430 "surface.yy" { interpreter.setPrintFlag((yyvsp[(3) - (5)].yyPrintFlags), (yyvsp[(4) - (5)].yyBool)); ;} break; case 426: /* Line 1455 of yacc.c */ #line 1434 "surface.yy" { interpreter.setFlag(Interpreter::PRINT_ATTRIBUTE, (yyvsp[(4) - (5)].yyBool)); ;} break; case 427: /* Line 1455 of yacc.c */ #line 1438 "surface.yy" { interpreter.setFlag(Interpreter::PRINT_ATTRIBUTE_NEWLINE, (yyvsp[(5) - (6)].yyBool)); ;} break; case 428: /* Line 1455 of yacc.c */ #line 1442 "surface.yy" { interpreter.setFlag((yyvsp[(3) - (5)].yyFlags), (yyvsp[(4) - (5)].yyBool)); ;} break; case 429: /* Line 1455 of yacc.c */ #line 1446 "surface.yy" { interpreter.setFlag(Interpreter::BREAK, (yyvsp[(3) - (4)].yyBool)); ;} break; case 430: /* Line 1455 of yacc.c */ #line 1449 "surface.yy" { lexerCmdMode(); ;} break; case 431: /* Line 1455 of yacc.c */ #line 1450 "surface.yy" { lexerInitialMode(); ;} break; case 432: /* Line 1455 of yacc.c */ #line 1452 "surface.yy" { interpreter.setAutoImport((yyvsp[(2) - (7)].yyImportMode), (yyvsp[(4) - (7)].yyToken), (yyvsp[(6) - (7)].yyBool)); ;} break; case 433: /* Line 1455 of yacc.c */ #line 1455 "surface.yy" { lexerCmdMode(); ;} break; case 434: /* Line 1455 of yacc.c */ #line 1456 "surface.yy" { lexerInitialMode(); ;} break; case 435: /* Line 1455 of yacc.c */ #line 1458 "surface.yy" { interpreter.setOmodInclude((yyvsp[(5) - (8)].yyToken), (yyvsp[(7) - (8)].yyBool)); ;} break; case 436: /* Line 1455 of yacc.c */ #line 1462 "surface.yy" { globalVerboseFlag = (yyvsp[(3) - (4)].yyBool); ;} break; case 437: /* Line 1455 of yacc.c */ #line 1466 "surface.yy" { interpreter.setFlag(Interpreter::AUTO_CLEAR_MEMO, (yyvsp[(4) - (5)].yyBool)); ;} break; case 438: /* Line 1455 of yacc.c */ #line 1470 "surface.yy" { interpreter.setFlag(Interpreter::AUTO_CLEAR_RULES, (yyvsp[(4) - (5)].yyBool)); ;} break; case 439: /* Line 1455 of yacc.c */ #line 1474 "surface.yy" { interpreter.setFlag(Interpreter::COMPILE_COUNT, (yyvsp[(4) - (5)].yyBool)); ;} break; case 440: /* Line 1455 of yacc.c */ #line 1478 "surface.yy" { interpreter.setFlag(Interpreter::PROFILE, (yyvsp[(3) - (4)].yyBool)); ;} break; case 441: /* Line 1455 of yacc.c */ #line 1482 "surface.yy" { interpreter.setFlag(Interpreter::AUTO_CLEAR_PROFILE, (yyvsp[(4) - (5)].yyBool)); ;} break; case 442: /* Line 1455 of yacc.c */ #line 1489 "surface.yy" { PARSE_RESULT = UserLevelRewritingContext::RESUME; ;} break; case 443: /* Line 1455 of yacc.c */ #line 1493 "surface.yy" { PARSE_RESULT = UserLevelRewritingContext::ABORT; ;} break; case 444: /* Line 1455 of yacc.c */ #line 1497 "surface.yy" { PARSE_RESULT = UserLevelRewritingContext::STEP; ;} break; case 445: /* Line 1455 of yacc.c */ #line 1501 "surface.yy" { PARSE_RESULT = UserLevelRewritingContext::WHERE; ;} break; case 446: /* Line 1455 of yacc.c */ #line 1508 "surface.yy" { MemoryCell::setShowGC((yyvsp[(4) - (5)].yyBool)); ;} break; case 447: /* Line 1455 of yacc.c */ #line 1512 "surface.yy" { interpreter.setFlag(Interpreter::SHOW_STATS, (yyvsp[(3) - (4)].yyBool)); ;} break; case 448: /* Line 1455 of yacc.c */ #line 1518 "surface.yy" { lexerInitialMode(); ;} break; case 450: /* Line 1455 of yacc.c */ #line 1525 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_MIXFIX; ;} break; case 451: /* Line 1455 of yacc.c */ #line 1526 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_FLAT; ;} break; case 452: /* Line 1455 of yacc.c */ #line 1527 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_WITH_ALIASES; ;} break; case 453: /* Line 1455 of yacc.c */ #line 1528 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_WITH_PARENS; ;} break; case 454: /* Line 1455 of yacc.c */ #line 1529 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_GRAPH; ;} break; case 455: /* Line 1455 of yacc.c */ #line 1530 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_CONCEAL; ;} break; case 456: /* Line 1455 of yacc.c */ #line 1531 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_NUMBER; ;} break; case 457: /* Line 1455 of yacc.c */ #line 1532 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_RAT; ;} break; case 458: /* Line 1455 of yacc.c */ #line 1533 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_COLOR; ;} break; case 459: /* Line 1455 of yacc.c */ #line 1534 "surface.yy" { (yyval.yyPrintFlags) = Interpreter::PRINT_FORMAT; ;} break; case 460: /* Line 1455 of yacc.c */ #line 1537 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE; ;} break; case 461: /* Line 1455 of yacc.c */ #line 1538 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_CONDITION; ;} break; case 462: /* Line 1455 of yacc.c */ #line 1539 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_WHOLE; ;} break; case 463: /* Line 1455 of yacc.c */ #line 1540 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_SUBSTITUTION; ;} break; case 464: /* Line 1455 of yacc.c */ #line 1541 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_SELECT; ;} break; case 465: /* Line 1455 of yacc.c */ #line 1542 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_MB; ;} break; case 466: /* Line 1455 of yacc.c */ #line 1543 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_EQ; ;} break; case 467: /* Line 1455 of yacc.c */ #line 1544 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_RL; ;} break; case 468: /* Line 1455 of yacc.c */ #line 1545 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_REWRITE; ;} break; case 469: /* Line 1455 of yacc.c */ #line 1546 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_BODY; ;} break; case 470: /* Line 1455 of yacc.c */ #line 1547 "surface.yy" { (yyval.yyFlags) = Interpreter::TRACE_BUILTIN; ;} break; case 471: /* Line 1455 of yacc.c */ #line 1550 "surface.yy" { (yyval.yyBool) = true; ;} break; case 472: /* Line 1455 of yacc.c */ #line 1551 "surface.yy" { (yyval.yyBool) = false; ;} break; case 473: /* Line 1455 of yacc.c */ #line 1554 "surface.yy" { (yyval.yyBool) = true; ;} break; case 474: /* Line 1455 of yacc.c */ #line 1555 "surface.yy" { (yyval.yyBool) = false; ;} break; case 475: /* Line 1455 of yacc.c */ #line 1558 "surface.yy" { (yyval.yyBool) = true; ;} break; case 476: /* Line 1455 of yacc.c */ #line 1559 "surface.yy" { (yyval.yyBool) = false; ;} break; case 477: /* Line 1455 of yacc.c */ #line 1562 "surface.yy" { (yyval.yyBool) = true; ;} break; case 478: /* Line 1455 of yacc.c */ #line 1563 "surface.yy" { (yyval.yyBool) = false; ;} break; case 479: /* Line 1455 of yacc.c */ #line 1568 "surface.yy" { (yyval.yySearchKind) = Interpreter::NARROW; ;} break; case 480: /* Line 1455 of yacc.c */ #line 1569 "surface.yy" { (yyval.yySearchKind) = Interpreter::XG_NARROW; ;} break; case 481: /* Line 1455 of yacc.c */ #line 1570 "surface.yy" { (yyval.yySearchKind) = Interpreter::SEARCH; ;} break; case 482: /* Line 1455 of yacc.c */ #line 1573 "surface.yy" { (yyval.yyBool) = true; ;} break; case 483: /* Line 1455 of yacc.c */ #line 1574 "surface.yy" { (yyval.yyBool) = false; ;} break; case 484: /* Line 1455 of yacc.c */ #line 1577 "surface.yy" { (yyval.yyBool) = true; ;} break; case 485: /* Line 1455 of yacc.c */ #line 1578 "surface.yy" { (yyval.yyBool) = false; ;} break; case 486: /* Line 1455 of yacc.c */ #line 1581 "surface.yy" { (yyval.yyInt64) = (yyvsp[(1) - (1)].yyInt64); ;} break; case 487: /* Line 1455 of yacc.c */ #line 1582 "surface.yy" { (yyval.yyInt64) = NONE; ;} break; case 488: /* Line 1455 of yacc.c */ #line 1585 "surface.yy" { (yyval.yyImportMode) = ImportModule::PROTECTING; ;} break; case 489: /* Line 1455 of yacc.c */ #line 1586 "surface.yy" { (yyval.yyImportMode) = ImportModule::EXTENDING; ;} break; case 490: /* Line 1455 of yacc.c */ #line 1587 "surface.yy" { (yyval.yyImportMode) = ImportModule::INCLUDING; ;} break; case 492: /* Line 1455 of yacc.c */ #line 1597 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 494: /* Line 1455 of yacc.c */ #line 1601 "surface.yy" { moduleExpr = lexerBubble; lexBubble(END_COMMAND, 1); ;} break; case 497: /* Line 1455 of yacc.c */ #line 1613 "surface.yy" { lexSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 500: /* Line 1455 of yacc.c */ #line 1616 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 502: /* Line 1455 of yacc.c */ #line 1621 "surface.yy" { lexContinueSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 504: /* Line 1455 of yacc.c */ #line 1623 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 507: /* Line 1455 of yacc.c */ #line 1629 "surface.yy" { number = Token::codeToInt64(lexerBubble[1].code()); ;} break; case 509: /* Line 1455 of yacc.c */ #line 1631 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 512: /* Line 1455 of yacc.c */ #line 1646 "surface.yy" { lexSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 515: /* Line 1455 of yacc.c */ #line 1649 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 517: /* Line 1455 of yacc.c */ #line 1658 "surface.yy" { lexContinueSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 519: /* Line 1455 of yacc.c */ #line 1660 "surface.yy" { lexContinueSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 521: /* Line 1455 of yacc.c */ #line 1662 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 524: /* Line 1455 of yacc.c */ #line 1672 "surface.yy" { number = Token::codeToInt64(lexerBubble[1].code()); ;} break; case 526: /* Line 1455 of yacc.c */ #line 1674 "surface.yy" { lexContinueSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 528: /* Line 1455 of yacc.c */ #line 1676 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 531: /* Line 1455 of yacc.c */ #line 1686 "surface.yy" { lexContinueSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 533: /* Line 1455 of yacc.c */ #line 1688 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 536: /* Line 1455 of yacc.c */ #line 1699 "surface.yy" { number = Token::codeToInt64(lexerBubble[1].code()); number2 = Token::codeToInt64(lexerBubble[3].code()); clear(); ;} break; case 538: /* Line 1455 of yacc.c */ #line 1705 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 541: /* Line 1455 of yacc.c */ #line 1715 "surface.yy" { lexContinueSave((yyvsp[(1) - (1)].yyToken)); ;} break; case 543: /* Line 1455 of yacc.c */ #line 1717 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 546: /* Line 1455 of yacc.c */ #line 1727 "surface.yy" { number2 = Token::codeToInt64(lexerBubble[2].code()); ;} break; case 548: /* Line 1455 of yacc.c */ #line 1729 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0); ;} break; case 551: /* Line 1455 of yacc.c */ #line 1734 "surface.yy" { lexContinueBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 0, 1); ;} break; case 554: /* Line 1455 of yacc.c */ #line 1740 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), END_COMMAND, 1, 1); ;} break; case 556: /* Line 1455 of yacc.c */ #line 1742 "surface.yy" { lexBubble((yyvsp[(1) - (1)].yyToken), BAR_COLON | END_COMMAND, 0); ;} break; case 558: /* Line 1455 of yacc.c */ #line 1745 "surface.yy" { lexerBubble.resize(1); lexerBubble[0].dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(lexerBubble[0]); ;} break; case 596: /* Line 1455 of yacc.c */ #line 1784 "surface.yy" {;} break; case 598: /* Line 1455 of yacc.c */ #line 1789 "surface.yy" { singleton[0].dropChar((yyvsp[(1) - (1)].yyToken)); missingSpace(singleton[0]); interpreter.addSelected(singleton); ;} break; case 601: /* Line 1455 of yacc.c */ #line 1800 "surface.yy" { singleton[0] = (yyvsp[(1) - (1)].yyToken); interpreter.addSelected(singleton); ;} break; case 602: /* Line 1455 of yacc.c */ #line 1805 "surface.yy" { interpreter.addSelected(lexerBubble); ;} break; /* Line 1455 of yacc.c */ #line 5899 "surface.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 1675 of yacc.c */ #line 1835 "surface.yy" static void yyerror(char *s) { if (!(UserLevelRewritingContext::interrupted())) IssueWarning(LineNumber(lineNumber) << ": " << s); } void cleanUpModuleExpression() { // // Delete pieces of a partly built module expression. // delete currentRenaming; currentRenaming = 0; while (!moduleExpressions.empty()) { moduleExpressions.top()->deepSelfDestruct(); moduleExpressions.pop(); } } void cleanUpParser() { interpreter.makeClean(lineNumber); } void missingSpace(const Token& token) { IssueWarning(LineNumber(token.lineNumber()) << ": missing space between " << QUOTE(token) << " and period."); } Maude-2.6/src/Mixfix/quotedIdentifierTerm.cc0000644000147300135640000000573210505101671016046 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class QuotedIdentifierTerm. // // utility stuff #include "macros.hh" #include "vector.hh" #include "stringTable.hh" // forward declarations #include "interface.hh" #include "core.hh" #include "NA_Theory.hh" #include "mixfix.hh" // interface class definitions #include "symbol.hh" #include "dagNode.hh" #include "term.hh" // core class definitions #include "symbolMap.hh" // front end class definitions #include "quotedIdentifierSymbol.hh" #include "quotedIdentifierTerm.hh" #include "quotedIdentifierDagNode.hh" #include "token.hh" QuotedIdentifierTerm::QuotedIdentifierTerm(QuotedIdentifierSymbol* symbol, int idIndex) : NA_Term(symbol), idIndex(idIndex) { } Term* QuotedIdentifierTerm::deepCopy2(SymbolMap* map) const { return new QuotedIdentifierTerm(static_cast(map == 0 ? symbol() : map->translate(symbol())), idIndex); } Term* QuotedIdentifierTerm::instantiate2(const Vector& varBindings, SymbolMap* translator) { return new QuotedIdentifierTerm(safeCast(QuotedIdentifierSymbol*, translator->findTargetVersionOfSymbol(symbol())), idIndex); } Term* QuotedIdentifierTerm::normalize(bool /* full */, bool& changed) { changed = false; setHashValue(hash(symbol()->getHashValue(), idIndex)); return this; } int QuotedIdentifierTerm::compareArguments(const Term* other) const { int otherIndex = static_cast(other)->idIndex; if (idIndex == otherIndex) return 0; return strcmp(Token::name(idIndex), Token::name(otherIndex)); } int QuotedIdentifierTerm::compareArguments(const DagNode* other) const { int otherIndex = static_cast(other)->getIdIndex(); if (idIndex == otherIndex) return 0; return strcmp(Token::name(idIndex), Token::name(otherIndex)); } void QuotedIdentifierTerm::overwriteWithDagNode(DagNode* old) const { (void) new(old) QuotedIdentifierDagNode(static_cast(symbol()), idIndex); } NA_DagNode* QuotedIdentifierTerm::makeDagNode() const { return new QuotedIdentifierDagNode(static_cast(symbol()), idIndex); } Maude-2.6/src/Mixfix/importTranslation.hh0000644000147300135640000000522711404310733015454 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to translate symbols from imported module to importing module. // #ifndef _importTranslation_hh_ #define _importTranslation_hh_ #include #include "symbolMap.hh" #include "pointerMap.hh" class ImportTranslation : public SymbolMap { NO_COPYING(ImportTranslation); public: ImportTranslation(ImportModule* target, Renaming* renaming = 0); void push(Renaming* renaming, ImportModule* target); // // These three functions are required by our base class. // Symbol* translate(Symbol* symbol); // returns 0 to indicate op->term mapping in play Term* translateTerm(const Term* term); // handles op->term mappings on a whole term basis Symbol* findTargetVersionOfSymbol(Symbol* symbol); // // Other public functions that we provide. // Sort* translate(const Sort* sort); ConnectedComponent* translate(const ConnectedComponent* component); int translateLabel(int id); private: ImportTranslation(); // // Typically we have a list of renamings that move stuff from module to module // until we arrive at the final target module. // typedef list RenamingList; typedef list ModuleList; static ConnectedComponent* translate(Renaming* renaming, ImportModule* target, const ConnectedComponent* old); Symbol* translateRegularSymbol(Symbol* symbol, RenamingList::const_iterator& opToTerm, int& opToTermIndex) const; RenamingList renamings; ModuleList targets; PointerMap directMap; }; inline ImportTranslation::ImportTranslation() { } inline ConnectedComponent* ImportTranslation::translate(const ConnectedComponent* component) { return translate(component->sort(1))->component(); } inline void ImportTranslation::push(Renaming* renaming, ImportModule* target) { renamings.push_front(renaming); targets.push_front(target); } #endif Maude-2.6/src/Mixfix/preModule.hh0000644000147300135640000000461611147372633013673 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Abstract base class for module descriptions that can produce actual modules. // #ifndef _preModule_hh_ #define _preModule_hh_ #include "namedEntity.hh" #include "mixfixModule.hh" #include "moduleDatabase.hh" class PreModule : public NamedEntity, public Entity::User { NO_COPYING(PreModule); public: PreModule(int moduleName, Interpreter* owner); virtual ~PreModule(); Interpreter* getOwner() const; void setModuleType(MixfixModule::ModuleType type); MixfixModule::ModuleType getModuleType() const; virtual int getNrParameters() const = 0; virtual int getParameterName(int index) const = 0; virtual const ModuleExpression* getParameter(int index) const = 0; virtual const ModuleDatabase::ImportMap& getAutoImports() const = 0; virtual int getNrImports() const = 0; virtual int getImportMode(int index) const = 0; virtual const ModuleExpression* getImport(int index) const = 0; virtual VisibleModule* getFlatSignature() = 0; virtual VisibleModule* getFlatModule() = 0; private: Interpreter* const owner; MixfixModule::ModuleType moduleType; }; inline Interpreter* PreModule::getOwner() const { return owner; } inline void PreModule::setModuleType(MixfixModule::ModuleType type) { moduleType = type; } inline MixfixModule::ModuleType PreModule::getModuleType() const { return moduleType; } #ifndef NO_ASSERT inline ostream& operator<<(ostream& s, const PreModule* p) { // // Needed to avoid overload ambiguity between NamedEntity and Entity::User. // s << static_cast(p); return s; } #endif #endif Maude-2.6/src/Mixfix/maudemlBuffer.hh0000644000147300135640000000540110460030202014462 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class to generate MaudeML from Maude internal data structures. // #ifndef _maudemlBuffer_hh_ #define _maudemlBuffer_hh_ #include "xmlBuffer.hh" class MaudemlBuffer : public XmlBuffer { NO_COPYING(MaudemlBuffer); public: MaudemlBuffer(ostream& output); void generateShowSearchPath(int stateNr); void generateShowSearchGraph(); void generateReduce(DagNode* subject); void generateRewrite(DagNode* subject, Int64 limit); void generateFrewrite(DagNode* subject, Int64 limit, Int64 gas); void generateErewrite(DagNode* subject, Int64 limit, Int64 gas); void generateSearch(DagNode* subject, PreEquation* pattern, const string& searchType, Int64 limit, Int64 depth); void generateContinue(const string& command, Module* module, Int64 limit); void generateSearchResult(Int64 number, RewriteSequenceSearch* state, const Timer& timer, bool showStats, bool showTiming, bool showBreakdown); void generateSubstitution(const Substitution* substitution, const VariableInfo* varInfo); void generateAssignment(Term* variable, DagNode* value); // void generateShow(const string& item, Module* module = 0); void generate(Term* term); void generate(const ConditionFragment* c); void generate(Rule* rule); void generate(DagNode* dagNode, PointerSet* visited = 0); void generateSearchGraph(RewriteSequenceSearch* graph); void generateSearchPath(RewriteSequenceSearch* graph, int stateNr); void generateCondition(const Vector& condition); void generateResult(RewritingContext& context, const Timer& timer, bool showStats, bool showTiming, bool showBreakdown); private: static string sortString(Sort* sort); static string kindString(ConnectedComponent* kind); void generateStats(RewritingContext& context, const Timer& timer, bool showTiming, bool showBreakdown); }; #endif Maude-2.6/src/Mixfix/renaming.cc0000644000147300135640000004664511145122721013522 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class Renaming. // // utility stuff #include "macros.hh" #include "vector.hh" // forward declarations #include "core.hh" #include "interface.hh" #include "strategyLanguage.hh" #include "mixfix.hh" // interface class definitions #include "term.hh" // front end class definitions #include "token.hh" #include "syntacticPreModule.hh" #include "importModule.hh" #include "renaming.hh" void Renaming::setType(set& type, const ConnectedComponent* component) { int nrSorts = component->nrSorts(); for (int i = 1; i < nrSorts; i++) type.insert(component->sort(i)->id()); } crope Renaming::makeTypeName(const set& type) { crope name; FOR_EACH_CONST(i, set, type) { name += name.empty() ? "[" : ","; name += Token::sortName(*i); } return name + "]"; } crope Renaming::makeCanonicalName() const { crope name; { FOR_EACH_CONST(i, IdMap, sortMap) { if (!name.empty()) name += ", "; name += "sort "; name += Token::sortName(i->first); name += " to "; name += Token::sortName(i->second); } } { FOR_EACH_CONST(i, IdMap, labelMap) { if (!name.empty()) name += ", "; name += "label "; name += Token::name(i->first); name += " to "; name += Token::name(i->second); } } int nrOpMappings = opMap.size(); if (nrOpMappings > 0) { Vector opRopes(nrOpMappings); { Vector::iterator j = opRopes.begin(); FOR_EACH_CONST(i, OpMap, opMap) { *j = "op "; *j += Token::name(i->first); if (!(i->second.types.empty())) { *j += " :"; int nrArgs = i->second.types.size() - 1; for (int k = 0; k < nrArgs; k++) { *j += " "; *j += makeTypeName(i->second.types[k]); } *j += " -> "; *j += makeTypeName(i->second.types[nrArgs]); } *j += " to "; *j += Token::name(i->second.name); bool attr = false; if (i->second.prec >= MixfixModule::MIN_PREC) { *j += attr ? " " : " ["; *j += "prec "; *j += int64ToString(i->second.prec); attr = true; } if (!(i->second.gather.empty())) { *j += attr ? " " : " ["; *j += "gather "; int nrArgs = i->second.gather.size(); for (int k = 0; k < nrArgs; k++) { *j += (k == 0) ? "(" : " "; switch (i->second.gather[k]) { case MixfixModule::GATHER_AMP: { *j += '&'; break; } case MixfixModule::GATHER_E: { *j += 'E'; break; } case MixfixModule::GATHER_e: { *j += 'e'; break; } } } *j += ")"; attr = true; } if (!(i->second.format.empty())) { *j += attr ? " " : " ["; *j += "format "; int nrWords = i->second.format.size(); for (int k = 0; k < nrWords; k++) { *j += (k == 0) ? "(" : " "; *j += Token::name(i->second.format[k]); } *j += ")"; attr = true; } if (!(i->second.latexMacro.empty())) { *j += attr ? " " : " ["; *j += "latex \""; *j += i->second.latexMacro.c_str(); *j += "\""; attr = true; } if (attr) *j += "]"; ++j; } } sort(opRopes.begin(), opRopes.end()); { FOR_EACH_CONST(i, Vector, opRopes) { if (!name.empty()) name += ", "; name += *i; } } } return name; } Renaming* Renaming::makeCanonicalVersion(ImportModule* module) const { Renaming* canonical = new Renaming; { // // Prune sort mappings to those that actually occur // in the module. We do not allow sorts that come from // a parameter to be mapped. // FOR_EACH_CONST(i, IdMap, sortMap) { Sort* s = module->findSort(i->first); if (s != 0) { if (module->parameterDeclared(s)) { IssueAdvisory("Ignoring a sort mapping because sort " << QUOTE(s) << " comes from a parameter."); } else { pair p = canonical->sortMap.insert(*i); Assert(p.second, "dup sort mapping"); canonical->sortMapIndex.append(p.first); } } } } { // // Prune label mappings to those that actually occur // in the module. // const set& labels = module->getLabels(); FOR_EACH_CONST(i, IdMap, labelMap) { if (labels.find(i->first) != labels.end()) { pair p = canonical->labelMap.insert(*i); Assert(p.second, "dup label mapping"); canonical->labelMapIndex.append(p.first); } } } { IdSet genericsToConsider; // generics that affect an operator IdSet genericsToAvoid; // subset that affect an operator from a parameter { // // For each operator in the module that is not from a parameter // and would be remapped by an orginal mapping, we add a mapping // to the canonical renaming unless the mapping is a generic one // in which case we add the id to genericsToConsider. For operators // from parameter theories, if the mapping is specific we emit an // advisory otherwise we add it to both genericsToConsider and // genericsToAvoid so as to be able to generate an advisory. // const Vector symbols = module->getSymbols(); int nrUserSymbols = module->getNrUserSymbols(); for (int i = 0; i < nrUserSymbols; i++) { Symbol* symbol = symbols[i]; int id = symbol->id(); const OpMap::const_iterator e = opMap.upper_bound(id); for (OpMap::const_iterator j = opMap.lower_bound(id); j != e; ++j) { const Vector& types = j->second.types; if (module->parameterDeclared(symbol)) { if (types.empty()) { genericsToConsider.insert(id); genericsToAvoid.insert(id); } else { IssueAdvisory("Ignoring a specific op mapping because operator " << QUOTE(symbol) << " comes from a parameter."); } } else { if (types.empty()) genericsToConsider.insert(id); else { // // arity specific case // if (typeMatch(types, symbol)) { OpMap::iterator n = canonical->opMap.insert(OpMap::value_type(id, OpMapping())); int nrTypes = types.size(); n->second.types.resize(nrTypes); --nrTypes; for (int i = 0; i < nrTypes; i++) setType(n->second.types[i], symbol->domainComponent(i)); setType(n->second.types[nrTypes], symbol->rangeComponent()); n->second.name = j->second.name; n->second.term = 0; n->second.prec = j->second.prec; n->second.gather = j->second.gather; n->second.format = j->second.format; n->second.latexMacro = j->second.latexMacro; n->second.index = canonical->opMapIndex.size(); canonical->opMapIndex.append(n); } } } } } } { // // For each polymorph in the module, add its id to genericsToConsider. // If it came from a parameter, also add its id to genericsToAvoid. // int nrPolymorphs = module->getNrPolymorphs(); for (int i = 0; i < nrPolymorphs; i++) { int id = module->getPolymorphName(i).code(); genericsToConsider.insert(id); if (module->parameterDeclaredPolymorph(i)) genericsToAvoid.insert(id); } } { // // Finally we add the generics which affect an operator and which // which we did not decide to avoid. // FOR_EACH_CONST(i, IdSet, genericsToConsider) { int id = *i; const OpMap::const_iterator e = opMap.upper_bound(id); for (OpMap::const_iterator j = opMap.lower_bound(id); j != e; ++j) { if (j->second.types.empty()) { if (genericsToAvoid.find(id) != genericsToAvoid.end()) { IssueAdvisory("Ignoring a generic op mapping because operator " << QUOTE(Token::name(id)) << " comes from a parameter."); } else { OpMap::iterator n = canonical->opMap.insert(*j); n->second.index = canonical->opMapIndex.size(); canonical->opMapIndex.append(n); } } } } } } if (canonical->sortMap.empty() && canonical->opMap.empty() && canonical->labelMap.empty()) { delete canonical; return 0; } return canonical; } int Renaming::renameSort(int oldId) const { IdMap::const_iterator i = sortMap.find(oldId); return (i == sortMap.end()) ? oldId : i->second; } int Renaming::renameLabel(int oldId) const { IdMap::const_iterator i = labelMap.find(oldId); return (i == labelMap.end()) ? oldId : i->second; } bool Renaming::typeMatch(const set& type, const ConnectedComponent* component) { set::const_iterator e = type.end(); int nrSorts = component->nrSorts(); for (int i = 1; i < nrSorts; i++) { if (type.find(component->sort(i)->id()) != e) return true; } return false; } bool Renaming::typeMatch(const Vector >& types, Symbol* oldSymbol) { int nrArgs = types.size() - 1; if (oldSymbol->arity() != nrArgs) return false; for (int i = 0; i < nrArgs; i++) { if (!typeMatch(types[i], oldSymbol->domainComponent(i))) return false; } return typeMatch(types[nrArgs], oldSymbol->rangeComponent()); } int Renaming::renameOp(Symbol* oldSymbol) const { int oldId = oldSymbol->id(); int index = NONE; const OpMap::const_iterator e = opMap.end(); for (OpMap::const_iterator i = opMap.find(oldId); i != e && i->first == oldId; ++i) { const Vector >& types = i->second.types; if (types.empty() || typeMatch(types, oldSymbol)) { if (index == NONE) index = i->second.index; else { IssueWarning("multiple renamings apply to " << QUOTE(oldSymbol)); break; } } } return index; } bool Renaming::typeMatch(const Vector >& types, const Vector& sortNames) { int nrTypes = types.size(); for (int i = 0; i < nrTypes; ++i) { const set& type = types[i]; if (type.find(sortNames[i]) == type.end()) return false; } return true; } int Renaming::renameOp(int id, const Vector& sortNames) const { int index = NONE; const OpMap::const_iterator e = opMap.end(); for (OpMap::const_iterator i = opMap.find(id); i != e && i->first == id; ++i) { const Vector >& types = i->second.types; if (types.empty() || typeMatch(types, sortNames)) { if (index == NONE) index = i->second.index; else { IssueWarning("multiple renamings apply to " << QUOTE(Token::name(id))); break; } } } return index; } int Renaming::renamePolymorph(int oldId) const { const OpMap::const_iterator e = opMap.end(); for (OpMap::const_iterator i = opMap.find(oldId); i != e && i->first == oldId; ++i) { if (i->second.types.empty()) return i->second.index; // check for multiple renamings? } return NONE; } void Renaming::addSortAndLabelMappings(const Renaming* original) { { FOR_EACH_CONST(i, IdMap, original->sortMap) { pair p = sortMap.insert(*i); if (p.second) sortMapIndex.append(p.first); } } { FOR_EACH_CONST(i, IdMap, original->labelMap) { pair p = labelMap.insert(*i); if (p.second) labelMapIndex.append(p.first); } } } void Renaming::addOpMappingPartialCopy(const Renaming* original, int index) { // // Add a copy of a given op mapping, leaving out any type info. // OpMap::const_iterator from = original->opMapIndex[index]; lastOpMapping = opMap.insert(OpMap::value_type(from->first, OpMapping())); lastOpMapping->second.name = from->second.name; lastOpMapping->second.term = 0; lastOpMapping->second.prec = from->second.prec; lastOpMapping->second.gather = from->second.gather; lastOpMapping->second.format = from->second.format; lastOpMapping->second.latexMacro = from->second.latexMacro; lastOpMapping->second.index = opMapIndex.size(); opMapIndex.append(lastOpMapping); } void Renaming::addSortMapping(Token from, Token to) { pair p = sortMap.insert(IdMap::value_type(from.code(), to.code())); if (p.second) sortMapIndex.append(p.first); else IssueWarning(LineNumber(from.lineNumber()) << ": multiple mapping for sort " << QUOTE(from) << " in renaming."); } void Renaming::addSortMapping(int from, int to) { pair p = sortMap.insert(IdMap::value_type(from, to)); Assert(p.second, "multiple mapping for sort"); sortMapIndex.append(p.first); } void Renaming::addLabelMapping(Token from, Token to) { pair p = labelMap.insert(IdMap::value_type(from.code(), to.code())); if (p.second) labelMapIndex.append(p.first); else IssueWarning(LineNumber(from.lineNumber()) << ": multiple mapping for label " << QUOTE(from) << " in renaming."); } void Renaming::addLabelMapping(int from, int to) { pair p = labelMap.insert(IdMap::value_type(from, to)); Assert(p.second, "multiple mapping for label"); labelMapIndex.append(p.first); } void Renaming::addOpMapping(const Vector& tokens) { int name = Token::bubbleToPrefixNameCode(tokens); lastOpMapping = opMap.insert(OpMap::value_type(name, OpMapping())); lastOpMapping->second.prec = MixfixModule::MIN_PREC - 1; // initialize to invalid value lastOpMapping->second.index = opMapIndex.size(); // // We insert safe dummy values in case addOpTarget() never gets called (because of a syntax error). // lastOpMapping->second.name = name; // map op to itself lastOpMapping->second.term = 0; opMapIndex.append(lastOpMapping); } void Renaming::addOpMapping(int code) { lastOpMapping = opMap.insert(OpMap::value_type(code, OpMapping())); lastOpMapping->second.prec = MixfixModule::MIN_PREC - 1; // initialize to invalid value lastOpMapping->second.index = opMapIndex.size(); opMapIndex.append(lastOpMapping); } void Renaming::addVarDecl(Token /* varName */) { CantHappen("renamings don't take var decls"); } void Renaming::addType(bool /* kind */, const Vector& tokens) { Vector >& types = lastOpMapping->second.types; int nrTypes = types.length(); types.resize(nrTypes + 1); set& type = types[nrTypes]; FOR_EACH_CONST(i, Vector, tokens) type.insert(i->code()); } void Renaming::addType(const ConnectedComponent* component) { Vector >& types = lastOpMapping->second.types; int nrTypes = types.length(); types.resize(nrTypes + 1); setType(types[nrTypes], component); } void Renaming::addOpTarget(const Vector& tokens) { lastOpMapping->second.name = Token::bubbleToPrefixNameCode(tokens); lastOpMapping->second.term = 0; } void Renaming::addOpTarget(int code) { lastOpMapping->second.name = code; lastOpMapping->second.term = 0; } void Renaming::addOpTargetTerm(Term* term) { lastOpMapping->second.name = NONE; lastOpMapping->second.term = term; } void Renaming::setPrec(Token precTok) { int prec; if (precTok.getInt(prec) && prec >= MixfixModule::MIN_PREC && prec <= MixfixModule::MAX_PREC) lastOpMapping->second.prec = prec; else { IssueWarning(LineNumber(precTok.lineNumber()) << ": bad value " << QUOTE(precTok) << " for prec attribute."); } } void Renaming::setGather(const Vector& gather) { int length = gather.length(); OpMapping& opMapping = lastOpMapping->second; if (opMapping.types.length() != 0 && length != opMapping.types.length() - 1) { IssueWarning(LineNumber(gather[0].lineNumber()) << ": bad gather length."); return; } for (int i = 0; i < length; i++) { const char* str = gather[i].name(); if (str[0] != '\0' && str[1] == '\0') { switch(str[0]) { case '&': opMapping.gather.append(MixfixModule::GATHER_AMP); continue; case 'E': opMapping.gather.append(MixfixModule::GATHER_E); continue; case 'e': opMapping.gather.append(MixfixModule::GATHER_e); continue; } } IssueWarning(LineNumber(gather[i].lineNumber()) << ": bad value " << QUOTE(str) << " in gather attribute. Recovering by ignoring gather attribute."); opMapping.gather.clear(); // for safety return; } } void Renaming::setFormat(const Vector& format) { int length = format.length(); OpMapping& opMapping = lastOpMapping->second; for (int i = 0; i < length; i++) { if (SyntacticPreModule::checkFormatString(format[i].name())) opMapping.format.append(format[i].code()); else { IssueWarning(LineNumber(format[i].lineNumber()) << ": bad value " << QUOTE(format[i]) << " in format attribute. Recovering by ignoring format attribute."); opMapping.format.clear(); // for safety return; } } } void Renaming::setLatexMacro(const string& latexMacro) { lastOpMapping->second.latexMacro = latexMacro; } void Renaming::printRenamingType(ostream& s, int opMappingNr, int typeNr) const { char sep = '['; const set& sorts = getTypeSorts(opMappingNr, typeNr); FOR_EACH_CONST(i, set, sorts) { s << sep << Token::sortName(*i); sep = ','; } s << ']'; } void Renaming::printRenaming(ostream& s, const char* sep, const char* sep2) const { { int nrSortMappings = getNrSortMappings(); for (int i = 0; i < nrSortMappings; i++) { s << sep << "sort " << Token::sortName(getSortFrom(i)) << " to " << Token::sortName(getSortTo(i)); sep = sep2; } } { int nrOpMappings = getNrOpMappings(); for (int i = 0; i < nrOpMappings; i++) { s << sep << "op " << Token::name(getOpFrom(i)); int nrTypes = getNrTypes(i); if (nrTypes > 0) { s << " :"; --nrTypes; for (int j = 0; j < nrTypes; j++) { s << ' '; printRenamingType(s, i, j); } s << " -> "; printRenamingType(s, i, nrTypes); } Assert(getOpTo(i) != NONE && getOpTargetTerm(i) == 0, "renamings with op->term mappings are not printable"); s << " to " << Token::name(getOpTo(i)); int prec = getPrec(i); const Vector& gather = getGather(i); const Vector& format = getFormat(i); if (prec >= MixfixModule::MIN_PREC || !(gather.empty()) || !(format.empty())) { sep = " ["; if (prec >= MixfixModule::MIN_PREC) { s << sep << "prec " << prec; sep = " "; } if (!(gather.empty())) { s << sep; sep = " "; SyntacticPreModule::printGather(s, gather); } if (!(format.empty())) { s << sep; sep = " "; SyntacticPreModule::printFormat(s, format); } s << ']'; } sep = sep2; } } { int nrLabelMappings = getNrLabelMappings(); for (int i = 0; i < nrLabelMappings; i++) { s << sep << "label " << Token::name(getLabelFrom(i)) << " to " << Token::name(getLabelTo(i)); sep = sep2; } } } ostream& operator<<(ostream& s, const Renaming* renaming) { s << '('; renaming->printRenaming(s, "", ", "); return s << ')'; } Maude-2.6/src/Mixfix/symbolType.cc0000644000147300135640000000313711064003731014055 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Implementation for class SymbolType. // // utility stuff #include "macros.hh" // front end class definitions #include "symbolType.hh" bool SymbolType::compatible(SymbolType other) const { return (info & ~CTOR) == (other.info & ~CTOR); } bool SymbolType::dittoProblem() const { return (info & DITTO) && (getBasicType() != STANDARD || (getFlags() & ~CTOR) != DITTO); } int SymbolType::specialNameToBasicType(const char* name) { #define MACRO(HookName, SymbolFlag) \ if (strcmp(name, #HookName) == 0) return SymbolFlag; else #include "specialSymbolTypes.cc" #undef MACRO return 0; } #ifndef NO_ASSERT ostream& operator<<(ostream& s, SymbolType st) { s << "type = " << st.getBasicType() << " flags = " << st.getFlags(); return s; } #endif Maude-2.6/src/Mixfix/mixfixParser.hh0000644000147300135640000001377211055104356014414 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for mixfix parser with actions. // #ifndef _mixfixParser_hh_ #define _mixfixParser_hh_ #include #ifdef SCP #include "scp_parser.hh" #else #include "parser.hh" #endif #include "intSet.hh" #include "token.hh" class MixfixParser { NO_COPYING(MixfixParser); public: enum SemanticActions { NOP, PASS_THRU, // // Term construction actions. // MAKE_TERM, ASSOC_LIST, // // Special kinds of terms. // MAKE_VARIABLE, MAKE_VARIABLE_FROM_ALIAS, MAKE_NATURAL, MAKE_INTEGER, MAKE_RATIONAL, MAKE_FLOAT, MAKE_QUOTED_IDENTIFIER, MAKE_STRING, MAKE_SORT_TEST, // HACK used for condition fragment as well MAKE_POLYMORPH, MAKE_ITER, MAKE_BUBBLE, // // Statement construction actions. // MAKE_MB, MAKE_CMB, MAKE_EQ, MAKE_CEQ, MAKE_RL, MAKE_CRL, MAKE_LABEL, MAKE_ATTRIBUTE_PART, // // Condition construction actions. // FRAGMENT_LIST, MAKE_TRUE, MAKE_EQUALITY, MAKE_ASSIGNMENT, MAKE_REWRITE, // // Attribute construction actions. // MAKE_LABEL_ATTRIBUTE, MAKE_METADATA_ATTRIBUTE, MAKE_NONEXEC_ATTRIBUTE, MAKE_OWISE_ATTRIBUTE, MAKE_PRINT_ATTRIBUTE, MAKE_ATTRIBUTE_LIST, // // Command construction actions. // CONDITIONAL_COMMAND, UNIFY_LIST, // // Strategy expression construction actions // MAKE_TRIVIAL, MAKE_ALL, MAKE_APPLICATION, MAKE_TOP, MAKE_CONCATENATION, MAKE_UNION, MAKE_ITERATION, MAKE_BRANCH, MAKE_TEST, MAKE_STRATEGY_LIST, MAKE_SUBSTITUTION, MAKE_PRINT_LIST }; MixfixParser(MixfixModule& client); // // Functions to construct parser. // void insertProduction(int lhs, const Vector& rhs, int prec, const Vector& gather, int action = NOP, int data = NONE, int data2 = NONE); void insertBubbleProduction(int lhs, int lowerBound, int upperBound, int leftParenCode, int rightParenCode, const Vector& excluded, int bubbleSpecIndex); void insertSpecialTerminal(int tokenProperty, int codeToUse); void insertVariableTerminal(int sortNameCode, int codeToUse); void insertIterSymbolTerminal(int iterSymbolNameCode, int codeToUse); // // Function that parses a vector of tokens to a parse tree. // int parseSentence(const Vector& original, int root, int& firstBad, int begin, int nrTokens); // // Functions that analyse the parse tree. // void makeTerms(Term*& first, Term*& second); void insertStatement(); void makeMatchCommand(Term*& pattern, Term*& subject, Vector& condition); void makeUnifyCommand(Vector& lhs, Vector& rhs); void makeSearchCommand(Term*& initial, int& searchType, Term*& target, Vector& condition); void makeStrategyCommand(Term*& subject, StrategyExpression*& strategy); void makeAssignment(int node, Vector& variables, Vector& values); void makeSubstitution(int node, Vector& variables, Vector& values); // // Functions to get info about the parser. // const IntSet& getTokenSet(); // HACK int getNrProductions(); private: typedef map IntMap; enum Flags { NONEXEC = 1, OWISE = 2, PRINT = 4 }; struct Action { int data; // main data short action; // action to take on data short data2; // auxillary data for actions that need it }; Sort* getSort(int node); Term* makeTerm(int node); StrategyExpression* makeStrategy(int node); ConditionFragment* makeConditionFragment(int node); void makeCondition(int node, Vector& condition); void makeStatement(int node); void makeAttributePart(int node, int& label, int& metadata, FlagSet& flags, Vector& printNames, Vector& printSorts); void makePrintList(int node, Vector& names, Vector& sorts); void makeStatementPart(int node, int label, int metadata, FlagSet& flags, const Vector& printNames, const Vector& printSorts); void makeStrategyList(int node, Vector& strategies); int translateSpecialToken(int code); MixfixModule& client; Parser parser; // CFG parser IntSet tokens; // mapping between token codes and terminal numbers Vector actions; // action associated with each production Vector specialTerminals; // special terminals for tokens with special properties IntMap variableTerminals; // special terminals for on-the-fly variables IntMap iterSymbolTerminals; // special terminals for tokens like f^42 bool bubblesAllowed; // do we allow bubbles of unknown tokens // // We store the tokens we are parsing here to avoid passing extra parameters // when recursing down a parse tree. // const Vector* currentSentence; // actual tokens so we can deal with special tokens int currentOffset; // start of parsed tokens Vector sentence; // sentence translated into terminal numbers int nrParses; }; inline int MixfixParser::getNrProductions() { return actions.length(); } #endif Maude-2.6/src/Mixfix/specialTokens.cc0000644000147300135640000000700711012702241014505 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // List of all the tokens special enough that we keep track of their id // in the symbol table. // // We generate various chunks of linear (branching) code to handle // this hetrogeneous collection by macro expansion. // The format is: // MACRO(name, string) // MACRO(leftParen, "(") MACRO(rightParen, ")") MACRO(leftBracket, "[") MACRO(rightBracket, "]") MACRO(leftBrace, "{") MACRO(rightBrace, "}") MACRO(comma, ",") MACRO(underscore, "_") MACRO(dot, ".") MACRO(equals, "=") MACRO(assign, ":=") MACRO(arrow, "=>") MACRO(arrowOne, "=>1") MACRO(arrowPlus, "=>+") MACRO(arrowStar, "=>*") MACRO(arrowBang, "=>!") MACRO(suchThat, "s.t.") MACRO(such, "such") MACRO(that, "that") MACRO(mb, "mb") MACRO(cmb, "cmb") MACRO(eq, "eq") MACRO(ceq, "ceq") MACRO(rl, "rl") MACRO(crl, "crl") MACRO(cq, "cq") MACRO(ifToken, "if") MACRO(colon, ":") MACRO(colon2, "::") MACRO(wedge, "/\\") MACRO(label, "label") MACRO(metadata, "metadata") MACRO(nonexec, "nonexec") MACRO(otherwise, "otherwise") MACRO(owise, "owise") MACRO(print, "print") MACRO(lessThan, "<") MACRO(partial, "~>") MACRO(th, "th") MACRO(fth, "fth") MACRO(mod, "mod") MACRO(fmod, "fmod") MACRO(smod, "smod") MACRO(omod, "omod") MACRO(obj, "obj") MACRO(endth, "endth") MACRO(endfth, "endfth") MACRO(endm, "endm") MACRO(endfm, "endfm") MACRO(endsm, "endsm") MACRO(endom, "endom") MACRO(endo, "endo") MACRO(jbo, "jbo") MACRO(pr, "pr") MACRO(protecting, "protecting") MACRO(ex, "ex") MACRO(extending, "extending") MACRO(inc, "inc") MACRO(including, "including") MACRO(us, "us") MACRO(usingToken, "using") MACRO(fail, "fail") MACRO(idle, "idle") MACRO(all, "all") MACRO(top, "top") MACRO(notToken, "not") MACRO(test, "test") MACRO(tryToken, "try") MACRO(semicolon, ";") MACRO(pipe, "|") MACRO(plus, "+") MACRO(star, "*") MACRO(bang, "!") MACRO(query, "?") MACRO(matches, "<=?") MACRO(unifies, "=?") MACRO(assignment, "<-") MACRO(orelse, "or-else") MACRO(match, "match") MACRO(xmatch, "xmatch") MACRO(amatch, "amatch") // // Special hook identifier tokens. // MACRO(bubble, "Bubble") MACRO(exclude, "Exclude") MACRO(qidSymbolToken, "qidSymbol") MACRO(nilQidListSymbolToken, "nilQidListSymbol") MACRO(qidListSymbolToken, "qidListSymbol") // // Pseudo-tokens needed as place holders for special terminals. // MACRO(smallNat, "[ SMALL_NAT ]") MACRO(zero, "[ ZERO ]") MACRO(smallNeg, "[ SMALL_NEG ]") MACRO(rational, "[ RATIONAL ]") MACRO(floatToken, "[ FLOAT ]") MACRO(quotedIdentifier, "[ QUOTED_IDENTIFIER ]") MACRO(stringToken, "[ STRING ]") MACRO(endsInColon, "[ ENDS_IN_COLON ]") Maude-2.6/src/Mixfix/quotedIdentifierDagNode.hh0000644000147300135640000000274507666304133016467 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for dag nodes containing quoted identifiers // (references to real identifiers). // #ifndef _quotedIdentifierDagNode_hh_ #define _quotedIdentifierDagNode_hh_ #include "NA_DagNode.hh" class QuotedIdentifierDagNode : public NA_DagNode { public: QuotedIdentifierDagNode(QuotedIdentifierSymbol* symbol, int idIndex); size_t getHashValue(); int compareArguments(const DagNode* other) const; void overwriteWithClone(DagNode* old); DagNode* makeClone(); int getIdIndex() const; private: NO_COPYING(QuotedIdentifierDagNode); const int idIndex; }; inline int QuotedIdentifierDagNode::getIdIndex() const { return idIndex; } #endif Maude-2.6/src/Mixfix/banner.cc0000644000147300135640000000326611351031252013154 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2010 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Banner gets recompiled every build to update time; so keep it small. // #if HAVE_CONFIG_H #include #endif #if HAVE_OSTREAM #include #elif HAVE_OSTREAM_H #include #endif using namespace std; #include "timeStuff.hh" #include "tty.hh" void printBanner(std::ostream& s) { struct timeval t; gettimeofday(&t, 0); time_t secs = t.tv_sec; s << "\t\t \\||||||||||||||||||/\n"; s << "\t\t --- Welcome to " << Tty(Tty::RED) << 'M' << Tty(Tty::CYAN) << 'a' << Tty(Tty::BLUE) << 'u' << Tty(Tty::MAGENTA) << 'd' << Tty(Tty::GREEN) << 'e' << Tty(Tty::RESET) << " ---\n"; s << "\t\t /||||||||||||||||||\\\n"; s << "\t " << PACKAGE_STRING << " built: " << __DATE__ << ' ' << __TIME__ << '\n'; s << "\t Copyright 1997-2010 SRI International\n"; s << "\t\t " << ctime(&secs); } Maude-2.6/src/Mixfix/fileTable.hh0000644000147300135640000000403507666304133013622 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Class for table of files that we have seen. // #ifndef _fileTable_hh_ #define _fileTable_hh_ #include "stringTable.hh" #include "token.hh" class FileTable { public: enum SpecialLineNumbers { SYSTEM_CREATED = -1, // line number for things created by the system META_LEVEL_CREATED = -2, // line number for things created in the metalevel COMMAND_LINE = -3, // line number for command line argument AUTOMATIC = -1, }; FileTable(); void openFile(int lineNumber, const char* name, bool silent); void closeFile(int lineNumber); void beginModule(Token type, Token name); void endModule(int lineNumber); void abortEverything(int lineNumber); void printLineNumber(ostream& s, int lineNumber); bool outputLine(); private: NO_COPYING(FileTable); struct Entry { int absoluteLineNumber; union { int fileNameIndex; int moduleNameIndex; }; union { int relativeLineNumber; int moduleTypeIndex; }; }; int binarySearch(Vector& table, int lineNumber); StringTable fileNames; Vector fileChanges; Vector moduleChanges; Vector fileStack; Vector moduleStack; int firstSilent; }; #endif Maude-2.6/src/Mixfix/makeGrammar.cc0000644000147300135640000011722611152121001014124 00000000000000/* This file is part of the Maude 2 interpreter. Copyright 1997-2003 SRI International, Menlo Park, CA 94025, USA. This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ // // Functions for making a Maude grammar from a signature. // void MixfixModule::makeGrammar(bool complexFlag) { if (parser != 0) { if (!complexFlag || complexParser) return; delete parser; } parser = new MixfixParser(*this); complexParser = complexFlag; // // NonTerminals are allocated as follows: // fixed one-off: -1,..., componentNonTerminalBase + 1 // per component: componentNonTerminalBase,..., componentNonTerminalBase - NUMBER_OF_TYPES * #components + 1 // on demand: componentNonTerminalBase - NUMBER_OF_TYPES * #components,... downwards // componentNonTerminalBase = complexParser ? COMPLEX_BASE : SIMPLE_BASE; nextNonTerminal = componentNonTerminalBase - NUMBER_OF_TYPES * getConnectedComponents().length() + 1; if (complexFlag) { makeComplexProductions(); makeStrategyLanguageProductions(); } else makeLabelProductions(); makeStatementProductions(); makeConditionProductions(); makeAttributeProductions(); makeParameterizedSortProductions(); makeComponentProductions(); makeSymbolProductions(); makeVariableProductions(); makeBoolProductions(); makeSpecialProductions(); makePolymorphProductions(); makeBubbleProductions(); // // These two data structures are only used for making the grammar and must be cleared in // case we ever need to regenerate the grammar, since the nonterminals they contain will // no longer be valid. // iterSymbols.clear(); leadTokens.clear(); } void MixfixModule::makeParameterizedSortProductions() { FOR_EACH_CONST(i, SortMap, sortNames) { int name= i->first; if (Token::auxProperty(name) == Token::AUX_STRUCTURED_SORT) { // // Need to make a non-terminal for each lead token of a parameterized sort // so we can parse on-the-fly variables. // Vector parts; Token::splitParameterizedSort(name, parts); int lead = parts[0]; pair p = leadTokens.insert(IntMap::value_type(lead, GARBAGE)); if (p.second) { // // First time we've seen this lead token so we need to make a nonterminal, // terminal and production for it so we can parse on-the-fly variables for // for parameterized sorts starting with this token. // int nt = newNonTerminal(); string leadString(Token::name(lead)); int t = Token::encode((leadString + " variable").c_str()); p.first->second = nt; Vector rhs(1); rhs[0] = t; //cout << "para " << nt << " ::= " << rhs[0] << endl; parser->insertProduction(nt, rhs, 0, emptyGather); parser->insertVariableTerminal(lead, t); } } } } void MixfixModule::makeComplexProductions() { #if PARSER_DEBUG cout << "\n"; #endif static Vector rhs(3); rhs.resize(1); rhs[0] = arrowOne; parser->insertProduction(SEARCH_CONNECTIVE, rhs, 0, emptyGather, MixfixParser::NOP, RewriteSequenceSearch::ONE_STEP); rhs[0] = arrowPlus; parser->insertProduction(SEARCH_CONNECTIVE, rhs, 0, emptyGather, MixfixParser::NOP, RewriteSequenceSearch::AT_LEAST_ONE_STEP); rhs[0] = arrowStar; parser->insertProduction(SEARCH_CONNECTIVE, rhs, 0, emptyGather, MixfixParser::NOP, RewriteSequenceSearch::ANY_STEPS); rhs[0] = arrowBang; parser->insertProduction(SEARCH_CONNECTIVE, rhs, 0, emptyGather, MixfixParser::NOP, RewriteSequenceSearch::NORMAL_FORM); rhs[0] = MATCH_PAIR; parser->insertProduction(MATCH_COMMAND, rhs, 0, gatherAny); rhs[0] = UNIFY_PAIR; parser->insertProduction(UNIFY_COMMAND, rhs, 0, gatherAny); rhs[0] = SEARCH_PAIR; parser->insertProduction(SEARCH_COMMAND, rhs, 0, gatherAny); rhs[0] = suchThat; parser->insertProduction(SUCH_THAT, rhs, 0, gatherAny); rhs.resize(2); rhs[0] = such; rhs[1] = that; parser->insertProduction(SUCH_THAT, rhs, 0, gatherAnyAny); rhs.resize(3); rhs[0] = MATCH_PAIR; rhs[1] = SUCH_THAT; rhs[2] = CONDITION; parser->insertProduction(MATCH_COMMAND, rhs, 0, gatherAnyAnyAny, MixfixParser::CONDITIONAL_COMMAND); rhs[0] = SEARCH_PAIR; rhs[2] = RULE_CONDITION; parser->insertProduction(SEARCH_COMMAND, rhs, 0, gatherAnyAnyAny, MixfixParser::CONDITIONAL_COMMAND); rhs[0] = UNIFY_PAIR; rhs[1] = wedge; rhs[2] = UNIFY_COMMAND; parser->insertProduction(UNIFY_COMMAND, rhs, 0, gatherAnyAny, MixfixParser::UNIFY_LIST); // // Substitutions. // rhs.resize(1); rhs[0] = ASSIGNMENT; parser->insertProduction(SUBSTITUTION, rhs, 0, gatherAny, MixfixParser::PASS_THRU); rhs.resize(3); rhs[0] = ASSIGNMENT; rhs[1] = comma; rhs[2] = SUBSTITUTION; parser->insertProduction(SUBSTITUTION, rhs, PREFIX_GATHER, gatherPrefixPrefix, MixfixParser::MAKE_SUBSTITUTION); } void MixfixModule::makeStrategyLanguageProductions() { #if PARSER_DEBUG cout << "\n"; #endif static Vector rhs(3); // // We assume that rules have been flattened in. For each label occuring in a rule, // we add a production. NOTE: we may need to explicitly track imported labels once we // have smods. // rhs.resize(1); { set handled; FOR_EACH_CONST(i, Vector, getRules()) { int label = (*i)->getLabel().id(); if (label != NONE && handled.find(label) == handled.end()) { rhs[0] = label; parser->insertProduction(LABEL, rhs, 0, emptyGather, MixfixParser::NOP, label); handled.insert(label); } } } rhs[0] = fail; parser->insertProduction(STRATEGY_EXPRESSION, rhs, 0, emptyGather, MixfixParser::MAKE_TRIVIAL, false); rhs[0] = idle; parser->insertProduction(STRATEGY_EXPRESSION, rhs, 0, emptyGather, MixfixParser::MAKE_TRIVIAL, true); rhs[0] = all; parser->insertProduction(STRATEGY_EXPRESSION, rhs, 0, emptyGather, MixfixParser::MAKE_ALL); { // // =