Changes in / [b826e6b:fea3faa]


Ignore:
Files:
29 added
39 deleted
160 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rb826e6b rfea3faa  
    3737src/libcfa/libcfa-prelude.c
    3838
    39 # generated by bison and lex from parser.yy and lex.ll
     39# generated by bison and lex from cfa.yy and lex.ll, respectively
    4040src/Parser/parser.output
    4141src/Parser/lex.cc
    4242src/Parser/parser.cc
    4343src/Parser/parser.h
    44 src/Parser/parser.hh
    45 
    46 tools/prettyprinter/parser.output
    47 tools/prettyprinter/lex.cc
    48 tools/prettyprinter/parser.cc
    49 tools/prettyprinter/parser.h
    50 tools/prettyprinter/parser.hh
    51 tools/prettyprinter/pretty
    52 tools/pretty
    5344
    5445# generated by xfig for user manual
     
    5647doc/user/pointer1.tex
    5748doc/user/pointer2.tex
    58 doc/user/EHMHierarchy.tex
  • Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1819###############################################################################
    1920VPATH = @srcdir@
    20 am__is_gnu_make = { \
    21   if test -z '$(MAKELEVEL)'; then \
    22     false; \
    23   elif test -n '$(MAKE_HOST)'; then \
    24     true; \
    25   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    26     true; \
    27   else \
    28     false; \
    29   fi; \
    30 }
    31 am__make_running_with_option = \
    32   case $${target_option-} in \
    33       ?) ;; \
    34       *) echo "am__make_running_with_option: internal error: invalid" \
    35               "target option '$${target_option-}' specified" >&2; \
    36          exit 1;; \
    37   esac; \
    38   has_opt=no; \
    39   sane_makeflags=$$MAKEFLAGS; \
    40   if $(am__is_gnu_make); then \
    41     sane_makeflags=$$MFLAGS; \
    42   else \
    43     case $$MAKEFLAGS in \
    44       *\\[\ \   ]*) \
    45         bs=\\; \
    46         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    47           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    48     esac; \
    49   fi; \
    50   skip_next=no; \
    51   strip_trailopt () \
    52   { \
    53     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    54   }; \
    55   for flg in $$sane_makeflags; do \
    56     test $$skip_next = yes && { skip_next=no; continue; }; \
    57     case $$flg in \
    58       *=*|--*) continue;; \
    59         -*I) strip_trailopt 'I'; skip_next=yes;; \
    60       -*I?*) strip_trailopt 'I';; \
    61         -*O) strip_trailopt 'O'; skip_next=yes;; \
    62       -*O?*) strip_trailopt 'O';; \
    63         -*l) strip_trailopt 'l'; skip_next=yes;; \
    64       -*l?*) strip_trailopt 'l';; \
    65       -[dEDm]) skip_next=yes;; \
    66       -[JT]) skip_next=yes;; \
    67     esac; \
    68     case $$flg in \
    69       *$$target_option*) has_opt=yes; break;; \
    70     esac; \
    71   done; \
    72   test $$has_opt = yes
    73 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    74 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7521pkgdatadir = $(datadir)/@PACKAGE@
    7622pkgincludedir = $(includedir)/@PACKAGE@
     
    9238host_triplet = @host@
    9339subdir = .
     40DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
     41        $(srcdir)/Makefile.in $(srcdir)/config.h.in \
     42        $(top_srcdir)/configure INSTALL automake/compile \
     43        automake/config.guess automake/config.sub automake/depcomp \
     44        automake/install-sh automake/missing automake/ylwrap
    9445ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    9546am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    9647am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9748        $(ACLOCAL_M4)
    98 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
    99         $(am__configure_deps) $(am__DIST_COMMON)
    10049am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
    10150 configure.lineno config.status.lineno
     
    10453CONFIG_CLEAN_FILES =
    10554CONFIG_CLEAN_VPATH_FILES =
    106 AM_V_P = $(am__v_P_@AM_V@)
    107 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    108 am__v_P_0 = false
    109 am__v_P_1 = :
    11055AM_V_GEN = $(am__v_GEN_@AM_V@)
    11156am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    112 am__v_GEN_0 = @echo "  GEN     " $@;
    113 am__v_GEN_1 =
     57am__v_GEN_0 = @echo "  GEN   " $@;
    11458AM_V_at = $(am__v_at_@AM_V@)
    11559am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    11660am__v_at_0 = @
    117 am__v_at_1 =
    11861SOURCES =
    11962DIST_SOURCES =
    120 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
    121         ctags-recursive dvi-recursive html-recursive info-recursive \
    122         install-data-recursive install-dvi-recursive \
    123         install-exec-recursive install-html-recursive \
    124         install-info-recursive install-pdf-recursive \
    125         install-ps-recursive install-recursive installcheck-recursive \
    126         installdirs-recursive pdf-recursive ps-recursive \
    127         tags-recursive uninstall-recursive
    128 am__can_run_installinfo = \
    129   case $$AM_UPDATE_INFO_DIR in \
    130     n|no|NO) false;; \
    131     *) (install-info --version) >/dev/null 2>&1;; \
    132   esac
     63RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
     64        html-recursive info-recursive install-data-recursive \
     65        install-dvi-recursive install-exec-recursive \
     66        install-html-recursive install-info-recursive \
     67        install-pdf-recursive install-ps-recursive install-recursive \
     68        installcheck-recursive installdirs-recursive pdf-recursive \
     69        ps-recursive uninstall-recursive
    13370RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
    13471  distclean-recursive maintainer-clean-recursive
    135 am__recursive_targets = \
    136   $(RECURSIVE_TARGETS) \
    137   $(RECURSIVE_CLEAN_TARGETS) \
    138   $(am__extra_recursive_targets)
    139 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
    140         cscope distdir dist dist-all distcheck
    141 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
    142         $(LISP)config.h.in
    143 # Read a list of newline-separated strings from the standard input,
    144 # and print each of them once, without duplicates.  Input order is
    145 # *not* preserved.
    146 am__uniquify_input = $(AWK) '\
    147   BEGIN { nonempty = 0; } \
    148   { items[$$0] = 1; nonempty = 1; } \
    149   END { if (nonempty) { for (i in items) print i; }; } \
    150 '
    151 # Make sure the list of sources is unique.  This is necessary because,
    152 # e.g., the same source file might be shared among _SOURCES variables
    153 # for different programs/libraries.
    154 am__define_uniq_tagged_files = \
    155   list='$(am__tagged_files)'; \
    156   unique=`for i in $$list; do \
    157     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    158   done | $(am__uniquify_input)`
     72AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
     73        $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
     74        distdir dist dist-all distcheck
    15975ETAGS = etags
    16076CTAGS = ctags
    161 CSCOPE = cscope
    16277DIST_SUBDIRS = $(SUBDIRS)
    163 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
    164         $(top_srcdir)/automake/compile \
    165         $(top_srcdir)/automake/config.guess \
    166         $(top_srcdir)/automake/config.sub \
    167         $(top_srcdir)/automake/install-sh \
    168         $(top_srcdir)/automake/missing INSTALL README automake/compile \
    169         automake/config.guess automake/config.sub automake/depcomp \
    170         automake/install-sh automake/missing automake/ylwrap
    17178DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    17279distdir = $(PACKAGE)-$(VERSION)
     
    17885      || { sleep 5 && rm -rf "$(distdir)"; }; \
    17986  else :; fi
    180 am__post_remove_distdir = $(am__remove_distdir)
    18187am__relativize = \
    18288  dir0=`pwd`; \
     
    206112DIST_ARCHIVES = $(distdir).tar.gz
    207113GZIP_ENV = --best
    208 DIST_TARGETS = dist-gzip
    209114distuninstallcheck_listfiles = find . -type f -print
    210115am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
     
    322227program_transform_name = @program_transform_name@
    323228psdir = @psdir@
    324 runstatedir = @runstatedir@
    325229sbindir = @sbindir@
    326230sharedstatedir = @sharedstatedir@
     
    354258        $(am__cd) $(top_srcdir) && \
    355259          $(AUTOMAKE) --foreign Makefile
     260.PRECIOUS: Makefile
    356261Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    357262        @case '$?' in \
     
    374279
    375280config.h: stamp-h1
    376         @test -f $@ || rm -f stamp-h1
    377         @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
     281        @if test ! -f $@; then rm -f stamp-h1; else :; fi
     282        @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
    378283
    379284stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
     
    389294
    390295# This directory's subdirectories are mostly independent; you can cd
    391 # into them and run 'make' without going through this Makefile.
    392 # To change the values of 'make' variables: instead of editing Makefiles,
    393 # (1) if the variable is set in 'config.status', edit 'config.status'
    394 #     (which will cause the Makefiles to be regenerated when you run 'make');
    395 # (2) otherwise, pass the desired values on the 'make' command line.
    396 $(am__recursive_targets):
    397         @fail=; \
    398         if $(am__make_keepgoing); then \
    399           failcom='fail=yes'; \
    400         else \
    401           failcom='exit 1'; \
    402         fi; \
     296# into them and run `make' without going through this Makefile.
     297# To change the values of `make' variables: instead of editing Makefiles,
     298# (1) if the variable is set in `config.status', edit `config.status'
     299#     (which will cause the Makefiles to be regenerated when you run `make');
     300# (2) otherwise, pass the desired values on the `make' command line.
     301$(RECURSIVE_TARGETS):
     302        @fail= failcom='exit 1'; \
     303        for f in x $$MAKEFLAGS; do \
     304          case $$f in \
     305            *=* | --[!k]*);; \
     306            *k*) failcom='fail=yes';; \
     307          esac; \
     308        done; \
    403309        dot_seen=no; \
    404310        target=`echo $@ | sed s/-recursive//`; \
    405         case "$@" in \
    406           distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
    407           *) list='$(SUBDIRS)' ;; \
    408         esac; \
    409         for subdir in $$list; do \
     311        list='$(SUBDIRS)'; for subdir in $$list; do \
    410312          echo "Making $$target in $$subdir"; \
    411313          if test "$$subdir" = "."; then \
     
    422324        fi; test -z "$$fail"
    423325
    424 ID: $(am__tagged_files)
    425         $(am__define_uniq_tagged_files); mkid -fID $$unique
    426 tags: tags-recursive
    427 TAGS: tags
    428 
    429 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     326$(RECURSIVE_CLEAN_TARGETS):
     327        @fail= failcom='exit 1'; \
     328        for f in x $$MAKEFLAGS; do \
     329          case $$f in \
     330            *=* | --[!k]*);; \
     331            *k*) failcom='fail=yes';; \
     332          esac; \
     333        done; \
     334        dot_seen=no; \
     335        case "$@" in \
     336          distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
     337          *) list='$(SUBDIRS)' ;; \
     338        esac; \
     339        rev=''; for subdir in $$list; do \
     340          if test "$$subdir" = "."; then :; else \
     341            rev="$$subdir $$rev"; \
     342          fi; \
     343        done; \
     344        rev="$$rev ."; \
     345        target=`echo $@ | sed s/-recursive//`; \
     346        for subdir in $$rev; do \
     347          echo "Making $$target in $$subdir"; \
     348          if test "$$subdir" = "."; then \
     349            local_target="$$target-am"; \
     350          else \
     351            local_target="$$target"; \
     352          fi; \
     353          ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
     354          || eval $$failcom; \
     355        done && test -z "$$fail"
     356tags-recursive:
     357        list='$(SUBDIRS)'; for subdir in $$list; do \
     358          test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
     359        done
     360ctags-recursive:
     361        list='$(SUBDIRS)'; for subdir in $$list; do \
     362          test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
     363        done
     364
     365ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     366        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     367        unique=`for i in $$list; do \
     368            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     369          done | \
     370          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     371              END { if (nonempty) { for (i in files) print i; }; }'`; \
     372        mkid -fID $$unique
     373tags: TAGS
     374
     375TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
     376                $(TAGS_FILES) $(LISP)
    430377        set x; \
    431378        here=`pwd`; \
     
    443390          fi; \
    444391        done; \
    445         $(am__define_uniq_tagged_files); \
     392        list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
     393        unique=`for i in $$list; do \
     394            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     395          done | \
     396          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     397              END { if (nonempty) { for (i in files) print i; }; }'`; \
    446398        shift; \
    447399        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    455407          fi; \
    456408        fi
    457 ctags: ctags-recursive
    458 
    459 CTAGS: ctags
    460 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    461         $(am__define_uniq_tagged_files); \
     409ctags: CTAGS
     410CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
     411                $(TAGS_FILES) $(LISP)
     412        list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
     413        unique=`for i in $$list; do \
     414            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     415          done | \
     416          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     417              END { if (nonempty) { for (i in files) print i; }; }'`; \
    462418        test -z "$(CTAGS_ARGS)$$unique" \
    463419          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    468424          && $(am__cd) $(top_srcdir) \
    469425          && gtags -i $(GTAGS_ARGS) "$$here"
    470 cscope: cscope.files
    471         test ! -s cscope.files \
    472           || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
    473 clean-cscope:
    474         -rm -f cscope.files
    475 cscope.files: clean-cscope cscopelist
    476 cscopelist: cscopelist-recursive
    477 
    478 cscopelist-am: $(am__tagged_files)
    479         list='$(am__tagged_files)'; \
    480         case "$(srcdir)" in \
    481           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    482           *) sdir=$(subdir)/$(srcdir) ;; \
    483         esac; \
    484         for i in $$list; do \
    485           if test -f "$$i"; then \
    486             echo "$(subdir)/$$i"; \
    487           else \
    488             echo "$$sdir/$$i"; \
    489           fi; \
    490         done >> $(top_builddir)/cscope.files
    491426
    492427distclean-tags:
    493428        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
    494         -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
    495429
    496430distdir: $(DISTFILES)
     
    528462        @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
    529463          if test "$$subdir" = .; then :; else \
    530             $(am__make_dryrun) \
    531               || test -d "$(distdir)/$$subdir" \
    532               || $(MKDIR_P) "$(distdir)/$$subdir" \
    533               || exit 1; \
     464            test -d "$(distdir)/$$subdir" \
     465            || $(MKDIR_P) "$(distdir)/$$subdir" \
     466            || exit 1; \
     467          fi; \
     468        done
     469        @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
     470          if test "$$subdir" = .; then :; else \
    534471            dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
    535472            $(am__relativize); \
     
    560497dist-gzip: distdir
    561498        tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
    562         $(am__post_remove_distdir)
     499        $(am__remove_distdir)
    563500
    564501dist-bzip2: distdir
    565502        tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
    566         $(am__post_remove_distdir)
     503        $(am__remove_distdir)
    567504
    568505dist-lzip: distdir
    569506        tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
    570         $(am__post_remove_distdir)
     507        $(am__remove_distdir)
     508
     509dist-lzma: distdir
     510        tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
     511        $(am__remove_distdir)
    571512
    572513dist-xz: distdir
    573514        tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
    574         $(am__post_remove_distdir)
     515        $(am__remove_distdir)
    575516
    576517dist-tarZ: distdir
    577         @echo WARNING: "Support for distribution archives compressed with" \
    578                        "legacy program 'compress' is deprecated." >&2
    579         @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
    580518        tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
    581         $(am__post_remove_distdir)
     519        $(am__remove_distdir)
    582520
    583521dist-shar: distdir
    584         @echo WARNING: "Support for shar distribution archives is" \
    585                        "deprecated." >&2
    586         @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
    587522        shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
    588         $(am__post_remove_distdir)
     523        $(am__remove_distdir)
    589524
    590525dist-zip: distdir
    591526        -rm -f $(distdir).zip
    592527        zip -rq $(distdir).zip $(distdir)
    593         $(am__post_remove_distdir)
    594 
    595 dist dist-all:
    596         $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
    597         $(am__post_remove_distdir)
     528        $(am__remove_distdir)
     529
     530dist dist-all: distdir
     531        tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
     532        $(am__remove_distdir)
    598533
    599534# This target untars the dist file and tries a VPATH configuration.  Then
     
    606541        *.tar.bz2*) \
    607542          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
     543        *.tar.lzma*) \
     544          lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
    608545        *.tar.lz*) \
    609546          lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
     
    617554          unzip $(distdir).zip ;;\
    618555        esac
    619         chmod -R a-w $(distdir)
    620         chmod u+w $(distdir)
    621         mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
     556        chmod -R a-w $(distdir); chmod a+w $(distdir)
     557        mkdir $(distdir)/_build
     558        mkdir $(distdir)/_inst
    622559        chmod a-w $(distdir)
    623560        test -d $(distdir)/_build || exit 0; \
     
    625562          && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
    626563          && am__cwd=`pwd` \
    627           && $(am__cd) $(distdir)/_build/sub \
    628           && ../../configure \
     564          && $(am__cd) $(distdir)/_build \
     565          && ../configure --srcdir=.. --prefix="$$dc_install_base" \
    629566            $(AM_DISTCHECK_CONFIGURE_FLAGS) \
    630567            $(DISTCHECK_CONFIGURE_FLAGS) \
    631             --srcdir=../.. --prefix="$$dc_install_base" \
    632568          && $(MAKE) $(AM_MAKEFLAGS) \
    633569          && $(MAKE) $(AM_MAKEFLAGS) dvi \
     
    652588          && cd "$$am__cwd" \
    653589          || exit 1
    654         $(am__post_remove_distdir)
     590        $(am__remove_distdir)
    655591        @(echo "$(distdir) archives ready for distribution: "; \
    656592          list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
     
    787723uninstall-am:
    788724
    789 .MAKE: $(am__recursive_targets) all install-am install-strip
    790 
    791 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
    792         am--refresh check check-am clean clean-cscope clean-generic \
    793         cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
    794         dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
     725.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
     726        ctags-recursive install-am install-strip tags-recursive
     727
     728.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
     729        all all-am am--refresh check check-am clean clean-generic \
     730        ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
     731        dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
    795732        distcheck distclean distclean-generic distclean-hdr \
    796733        distclean-tags distcleancheck distdir distuninstallcheck dvi \
     
    802739        installcheck installcheck-am installdirs installdirs-am \
    803740        maintainer-clean maintainer-clean-generic mostlyclean \
    804         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    805         uninstall-am
    806 
    807 .PRECIOUS: Makefile
     741        mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
     742        uninstall uninstall-am
    808743
    809744
  • aclocal.m4

    rb826e6b rfea3faa  
    1 # generated automatically by aclocal 1.15 -*- Autoconf -*-
    2 
    3 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
    4 
     1# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
     2
     3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
     4# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
     5# Inc.
    56# This file is free software; the Free Software Foundation
    67# gives unlimited permission to copy and/or distribute it,
     
    1213# PARTICULAR PURPOSE.
    1314
    14 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
    1515m4_ifndef([AC_AUTOCONF_VERSION],
    1616  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
    17 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
    18 [m4_warning([this file was generated for autoconf 2.69.
     17m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
     18[m4_warning([this file was generated for autoconf 2.68.
    1919You have another version of autoconf.  It may work, but is not guaranteed to.
    2020If you have problems, you may need to regenerate the build system entirely.
    21 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
    22 
    23 # Copyright (C) 2002-2014 Free Software Foundation, Inc.
    24 #
    25 # This file is free software; the Free Software Foundation
    26 # gives unlimited permission to copy and/or distribute it,
    27 # with or without modifications, as long as this notice is preserved.
     21To do so, use the procedure documented by the package, typically `autoreconf'.])])
     22
     23# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
     24# Foundation, Inc.
     25#
     26# This file is free software; the Free Software Foundation
     27# gives unlimited permission to copy and/or distribute it,
     28# with or without modifications, as long as this notice is preserved.
     29
     30# serial 1
    2831
    2932# AM_AUTOMAKE_VERSION(VERSION)
     
    3336# (This private macro should not be called outside this file.)
    3437AC_DEFUN([AM_AUTOMAKE_VERSION],
    35 [am__api_version='1.15'
     38[am__api_version='1.11'
    3639dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
    3740dnl require some minimum version.  Point them to the right macro.
    38 m4_if([$1], [1.15], [],
     41m4_if([$1], [1.11.3], [],
    3942      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
    4043])
     
    5255# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
    5356AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
    54 [AM_AUTOMAKE_VERSION([1.15])dnl
     57[AM_AUTOMAKE_VERSION([1.11.3])dnl
    5558m4_ifndef([AC_AUTOCONF_VERSION],
    5659  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
     
    5962# Figure out how to run the assembler.                      -*- Autoconf -*-
    6063
    61 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    62 #
    63 # This file is free software; the Free Software Foundation
    64 # gives unlimited permission to copy and/or distribute it,
    65 # with or without modifications, as long as this notice is preserved.
     64# Copyright (C) 2001, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
     65#
     66# This file is free software; the Free Software Foundation
     67# gives unlimited permission to copy and/or distribute it,
     68# with or without modifications, as long as this notice is preserved.
     69
     70# serial 5
    6671
    6772# AM_PROG_AS
     
    7984# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
    8085
    81 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    82 #
    83 # This file is free software; the Free Software Foundation
    84 # gives unlimited permission to copy and/or distribute it,
    85 # with or without modifications, as long as this notice is preserved.
     86# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
     87#
     88# This file is free software; the Free Software Foundation
     89# gives unlimited permission to copy and/or distribute it,
     90# with or without modifications, as long as this notice is preserved.
     91
     92# serial 1
    8693
    8794# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
    88 # $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
    89 # '$srcdir', '$srcdir/..', or '$srcdir/../..'.
     95# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
     96# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
    9097#
    9198# Of course, Automake must honor this variable whenever it calls a
     
    106113# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
    107114# are both prefixed by $srcdir.  In an in-source build this is usually
    108 # harmless because $srcdir is '.', but things will broke when you
     115# harmless because $srcdir is `.', but things will broke when you
    109116# start a VPATH build or use an absolute $srcdir.
    110117#
     
    124131
    125132AC_DEFUN([AM_AUX_DIR_EXPAND],
    126 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
    127 # Expand $ac_aux_dir to an absolute path.
    128 am_aux_dir=`cd "$ac_aux_dir" && pwd`
     133[dnl Rely on autoconf to set up CDPATH properly.
     134AC_PREREQ([2.50])dnl
     135# expand $ac_aux_dir to an absolute path
     136am_aux_dir=`cd $ac_aux_dir && pwd`
    129137])
    130138
    131139# AM_COND_IF                                            -*- Autoconf -*-
    132140
    133 # Copyright (C) 2008-2014 Free Software Foundation, Inc.
    134 #
    135 # This file is free software; the Free Software Foundation
    136 # gives unlimited permission to copy and/or distribute it,
    137 # with or without modifications, as long as this notice is preserved.
     141# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
     142#
     143# This file is free software; the Free Software Foundation
     144# gives unlimited permission to copy and/or distribute it,
     145# with or without modifications, as long as this notice is preserved.
     146
     147# serial 3
    138148
    139149# _AM_COND_IF
     
    145155m4_define([_AM_COND_ELSE])
    146156m4_define([_AM_COND_ENDIF])
     157
    147158
    148159# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE])
     
    168179# AM_CONDITIONAL                                            -*- Autoconf -*-
    169180
    170 # Copyright (C) 1997-2014 Free Software Foundation, Inc.
    171 #
    172 # This file is free software; the Free Software Foundation
    173 # gives unlimited permission to copy and/or distribute it,
    174 # with or without modifications, as long as this notice is preserved.
     181# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
     182# Free Software Foundation, Inc.
     183#
     184# This file is free software; the Free Software Foundation
     185# gives unlimited permission to copy and/or distribute it,
     186# with or without modifications, as long as this notice is preserved.
     187
     188# serial 9
    175189
    176190# AM_CONDITIONAL(NAME, SHELL-CONDITION)
     
    178192# Define a conditional.
    179193AC_DEFUN([AM_CONDITIONAL],
    180 [AC_PREREQ([2.52])dnl
    181  m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
    182        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
     194[AC_PREREQ(2.52)dnl
     195 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
     196        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
    183197AC_SUBST([$1_TRUE])dnl
    184198AC_SUBST([$1_FALSE])dnl
     
    199213fi])])
    200214
    201 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
    202 #
    203 # This file is free software; the Free Software Foundation
    204 # gives unlimited permission to copy and/or distribute it,
    205 # with or without modifications, as long as this notice is preserved.
    206 
    207 
    208 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
     215# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
     216# 2010, 2011 Free Software Foundation, Inc.
     217#
     218# This file is free software; the Free Software Foundation
     219# gives unlimited permission to copy and/or distribute it,
     220# with or without modifications, as long as this notice is preserved.
     221
     222# serial 12
     223
     224# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
    209225# written in clear, in which case automake, when reading aclocal.m4,
    210226# will think it sees a *use*, and therefore will trigger all it's
     
    216232# ----------------------
    217233# See how the compiler implements dependency checking.
    218 # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
     234# NAME is "CC", "CXX", "GCJ", or "OBJC".
    219235# We try a few techniques and use that to set a single cache variable.
    220236#
     
    229245AC_REQUIRE([AM_DEP_TRACK])dnl
    230246
    231 m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
    232       [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
    233       [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
    234       [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
    235       [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
    236       [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
    237                     [depcc="$$1"   am_compiler_list=])
     247ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
     248       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
     249       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
     250       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
     251       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
     252                   [depcc="$$1"   am_compiler_list=])
    238253
    239254AC_CACHE_CHECK([dependency style of $depcc],
     
    243258  # making bogus files that we don't know about and never remove.  For
    244259  # instance it was reported that on HP-UX the gcc test will end up
    245   # making a dummy file named 'D' -- because '-MD' means "put the output
    246   # in D".
     260  # making a dummy file named `D' -- because `-MD' means `put the output
     261  # in D'.
    247262  rm -rf conftest.dir
    248263  mkdir conftest.dir
     
    284299    for i in 1 2 3 4 5 6; do
    285300      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    286       # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
    287       # Solaris 10 /bin/sh.
    288       echo '/* dummy */' > sub/conftst$i.h
     301      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
     302      # Solaris 8's {/usr,}/bin/sh.
     303      touch sub/conftst$i.h
    289304    done
    290305    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
    291306
    292     # We check with '-c' and '-o' for the sake of the "dashmstdout"
     307    # We check with `-c' and `-o' for the sake of the "dashmstdout"
    293308    # mode.  It turns out that the SunPro C++ compiler does not properly
    294     # handle '-M -o', and we need to detect this.  Also, some Intel
    295     # versions had trouble with output in subdirs.
     309    # handle `-M -o', and we need to detect this.  Also, some Intel
     310    # versions had trouble with output in subdirs
    296311    am__obj=sub/conftest.${OBJEXT-o}
    297312    am__minus_obj="-o $am__obj"
     
    302317      ;;
    303318    nosideeffect)
    304       # After this tag, mechanisms are not by side-effect, so they'll
    305       # only be used when explicitly requested.
     319      # after this tag, mechanisms are not by side-effect, so they'll
     320      # only be used when explicitly requested
    306321      if test "x$enable_dependency_tracking" = xyes; then
    307322        continue
     
    311326      ;;
    312327    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
    313       # This compiler won't grok '-c -o', but also, the minuso test has
     328      # This compiler won't grok `-c -o', but also, the minuso test has
    314329      # not run yet.  These depmodes are late enough in the game, and
    315330      # so weak that their functioning should not be impacted.
     
    359374# -------------
    360375# Choose a directory name for dependency files.
    361 # This macro is AC_REQUIREd in _AM_DEPENDENCIES.
     376# This macro is AC_REQUIREd in _AM_DEPENDENCIES
    362377AC_DEFUN([AM_SET_DEPDIR],
    363378[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
     
    369384# ------------
    370385AC_DEFUN([AM_DEP_TRACK],
    371 [AC_ARG_ENABLE([dependency-tracking], [dnl
    372 AS_HELP_STRING(
    373   [--enable-dependency-tracking],
    374   [do not reject slow dependency extractors])
    375 AS_HELP_STRING(
    376   [--disable-dependency-tracking],
    377   [speeds up one-time build])])
     386[AC_ARG_ENABLE(dependency-tracking,
     387[  --disable-dependency-tracking  speeds up one-time build
     388  --enable-dependency-tracking   do not reject slow dependency extractors])
    378389if test "x$enable_dependency_tracking" != xno; then
    379390  am_depcomp="$ac_aux_dir/depcomp"
     
    390401# Generate code to set up dependency tracking.              -*- Autoconf -*-
    391402
    392 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
    393 #
    394 # This file is free software; the Free Software Foundation
    395 # gives unlimited permission to copy and/or distribute it,
    396 # with or without modifications, as long as this notice is preserved.
    397 
     403# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
     404# Free Software Foundation, Inc.
     405#
     406# This file is free software; the Free Software Foundation
     407# gives unlimited permission to copy and/or distribute it,
     408# with or without modifications, as long as this notice is preserved.
     409
     410#serial 5
    398411
    399412# _AM_OUTPUT_DEPENDENCY_COMMANDS
     
    401414AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
    402415[{
    403   # Older Autoconf quotes --file arguments for eval, but not when files
     416  # Autoconf 2.62 quotes --file arguments for eval, but not when files
    404417  # are listed without --file.  Let's play safe and only enable the eval
    405418  # if we detect the quoting.
     
    414427    mf=`echo "$mf" | sed -e 's/:.*$//'`
    415428    # Check whether this is an Automake generated Makefile or not.
    416     # We used to match only the files named 'Makefile.in', but
     429    # We used to match only the files named `Makefile.in', but
    417430    # some people rename them; so instead we look at the file content.
    418431    # Grep'ing the first line is not enough: some people post-process
     
    426439    fi
    427440    # Extract the definition of DEPDIR, am__include, and am__quote
    428     # from the Makefile without running 'make'.
     441    # from the Makefile without running `make'.
    429442    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
    430443    test -z "$DEPDIR" && continue
    431444    am__include=`sed -n 's/^am__include = //p' < "$mf"`
    432     test -z "$am__include" && continue
     445    test -z "am__include" && continue
    433446    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
     447    # When using ansi2knr, U may be empty or an underscore; expand it
     448    U=`sed -n 's/^U = //p' < "$mf"`
    434449    # Find all dependency output files, they are included files with
    435450    # $(DEPDIR) in their names.  We invoke sed twice because it is the
     
    438453    for file in `sed -n "
    439454      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
    440          sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
     455         sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
    441456      # Make sure the directory exists.
    442457      test -f "$dirpart/$file" && continue
     
    456471#
    457472# This code is only required when automatic dependency tracking
    458 # is enabled.  FIXME.  This creates each '.P' file that we will
     473# is enabled.  FIXME.  This creates each `.P' file that we will
    459474# need in order to bootstrap the dependency handling code.
    460475AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
     
    466481# Do all the work for Automake.                             -*- Autoconf -*-
    467482
    468 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
    469 #
    470 # This file is free software; the Free Software Foundation
    471 # gives unlimited permission to copy and/or distribute it,
    472 # with or without modifications, as long as this notice is preserved.
     483# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
     484# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
     485#
     486# This file is free software; the Free Software Foundation
     487# gives unlimited permission to copy and/or distribute it,
     488# with or without modifications, as long as this notice is preserved.
     489
     490# serial 16
    473491
    474492# This macro actually does too much.  Some checks are only needed if
    475493# your package does certain things.  But this isn't really a big deal.
    476 
    477 dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
    478 m4_define([AC_PROG_CC],
    479 m4_defn([AC_PROG_CC])
    480 [_AM_PROG_CC_C_O
    481 ])
    482494
    483495# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
     
    493505# release and drop the old call support.
    494506AC_DEFUN([AM_INIT_AUTOMAKE],
    495 [AC_PREREQ([2.65])dnl
     507[AC_PREREQ([2.62])dnl
    496508dnl Autoconf wants to disallow AM_ names.  We explicitly allow
    497509dnl the ones we care about.
     
    522534dnl Distinguish between old-style and new-style calls.
    523535m4_ifval([$2],
    524 [AC_DIAGNOSE([obsolete],
    525              [$0: two- and three-arguments forms are deprecated.])
    526 m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
     536[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
    527537 AC_SUBST([PACKAGE], [$1])dnl
    528538 AC_SUBST([VERSION], [$2])],
    529539[_AM_SET_OPTIONS([$1])dnl
    530540dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
    531 m4_if(
    532   m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
    533   [ok:ok],,
     541m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
    534542  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
    535543 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
     
    537545
    538546_AM_IF_OPTION([no-define],,
    539 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
    540  AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
     547[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
     548 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
    541549
    542550# Some tools Automake needs.
    543551AC_REQUIRE([AM_SANITY_CHECK])dnl
    544552AC_REQUIRE([AC_ARG_PROGRAM])dnl
    545 AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
    546 AM_MISSING_PROG([AUTOCONF], [autoconf])
    547 AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
    548 AM_MISSING_PROG([AUTOHEADER], [autoheader])
    549 AM_MISSING_PROG([MAKEINFO], [makeinfo])
     553AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
     554AM_MISSING_PROG(AUTOCONF, autoconf)
     555AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
     556AM_MISSING_PROG(AUTOHEADER, autoheader)
     557AM_MISSING_PROG(MAKEINFO, makeinfo)
    550558AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
    551559AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
    552 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
    553 # For better backward compatibility.  To be removed once Automake 1.9.x
    554 # dies out for good.  For more background, see:
    555 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
    556 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
    557 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
    558 # We need awk for the "check" target (and possibly the TAP driver).  The
    559 # system "awk" is bad on some platforms.
     560AC_REQUIRE([AM_PROG_MKDIR_P])dnl
     561# We need awk for the "check" target.  The system "awk" is bad on
     562# some platforms.
    560563AC_REQUIRE([AC_PROG_AWK])dnl
    561564AC_REQUIRE([AC_PROG_MAKE_SET])dnl
     
    566569_AM_IF_OPTION([no-dependencies],,
    567570[AC_PROVIDE_IFELSE([AC_PROG_CC],
    568                   [_AM_DEPENDENCIES([CC])],
    569                   [m4_define([AC_PROG_CC],
    570                              m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
     571                  [_AM_DEPENDENCIES(CC)],
     572                  [define([AC_PROG_CC],
     573                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
    571574AC_PROVIDE_IFELSE([AC_PROG_CXX],
    572                   [_AM_DEPENDENCIES([CXX])],
    573                   [m4_define([AC_PROG_CXX],
    574                              m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
     575                  [_AM_DEPENDENCIES(CXX)],
     576                  [define([AC_PROG_CXX],
     577                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
    575578AC_PROVIDE_IFELSE([AC_PROG_OBJC],
    576                   [_AM_DEPENDENCIES([OBJC])],
    577                   [m4_define([AC_PROG_OBJC],
    578                              m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
    579 AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
    580                   [_AM_DEPENDENCIES([OBJCXX])],
    581                   [m4_define([AC_PROG_OBJCXX],
    582                              m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
    583 ])
    584 AC_REQUIRE([AM_SILENT_RULES])dnl
    585 dnl The testsuite driver may need to know about EXEEXT, so add the
    586 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
    587 dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
     579                  [_AM_DEPENDENCIES(OBJC)],
     580                  [define([AC_PROG_OBJC],
     581                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
     582])
     583_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
     584dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
     585dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
     586dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
    588587AC_CONFIG_COMMANDS_PRE(dnl
    589588[m4_provide_if([_AM_COMPILER_EXEEXT],
    590589  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
    591 
    592 # POSIX will say in a future version that running "rm -f" with no argument
    593 # is OK; and we want to be able to make that assumption in our Makefile
    594 # recipes.  So use an aggressive probe to check that the usage we want is
    595 # actually supported "in the wild" to an acceptable degree.
    596 # See automake bug#10828.
    597 # To make any issue more visible, cause the running configure to be aborted
    598 # by default if the 'rm' program in use doesn't match our expectations; the
    599 # user can still override this though.
    600 if rm -f && rm -fr && rm -rf; then : OK; else
    601   cat >&2 <<'END'
    602 Oops!
    603 
    604 Your 'rm' program seems unable to run without file operands specified
    605 on the command line, even when the '-f' option is present.  This is contrary
    606 to the behaviour of most rm programs out there, and not conforming with
    607 the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
    608 
    609 Please tell bug-automake@gnu.org about your system, including the value
    610 of your $PATH and any error possibly output before this message.  This
    611 can help us improve future automake versions.
    612 
    613 END
    614   if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
    615     echo 'Configuration will proceed anyway, since you have set the' >&2
    616     echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
    617     echo >&2
    618   else
    619     cat >&2 <<'END'
    620 Aborting the configuration process, to ensure you take notice of the issue.
    621 
    622 You can download and install GNU coreutils to get an 'rm' implementation
    623 that behaves properly: <http://www.gnu.org/software/coreutils/>.
    624 
    625 If you want to complete the configuration process using your problematic
    626 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
    627 to "yes", and re-run configure.
    628 
    629 END
    630     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
    631   fi
    632 fi
    633 dnl The trailing newline in this macro's definition is deliberate, for
    634 dnl backward compatibility and to allow trailing 'dnl'-style comments
    635 dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
    636 ])
    637 
    638 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
     590])
     591
     592dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
    639593dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
    640594dnl mangled by Autoconf and run in a shell conditional statement.
    641595m4_define([_AC_COMPILER_EXEEXT],
    642596m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
     597
    643598
    644599# When config.status generates a header, we must update the stamp-h file.
     
    663618echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
    664619
    665 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    666 #
    667 # This file is free software; the Free Software Foundation
    668 # gives unlimited permission to copy and/or distribute it,
    669 # with or without modifications, as long as this notice is preserved.
     620# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
     621# Inc.
     622#
     623# This file is free software; the Free Software Foundation
     624# gives unlimited permission to copy and/or distribute it,
     625# with or without modifications, as long as this notice is preserved.
     626
     627# serial 1
    670628
    671629# AM_PROG_INSTALL_SH
     
    674632AC_DEFUN([AM_PROG_INSTALL_SH],
    675633[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
    676 if test x"${install_sh+set}" != xset; then
     634if test x"${install_sh}" != xset; then
    677635  case $am_aux_dir in
    678636  *\ * | *\     *)
     
    682640  esac
    683641fi
    684 AC_SUBST([install_sh])])
    685 
    686 # Copyright (C) 2003-2014 Free Software Foundation, Inc.
    687 #
    688 # This file is free software; the Free Software Foundation
    689 # gives unlimited permission to copy and/or distribute it,
    690 # with or without modifications, as long as this notice is preserved.
     642AC_SUBST(install_sh)])
     643
     644# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
     645#
     646# This file is free software; the Free Software Foundation
     647# gives unlimited permission to copy and/or distribute it,
     648# with or without modifications, as long as this notice is preserved.
     649
     650# serial 2
    691651
    692652# Check whether the underlying file-system supports filenames
     
    706666# From Jim Meyering
    707667
    708 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
    709 #
    710 # This file is free software; the Free Software Foundation
    711 # gives unlimited permission to copy and/or distribute it,
    712 # with or without modifications, as long as this notice is preserved.
     668# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
     669# 2011 Free Software Foundation, Inc.
     670#
     671# This file is free software; the Free Software Foundation
     672# gives unlimited permission to copy and/or distribute it,
     673# with or without modifications, as long as this notice is preserved.
     674
     675# serial 5
    713676
    714677# AM_MAINTAINER_MODE([DEFAULT-MODE])
    715678# ----------------------------------
    716679# Control maintainer-specific portions of Makefiles.
    717 # Default is to disable them, unless 'enable' is passed literally.
    718 # For symmetry, 'disable' may be passed as well.  Anyway, the user
     680# Default is to disable them, unless `enable' is passed literally.
     681# For symmetry, `disable' may be passed as well.  Anyway, the user
    719682# can override the default with the --enable/--disable switch.
    720683AC_DEFUN([AM_MAINTAINER_MODE],
     
    727690  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
    728691  AC_ARG_ENABLE([maintainer-mode],
    729     [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
    730       am_maintainer_other[ make rules and dependencies not useful
    731       (and sometimes confusing) to the casual installer])],
    732     [USE_MAINTAINER_MODE=$enableval],
    733     [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
     692[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
     693                          (and sometimes confusing) to the casual installer],
     694      [USE_MAINTAINER_MODE=$enableval],
     695      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
    734696  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
    735697  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
     
    739701)
    740702
     703AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
     704
    741705# Check to see how 'make' treats includes.                  -*- Autoconf -*-
    742706
    743 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    744 #
    745 # This file is free software; the Free Software Foundation
    746 # gives unlimited permission to copy and/or distribute it,
    747 # with or without modifications, as long as this notice is preserved.
     707# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
     708#
     709# This file is free software; the Free Software Foundation
     710# gives unlimited permission to copy and/or distribute it,
     711# with or without modifications, as long as this notice is preserved.
     712
     713# serial 4
    748714
    749715# AM_MAKE_INCLUDE()
     
    764730# First try GNU make style include.
    765731echo "include confinc" > confmf
    766 # Ignore all kinds of additional output from 'make'.
     732# Ignore all kinds of additional output from `make'.
    767733case `$am_make -s -f confmf 2> /dev/null` in #(
    768734*the\ am__doit\ target*)
     
    789755])
    790756
     757# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
     758# Free Software Foundation, Inc.
     759#
     760# This file is free software; the Free Software Foundation
     761# gives unlimited permission to copy and/or distribute it,
     762# with or without modifications, as long as this notice is preserved.
     763
     764# serial 6
     765
     766# AM_PROG_CC_C_O
     767# --------------
     768# Like AC_PROG_CC_C_O, but changed for automake.
     769AC_DEFUN([AM_PROG_CC_C_O],
     770[AC_REQUIRE([AC_PROG_CC_C_O])dnl
     771AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
     772AC_REQUIRE_AUX_FILE([compile])dnl
     773# FIXME: we rely on the cache variable name because
     774# there is no other way.
     775set dummy $CC
     776am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
     777eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
     778if test "$am_t" != yes; then
     779   # Losing compiler, so override with the script.
     780   # FIXME: It is wrong to rewrite CC.
     781   # But if we don't then we get into trouble of one sort or another.
     782   # A longer-term fix would be to have automake use am__CC in this case,
     783   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
     784   CC="$am_aux_dir/compile $CC"
     785fi
     786dnl Make sure AC_PROG_CC is never called again, or it will override our
     787dnl setting of CC.
     788m4_define([AC_PROG_CC],
     789          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
     790])
     791
    791792# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
    792793
    793 # Copyright (C) 1997-2014 Free Software Foundation, Inc.
    794 #
    795 # This file is free software; the Free Software Foundation
    796 # gives unlimited permission to copy and/or distribute it,
    797 # with or without modifications, as long as this notice is preserved.
     794# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
     795# Free Software Foundation, Inc.
     796#
     797# This file is free software; the Free Software Foundation
     798# gives unlimited permission to copy and/or distribute it,
     799# with or without modifications, as long as this notice is preserved.
     800
     801# serial 6
    798802
    799803# AM_MISSING_PROG(NAME, PROGRAM)
     
    804808AC_SUBST($1)])
    805809
     810
    806811# AM_MISSING_HAS_RUN
    807812# ------------------
    808 # Define MISSING if not defined so far and test if it is modern enough.
    809 # If it is, set am_missing_run to use it, otherwise, to nothing.
     813# Define MISSING if not defined so far and test if it supports --run.
     814# If it does, set am_missing_run to use it, otherwise, to nothing.
    810815AC_DEFUN([AM_MISSING_HAS_RUN],
    811816[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
     
    820825fi
    821826# Use eval to expand $SHELL
    822 if eval "$MISSING --is-lightweight"; then
    823   am_missing_run="$MISSING "
     827if eval "$MISSING --run true"; then
     828  am_missing_run="$MISSING --run "
    824829else
    825830  am_missing_run=
    826   AC_MSG_WARN(['missing' script is too old or missing])
    827 fi
     831  AC_MSG_WARN([`missing' script is too old or missing])
     832fi
     833])
     834
     835# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
     836# Inc.
     837#
     838# This file is free software; the Free Software Foundation
     839# gives unlimited permission to copy and/or distribute it,
     840# with or without modifications, as long as this notice is preserved.
     841
     842# serial 1
     843
     844# AM_PROG_MKDIR_P
     845# ---------------
     846# Check for `mkdir -p'.
     847AC_DEFUN([AM_PROG_MKDIR_P],
     848[AC_PREREQ([2.60])dnl
     849AC_REQUIRE([AC_PROG_MKDIR_P])dnl
     850dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
     851dnl while keeping a definition of mkdir_p for backward compatibility.
     852dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
     853dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
     854dnl Makefile.ins that do not define MKDIR_P, so we do our own
     855dnl adjustment using top_builddir (which is defined more often than
     856dnl MKDIR_P).
     857AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
     858case $mkdir_p in
     859  [[\\/$]]* | ?:[[\\/]]*) ;;
     860  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
     861esac
    828862])
    829863
    830864# Helper functions for option handling.                     -*- Autoconf -*-
    831865
    832 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    833 #
    834 # This file is free software; the Free Software Foundation
    835 # gives unlimited permission to copy and/or distribute it,
    836 # with or without modifications, as long as this notice is preserved.
     866# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
     867# Foundation, Inc.
     868#
     869# This file is free software; the Free Software Foundation
     870# gives unlimited permission to copy and/or distribute it,
     871# with or without modifications, as long as this notice is preserved.
     872
     873# serial 5
    837874
    838875# _AM_MANGLE_OPTION(NAME)
     
    845882# Set option NAME.  Presently that only means defining a flag for this option.
    846883AC_DEFUN([_AM_SET_OPTION],
    847 [m4_define(_AM_MANGLE_OPTION([$1]), [1])])
     884[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
    848885
    849886# _AM_SET_OPTIONS(OPTIONS)
     
    859896[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
    860897
    861 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
    862 #
    863 # This file is free software; the Free Software Foundation
    864 # gives unlimited permission to copy and/or distribute it,
    865 # with or without modifications, as long as this notice is preserved.
    866 
    867 # _AM_PROG_CC_C_O
    868 # ---------------
    869 # Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
    870 # to automatically call this.
    871 AC_DEFUN([_AM_PROG_CC_C_O],
    872 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
    873 AC_REQUIRE_AUX_FILE([compile])dnl
    874 AC_LANG_PUSH([C])dnl
    875 AC_CACHE_CHECK(
    876   [whether $CC understands -c and -o together],
    877   [am_cv_prog_cc_c_o],
    878   [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
    879   # Make sure it works both with $CC and with simple cc.
    880   # Following AC_PROG_CC_C_O, we do the test twice because some
    881   # compilers refuse to overwrite an existing .o file with -o,
    882   # though they will create one.
    883   am_cv_prog_cc_c_o=yes
    884   for am_i in 1 2; do
    885     if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
    886          && test -f conftest2.$ac_objext; then
    887       : OK
    888     else
    889       am_cv_prog_cc_c_o=no
    890       break
    891     fi
    892   done
    893   rm -f core conftest*
    894   unset am_i])
    895 if test "$am_cv_prog_cc_c_o" != yes; then
    896    # Losing compiler, so override with the script.
    897    # FIXME: It is wrong to rewrite CC.
    898    # But if we don't then we get into trouble of one sort or another.
    899    # A longer-term fix would be to have automake use am__CC in this case,
    900    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
    901    CC="$am_aux_dir/compile $CC"
    902 fi
    903 AC_LANG_POP([C])])
    904 
    905 # For backward compatibility.
    906 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
    907 
    908 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    909 #
    910 # This file is free software; the Free Software Foundation
    911 # gives unlimited permission to copy and/or distribute it,
    912 # with or without modifications, as long as this notice is preserved.
    913 
    914 # AM_RUN_LOG(COMMAND)
    915 # -------------------
    916 # Run COMMAND, save the exit status in ac_status, and log it.
    917 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
    918 AC_DEFUN([AM_RUN_LOG],
    919 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
    920    ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
    921    ac_status=$?
    922    echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    923    (exit $ac_status); }])
    924 
    925898# Check to make sure that the build environment is sane.    -*- Autoconf -*-
    926899
    927 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
    928 #
    929 # This file is free software; the Free Software Foundation
    930 # gives unlimited permission to copy and/or distribute it,
    931 # with or without modifications, as long as this notice is preserved.
     900# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
     901# Free Software Foundation, Inc.
     902#
     903# This file is free software; the Free Software Foundation
     904# gives unlimited permission to copy and/or distribute it,
     905# with or without modifications, as long as this notice is preserved.
     906
     907# serial 5
    932908
    933909# AM_SANITY_CHECK
     
    935911AC_DEFUN([AM_SANITY_CHECK],
    936912[AC_MSG_CHECKING([whether build environment is sane])
     913# Just in case
     914sleep 1
     915echo timestamp > conftest.file
    937916# Reject unsafe characters in $srcdir or the absolute working directory
    938917# name.  Accept space and tab only in the latter.
     
    945924case $srcdir in
    946925  *[[\\\"\#\$\&\'\`$am_lf\ \    ]]*)
    947     AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
     926    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
    948927esac
    949928
    950 # Do 'set' in a subshell so we don't clobber the current shell's
     929# Do `set' in a subshell so we don't clobber the current shell's
    951930# arguments.  Must try -L first in case configure is actually a
    952931# symlink; some systems play weird games with the mod time of symlinks
     
    954933# directory).
    955934if (
    956    am_has_slept=no
    957    for am_try in 1 2; do
    958      echo "timestamp, slept: $am_has_slept" > conftest.file
    959      set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    960      if test "$[*]" = "X"; then
    961         # -L didn't work.
    962         set X `ls -t "$srcdir/configure" conftest.file`
    963      fi
    964      if test "$[*]" != "X $srcdir/configure conftest.file" \
    965         && test "$[*]" != "X conftest.file $srcdir/configure"; then
    966 
    967         # If neither matched, then we have a broken ls.  This can happen
    968         # if, for instance, CONFIG_SHELL is bash and it inherits a
    969         # broken ls alias from the environment.  This has actually
    970         # happened.  Such a system could not be considered "sane".
    971         AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
    972   alias in your environment])
    973      fi
    974      if test "$[2]" = conftest.file || test $am_try -eq 2; then
    975        break
    976      fi
    977      # Just in case.
    978      sleep 1
    979      am_has_slept=yes
    980    done
     935   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
     936   if test "$[*]" = "X"; then
     937      # -L didn't work.
     938      set X `ls -t "$srcdir/configure" conftest.file`
     939   fi
     940   rm -f conftest.file
     941   if test "$[*]" != "X $srcdir/configure conftest.file" \
     942      && test "$[*]" != "X conftest.file $srcdir/configure"; then
     943
     944      # If neither matched, then we have a broken ls.  This can happen
     945      # if, for instance, CONFIG_SHELL is bash and it inherits a
     946      # broken ls alias from the environment.  This has actually
     947      # happened.  Such a system could not be considered "sane".
     948      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
     949alias in your environment])
     950   fi
     951
    981952   test "$[2]" = conftest.file
    982953   )
     
    988959Check your system clock])
    989960fi
    990 AC_MSG_RESULT([yes])
    991 # If we didn't sleep, we still need to ensure time stamps of config.status and
    992 # generated files are strictly newer.
    993 am_sleep_pid=
    994 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
    995   ( sleep 1 ) &
    996   am_sleep_pid=$!
    997 fi
    998 AC_CONFIG_COMMANDS_PRE(
    999   [AC_MSG_CHECKING([that generated files are newer than configure])
    1000    if test -n "$am_sleep_pid"; then
    1001      # Hide warnings about reused PIDs.
    1002      wait $am_sleep_pid 2>/dev/null
    1003    fi
    1004    AC_MSG_RESULT([done])])
    1005 rm -f conftest.file
    1006 ])
    1007 
    1008 # Copyright (C) 2009-2014 Free Software Foundation, Inc.
    1009 #
    1010 # This file is free software; the Free Software Foundation
    1011 # gives unlimited permission to copy and/or distribute it,
    1012 # with or without modifications, as long as this notice is preserved.
     961AC_MSG_RESULT(yes)])
     962
     963# Copyright (C) 2009, 2011  Free Software Foundation, Inc.
     964#
     965# This file is free software; the Free Software Foundation
     966# gives unlimited permission to copy and/or distribute it,
     967# with or without modifications, as long as this notice is preserved.
     968
     969# serial 2
    1013970
    1014971# AM_SILENT_RULES([DEFAULT])
    1015972# --------------------------
    1016973# Enable less verbose build rules; with the default set to DEFAULT
    1017 # ("yes" being less verbose, "no" or empty being verbose).
     974# (`yes' being less verbose, `no' or empty being verbose).
    1018975AC_DEFUN([AM_SILENT_RULES],
    1019 [AC_ARG_ENABLE([silent-rules], [dnl
    1020 AS_HELP_STRING(
    1021   [--enable-silent-rules],
    1022   [less verbose build output (undo: "make V=1")])
    1023 AS_HELP_STRING(
    1024   [--disable-silent-rules],
    1025   [verbose build output (undo: "make V=0")])dnl
    1026 ])
    1027 case $enable_silent_rules in @%:@ (((
    1028   yes) AM_DEFAULT_VERBOSITY=0;;
    1029    no) AM_DEFAULT_VERBOSITY=1;;
    1030     *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
     976[AC_ARG_ENABLE([silent-rules],
     977[  --enable-silent-rules          less verbose build output (undo: `make V=1')
     978  --disable-silent-rules         verbose build output (undo: `make V=0')])
     979case $enable_silent_rules in
     980yes) AM_DEFAULT_VERBOSITY=0;;
     981no)  AM_DEFAULT_VERBOSITY=1;;
     982*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
    1031983esac
    1032984dnl
    1033 dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
     985dnl A few `make' implementations (e.g., NonStop OS and NextStep)
    1034986dnl do not support nested variable expansions.
    1035987dnl See automake bug#9928 and bug#10237.
     
    10491001fi])
    10501002if test $am_cv_make_support_nested_variables = yes; then
    1051   dnl Using '$V' instead of '$(V)' breaks IRIX make.
     1003  dnl Using `$V' instead of `$(V)' breaks IRIX make.
    10521004  AM_V='$(V)'
    10531005  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
     
    10661018])
    10671019
    1068 # Copyright (C) 2001-2014 Free Software Foundation, Inc.
    1069 #
    1070 # This file is free software; the Free Software Foundation
    1071 # gives unlimited permission to copy and/or distribute it,
    1072 # with or without modifications, as long as this notice is preserved.
     1020# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
     1021#
     1022# This file is free software; the Free Software Foundation
     1023# gives unlimited permission to copy and/or distribute it,
     1024# with or without modifications, as long as this notice is preserved.
     1025
     1026# serial 1
    10731027
    10741028# AM_PROG_INSTALL_STRIP
    10751029# ---------------------
    1076 # One issue with vendor 'install' (even GNU) is that you can't
     1030# One issue with vendor `install' (even GNU) is that you can't
    10771031# specify the program used to strip binaries.  This is especially
    10781032# annoying in cross-compiling environments, where the build's strip
    10791033# is unlikely to handle the host's binaries.
    10801034# Fortunately install-sh will honor a STRIPPROG variable, so we
    1081 # always use install-sh in "make install-strip", and initialize
     1035# always use install-sh in `make install-strip', and initialize
    10821036# STRIPPROG with the value of the STRIP variable (set by the user).
    10831037AC_DEFUN([AM_PROG_INSTALL_STRIP],
    10841038[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
    1085 # Installed binaries are usually stripped using 'strip' when the user
    1086 # run "make install-strip".  However 'strip' might not be the right
     1039# Installed binaries are usually stripped using `strip' when the user
     1040# run `make install-strip'.  However `strip' might not be the right
    10871041# tool to use in cross-compilation environments, therefore Automake
    1088 # will honor the 'STRIP' environment variable to overrule this program.
    1089 dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
     1042# will honor the `STRIP' environment variable to overrule this program.
     1043dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
    10901044if test "$cross_compiling" != no; then
    10911045  AC_CHECK_TOOL([STRIP], [strip], :)
     
    10941048AC_SUBST([INSTALL_STRIP_PROGRAM])])
    10951049
    1096 # Copyright (C) 2006-2014 Free Software Foundation, Inc.
    1097 #
    1098 # This file is free software; the Free Software Foundation
    1099 # gives unlimited permission to copy and/or distribute it,
    1100 # with or without modifications, as long as this notice is preserved.
     1050# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
     1051#
     1052# This file is free software; the Free Software Foundation
     1053# gives unlimited permission to copy and/or distribute it,
     1054# with or without modifications, as long as this notice is preserved.
     1055
     1056# serial 3
    11011057
    11021058# _AM_SUBST_NOTMAKE(VARIABLE)
     
    11131069# Check how to create a tarball.                            -*- Autoconf -*-
    11141070
    1115 # Copyright (C) 2004-2014 Free Software Foundation, Inc.
    1116 #
    1117 # This file is free software; the Free Software Foundation
    1118 # gives unlimited permission to copy and/or distribute it,
    1119 # with or without modifications, as long as this notice is preserved.
     1071# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
     1072#
     1073# This file is free software; the Free Software Foundation
     1074# gives unlimited permission to copy and/or distribute it,
     1075# with or without modifications, as long as this notice is preserved.
     1076
     1077# serial 2
    11201078
    11211079# _AM_PROG_TAR(FORMAT)
    11221080# --------------------
    11231081# Check how to create a tarball in format FORMAT.
    1124 # FORMAT should be one of 'v7', 'ustar', or 'pax'.
     1082# FORMAT should be one of `v7', `ustar', or `pax'.
    11251083#
    11261084# Substitute a variable $(am__tar) that is a command
     
    11321090# a tarball read from stdin.
    11331091#     $(am__untar) < result.tar
    1134 #
    11351092AC_DEFUN([_AM_PROG_TAR],
    11361093[# Always define AMTAR for backward compatibility.  Yes, it's still used
    11371094# in the wild :-(  We should find a proper way to deprecate it ...
    11381095AC_SUBST([AMTAR], ['$${TAR-tar}'])
    1139 
    1140 # We'll loop over all known methods to create a tar archive until one works.
     1096m4_if([$1], [v7],
     1097     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
     1098     [m4_case([$1], [ustar],, [pax],,
     1099              [m4_fatal([Unknown tar format])])
     1100AC_MSG_CHECKING([how to create a $1 tar archive])
     1101# Loop over all known methods to create a tar archive until one works.
    11411102_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
    1142 
    1143 m4_if([$1], [v7],
    1144   [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
    1145 
    1146   [m4_case([$1],
    1147     [ustar],
    1148      [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
    1149       # There is notably a 21 bits limit for the UID and the GID.  In fact,
    1150       # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
    1151       # and bug#13588).
    1152       am_max_uid=2097151 # 2^21 - 1
    1153       am_max_gid=$am_max_uid
    1154       # The $UID and $GID variables are not portable, so we need to resort
    1155       # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
    1156       # below are definitely unexpected, so allow the users to see them
    1157       # (that is, avoid stderr redirection).
    1158       am_uid=`id -u || echo unknown`
    1159       am_gid=`id -g || echo unknown`
    1160       AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
    1161       if test $am_uid -le $am_max_uid; then
    1162          AC_MSG_RESULT([yes])
    1163       else
    1164          AC_MSG_RESULT([no])
    1165          _am_tools=none
    1166       fi
    1167       AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
    1168       if test $am_gid -le $am_max_gid; then
    1169          AC_MSG_RESULT([yes])
    1170       else
    1171         AC_MSG_RESULT([no])
    1172         _am_tools=none
    1173       fi],
    1174 
    1175   [pax],
    1176     [],
    1177 
    1178   [m4_fatal([Unknown tar format])])
    1179 
    1180   AC_MSG_CHECKING([how to create a $1 tar archive])
    1181 
    1182   # Go ahead even if we have the value already cached.  We do so because we
    1183   # need to set the values for the 'am__tar' and 'am__untar' variables.
    1184   _am_tools=${am_cv_prog_tar_$1-$_am_tools}
    1185 
    1186   for _am_tool in $_am_tools; do
    1187     case $_am_tool in
    1188     gnutar)
    1189       for _am_tar in tar gnutar gtar; do
    1190         AM_RUN_LOG([$_am_tar --version]) && break
    1191       done
    1192       am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
    1193       am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
    1194       am__untar="$_am_tar -xf -"
    1195       ;;
    1196     plaintar)
    1197       # Must skip GNU tar: if it does not support --format= it doesn't create
    1198       # ustar tarball either.
    1199       (tar --version) >/dev/null 2>&1 && continue
    1200       am__tar='tar chf - "$$tardir"'
    1201       am__tar_='tar chf - "$tardir"'
    1202       am__untar='tar xf -'
    1203       ;;
    1204     pax)
    1205       am__tar='pax -L -x $1 -w "$$tardir"'
    1206       am__tar_='pax -L -x $1 -w "$tardir"'
    1207       am__untar='pax -r'
    1208       ;;
    1209     cpio)
    1210       am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
    1211       am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
    1212       am__untar='cpio -i -H $1 -d'
    1213       ;;
    1214     none)
    1215       am__tar=false
    1216       am__tar_=false
    1217       am__untar=false
    1218       ;;
    1219     esac
    1220 
    1221     # If the value was cached, stop now.  We just wanted to have am__tar
    1222     # and am__untar set.
    1223     test -n "${am_cv_prog_tar_$1}" && break
    1224 
    1225     # tar/untar a dummy directory, and stop if the command works.
    1226     rm -rf conftest.dir
    1227     mkdir conftest.dir
    1228     echo GrepMe > conftest.dir/file
    1229     AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
    1230     rm -rf conftest.dir
    1231     if test -s conftest.tar; then
    1232       AM_RUN_LOG([$am__untar <conftest.tar])
    1233       AM_RUN_LOG([cat conftest.dir/file])
    1234       grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
    1235     fi
    1236   done
     1103_am_tools=${am_cv_prog_tar_$1-$_am_tools}
     1104# Do not fold the above two line into one, because Tru64 sh and
     1105# Solaris sh will not grok spaces in the rhs of `-'.
     1106for _am_tool in $_am_tools
     1107do
     1108  case $_am_tool in
     1109  gnutar)
     1110    for _am_tar in tar gnutar gtar;
     1111    do
     1112      AM_RUN_LOG([$_am_tar --version]) && break
     1113    done
     1114    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
     1115    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
     1116    am__untar="$_am_tar -xf -"
     1117    ;;
     1118  plaintar)
     1119    # Must skip GNU tar: if it does not support --format= it doesn't create
     1120    # ustar tarball either.
     1121    (tar --version) >/dev/null 2>&1 && continue
     1122    am__tar='tar chf - "$$tardir"'
     1123    am__tar_='tar chf - "$tardir"'
     1124    am__untar='tar xf -'
     1125    ;;
     1126  pax)
     1127    am__tar='pax -L -x $1 -w "$$tardir"'
     1128    am__tar_='pax -L -x $1 -w "$tardir"'
     1129    am__untar='pax -r'
     1130    ;;
     1131  cpio)
     1132    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
     1133    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
     1134    am__untar='cpio -i -H $1 -d'
     1135    ;;
     1136  none)
     1137    am__tar=false
     1138    am__tar_=false
     1139    am__untar=false
     1140    ;;
     1141  esac
     1142
     1143  # If the value was cached, stop now.  We just wanted to have am__tar
     1144  # and am__untar set.
     1145  test -n "${am_cv_prog_tar_$1}" && break
     1146
     1147  # tar/untar a dummy directory, and stop if the command works
    12371148  rm -rf conftest.dir
    1238 
    1239   AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
    1240   AC_MSG_RESULT([$am_cv_prog_tar_$1])])
    1241 
     1149  mkdir conftest.dir
     1150  echo GrepMe > conftest.dir/file
     1151  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
     1152  rm -rf conftest.dir
     1153  if test -s conftest.tar; then
     1154    AM_RUN_LOG([$am__untar <conftest.tar])
     1155    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
     1156  fi
     1157done
     1158rm -rf conftest.dir
     1159
     1160AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
     1161AC_MSG_RESULT([$am_cv_prog_tar_$1])])
    12421162AC_SUBST([am__tar])
    12431163AC_SUBST([am__untar])
  • automake/config.guess

    rb826e6b rfea3faa  
    1 /usr/share/automake-1.15/config.guess
     1/usr/share/automake-1.11/config.guess
  • automake/config.sub

    rb826e6b rfea3faa  
    1 /usr/share/automake-1.15/config.sub
     1/usr/share/automake-1.11/config.sub
  • automake/missing

    rb826e6b rfea3faa  
    11#! /bin/sh
    2 # Common wrapper for a few potentially missing GNU programs.
    3 
    4 scriptversion=2013-10-28.13; # UTC
    5 
    6 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
    7 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
     2# Common stub for a few missing GNU programs while installing.
     3
     4scriptversion=2012-01-06.13; # UTC
     5
     6# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
     7# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
     8# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
    89
    910# This program is free software; you can redistribute it and/or modify
     
    2627
    2728if test $# -eq 0; then
    28   echo 1>&2 "Try '$0 --help' for more information"
     29  echo 1>&2 "Try \`$0 --help' for more information"
    2930  exit 1
    3031fi
    3132
     33run=:
     34sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
     35sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
     36
     37# In the cases where this matters, `missing' is being run in the
     38# srcdir already.
     39if test -f configure.ac; then
     40  configure_ac=configure.ac
     41else
     42  configure_ac=configure.in
     43fi
     44
     45msg="missing on your system"
     46
    3247case $1 in
    33 
    34   --is-lightweight)
    35     # Used by our autoconf macros to check whether the available missing
    36     # script is modern enough.
    37     exit 0
    38     ;;
    39 
    40   --run)
    41     # Back-compat with the calling convention used by older automake.
    42     shift
    43     ;;
     48--run)
     49  # Try to run requested program, and just exit if it succeeds.
     50  run=
     51  shift
     52  "$@" && exit 0
     53  # Exit code 63 means version mismatch.  This often happens
     54  # when the user try to use an ancient version of a tool on
     55  # a file that requires a minimum version.  In this case we
     56  # we should proceed has if the program had been absent, or
     57  # if --run hadn't been passed.
     58  if test $? = 63; then
     59    run=:
     60    msg="probably too old"
     61  fi
     62  ;;
    4463
    4564  -h|--h|--he|--hel|--help)
     
    4766$0 [OPTION]... PROGRAM [ARGUMENT]...
    4867
    49 Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
    50 to PROGRAM being missing or too old.
     68Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
     69error status if there is no known handling for PROGRAM.
    5170
    5271Options:
    5372  -h, --help      display this help and exit
    5473  -v, --version   output version information and exit
     74  --run           try to run the given command, and emulate it if it fails
    5575
    5676Supported PROGRAM values:
    57   aclocal   autoconf  autoheader   autom4te  automake  makeinfo
    58   bison     yacc      flex         lex       help2man
    59 
    60 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
    61 'g' are ignored when checking the name.
     77  aclocal      touch file \`aclocal.m4'
     78  autoconf     touch file \`configure'
     79  autoheader   touch file \`config.h.in'
     80  autom4te     touch the output file, or create a stub one
     81  automake     touch all \`Makefile.in' files
     82  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
     83  flex         create \`lex.yy.c', if possible, from existing .c
     84  help2man     touch the output file
     85  lex          create \`lex.yy.c', if possible, from existing .c
     86  makeinfo     touch the output file
     87  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
     88
     89Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
     90\`g' are ignored when checking the name.
    6291
    6392Send bug reports to <bug-automake@gnu.org>."
     
    71100
    72101  -*)
    73     echo 1>&2 "$0: unknown '$1' option"
    74     echo 1>&2 "Try '$0 --help' for more information"
     102    echo 1>&2 "$0: Unknown \`$1' option"
     103    echo 1>&2 "Try \`$0 --help' for more information"
    75104    exit 1
    76105    ;;
     
    78107esac
    79108
    80 # Run the given program, remember its exit status.
    81 "$@"; st=$?
    82 
    83 # If it succeeded, we are done.
    84 test $st -eq 0 && exit 0
    85 
    86 # Also exit now if we it failed (or wasn't found), and '--version' was
    87 # passed; such an option is passed most likely to detect whether the
    88 # program is present and works.
    89 case $2 in --version|--help) exit $st;; esac
    90 
    91 # Exit code 63 means version mismatch.  This often happens when the user
    92 # tries to use an ancient version of a tool on a file that requires a
    93 # minimum version.
    94 if test $st -eq 63; then
    95   msg="probably too old"
    96 elif test $st -eq 127; then
    97   # Program was missing.
    98   msg="missing on your system"
    99 else
    100   # Program was found and executed, but failed.  Give up.
    101   exit $st
    102 fi
    103 
    104 perl_URL=http://www.perl.org/
    105 flex_URL=http://flex.sourceforge.net/
    106 gnu_software_URL=http://www.gnu.org/software
    107 
    108 program_details ()
    109 {
    110   case $1 in
    111     aclocal|automake)
    112       echo "The '$1' program is part of the GNU Automake package:"
    113       echo "<$gnu_software_URL/automake>"
    114       echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
    115       echo "<$gnu_software_URL/autoconf>"
    116       echo "<$gnu_software_URL/m4/>"
    117       echo "<$perl_URL>"
    118       ;;
    119     autoconf|autom4te|autoheader)
    120       echo "The '$1' program is part of the GNU Autoconf package:"
    121       echo "<$gnu_software_URL/autoconf/>"
    122       echo "It also requires GNU m4 and Perl in order to run:"
    123       echo "<$gnu_software_URL/m4/>"
    124       echo "<$perl_URL>"
    125       ;;
    126   esac
    127 }
    128 
    129 give_advice ()
    130 {
    131   # Normalize program name to check for.
    132   normalized_program=`echo "$1" | sed '
    133     s/^gnu-//; t
    134     s/^gnu//; t
    135     s/^g//; t'`
    136 
    137   printf '%s\n' "'$1' is $msg."
    138 
    139   configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
    140   case $normalized_program in
    141     autoconf*)
    142       echo "You should only need it if you modified 'configure.ac',"
    143       echo "or m4 files included by it."
    144       program_details 'autoconf'
    145       ;;
    146     autoheader*)
    147       echo "You should only need it if you modified 'acconfig.h' or"
    148       echo "$configure_deps."
    149       program_details 'autoheader'
    150       ;;
    151     automake*)
    152       echo "You should only need it if you modified 'Makefile.am' or"
    153       echo "$configure_deps."
    154       program_details 'automake'
    155       ;;
    156     aclocal*)
    157       echo "You should only need it if you modified 'acinclude.m4' or"
    158       echo "$configure_deps."
    159       program_details 'aclocal'
    160       ;;
    161    autom4te*)
    162       echo "You might have modified some maintainer files that require"
    163       echo "the 'autom4te' program to be rebuilt."
    164       program_details 'autom4te'
    165       ;;
    166     bison*|yacc*)
    167       echo "You should only need it if you modified a '.y' file."
    168       echo "You may want to install the GNU Bison package:"
    169       echo "<$gnu_software_URL/bison/>"
    170       ;;
    171     lex*|flex*)
    172       echo "You should only need it if you modified a '.l' file."
    173       echo "You may want to install the Fast Lexical Analyzer package:"
    174       echo "<$flex_URL>"
    175       ;;
    176     help2man*)
    177       echo "You should only need it if you modified a dependency" \
    178            "of a man page."
    179       echo "You may want to install the GNU Help2man package:"
    180       echo "<$gnu_software_URL/help2man/>"
    181     ;;
    182     makeinfo*)
    183       echo "You should only need it if you modified a '.texi' file, or"
    184       echo "any other file indirectly affecting the aspect of the manual."
    185       echo "You might want to install the Texinfo package:"
    186       echo "<$gnu_software_URL/texinfo/>"
    187       echo "The spurious makeinfo call might also be the consequence of"
    188       echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
    189       echo "want to install GNU make:"
    190       echo "<$gnu_software_URL/make/>"
    191       ;;
    192     *)
    193       echo "You might have modified some files without having the proper"
    194       echo "tools for further handling them.  Check the 'README' file, it"
    195       echo "often tells you about the needed prerequisites for installing"
    196       echo "this package.  You may also peek at any GNU archive site, in"
    197       echo "case some other package contains this missing '$1' program."
    198       ;;
    199   esac
    200 }
    201 
    202 give_advice "$1" | sed -e '1s/^/WARNING: /' \
    203                        -e '2,$s/^/         /' >&2
    204 
    205 # Propagate the correct exit status (expected to be 127 for a program
    206 # not found, 63 for a program that failed due to version mismatch).
    207 exit $st
     109# normalize program name to check for.
     110program=`echo "$1" | sed '
     111  s/^gnu-//; t
     112  s/^gnu//; t
     113  s/^g//; t'`
     114
     115# Now exit if we have it, but it failed.  Also exit now if we
     116# don't have it and --version was passed (most likely to detect
     117# the program).  This is about non-GNU programs, so use $1 not
     118# $program.
     119case $1 in
     120  lex*|yacc*)
     121    # Not GNU programs, they don't have --version.
     122    ;;
     123
     124  *)
     125    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
     126       # We have it, but it failed.
     127       exit 1
     128    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
     129       # Could not run --version or --help.  This is probably someone
     130       # running `$TOOL --version' or `$TOOL --help' to check whether
     131       # $TOOL exists and not knowing $TOOL uses missing.
     132       exit 1
     133    fi
     134    ;;
     135esac
     136
     137# If it does not exist, or fails to run (possibly an outdated version),
     138# try to emulate it.
     139case $program in
     140  aclocal*)
     141    echo 1>&2 "\
     142WARNING: \`$1' is $msg.  You should only need it if
     143         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
     144         to install the \`Automake' and \`Perl' packages.  Grab them from
     145         any GNU archive site."
     146    touch aclocal.m4
     147    ;;
     148
     149  autoconf*)
     150    echo 1>&2 "\
     151WARNING: \`$1' is $msg.  You should only need it if
     152         you modified \`${configure_ac}'.  You might want to install the
     153         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
     154         archive site."
     155    touch configure
     156    ;;
     157
     158  autoheader*)
     159    echo 1>&2 "\
     160WARNING: \`$1' is $msg.  You should only need it if
     161         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
     162         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
     163         from any GNU archive site."
     164    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
     165    test -z "$files" && files="config.h"
     166    touch_files=
     167    for f in $files; do
     168      case $f in
     169      *:*) touch_files="$touch_files "`echo "$f" |
     170                                       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
     171      *) touch_files="$touch_files $f.in";;
     172      esac
     173    done
     174    touch $touch_files
     175    ;;
     176
     177  automake*)
     178    echo 1>&2 "\
     179WARNING: \`$1' is $msg.  You should only need it if
     180         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
     181         You might want to install the \`Automake' and \`Perl' packages.
     182         Grab them from any GNU archive site."
     183    find . -type f -name Makefile.am -print |
     184           sed 's/\.am$/.in/' |
     185           while read f; do touch "$f"; done
     186    ;;
     187
     188  autom4te*)
     189    echo 1>&2 "\
     190WARNING: \`$1' is needed, but is $msg.
     191         You might have modified some files without having the
     192         proper tools for further handling them.
     193         You can get \`$1' as part of \`Autoconf' from any GNU
     194         archive site."
     195
     196    file=`echo "$*" | sed -n "$sed_output"`
     197    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     198    if test -f "$file"; then
     199        touch $file
     200    else
     201        test -z "$file" || exec >$file
     202        echo "#! /bin/sh"
     203        echo "# Created by GNU Automake missing as a replacement of"
     204        echo "#  $ $@"
     205        echo "exit 0"
     206        chmod +x $file
     207        exit 1
     208    fi
     209    ;;
     210
     211  bison*|yacc*)
     212    echo 1>&2 "\
     213WARNING: \`$1' $msg.  You should only need it if
     214         you modified a \`.y' file.  You may need the \`Bison' package
     215         in order for those modifications to take effect.  You can get
     216         \`Bison' from any GNU archive site."
     217    rm -f y.tab.c y.tab.h
     218    if test $# -ne 1; then
     219        eval LASTARG=\${$#}
     220        case $LASTARG in
     221        *.y)
     222            SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
     223            if test -f "$SRCFILE"; then
     224                 cp "$SRCFILE" y.tab.c
     225            fi
     226            SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
     227            if test -f "$SRCFILE"; then
     228                 cp "$SRCFILE" y.tab.h
     229            fi
     230          ;;
     231        esac
     232    fi
     233    if test ! -f y.tab.h; then
     234        echo >y.tab.h
     235    fi
     236    if test ! -f y.tab.c; then
     237        echo 'main() { return 0; }' >y.tab.c
     238    fi
     239    ;;
     240
     241  lex*|flex*)
     242    echo 1>&2 "\
     243WARNING: \`$1' is $msg.  You should only need it if
     244         you modified a \`.l' file.  You may need the \`Flex' package
     245         in order for those modifications to take effect.  You can get
     246         \`Flex' from any GNU archive site."
     247    rm -f lex.yy.c
     248    if test $# -ne 1; then
     249        eval LASTARG=\${$#}
     250        case $LASTARG in
     251        *.l)
     252            SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
     253            if test -f "$SRCFILE"; then
     254                 cp "$SRCFILE" lex.yy.c
     255            fi
     256          ;;
     257        esac
     258    fi
     259    if test ! -f lex.yy.c; then
     260        echo 'main() { return 0; }' >lex.yy.c
     261    fi
     262    ;;
     263
     264  help2man*)
     265    echo 1>&2 "\
     266WARNING: \`$1' is $msg.  You should only need it if
     267         you modified a dependency of a manual page.  You may need the
     268         \`Help2man' package in order for those modifications to take
     269         effect.  You can get \`Help2man' from any GNU archive site."
     270
     271    file=`echo "$*" | sed -n "$sed_output"`
     272    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     273    if test -f "$file"; then
     274        touch $file
     275    else
     276        test -z "$file" || exec >$file
     277        echo ".ab help2man is required to generate this page"
     278        exit $?
     279    fi
     280    ;;
     281
     282  makeinfo*)
     283    echo 1>&2 "\
     284WARNING: \`$1' is $msg.  You should only need it if
     285         you modified a \`.texi' or \`.texinfo' file, or any other file
     286         indirectly affecting the aspect of the manual.  The spurious
     287         call might also be the consequence of using a buggy \`make' (AIX,
     288         DU, IRIX).  You might want to install the \`Texinfo' package or
     289         the \`GNU make' package.  Grab either from any GNU archive site."
     290    # The file to touch is that specified with -o ...
     291    file=`echo "$*" | sed -n "$sed_output"`
     292    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
     293    if test -z "$file"; then
     294      # ... or it is the one specified with @setfilename ...
     295      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
     296      file=`sed -n '
     297        /^@setfilename/{
     298          s/.* \([^ ]*\) *$/\1/
     299          p
     300          q
     301        }' $infile`
     302      # ... or it is derived from the source name (dir/f.texi becomes f.info)
     303      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     304    fi
     305    # If the file does not exist, the user really needs makeinfo;
     306    # let's fail without touching anything.
     307    test -f $file || exit 1
     308    touch $file
     309    ;;
     310
     311  *)
     312    echo 1>&2 "\
     313WARNING: \`$1' is needed, and is $msg.
     314         You might have modified some files without having the
     315         proper tools for further handling them.  Check the \`README' file,
     316         it often tells you about the needed prerequisites for installing
     317         this package.  You may also peek at any GNU archive site, in case
     318         some other package would contain this missing \`$1' program."
     319    exit 1
     320    ;;
     321esac
     322
     323exit 0
    208324
    209325# Local variables:
  • config.h.in

    rb826e6b rfea3faa  
    120120/* Define to 1 if the system has the type `_Bool'. */
    121121#undef HAVE__BOOL
     122
     123/* Define to 1 if your C compiler doesn't accept -c and -o together. */
     124#undef NO_MINUS_C_MINUS_O
    122125
    123126/* Name of package */
  • configure

    rb826e6b rfea3faa  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.69 for cfa-cc 1.0.0.0.
     3# Generated by GNU Autoconf 2.68 for cfa-cc 1.0.0.0.
    44#
    55# Report bugs to <cforall@plg.uwaterloo.ca>.
    66#
    77#
    8 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
     8# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
     9# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
     10# Foundation, Inc.
    911#
    1012#
     
    135137(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
    136138
    137 # Use a proper internal environment variable to ensure we don't fall
    138   # into an infinite loop, continuously re-executing ourselves.
    139   if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
    140     _as_can_reexec=no; export _as_can_reexec;
    141     # We cannot yet assume a decent shell, so we have to provide a
    142 # neutralization value for shells without unset; and this also
    143 # works around shells that cannot unset nonexistent variables.
    144 # Preserve -v and -x to the replacement shell.
    145 BASH_ENV=/dev/null
    146 ENV=/dev/null
    147 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
    148 case $- in # ((((
    149   *v*x* | *x*v* ) as_opts=-vx ;;
    150   *v* ) as_opts=-v ;;
    151   *x* ) as_opts=-x ;;
    152   * ) as_opts= ;;
    153 esac
    154 exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
    155 # Admittedly, this is quite paranoid, since all the known shells bail
    156 # out after a failed `exec'.
    157 $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
    158 as_fn_exit 255
    159   fi
    160   # We don't want this to propagate to other subprocesses.
    161           { _as_can_reexec=; unset _as_can_reexec;}
    162139if test "x$CONFIG_SHELL" = x; then
    163140  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
     
    193170  exitcode=1; echo positional parameters were not saved.
    194171fi
    195 test x\$exitcode = x0 || exit 1
    196 test -x / || exit 1"
     172test x\$exitcode = x0 || exit 1"
    197173  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
    198174  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
     
    239215
    240216      if test "x$CONFIG_SHELL" != x; then :
    241   export CONFIG_SHELL
    242              # We cannot yet assume a decent shell, so we have to provide a
    243 # neutralization value for shells without unset; and this also
    244 # works around shells that cannot unset nonexistent variables.
    245 # Preserve -v and -x to the replacement shell.
    246 BASH_ENV=/dev/null
    247 ENV=/dev/null
    248 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
    249 case $- in # ((((
    250   *v*x* | *x*v* ) as_opts=-vx ;;
    251   *v* ) as_opts=-v ;;
    252   *x* ) as_opts=-x ;;
    253   * ) as_opts= ;;
    254 esac
    255 exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
    256 # Admittedly, this is quite paranoid, since all the known shells bail
    257 # out after a failed `exec'.
    258 $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
    259 exit 255
     217  # We cannot yet assume a decent shell, so we have to provide a
     218        # neutralization value for shells without unset; and this also
     219        # works around shells that cannot unset nonexistent variables.
     220        # Preserve -v and -x to the replacement shell.
     221        BASH_ENV=/dev/null
     222        ENV=/dev/null
     223        (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
     224        export CONFIG_SHELL
     225        case $- in # ((((
     226          *v*x* | *x*v* ) as_opts=-vx ;;
     227          *v* ) as_opts=-v ;;
     228          *x* ) as_opts=-x ;;
     229          * ) as_opts= ;;
     230        esac
     231        exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
    260232fi
    261233
     
    360332
    361333} # as_fn_mkdir_p
    362 
    363 # as_fn_executable_p FILE
    364 # -----------------------
    365 # Test if FILE is an executable regular file.
    366 as_fn_executable_p ()
    367 {
    368   test -f "$1" && test -x "$1"
    369 } # as_fn_executable_p
    370334# as_fn_append VAR VALUE
    371335# ----------------------
     
    489453    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
    490454
    491   # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
    492   # already done that, so ensure we don't try to do so again and fall
    493   # in an infinite loop.  This has already happened in practice.
    494   _as_can_reexec=no; export _as_can_reexec
    495455  # Don't try to exec as it changes $[0], causing all sort of problems
    496456  # (the dirname of $[0] is not the place where we might find the
     
    527487    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    528488    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    529     # In both cases, we have to default to `cp -pR'.
     489    # In both cases, we have to default to `cp -p'.
    530490    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
    531       as_ln_s='cp -pR'
     491      as_ln_s='cp -p'
    532492  elif ln conf$$.file conf$$ 2>/dev/null; then
    533493    as_ln_s=ln
    534494  else
    535     as_ln_s='cp -pR'
     495    as_ln_s='cp -p'
    536496  fi
    537497else
    538   as_ln_s='cp -pR'
     498  as_ln_s='cp -p'
    539499fi
    540500rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
     
    548508fi
    549509
    550 as_test_x='test -x'
    551 as_executable_p=as_fn_executable_p
     510if test -x / >/dev/null 2>&1; then
     511  as_test_x='test -x'
     512else
     513  if ls -dL / >/dev/null 2>&1; then
     514    as_ls_L_option=L
     515  else
     516    as_ls_L_option=
     517  fi
     518  as_test_x='
     519    eval sh -c '\''
     520      if test -d "$1"; then
     521        test -d "$1/.";
     522      else
     523        case $1 in #(
     524        -*)set "./$1";;
     525        esac;
     526        case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
     527        ???[sx]*):;;*)false;;esac;fi
     528    '\'' sh
     529  '
     530fi
     531as_executable_p=$as_test_x
    552532
    553533# Sed expression to map a string onto a valid CPP name.
     
    738718oldincludedir
    739719includedir
    740 runstatedir
    741720localstatedir
    742721sharedstatedir
     
    824803sharedstatedir='${prefix}/com'
    825804localstatedir='${prefix}/var'
    826 runstatedir='${localstatedir}/run'
    827805includedir='${prefix}/include'
    828806oldincludedir='/usr/include'
     
    10771055    silent=yes ;;
    10781056
    1079   -runstatedir | --runstatedir | --runstatedi | --runstated \
    1080   | --runstate | --runstat | --runsta | --runst | --runs \
    1081   | --run | --ru | --r)
    1082     ac_prev=runstatedir ;;
    1083   -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
    1084   | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
    1085   | --run=* | --ru=* | --r=*)
    1086     runstatedir=$ac_optarg ;;
    1087 
    10881057  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
    10891058    ac_prev=sbindir ;;
     
    12231192                datadir sysconfdir sharedstatedir localstatedir includedir \
    12241193                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
    1225                 libdir localedir mandir runstatedir
     1194                libdir localedir mandir
    12261195do
    12271196  eval ac_val=\$$ac_var
     
    12511220  if test "x$build_alias" = x; then
    12521221    cross_compiling=maybe
     1222    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
     1223    If a cross compiler is detected then cross compile mode will be used" >&2
    12531224  elif test "x$build_alias" != "x$host_alias"; then
    12541225    cross_compiling=yes
     
    13761347  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    13771348  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    1378   --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
    13791349  --libdir=DIR            object code libraries [EPREFIX/lib]
    13801350  --includedir=DIR        C header files [PREFIX/include]
     
    14151385  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
    14161386  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
    1417   --enable-silent-rules   less verbose build output (undo: "make V=1")
    1418   --disable-silent-rules  verbose build output (undo: "make V=0")
    1419   --disable-maintainer-mode
    1420                           disable make rules and dependencies not useful (and
    1421                           sometimes confusing) to the casual installer
     1387  --enable-silent-rules          less verbose build output (undo: `make V=1')
     1388  --disable-silent-rules         verbose build output (undo: `make V=0')
     1389  --disable-maintainer-mode  disable make rules and dependencies not useful
     1390                          (and sometimes confusing) to the casual installer
    14221391  --enable-target-release Build and install the release target
    14231392  --enable-target-debug   Build and install the debug target
    14241393  --enable-threading      Build and install libcfa with threading support
    14251394                          (Enabled by default)
    1426   --enable-dependency-tracking
    1427                           do not reject slow dependency extractors
    1428   --disable-dependency-tracking
    1429                           speeds up one-time build
     1395  --disable-dependency-tracking  speeds up one-time build
     1396  --enable-dependency-tracking   do not reject slow dependency extractors
    14301397
    14311398Optional Packages:
     
    15221489  cat <<\_ACEOF
    15231490cfa-cc configure 1.0.0.0
    1524 generated by GNU Autoconf 2.69
    1525 
    1526 Copyright (C) 2012 Free Software Foundation, Inc.
     1491generated by GNU Autoconf 2.68
     1492
     1493Copyright (C) 2010 Free Software Foundation, Inc.
    15271494This configure script is free software; the Free Software Foundation
    15281495gives unlimited permission to copy, distribute and modify it.
     
    16381605       } && test -s conftest$ac_exeext && {
    16391606         test "$cross_compiling" = yes ||
    1640          test -x conftest$ac_exeext
     1607         $as_test_x conftest$ac_exeext
    16411608       }; then :
    16421609  ac_retval=0
     
    20041971{
    20051972static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
    2006 test_array [0] = 0;
    2007 return test_array [0];
     1973test_array [0] = 0
    20081974
    20091975  ;
     
    20211987static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
    20221988                 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
    2023 test_array [0] = 0;
    2024 return test_array [0];
     1989test_array [0] = 0
    20251990
    20261991  ;
     
    20792044{
    20802045static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
    2081 test_array [0] = 0;
    2082 return test_array [0];
     2046test_array [0] = 0
    20832047
    20842048  ;
     
    21132077
    21142078It was created by cfa-cc $as_me 1.0.0.0, which was
    2115 generated by GNU Autoconf 2.69.  Invocation command line was
     2079generated by GNU Autoconf 2.68.  Invocation command line was
    21162080
    21172081  $ $0 $@
     
    24972461fi
    24982462
    2499 case $enable_silent_rules in # (((
    2500   yes) AM_DEFAULT_VERBOSITY=0;;
    2501    no) AM_DEFAULT_VERBOSITY=1;;
    2502     *) AM_DEFAULT_VERBOSITY=1;;
     2463case $enable_silent_rules in
     2464yes) AM_DEFAULT_VERBOSITY=0;;
     2465no) AM_DEFAULT_VERBOSITY=1;;
     2466*)  AM_DEFAULT_VERBOSITY=1;;
    25032467esac
    25042468am_make=${MAKE-make}
     
    25322496
    25332497
    2534 am__api_version='1.15'
     2498am__api_version='1.11'
    25352499
    25362500# Find a good install program.  We prefer a C program (faster),
     
    25712535    for ac_prog in ginstall scoinst install; do
    25722536      for ac_exec_ext in '' $ac_executable_extensions; do
    2573         if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
     2537        if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
    25742538          if test $ac_prog = install &&
    25752539            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
     
    26292593{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
    26302594$as_echo_n "checking whether build environment is sane... " >&6; }
     2595# Just in case
     2596sleep 1
     2597echo timestamp > conftest.file
    26312598# Reject unsafe characters in $srcdir or the absolute working directory
    26322599# name.  Accept space and tab only in the latter.
     
    26392606case $srcdir in
    26402607  *[\\\"\#\$\&\'\`$am_lf\ \     ]*)
    2641     as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
     2608    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
    26422609esac
    26432610
    2644 # Do 'set' in a subshell so we don't clobber the current shell's
     2611# Do `set' in a subshell so we don't clobber the current shell's
    26452612# arguments.  Must try -L first in case configure is actually a
    26462613# symlink; some systems play weird games with the mod time of symlinks
     
    26482615# directory).
    26492616if (
    2650    am_has_slept=no
    2651    for am_try in 1 2; do
    2652      echo "timestamp, slept: $am_has_slept" > conftest.file
    2653      set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    2654      if test "$*" = "X"; then
    2655         # -L didn't work.
    2656         set X `ls -t "$srcdir/configure" conftest.file`
    2657      fi
    2658      if test "$*" != "X $srcdir/configure conftest.file" \
    2659         && test "$*" != "X conftest.file $srcdir/configure"; then
    2660 
    2661         # If neither matched, then we have a broken ls.  This can happen
    2662         # if, for instance, CONFIG_SHELL is bash and it inherits a
    2663         # broken ls alias from the environment.  This has actually
    2664         # happened.  Such a system could not be considered "sane".
    2665         as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
    2666   alias in your environment" "$LINENO" 5
    2667      fi
    2668      if test "$2" = conftest.file || test $am_try -eq 2; then
    2669        break
    2670      fi
    2671      # Just in case.
    2672      sleep 1
    2673      am_has_slept=yes
    2674    done
     2617   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
     2618   if test "$*" = "X"; then
     2619      # -L didn't work.
     2620      set X `ls -t "$srcdir/configure" conftest.file`
     2621   fi
     2622   rm -f conftest.file
     2623   if test "$*" != "X $srcdir/configure conftest.file" \
     2624      && test "$*" != "X conftest.file $srcdir/configure"; then
     2625
     2626      # If neither matched, then we have a broken ls.  This can happen
     2627      # if, for instance, CONFIG_SHELL is bash and it inherits a
     2628      # broken ls alias from the environment.  This has actually
     2629      # happened.  Such a system could not be considered "sane".
     2630      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
     2631alias in your environment" "$LINENO" 5
     2632   fi
     2633
    26752634   test "$2" = conftest.file
    26762635   )
     
    26842643{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
    26852644$as_echo "yes" >&6; }
    2686 # If we didn't sleep, we still need to ensure time stamps of config.status and
    2687 # generated files are strictly newer.
    2688 am_sleep_pid=
    2689 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
    2690   ( sleep 1 ) &
    2691   am_sleep_pid=$!
    2692 fi
    2693 
    2694 rm -f conftest.file
    2695 
    26962645test "$program_prefix" != NONE &&
    26972646  program_transform_name="s&^&$program_prefix&;$program_transform_name"
     
    27042653program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
    27052654
    2706 # Expand $ac_aux_dir to an absolute path.
    2707 am_aux_dir=`cd "$ac_aux_dir" && pwd`
     2655# expand $ac_aux_dir to an absolute path
     2656am_aux_dir=`cd $ac_aux_dir && pwd`
    27082657
    27092658if test x"${MISSING+set}" != xset; then
     
    27162665fi
    27172666# Use eval to expand $SHELL
    2718 if eval "$MISSING --is-lightweight"; then
    2719   am_missing_run="$MISSING "
     2667if eval "$MISSING --run true"; then
     2668  am_missing_run="$MISSING --run "
    27202669else
    27212670  am_missing_run=
    2722   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
    2723 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
    2724 fi
    2725 
    2726 if test x"${install_sh+set}" != xset; then
     2671  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
     2672$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
     2673fi
     2674
     2675if test x"${install_sh}" != xset; then
    27272676  case $am_aux_dir in
    27282677  *\ * | *\     *)
     
    27332682fi
    27342683
    2735 # Installed binaries are usually stripped using 'strip' when the user
    2736 # run "make install-strip".  However 'strip' might not be the right
     2684# Installed binaries are usually stripped using `strip' when the user
     2685# run `make install-strip'.  However `strip' might not be the right
    27372686# tool to use in cross-compilation environments, therefore Automake
    2738 # will honor the 'STRIP' environment variable to overrule this program.
     2687# will honor the `STRIP' environment variable to overrule this program.
    27392688if test "$cross_compiling" != no; then
    27402689  if test -n "$ac_tool_prefix"; then
     
    27552704  test -z "$as_dir" && as_dir=.
    27562705    for ac_exec_ext in '' $ac_executable_extensions; do
    2757   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     2706  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    27582707    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
    27592708    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    27952744  test -z "$as_dir" && as_dir=.
    27962745    for ac_exec_ext in '' $ac_executable_extensions; do
    2797   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     2746  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    27982747    ac_cv_prog_ac_ct_STRIP="strip"
    27992748    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    28462795    for ac_prog in mkdir gmkdir; do
    28472796         for ac_exec_ext in '' $ac_executable_extensions; do
    2848            as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
     2797           { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
    28492798           case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
    28502799             'mkdir (GNU coreutils) '* | \
     
    28752824$as_echo "$MKDIR_P" >&6; }
    28762825
     2826mkdir_p="$MKDIR_P"
     2827case $mkdir_p in
     2828  [\\/$]* | ?:[\\/]*) ;;
     2829  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
     2830esac
     2831
    28772832for ac_prog in gawk mawk nawk awk
    28782833do
     
    28932848  test -z "$as_dir" && as_dir=.
    28942849    for ac_exec_ext in '' $ac_executable_extensions; do
    2895   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     2850  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    28962851    ac_cv_prog_AWK="$ac_prog"
    28972852    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    30072962MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
    30082963
    3009 # For better backward compatibility.  To be removed once Automake 1.9.x
    3010 # dies out for good.  For more background, see:
    3011 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
    3012 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
    3013 mkdir_p='$(MKDIR_P)'
    3014 
    3015 # We need awk for the "check" target (and possibly the TAP driver).  The
    3016 # system "awk" is bad on some platforms.
     2964# We need awk for the "check" target.  The system "awk" is bad on
     2965# some platforms.
    30172966# Always define AMTAR for backward compatibility.  Yes, it's still used
    30182967# in the wild :-(  We should find a proper way to deprecate it ...
    30192968AMTAR='$${TAR-tar}'
    30202969
    3021 
    3022 # We'll loop over all known methods to create a tar archive until one works.
    3023 _am_tools='gnutar  pax cpio none'
    3024 
    30252970am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
    30262971
     
    30282973
    30292974
    3030 
    3031 
    3032 # POSIX will say in a future version that running "rm -f" with no argument
    3033 # is OK; and we want to be able to make that assumption in our Makefile
    3034 # recipes.  So use an aggressive probe to check that the usage we want is
    3035 # actually supported "in the wild" to an acceptable degree.
    3036 # See automake bug#10828.
    3037 # To make any issue more visible, cause the running configure to be aborted
    3038 # by default if the 'rm' program in use doesn't match our expectations; the
    3039 # user can still override this though.
    3040 if rm -f && rm -fr && rm -rf; then : OK; else
    3041   cat >&2 <<'END'
    3042 Oops!
    3043 
    3044 Your 'rm' program seems unable to run without file operands specified
    3045 on the command line, even when the '-f' option is present.  This is contrary
    3046 to the behaviour of most rm programs out there, and not conforming with
    3047 the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
    3048 
    3049 Please tell bug-automake@gnu.org about your system, including the value
    3050 of your $PATH and any error possibly output before this message.  This
    3051 can help us improve future automake versions.
    3052 
    3053 END
    3054   if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
    3055     echo 'Configuration will proceed anyway, since you have set the' >&2
    3056     echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
    3057     echo >&2
    3058   else
    3059     cat >&2 <<'END'
    3060 Aborting the configuration process, to ensure you take notice of the issue.
    3061 
    3062 You can download and install GNU coreutils to get an 'rm' implementation
    3063 that behaves properly: <http://www.gnu.org/software/coreutils/>.
    3064 
    3065 If you want to complete the configuration process using your problematic
    3066 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
    3067 to "yes", and re-run configure.
    3068 
    3069 END
    3070     as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
    3071   fi
    3072 fi
    30732975
    30742976
     
    32003102  test -z "$as_dir" && as_dir=.
    32013103    for ac_exec_ext in '' $ac_executable_extensions; do
    3202   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     3104  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    32033105    ac_cv_path_BACKEND_CC="$as_dir/$ac_word$ac_exec_ext"
    32043106    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    34713373        case $host_cpu in
    34723374                i386)
    3473                         CFLAGS+=" -m32 "
    3474                         CXXFLAGS+=" -m32 "
    3475                         CFAFLAGS+=" -m32 "
    3476                         LDFLAGS+=" -m32 "
     3375                        CFLAGS+="-m32"
     3376                        CXXFLAGS+="-m32"
     3377                        CFAFLAGS+="-m32"
     3378                        LDFLAGS+="-m32"
    34773379                        ;;
    34783380                i686)
    3479                         CFLAGS+=" -m32 "
    3480                   CXXFLAGS+=" -m32 "
    3481                   CFAFLAGS+=" -m32 "
    3482                   LDFLAGS+=" -m32 "
     3381                        CFLAGS+="-m32"
     3382                        CXXFLAGS+="-m32"
     3383                        CFAFLAGS+="-m32"
     3384                        LDFLAGS+="-m32"
    34833385                        ;;
    34843386                x86_64)
    3485                         CFLAGS+=" -m64 "
    3486                         CXXFLAGS+=" -m64 "
    3487                         CFAFLAGS+=" -m64 "
    3488                         LDFLAGS+=" -m64 "
     3387                        CFLAGS+="-m64"
     3388                        CXXFLAGS+="-m64"
     3389                        CFAFLAGS+="-m64"
     3390                        LDFLAGS+="-m64"
    34893391                        ;;
    34903392        esac
     
    35283430  test -z "$as_dir" && as_dir=.
    35293431    for ac_exec_ext in '' $ac_executable_extensions; do
    3530   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     3432  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    35313433    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
    35323434    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    35723474  test -z "$as_dir" && as_dir=.
    35733475    for ac_exec_ext in '' $ac_executable_extensions; do
    3574   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     3476  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    35753477    ac_cv_prog_ac_ct_CXX="$ac_prog"
    35763478    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    40253927# First try GNU make style include.
    40263928echo "include confinc" > confmf
    4027 # Ignore all kinds of additional output from 'make'.
     3929# Ignore all kinds of additional output from `make'.
    40283930case `$am_make -s -f confmf 2> /dev/null` in #(
    40293931*the\ am__doit\ target*)
     
    40813983  # making bogus files that we don't know about and never remove.  For
    40823984  # instance it was reported that on HP-UX the gcc test will end up
    4083   # making a dummy file named 'D' -- because '-MD' means "put the output
    4084   # in D".
     3985  # making a dummy file named `D' -- because `-MD' means `put the output
     3986  # in D'.
    40853987  rm -rf conftest.dir
    40863988  mkdir conftest.dir
     
    41174019    for i in 1 2 3 4 5 6; do
    41184020      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    4119       # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
    4120       # Solaris 10 /bin/sh.
    4121       echo '/* dummy */' > sub/conftst$i.h
     4021      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
     4022      # Solaris 8's {/usr,}/bin/sh.
     4023      touch sub/conftst$i.h
    41224024    done
    41234025    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
    41244026
    4125     # We check with '-c' and '-o' for the sake of the "dashmstdout"
     4027    # We check with `-c' and `-o' for the sake of the "dashmstdout"
    41264028    # mode.  It turns out that the SunPro C++ compiler does not properly
    4127     # handle '-M -o', and we need to detect this.  Also, some Intel
    4128     # versions had trouble with output in subdirs.
     4029    # handle `-M -o', and we need to detect this.  Also, some Intel
     4030    # versions had trouble with output in subdirs
    41294031    am__obj=sub/conftest.${OBJEXT-o}
    41304032    am__minus_obj="-o $am__obj"
     
    41354037      ;;
    41364038    nosideeffect)
    4137       # After this tag, mechanisms are not by side-effect, so they'll
    4138       # only be used when explicitly requested.
     4039      # after this tag, mechanisms are not by side-effect, so they'll
     4040      # only be used when explicitly requested
    41394041      if test "x$enable_dependency_tracking" = xyes; then
    41404042        continue
     
    41444046      ;;
    41454047    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
    4146       # This compiler won't grok '-c -o', but also, the minuso test has
     4048      # This compiler won't grok `-c -o', but also, the minuso test has
    41474049      # not run yet.  These depmodes are late enough in the game, and
    41484050      # so weak that their functioning should not be impacted.
     
    42204122  test -z "$as_dir" && as_dir=.
    42214123    for ac_exec_ext in '' $ac_executable_extensions; do
    4222   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4124  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    42234125    ac_cv_prog_CC="${ac_tool_prefix}gcc"
    42244126    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    42604162  test -z "$as_dir" && as_dir=.
    42614163    for ac_exec_ext in '' $ac_executable_extensions; do
    4262   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4164  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    42634165    ac_cv_prog_ac_ct_CC="gcc"
    42644166    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    43134215  test -z "$as_dir" && as_dir=.
    43144216    for ac_exec_ext in '' $ac_executable_extensions; do
    4315   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4217  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    43164218    ac_cv_prog_CC="${ac_tool_prefix}cc"
    43174219    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    43544256  test -z "$as_dir" && as_dir=.
    43554257    for ac_exec_ext in '' $ac_executable_extensions; do
    4356   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4258  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    43574259    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
    43584260       ac_prog_rejected=yes
     
    44124314  test -z "$as_dir" && as_dir=.
    44134315    for ac_exec_ext in '' $ac_executable_extensions; do
    4414   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4316  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    44154317    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
    44164318    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    44564358  test -z "$as_dir" && as_dir=.
    44574359    for ac_exec_ext in '' $ac_executable_extensions; do
    4458   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     4360  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    44594361    ac_cv_prog_ac_ct_CC="$ac_prog"
    44604362    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    46524554#include <stdarg.h>
    46534555#include <stdio.h>
    4654 struct stat;
     4556#include <sys/types.h>
     4557#include <sys/stat.h>
    46554558/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
    46564559struct buf { int x; };
     
    47374640ac_compiler_gnu=$ac_cv_c_compiler_gnu
    47384641
    4739 ac_ext=c
    4740 ac_cpp='$CPP $CPPFLAGS'
    4741 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
    4742 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    4743 ac_compiler_gnu=$ac_cv_c_compiler_gnu
    4744 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
    4745 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
    4746 if ${am_cv_prog_cc_c_o+:} false; then :
    4747   $as_echo_n "(cached) " >&6
    4748 else
    4749   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    4750 /* end confdefs.h.  */
    4751 
    4752 int
    4753 main ()
    4754 {
    4755 
    4756   ;
    4757   return 0;
    4758 }
    4759 _ACEOF
    4760   # Make sure it works both with $CC and with simple cc.
    4761   # Following AC_PROG_CC_C_O, we do the test twice because some
    4762   # compilers refuse to overwrite an existing .o file with -o,
    4763   # though they will create one.
    4764   am_cv_prog_cc_c_o=yes
    4765   for am_i in 1 2; do
    4766     if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
    4767    ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
    4768    ac_status=$?
    4769    echo "$as_me:$LINENO: \$? = $ac_status" >&5
    4770    (exit $ac_status); } \
    4771          && test -f conftest2.$ac_objext; then
    4772       : OK
    4773     else
    4774       am_cv_prog_cc_c_o=no
    4775       break
    4776     fi
    4777   done
    4778   rm -f core conftest*
    4779   unset am_i
    4780 fi
    4781 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
    4782 $as_echo "$am_cv_prog_cc_c_o" >&6; }
    4783 if test "$am_cv_prog_cc_c_o" != yes; then
    4784    # Losing compiler, so override with the script.
    4785    # FIXME: It is wrong to rewrite CC.
    4786    # But if we don't then we get into trouble of one sort or another.
    4787    # A longer-term fix would be to have automake use am__CC in this case,
    4788    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
    4789    CC="$am_aux_dir/compile $CC"
    4790 fi
    4791 ac_ext=c
    4792 ac_cpp='$CPP $CPPFLAGS'
    4793 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
    4794 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
    4795 ac_compiler_gnu=$ac_cv_c_compiler_gnu
    4796 
    4797 
    47984642depcc="$CC"   am_compiler_list=
    47994643
     
    48074651  # making bogus files that we don't know about and never remove.  For
    48084652  # instance it was reported that on HP-UX the gcc test will end up
    4809   # making a dummy file named 'D' -- because '-MD' means "put the output
    4810   # in D".
     4653  # making a dummy file named `D' -- because `-MD' means `put the output
     4654  # in D'.
    48114655  rm -rf conftest.dir
    48124656  mkdir conftest.dir
     
    48434687    for i in 1 2 3 4 5 6; do
    48444688      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    4845       # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
    4846       # Solaris 10 /bin/sh.
    4847       echo '/* dummy */' > sub/conftst$i.h
     4689      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
     4690      # Solaris 8's {/usr,}/bin/sh.
     4691      touch sub/conftst$i.h
    48484692    done
    48494693    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
    48504694
    4851     # We check with '-c' and '-o' for the sake of the "dashmstdout"
     4695    # We check with `-c' and `-o' for the sake of the "dashmstdout"
    48524696    # mode.  It turns out that the SunPro C++ compiler does not properly
    4853     # handle '-M -o', and we need to detect this.  Also, some Intel
    4854     # versions had trouble with output in subdirs.
     4697    # handle `-M -o', and we need to detect this.  Also, some Intel
     4698    # versions had trouble with output in subdirs
    48554699    am__obj=sub/conftest.${OBJEXT-o}
    48564700    am__minus_obj="-o $am__obj"
     
    48614705      ;;
    48624706    nosideeffect)
    4863       # After this tag, mechanisms are not by side-effect, so they'll
    4864       # only be used when explicitly requested.
     4707      # after this tag, mechanisms are not by side-effect, so they'll
     4708      # only be used when explicitly requested
    48654709      if test "x$enable_dependency_tracking" = xyes; then
    48664710        continue
     
    48704714      ;;
    48714715    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
    4872       # This compiler won't grok '-c -o', but also, the minuso test has
     4716      # This compiler won't grok `-c -o', but also, the minuso test has
    48734717      # not run yet.  These depmodes are late enough in the game, and
    48744718      # so weak that their functioning should not be impacted.
     
    49424786  # making bogus files that we don't know about and never remove.  For
    49434787  # instance it was reported that on HP-UX the gcc test will end up
    4944   # making a dummy file named 'D' -- because '-MD' means "put the output
    4945   # in D".
     4788  # making a dummy file named `D' -- because `-MD' means `put the output
     4789  # in D'.
    49464790  rm -rf conftest.dir
    49474791  mkdir conftest.dir
     
    49764820    for i in 1 2 3 4 5 6; do
    49774821      echo '#include "conftst'$i'.h"' >> sub/conftest.c
    4978       # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
    4979       # Solaris 10 /bin/sh.
    4980       echo '/* dummy */' > sub/conftst$i.h
     4822      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
     4823      # Solaris 8's {/usr,}/bin/sh.
     4824      touch sub/conftst$i.h
    49814825    done
    49824826    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
    49834827
    4984     # We check with '-c' and '-o' for the sake of the "dashmstdout"
     4828    # We check with `-c' and `-o' for the sake of the "dashmstdout"
    49854829    # mode.  It turns out that the SunPro C++ compiler does not properly
    4986     # handle '-M -o', and we need to detect this.  Also, some Intel
    4987     # versions had trouble with output in subdirs.
     4830    # handle `-M -o', and we need to detect this.  Also, some Intel
     4831    # versions had trouble with output in subdirs
    49884832    am__obj=sub/conftest.${OBJEXT-o}
    49894833    am__minus_obj="-o $am__obj"
     
    49944838      ;;
    49954839    nosideeffect)
    4996       # After this tag, mechanisms are not by side-effect, so they'll
    4997       # only be used when explicitly requested.
     4840      # after this tag, mechanisms are not by side-effect, so they'll
     4841      # only be used when explicitly requested
    49984842      if test "x$enable_dependency_tracking" = xyes; then
    49994843        continue
     
    50034847      ;;
    50044848    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
    5005       # This compiler won't grok '-c -o', but also, the minuso test has
     4849      # This compiler won't grok `-c -o', but also, the minuso test has
    50064850      # not run yet.  These depmodes are late enough in the game, and
    50074851      # so weak that their functioning should not be impacted.
     
    50574901
    50584902
     4903if test "x$CC" != xcc; then
     4904  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
     4905$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
     4906else
     4907  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
     4908$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
     4909fi
     4910set dummy $CC; ac_cc=`$as_echo "$2" |
     4911                      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
     4912if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
     4913  $as_echo_n "(cached) " >&6
     4914else
     4915  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     4916/* end confdefs.h.  */
     4917
     4918int
     4919main ()
     4920{
     4921
     4922  ;
     4923  return 0;
     4924}
     4925_ACEOF
     4926# Make sure it works both with $CC and with simple cc.
     4927# We do the test twice because some compilers refuse to overwrite an
     4928# existing .o file with -o, though they will create one.
     4929ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
     4930rm -f conftest2.*
     4931if { { case "(($ac_try" in
     4932  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     4933  *) ac_try_echo=$ac_try;;
     4934esac
     4935eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     4936$as_echo "$ac_try_echo"; } >&5
     4937  (eval "$ac_try") 2>&5
     4938  ac_status=$?
     4939  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     4940  test $ac_status = 0; } &&
     4941   test -f conftest2.$ac_objext && { { case "(($ac_try" in
     4942  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     4943  *) ac_try_echo=$ac_try;;
     4944esac
     4945eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     4946$as_echo "$ac_try_echo"; } >&5
     4947  (eval "$ac_try") 2>&5
     4948  ac_status=$?
     4949  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     4950  test $ac_status = 0; };
     4951then
     4952  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
     4953  if test "x$CC" != xcc; then
     4954    # Test first that cc exists at all.
     4955    if { ac_try='cc -c conftest.$ac_ext >&5'
     4956  { { case "(($ac_try" in
     4957  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     4958  *) ac_try_echo=$ac_try;;
     4959esac
     4960eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     4961$as_echo "$ac_try_echo"; } >&5
     4962  (eval "$ac_try") 2>&5
     4963  ac_status=$?
     4964  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     4965  test $ac_status = 0; }; }; then
     4966      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
     4967      rm -f conftest2.*
     4968      if { { case "(($ac_try" in
     4969  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     4970  *) ac_try_echo=$ac_try;;
     4971esac
     4972eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     4973$as_echo "$ac_try_echo"; } >&5
     4974  (eval "$ac_try") 2>&5
     4975  ac_status=$?
     4976  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     4977  test $ac_status = 0; } &&
     4978         test -f conftest2.$ac_objext && { { case "(($ac_try" in
     4979  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
     4980  *) ac_try_echo=$ac_try;;
     4981esac
     4982eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
     4983$as_echo "$ac_try_echo"; } >&5
     4984  (eval "$ac_try") 2>&5
     4985  ac_status=$?
     4986  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     4987  test $ac_status = 0; };
     4988      then
     4989        # cc works too.
     4990        :
     4991      else
     4992        # cc exists but doesn't like -o.
     4993        eval ac_cv_prog_cc_${ac_cc}_c_o=no
     4994      fi
     4995    fi
     4996  fi
     4997else
     4998  eval ac_cv_prog_cc_${ac_cc}_c_o=no
     4999fi
     5000rm -f core conftest*
     5001
     5002fi
     5003if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
     5004  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     5005$as_echo "yes" >&6; }
     5006else
     5007  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     5008$as_echo "no" >&6; }
     5009
     5010$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
     5011
     5012fi
     5013
     5014# FIXME: we rely on the cache variable name because
     5015# there is no other way.
     5016set dummy $CC
     5017am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
     5018eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
     5019if test "$am_t" != yes; then
     5020   # Losing compiler, so override with the script.
     5021   # FIXME: It is wrong to rewrite CC.
     5022   # But if we don't then we get into trouble of one sort or another.
     5023   # A longer-term fix would be to have automake use am__CC in this case,
     5024   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
     5025   CC="$am_aux_dir/compile $CC"
     5026fi
     5027
    50595028        # deprecated
    50605029# These are often not installed and people miss seeing the "no", so stop the configure.
     
    50775046  test -z "$as_dir" && as_dir=.
    50785047    for ac_exec_ext in '' $ac_executable_extensions; do
    5079   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     5048  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    50805049    ac_cv_prog_YACC="$ac_prog"
    50815050    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    51225091  test -z "$as_dir" && as_dir=.
    51235092    for ac_exec_ext in '' $ac_executable_extensions; do
    5124   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     5093  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    51255094    ac_cv_prog_LEX="$ac_prog"
    51265095    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    51545123c { yymore (); }
    51555124d { yyless (1); }
    5156 e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument.  */
    5157     yyless ((input () != 0)); }
     5125e { yyless (input () != 0); }
    51585126f { unput (yytext[0]); }
    51595127. { BEGIN INITIAL; }
     
    53135281  test -z "$as_dir" && as_dir=.
    53145282    for ac_exec_ext in '' $ac_executable_extensions; do
    5315   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     5283  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    53165284    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
    53175285    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    53535321  test -z "$as_dir" && as_dir=.
    53545322    for ac_exec_ext in '' $ac_executable_extensions; do
    5355   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     5323  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    53565324    ac_cv_prog_ac_ct_RANLIB="ranlib"
    53575325    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     
    55465514    for ac_exec_ext in '' $ac_executable_extensions; do
    55475515      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
    5548       as_fn_executable_p "$ac_path_GREP" || continue
     5516      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
    55495517# Check for GNU ac_path_GREP and select it if it is found.
    55505518  # Check for GNU $ac_path_GREP
     
    56125580    for ac_exec_ext in '' $ac_executable_extensions; do
    56135581      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
    5614       as_fn_executable_p "$ac_path_EGREP" || continue
     5582      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
    56155583# Check for GNU ac_path_EGREP and select it if it is found.
    56165584  # Check for GNU $ac_path_EGREP
     
    59515919$ac_includes_default
    59525920int
    5953 find_stack_direction (int *addr, int depth)
     5921find_stack_direction ()
    59545922{
    5955   int dir, dummy = 0;
    5956   if (! addr)
    5957     addr = &dummy;
    5958   *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
    5959   dir = depth ? find_stack_direction (addr, depth - 1) : 0;
    5960   return dir + dummy;
     5923  static char *addr = 0;
     5924  auto char dummy;
     5925  if (addr == 0)
     5926    {
     5927      addr = &dummy;
     5928      return find_stack_direction ();
     5929    }
     5930  else
     5931    return (&dummy > addr) ? 1 : -1;
    59615932}
    59625933
    59635934int
    5964 main (int argc, char **argv)
     5935main ()
    59655936{
    5966   return find_stack_direction (0, argc + !argv + 20) < 0;
     5937  return find_stack_direction () < 0;
    59675938}
    59685939_ACEOF
     
    60095980/* end confdefs.h.  */
    60105981
    6011              #include <stdbool.h>
    6012              #ifndef bool
    6013               "error: bool is not defined"
    6014              #endif
    6015              #ifndef false
    6016               "error: false is not defined"
    6017              #endif
    6018              #if false
    6019               "error: false is not 0"
    6020              #endif
    6021              #ifndef true
    6022               "error: true is not defined"
    6023              #endif
    6024              #if true != 1
    6025               "error: true is not 1"
    6026              #endif
    6027              #ifndef __bool_true_false_are_defined
    6028               "error: __bool_true_false_are_defined is not defined"
    6029              #endif
    6030 
    6031              struct s { _Bool s: 1; _Bool t; } s;
    6032 
    6033              char a[true == 1 ? 1 : -1];
    6034              char b[false == 0 ? 1 : -1];
    6035              char c[__bool_true_false_are_defined == 1 ? 1 : -1];
    6036              char d[(bool) 0.5 == true ? 1 : -1];
    6037              /* See body of main program for 'e'.  */
    6038              char f[(_Bool) 0.0 == false ? 1 : -1];
    6039              char g[true];
    6040              char h[sizeof (_Bool)];
    6041              char i[sizeof s.t];
    6042              enum { j = false, k = true, l = false * true, m = true * 256 };
    6043              /* The following fails for
    6044                 HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
    6045              _Bool n[m];
    6046              char o[sizeof n == m * sizeof n[0] ? 1 : -1];
    6047              char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
    6048              /* Catch a bug in an HP-UX C compiler.  See
    6049                 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
    6050                 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
    6051               */
    6052              _Bool q = true;
    6053              _Bool *pq = &q;
     5982#include <stdbool.h>
     5983#ifndef bool
     5984 "error: bool is not defined"
     5985#endif
     5986#ifndef false
     5987 "error: false is not defined"
     5988#endif
     5989#if false
     5990 "error: false is not 0"
     5991#endif
     5992#ifndef true
     5993 "error: true is not defined"
     5994#endif
     5995#if true != 1
     5996 "error: true is not 1"
     5997#endif
     5998#ifndef __bool_true_false_are_defined
     5999 "error: __bool_true_false_are_defined is not defined"
     6000#endif
     6001
     6002        struct s { _Bool s: 1; _Bool t; } s;
     6003
     6004        char a[true == 1 ? 1 : -1];
     6005        char b[false == 0 ? 1 : -1];
     6006        char c[__bool_true_false_are_defined == 1 ? 1 : -1];
     6007        char d[(bool) 0.5 == true ? 1 : -1];
     6008        /* See body of main program for 'e'.  */
     6009        char f[(_Bool) 0.0 == false ? 1 : -1];
     6010        char g[true];
     6011        char h[sizeof (_Bool)];
     6012        char i[sizeof s.t];
     6013        enum { j = false, k = true, l = false * true, m = true * 256 };
     6014        /* The following fails for
     6015           HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
     6016        _Bool n[m];
     6017        char o[sizeof n == m * sizeof n[0] ? 1 : -1];
     6018        char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
     6019        /* Catch a bug in an HP-UX C compiler.  See
     6020           http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
     6021           http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
     6022        */
     6023        _Bool q = true;
     6024        _Bool *pq = &q;
    60546025
    60556026int
     
    60576028{
    60586029
    6059              bool e = &s;
    6060              *pq |= q;
    6061              *pq |= ! q;
    6062              /* Refer to every declared value, to avoid compiler optimizations.  */
    6063              return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
    6064                      + !m + !n + !o + !p + !q + !pq);
     6030        bool e = &s;
     6031        *pq |= q;
     6032        *pq |= ! q;
     6033        /* Refer to every declared value, to avoid compiler optimizations.  */
     6034        return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
     6035                + !m + !n + !o + !p + !q + !pq);
    60656036
    60666037  ;
     
    60776048{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
    60786049$as_echo "$ac_cv_header_stdbool_h" >&6; }
    6079    ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
     6050ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
    60806051if test "x$ac_cv_type__Bool" = xyes; then :
    60816052
     
    60866057
    60876058fi
    6088 
    60896059
    60906060if test $ac_cv_header_stdbool_h = yes; then
     
    62816251
    62826252
    6283 ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile tools/prettyprinter/Makefile"
     6253ac_config_files="$ac_config_files Makefile src/driver/Makefile src/Makefile src/benchmark/Makefile src/examples/Makefile src/tests/Makefile src/tests/preempt_longrun/Makefile src/prelude/Makefile src/libcfa/Makefile"
    62846254
    62856255
     
    63936363
    63946364
    6395 { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
    6396 $as_echo_n "checking that generated files are newer than configure... " >&6; }
    6397    if test -n "$am_sleep_pid"; then
    6398      # Hide warnings about reused PIDs.
    6399      wait $am_sleep_pid 2>/dev/null
    6400    fi
    6401    { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
    6402 $as_echo "done" >&6; }
    64036365 if test -n "$EXEEXT"; then
    64046366  am__EXEEXT_TRUE=
     
    67436705    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    67446706    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    6745     # In both cases, we have to default to `cp -pR'.
     6707    # In both cases, we have to default to `cp -p'.
    67466708    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
    6747       as_ln_s='cp -pR'
     6709      as_ln_s='cp -p'
    67486710  elif ln conf$$.file conf$$ 2>/dev/null; then
    67496711    as_ln_s=ln
    67506712  else
    6751     as_ln_s='cp -pR'
     6713    as_ln_s='cp -p'
    67526714  fi
    67536715else
    6754   as_ln_s='cp -pR'
     6716  as_ln_s='cp -p'
    67556717fi
    67566718rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
     
    68126774fi
    68136775
    6814 
    6815 # as_fn_executable_p FILE
    6816 # -----------------------
    6817 # Test if FILE is an executable regular file.
    6818 as_fn_executable_p ()
    6819 {
    6820   test -f "$1" && test -x "$1"
    6821 } # as_fn_executable_p
    6822 as_test_x='test -x'
    6823 as_executable_p=as_fn_executable_p
     6776if test -x / >/dev/null 2>&1; then
     6777  as_test_x='test -x'
     6778else
     6779  if ls -dL / >/dev/null 2>&1; then
     6780    as_ls_L_option=L
     6781  else
     6782    as_ls_L_option=
     6783  fi
     6784  as_test_x='
     6785    eval sh -c '\''
     6786      if test -d "$1"; then
     6787        test -d "$1/.";
     6788      else
     6789        case $1 in #(
     6790        -*)set "./$1";;
     6791        esac;
     6792        case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
     6793        ???[sx]*):;;*)false;;esac;fi
     6794    '\'' sh
     6795  '
     6796fi
     6797as_executable_p=$as_test_x
    68246798
    68256799# Sed expression to map a string onto a valid CPP name.
     
    68436817ac_log="
    68446818This file was extended by cfa-cc $as_me 1.0.0.0, which was
    6845 generated by GNU Autoconf 2.69.  Invocation command line was
     6819generated by GNU Autoconf 2.68.  Invocation command line was
    68466820
    68476821  CONFIG_FILES    = $CONFIG_FILES
     
    69096883ac_cs_version="\\
    69106884cfa-cc config.status 1.0.0.0
    6911 configured by $0, generated by GNU Autoconf 2.69,
     6885configured by $0, generated by GNU Autoconf 2.68,
    69126886  with options \\"\$ac_cs_config\\"
    69136887
    6914 Copyright (C) 2012 Free Software Foundation, Inc.
     6888Copyright (C) 2010 Free Software Foundation, Inc.
    69156889This config.status script is free software; the Free Software Foundation
    69166890gives unlimited permission to copy, distribute and modify it."
     
    70036977cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
    70046978if \$ac_cs_recheck; then
    7005   set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
     6979  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
    70066980  shift
    70076981  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
     
    70487022    "src/prelude/Makefile") CONFIG_FILES="$CONFIG_FILES src/prelude/Makefile" ;;
    70497023    "src/libcfa/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcfa/Makefile" ;;
    7050     "tools/prettyprinter/Makefile") CONFIG_FILES="$CONFIG_FILES tools/prettyprinter/Makefile" ;;
    70517024
    70527025  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
     
    76457618  case $ac_file$ac_mode in
    76467619    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
    7647   # Older Autoconf quotes --file arguments for eval, but not when files
     7620  # Autoconf 2.62 quotes --file arguments for eval, but not when files
    76487621  # are listed without --file.  Let's play safe and only enable the eval
    76497622  # if we detect the quoting.
     
    76587631    mf=`echo "$mf" | sed -e 's/:.*$//'`
    76597632    # Check whether this is an Automake generated Makefile or not.
    7660     # We used to match only the files named 'Makefile.in', but
     7633    # We used to match only the files named `Makefile.in', but
    76617634    # some people rename them; so instead we look at the file content.
    76627635    # Grep'ing the first line is not enough: some people post-process
     
    76927665    fi
    76937666    # Extract the definition of DEPDIR, am__include, and am__quote
    7694     # from the Makefile without running 'make'.
     7667    # from the Makefile without running `make'.
    76957668    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
    76967669    test -z "$DEPDIR" && continue
    76977670    am__include=`sed -n 's/^am__include = //p' < "$mf"`
    7698     test -z "$am__include" && continue
     7671    test -z "am__include" && continue
    76997672    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
     7673    # When using ansi2knr, U may be empty or an underscore; expand it
     7674    U=`sed -n 's/^U = //p' < "$mf"`
    77007675    # Find all dependency output files, they are included files with
    77017676    # $(DEPDIR) in their names.  We invoke sed twice because it is the
     
    77047679    for file in `sed -n "
    77057680      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
    7706          sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
     7681         sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
    77077682      # Make sure the directory exists.
    77087683      test -f "$dirpart/$file" && continue
  • configure.ac

    rb826e6b rfea3faa  
    99AM_SILENT_RULES([no])
    1010
    11 AM_INIT_AUTOMAKE([subdir-objects])
     11AM_INIT_AUTOMAKE
    1212AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
    1313
     
    167167AC_SUBST([MACHINE_TYPE],[$host_cpu])
    168168
    169 if ! test "$host_cpu" = "$build_cpu"; then
     169if ! test "$host_cpu" = "$build_cpu"; then 
    170170        case $host_cpu in
    171171                i386)
    172                         CFLAGS+=" -m32 "
    173                         CXXFLAGS+=" -m32 "
    174                         CFAFLAGS+=" -m32 "
    175                         LDFLAGS+=" -m32 "
     172                        CFLAGS+="-m32"
     173                        CXXFLAGS+="-m32"
     174                        CFAFLAGS+="-m32"
     175                        LDFLAGS+="-m32"
    176176                        ;;
    177177                i686)
    178                         CFLAGS+=" -m32 "
    179                   CXXFLAGS+=" -m32 "
    180                   CFAFLAGS+=" -m32 "
    181                   LDFLAGS+=" -m32 "
     178                        CFLAGS+="-m32"
     179                        CXXFLAGS+="-m32"
     180                        CFAFLAGS+="-m32"
     181                        LDFLAGS+="-m32"
    182182                        ;;
    183183                x86_64)
    184                         CFLAGS+=" -m64 "
    185                         CXXFLAGS+=" -m64 "
    186                         CFAFLAGS+=" -m64 "
    187                         LDFLAGS+=" -m64 "
     184                        CFLAGS+="-m64"
     185                        CXXFLAGS+="-m64"
     186                        CFAFLAGS+="-m64"
     187                        LDFLAGS+="-m64"
    188188                        ;;
    189189        esac
     
    238238        src/prelude/Makefile
    239239        src/libcfa/Makefile
    240         tools/prettyprinter/Makefile
    241240        ])
    242241
  • doc/LaTeXmacros/common.tex

    rb826e6b rfea3faa  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Mon Jul 17 10:21:17 2017
    14 %% Update Count     : 348
     13%% Last Modified On : Sun Jun 18 20:32:32 2017
     14%% Update Count     : 319
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    3636% Names used in the document.
    3737
    38 \newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name
     38\newcommand{\CFAIcon}{\textrm{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name
    3939\newcommand{\CFA}{\protect\CFAIcon} % safe for section/caption
    4040\newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall symbolic name
     
    5555\setlength{\parindentlnth}{\parindent}
    5656
    57 \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}}
    58 \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}}
    59 
    6057\newlength{\gcolumnposn}                                % temporary hack because lstlisting does not handle tabs correctly
    6158\newlength{\columnposn}
    6259\setlength{\gcolumnposn}{2.5in}
    6360\setlength{\columnposn}{\gcolumnposn}
    64 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
     61\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@commentstyle{#2}}}
    6562\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
    6663
     
    134131
    135132% inline text and code index (cannot use ©)
    136 \newcommand{\Indexc}[2][\@empty]{\lstinline[#1]$#2$\index{#2@\lstinline[#1]$#2$}}
     133\newcommand{\Indexc}[1]{\lstinline$#1$\index{#1@\lstinline$#1$}}
    137134% code index (cannot use ©)
    138 \newcommand{\indexc}[2][\@empty]{\index{#2@\lstinline[#1]$#2$}}
     135\newcommand{\indexc}[1]{\index{#1@\lstinline$#1$}}
    139136
    140137% Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}.
     
    234231basicstyle=\linespread{0.9}\sf,                                                 % reduce line spacing and use sanserif font
    235232stringstyle=\tt,                                                                                % use typewriter font
    236 tabsize=6,                                                                                              % N space tabbing
     233tabsize=4,                                                                                              % 4 space tabbing
    237234xleftmargin=\parindentlnth,                                                             % indent code to paragraph indentation
    238235extendedchars=true,                                                                             % allow ASCII characters in the range 128-255
  • doc/LaTeXmacros/lstlang.sty

    rb826e6b rfea3faa  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Wed Jul 12 22:42:09 2017
    11 %% Update Count     : 12
     10%% Last Modified On : Fri May 26 12:47:09 2017
     11%% Update Count     : 8
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    112112                finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t,
    113113                otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof,
    114                 __typeof__, with, zero_t},
     114                __typeof__, zero_t},
    115115        morekeywords=[2]{
    116116                _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex,
    117117                resume, suspend, thread, _Thread_local, yield},
    118         moredirectives={defined,include_next}%
    119118}
    120 
    121 % C++ programming language
    122 \lstdefinelanguage{C++}[ANSI]{C++}{}
    123119
    124120% uC++ programming language, based on ANSI C++
  • doc/bibliography/cfa.bib

    rb826e6b rfea3faa  
    22732273@manual{JavaScript,
    22742274    keywords    = {JavaScript},
    2275     contributer = {pabuhr@plg},
     2275    contributer = {pabuhr},
    22762276    title       = {ECMAScript 2015 Language Specification {JavaScript}},
    22772277    organization= {ECAM International},
     
    24462446@manual{Erlang,
    24472447    keywords    = {Erlang},
    2448     contributer = {pabuhr@plg},
     2448    contributer = {pabuhr},
    24492449    title       = {Erlang Reference Manual User's Guide, Vertion 7.0},
    24502450    organization= {Erlang/OTP System Documentation},
     
    27712771    publisher   = {ACM},
    27722772    address     = {New York, NY, USA},
    2773 }
    2774 
    2775 @article{Yang95,
    2776     keywords    = {software solutions, N-thread, mutual exclusions},
    2777     contributer = {pabuhr@plg},
    2778     author      = {Jae-Heon Yang and James H. Anderson},
    2779     title       = {A Fast, Scalable Mutual Exclusion Algorithm},
    2780     journal     = {Distributed Computing},
    2781     publisher   = {Springer-Verlag},
    2782     volume      = {9},
    2783     number      = {1},
    2784     year        = {1995},
    2785     pages       = {51-60},
    27862773}
    27872774
     
    50655052    contributer = {pabuhr@plg},
    50665053    author      = {Kathleen Jensen and Niklaus Wirth},
    5067     title       = {{P}ascal User Manual and Report, ISO Pascal Standard},
     5054    title       = {{P}ascal User Manual and Report},
    50685055    publisher   = {Springer--Verlag},
    5069     year        = 1991,
    5070     edition     = {4th},
    5071     note        = {Revised by Andrew B. Mickel and James F. Miner}
     5056    year        = 1985,
     5057    edition     = {3rd},
     5058    note        = {Revised by Andrew B. Mickel and James F. Miner, ISO Pascal Standard}
    50725059}
    50735060
  • doc/generic_types/mail

    rb826e6b rfea3faa  
    7878
    7979- OOPSLA'17 Submissions
    80 
    81 
    82 
    83 From: "OOPSLA'17 HotCRP" <noreply@oopsla17.hotcrp.com>
    84 Subject: [OOPSLA'17] Paper #20 "Generic and Tuple Types with Efficient..."
    85 To: Peter Buhr <pabuhr@uwaterloo.ca>
    86 Cc: jonathan.aldrich@cs.cmu.edu
    87 Reply-To: jonathan.aldrich@cs.cmu.edu
    88 Date: Wed,  7 Jun 2017 13:33:40 +0000 (UTC)
    89 
    90 Dear Peter Buhr,
    91 
    92 The author response period for OOPSLA has started, and will continue until
    93 the end of June 10th (Anywhere on Earth).  No email with a snapshot of your
    94 reviews will be sent: you can see the live version of reviews (including
    95 current updates) on the HotCRP system (links at the bottom).
    96 
    97 An author response should aim to:
    98  -correct reviewers' mistakes or misunderstandings
    99  -offer new information only when this addresses reviewers' concerns (e.g.,
    100 "I wonder if A might work better...";  "we tried that, but...")
    101  -answer explicit questions by the reviewers. The key questions will be in a
    102 designated "Questions for Author Response" entry of a review.
    103 
    104 Please keep in mind that an author response is *not* a "rebuttal". You are
    105 not rebutting an opponent's arguments with your own, in front of an
    106 audience that weighs both sets of arguments. Instead, your audience is the
    107 same reviewers who offered the comments in the first place, and their
    108 subjective weighing of different factors is very unlikely to change.
    109 
    110 During author response, please keep in mind that the reviewers are still
    111 unaware of author identity. If you need to refer to author-identifying
    112 information during your response, the ideal course of action is to place it
    113 at an external location and include a URL, with an explicit warning (e.g.,
    114 "WARNING: following this link will reveal author identity").
    115 
    116 As with all external resources, your response should be self-contained,
    117 without consulting them. That is, the author-visible external URL is just
    118 evidence, but the claim that this evidence supports should be clear in the
    119 response text. For instance:
    120 "we have received public feedback from the developers of X that confirm the
    121 issue [supporting URL] (WARNING: following this link will reveal author
    122 identity)"
    123 
    124 Your paper's access information is below:
    125 
    126        Title: Generic and Tuple Types with Efficient Dynamic Layout in C∀
    127   Paper site: https://oopsla17.hotcrp.com/paper/20
    128 
    129 Use the link below to sign in to the site.
    130 
    131 https://oopsla17.hotcrp.com/?email=pabuhr%40uwaterloo.ca
    132 
    133 Please contact me <jonathan.aldrich@cs.cmu.edu> with any questions or
    134 concerns.
    135 
    136 Best Regards and wishes for a constructive response,
    137 
    138 Jonathan Aldrich
    139 
    140 
    141 
    142 From: "OOPSLA'17 HotCRP" <noreply@oopsla17.hotcrp.com>
    143 Subject: [OOPSLA'17] Paper #20 "Generic and Tuple Types with Efficient..."
    144 To: Peter Buhr <pabuhr@uwaterloo.ca>
    145 Cc: jonathan.aldrich@cs.cmu.edu
    146 Reply-To: jonathan.aldrich@cs.cmu.edu
    147 Date: Tue, 20 Jun 2017 00:33:10 +0000 (UTC)
    148 
    149 Dear Peter Buhr,
    150 
    151 I regret to inform you that your submission to OOPSLA'17 listed below has not
    152 been selected for the second phase of the review process. I understand this is
    153 not welcome news but selection was very competitive: 157 of the 223 papers
    154 submitted did not advance to the second phase. For several of these, there was
    155 a clear impression that in the future they can evolve into some of the
    156 strongest results of our community.
    157 
    158        Title: Generic and Tuple Types with Efficient Dynamic Layout in C∀
    159   Paper site: https://oopsla17.hotcrp.com/paper/20
    160   Login link: https://oopsla17.hotcrp.com/?email=pabuhr%40uwaterloo.ca
    161 
    162 Below you will find reviews, as well as author-visible comments--the latter may
    163 include further communication. I hope you will find the reviewers' feedback
    164 useful.
    165 
    166 Best Regards,
    167 
    168 - Jonathan Aldrich <jonathan.aldrich@cs.cmu.edu>, for OOPSLA 2017
    169 Submissions
    170 
    171 
    172 
    173 ===========================================================================
    174                            OOPSLA'17 Review #20A
    175 ---------------------------------------------------------------------------
    176  Paper #20: Generic and Tuple Types with Efficient Dynamic Layout in C∀
    177 ---------------------------------------------------------------------------
    178 
    179                       Overall merit: C. Weak paper, though I will not fight
    180                                         strongly against it
    181                          Confidence: X. I am an expert in this area
    182 
    183                          ===== Paper summary =====
    184 
    185 This presents an extension of the C programming language that tries to preserve the character of the existing language, while adding tuples and generics. Unlike C++ templates, generics preserve separate compilation. Types are represented at runtime, if needed, by size and alignment values, along with pointers to the code for any needed operators. A microbenchmark performance comparison is provided.
    186 
    187                       ===== Comments for author =====
    188 
    189 This is an interesting extension to C, that may be of interest to some C programmers. It generally seems to be fairly well engineered, and mostly respects C's design goals.
    190 
    191 Unfortunately, there have been enough proposals for extended C dialects that this sort of design is tough to sell. And I don't think the evaluation really went far enough to make that case.
    192 
    193 The ideas in the paper don't appear to be fundamentally new. The idea of passing types as runtime objects has certainly been explored before. An additional ancient reference is http://dl.acm.org/citation.cfm?doid=13310.13330.
    194 
    195 There seems to be a new idea of minimally describing types using alignment and size attributes instead of (?) pointers to assignment operators and the like. But this scheme is not very well described. Notably, it is not clear how, say, a struct with atomic field or bit-fields would be described.
    196 
    197 I wasn't quite clear on the extent to which operator overloading is supported. The MAX example appears to me like it would be quite controversial among C programmers.
    198 
    199 It is not obvious that type inference here always converges. An outline of the algorithm would be useful.
    200 
    201 Above all, this needs experience results from a more complete implementation.
    202 
    203 Details:
    204 
    205 Relying on TIOBE here seems a bit dubious. Since it counts web pages, and C isn't exactly new and hot, it may actually understate your case.
    206 
    207 The print example seems a little simplistic, since it's not clear how it handles formatting.
    208 
    209 "does not using the return type"
    210 
    211               ===== Questions for authors’ response =====
    212 
    213 How are atomics, volatile, and bit-fields in structs handled?
    214 
    215 ===========================================================================
    216                            OOPSLA'17 Review #20B
    217 ---------------------------------------------------------------------------
    218  Paper #20: Generic and Tuple Types with Efficient Dynamic Layout in C∀
    219 ---------------------------------------------------------------------------
    220 
    221                       Overall merit: D. Reject
    222                          Confidence: X. I am an expert in this area
    223 
    224                          ===== Paper summary =====
    225 
    226 The authors present an extension to C, adding universal polymorphism and tuples. These features are described in prose. There is an implementation, though this is not described in depth in the paper. There is a benchmark evaluation.
    227 
    228                       ===== Comments for author =====
    229 
    230 The paper is well-written and the concepts explained well. It is nice to see work in the low-level/C space - I believe that it is an area that has not been well-served by the OOPSLA community. My concerns with the paper are that the contribution is rather small and the concepts are not well-evaluated; specifically this is a language design paper and there is no attempt to evaluate the actual language design.
    231 
    232 While it is reasonable to describe only a couple of features in a paper, I would then expect a detailed description of the implementation and/or a formalism with proven safety properties and a thorough evaluation of the design. For a paper which only describes the design of a language the bar is higher than two features - for example, a description of a 'large' language such as D or Rust, even then I would expect a stronger evaluation.
    233 
    234 ## On the design of C-forall
    235 
    236 There are some interesting points in the design of generics, notably the otype/dtype distinction. The design seems reasonable and follows what I would expect from other languages. The design for tuples is more unusual - the usual design of simple anonymous records with anonymous fields is extended with a mix of 'spread'ing, variadics, and implicit conversions. Importantly, the authors neither justify nor evaluate this departure - that is a severe omission for this paper. Furthermore, the only in-depth description of the implementation in the paper concerns tuples, and it seems to me that this is only interesting because of the unusual design - further reason for justifying it.
    237 
    238 ## Evaluation
    239 
    240 The paper evaluates the implementation of C-forall with (effectively) a single micro-benchmark. That benchmark seems to show that C-forall performs worse than C++ on every measure, but this is not really discussed.
    241 
    242 A better performance evaluation would consist of multiple tests, both micro-benchmarks and realistic code and would test C-forall compared to alternatives (D, Rust, Go, etc.) not just C/C++.
    243 
    244 However, performance is not the really interesting thing to test here. The authors propose a new language and while performance is an important consideration for systems languages, it is far from the most important. I would like to see the usability of the language tested with user studies of different kinds (various levels of skill-level and coding scenarios). The authors could also use case studies or programming idioms to compare programming in C-forall vs the alternatives (again, comparing with D, Rust, etc. is more interesting to me than C).
    245 
    246 Finally, in designing C-forall, the authors make several assumptions about why C programmers use C. These should be backed up either with evaluation or citation. Statements in the paper certainly do not reflect my experience discussing language design with C programmers, and I would like to see them verified.
    247 
    248 
    249 ## Related work
    250 
    251 The related work section is broad and gives good descriptions of other languages. However, the comparisons between languages focus more on the high-level goals of the language. It would be more interesting to focus on the details of the languages - the comparisons between Cyclone, C++, Java, and C-forall generics are good, I would like to see more of this with D and Rust, which are the more modern alternatives to C-forall (for example, Rust's notion of Sized and ?Sized types seems similar to otypes/dtypes).
    252 
    253 The related work is really missing any discussion of why the C-forall design choices are better than other languages. To clarify, I mean the specific design of generics and tuples, c.f., the suitability of the language in general because of garbage collection or learning difficulties.
    254 
    255 ===========================================================================
    256                            OOPSLA'17 Review #20C
    257 ---------------------------------------------------------------------------
    258  Paper #20: Generic and Tuple Types with Efficient Dynamic Layout in C∀
    259 ---------------------------------------------------------------------------
    260 
    261                       Overall merit: D. Reject
    262                          Confidence: Z. I am not an expert; my evaluation
    263                                         is that of an informed outsider
    264 
    265                          ===== Paper summary =====
    266 
    267 The paper presents two language features of "Cforall": generics and tuples.
    268 
    269                       ===== Comments for author =====
    270 
    271 The authors really need to talk about C++ as early as possible IMHO. That's the first thing that came to mind when reading the abstract: how is this different from C++?
    272 
    273 Comparison with C++:
    274 The main difference with C++ seems to be that Cforall favors separate compilation at the expense of runtime overhead while C++ systematically avoids any runtime overhead (at the expense of slow compilation times). C++ approach makes more sense IMHO. While it's true that people where using C for almost everything 30 years ago, that is just not true anymore. Most people writing C today are doing system programming, otherwise there would be using a higher level programming language (C#, Java etc ...).
    275 Now, when doing system programming, one needs very fine grain control over the resources: memory layout, etc ...
    276 It is pretty clear to me that the people writing that kind of code will favor generics that do not cost any overhead at runtime, otherwise they would be writing Java in the first place.
    277 The authors need to better justify the runtime overhead, or give escape hatches for those who don't want to pay that cost at runtime.
    278 They very often go back to the benefit of separate compilation, but that's not enough IMHO. Here is a proposal: why not have 2 modes, one called debug mode, used while developing the code, that would compile generics with a runtime overhead. Another, called production, that would unfold the world like C++ does?
    279 
    280 About Tuples:
    281 The section about tuples is too long. I would have spent more time explaining generics.
    282 
    283 Feedback:
    284 "This installation base"
    285 Unclear what you mean by that.
    286 
    287 "Prior projects ... but failed ..."
    288 Hummm ... What about C++.
    289 
    290 "... object-oriented or functional programming with garbage collection ..."
    291 You are really mixing apples and oranges here. Many C programmers have nothing agains object-oriented features, not even functional programming (C++ 11 adds
    292 a bunch of features proving my point), but it's clear that most of them feel very strongly against automated garbage collection.
    293 
    294 "In many cases, C++ is often ..."
    295 This sentence feels like it is coming out of nowhere.
    296 
    297 "... the polymorphic runtime-cost ..."
    298 Is there any way to avoid that overhead? It's true it will make the compiler faster, but there are cases where the user might not want to pay for
    299 the overhead at runtime. Is there a way to force the compiler to specialize the code?
    300 
    301 "... to write a type-safe Cforall wrapper malloc based ..."
    302 That cannot be true in general. Malloc produces a pointer (of any type), given an integer (the size).
    303 It looks like Cforall is assuming that the integer is the result of a call to sizeof (a good practice in C).
    304 However, if that's the case, it should be explained.
    305 
    306 "... allows variable overloading ..."
    307 How are conflict resolved? In other words, what happens when two variables could be used?
    308 
    309 "... reuses the generated structure declarations where appropriate."
    310 This is too vague.
    311 
    312 "... have multiple outcomes, some exceptional."
    313 Humm, I would say these two things are distinct. Let's just way that this way of presenting things is strange, I woulds ay that a function can either
    314 return one or multiple values or throw an exception. Not that some of the values returned are "exceptional".
    315 
    316 "The type-resolver ..."
    317 What's that? Type-checker? Type-inference?
    318 
    319 "... applies C conversions."
    320 Noooo! That's exactly what leads to very subtle bugs. Is there any way to stop those conversions from happening?
    321 
    322 "The minimal cost ..."
    323 In what regard? Runtime cost? How does the "resolver" know how expensive the conversions are?
    324 
    325 "z = 10 // mass assignments"
    326 That stuff is completely unreadable. Why not introduce a new operator?
    327 
    328 "... roughly equivalent time ..."
    329 Well, C++ looks faster to me.
    330 
    331 "... is restricted because the resolution does not using ..."
    332 Did you mean, does not use?
    333 
    334 "... D and go are garbage collected ..."
    335 Yes, but in D, the use of the GC is optional.
    336 
    337 "... while respecting the talent and skill of C programmers."
    338 Are you implying that other approaches are not?
    339 
    340 "On the surface, the project may appear as a rehash of similar mechanisms in C++."
    341 Absolutely.
    342 
    343 "... integration with C and its programmers ..."
    344 Bold claim. What makes you think you are integrated with programmers? Number of users?
    345 
    346 "... inline annotation at polymorphic function call sites to create a template-specialization ..."
    347 This should have been mentioned sooner. Plus conflating inlining and specialization is unfortunate.
    348 Does "inline" also inline the function? Or does it only specialize the code?
    349 If it also inline, that's a very unfortunate design. I might want to specialize the code, but without inlining ...
    350 How do I specialize a recursive function?
  • doc/proposals/references.md

    rb826e6b rfea3faa  
    1717derived rvalue types such as pointer types may include qualifiers;
    1818`const int *` is a distinct type from `int *`, though the latter is safely
    19 convertible to the former.
     19convertable to the former.
    2020In general, any number of qualifiers can be safely added to the
    2121pointed-to-type of a pointer type, e.g. `int *` converts safely to
     
    2323`const volatile int *`.
    2424
    25 Since lvalues are precisely "addressable objects", in C, only lvalues can be
     25Since lvalues are precicely "addressable objects", in C, only lvalues can be
    2626used as the operand of the `&` address-of operator.
    2727Similarly, only modifiable lvalues may be used as the assigned-to
     
    147147call "lvalue of type `T`" as `T&`.
    148148There's also an obvious argument that lvalues of a (possibly-qualified) type
    149 `T` should be convertible to references of type `T`, where `T` is also
     149`T` should be convertable to references of type `T`, where `T` is also
    150150so-qualified (e.g. lvalue `int` to `int&`, lvalue `const char` to
    151151`const char&`).
    152152By similar arguments to pointer types, qualifiers should be addable to the
    153153referred-to type of a reference (e.g. `int&` to `const int&`).
    154 As a note, since pointer arithmetic is explicitly not defined on `T&`,
     154As a note, since pointer arithmetic is explictly not defined on `T&`,
    155155`restrict T&` should be allowable and would have alias-analysis rules that
    156156are actually comprehensible to mere mortals.
  • doc/proposals/tagged-struct.txt

    rb826e6b rfea3faa  
    7171should be possible to do during linking.
    7272
    73 If a generic/polymorphic type is tagged its tagged would then be shared
    74 between all applications of that generic. Internal tags could be used to
    75 seperate these structures again, however it seems in most cases simply using
    76 the existing type parameters should provide the needed information.
    77 
    7873
    7974Traits:
     
    107102To allow for growth each option would have to be a structure itself.
    108103
    109 Which brings us to "tagged struct union", ie. a union of tagged structures
     104Which brings us to "tagget struct union", ie. a union of tagged structures
    110105as opposed to tagging the union itself. This extention acts as a constraint.
    111106If unions are declared tagged instead of creating a new tagged type, all
    112 possible values of the union must be of that tagged type or a child type. If
    113 the tagged type is omitted then they must all be tagged but of any tagged
    114 type.
    115 
    116 As a short cut union_instance->type might get the type object of the loaded
    117 value. It should always be the same operation regardless so it saves
    118 abritarly picking a branch of the union to get the type object.
     107possible values of the union must be of that tagged type or a child type.
    119108
    120109
    121 Type Objects Fields (Extention):
     110Custom Type Objects (Extention):
    122111
    123 Adding fields to the type object allows data to be shared between instances
    124 of the same type. Such behaviour could be mimiced by creating a lookup
    125 function on the type object pointer, but this may be cleaner and more
    126 efficient.
     112Some method to define type objects used within a tree of types. One option is
     113to allow the tree's type object to be specified by the tree root. It would
     114then have to be filled in for each type in the tree, including the root.
    127115
    128 The type object fields follow similar rules to the fields on the tagged
    129 objects themselves, they must be additive. So any fields present on a
    130 type object will be present (and in the same place) on all of its children.
     116The only required field is the parent field, a pointer to the type object's
     117type. (This is also the only required field on the tagged structure itself.)
    131118
    132 This does mean that many type object structure types will have to be auto
    133 generated, and traversing up the tree might get a little wierd. That could
    134 be symplified by only allowing the root type to specify fields on the type
    135 object, so that the type object is consistant throughout that particular tree.
    136 And hence the type_object pointers would also be consistant as the type they
    137 point to would never change.
    138 
    139 struct Example tagged {
    140         tagged char const * const type_name = "Example";
    141         int data;
    142 };
    143 
    144 Creates a tagged structure that has no parent, stores an integer and the type
    145 object also has an extra field that stores a string on the type object.
    146 This can be accessed by using member access on the type object, as a regular
    147 structure.
    148 
    149 Type object fields will have to allow initialization on their declaration,
    150 and declarations of children as well, as they are not assotiated with the
    151 later instances of the tagged structure.
    152 
    153         ...
    154         tagged void (*dtor)(tagged Example * this);
    155         ...
    156 
    157 Sub-Extention, not sure how it would work but some way to have a "dynamic"
    158 field that is considered the type of the current tagged struct might be useful
    159 for things like specifying a deconstructor. In this case, the following code
    160 will clean up any child type of Example:
    161 
    162 Example * ex = get_some_example();
    163 ex->type->dtor(ex);
     119A further extention could allow expanding type objects, so child types could
     120append fields to their parent's feild list. They might need their own type
     121objects at that point, or maybe static checks will be enough to see the
     122minimum field list.
  • doc/user/Makefile

    rb826e6b rfea3faa  
    11## Define the appropriate configuration variables.
    22
    3 TeXLIB = .:../LaTeXmacros:../bibliography/:
     3TeXLIB = .:../LaTeXmacros:../LaTeXmacros/listings:../LaTeXmacros/enumitem:../bibliography/:
    44LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error
    55BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
     
    1212
    1313FIGURES = ${addsuffix .tex, \
    14 EHMHierarchy \
    1514Cdecl \
    1615pointer1 \
  • doc/user/user.tex

    rb826e6b rfea3faa  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Mon Jul 17 13:06:40 2017
    14 %% Update Count     : 2825
     13%% Last Modified On : Fri Jun 16 12:00:01 2017
     14%% Update Count     : 2433
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    2525\usepackage{textcomp}
    2626\usepackage[latin1]{inputenc}
     27% Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
     28% removes it as a variable-name character so keyworks in variables are highlighted
     29\DeclareTextCommandDefault{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}
     30
    2731
    2832\usepackage{fullpage,times,comment}
     
    4448\renewcommand{\UrlFont}{\small\sf}
    4549
    46 % Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
    47 % removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR
    48 % AFTER HYPERREF.
    49 \renewcommand{\_}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
    50 \renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
    51 
    5250\setlength{\topmargin}{-0.45in}                                                 % move running title into header
    5351\setlength{\headsep}{0.25in}
     
    5654
    5755\CFAStyle                                                                                               % use default CFA format-style
    58 
    59 \lstnewenvironment{C++}[1][]
    60 {\lstset{language=C++,moredelim=**[is][\protect\color{red}]{®}{®}#1}}
    61 {}
    6256
    6357% inline code ©...© (copyright symbol) emacs: C-q M-)
     
    116110\renewcommand{\subsectionmark}[1]{\markboth{\thesubsection\quad #1}{\thesubsection\quad #1}}
    117111\pagenumbering{roman}
    118 \linenumbers                                            % comment out to turn off line numbering
     112%\linenumbers                                            % comment out to turn off line numbering
    119113
    120114\maketitle
     
    141135
    142136\CFA{}\index{cforall@\CFA}\footnote{Pronounced ``\Index*{C-for-all}'', and written \CFA, CFA, or \CFL.} is a modern general-purpose programming-language, designed as an evolutionary step forward for the C programming language.
    143 The syntax of \CFA builds from C and should look immediately familiar to C/\Index*[C++]{\CC{}} programmers.
     137The syntax of the \CFA language builds from C, and should look immediately familiar to C/\Index*[C++]{\CC{}} programmers.
    144138% Any language feature that is not described here can be assumed to be using the standard \Celeven syntax.
    145 \CFA adds many modern programming-language features that directly lead to increased \emph{\Index{safety}} and \emph{\Index{productivity}}, while maintaining interoperability with existing C programs and achieving similar performance.
    146 Like C, \CFA is a statically typed, procedural (non-\Index{object-oriented}) language with a low-overhead runtime, meaning there is no global \Index{garbage-collection}, but \Index{regional garbage-collection}\index{garbage-collection!regional} is possible.
     139\CFA adds many modern programming-language features that directly lead to increased \emph{\Index{safety}} and \emph{\Index{productivity}}, while maintaining interoperability with existing C programs and achieving C performance.
     140Like C, \CFA is a statically typed, procedural language with a low-overhead runtime, meaning there is no global \Index{garbage-collection}, but \Index{regional garbage-collection}\index{garbage-collection!regional} is possible.
    147141The primary new features include parametric-polymorphic routines and types, exceptions, concurrency, and modules.
    148142
    149 One of the main design philosophies of \CFA is to ``\Index{describe not prescribe}'', which means \CFA tries to provide a pathway from low-level C programming to high-level \CFA programming, but it does not force programmers to ``do the right thing''.
    150 Programmers can cautiously add \CFA extensions to their C programs in any order and at any time to incrementally move towards safer, higher-level programming.
    151 A programmer is always free to reach back to C from \CFA, for any reason, and in many cases, new \CFA features can be locally switched back to there C counterpart.
    152 There is no notion or requirement for \emph{rewriting} a legacy C program in \CFA;
    153 instead, a programmer evolves a legacy program into \CFA by incrementally incorporating \CFA features.
    154 As well, new programs can be written in \CFA using a combination of C and \CFA features.
    155 
    156 \Index*[C++]{\CC{}} had a similar goal 30 years ago, allowing object-oriented programming to be incrementally added to C.
    157 However, \CC currently has the disadvantages of a strong object-oriented bias, multiple legacy design-choices that cannot be updated, and active divergence of the language model from C, all of which requires significant effort and training to incrementally add \CC to a C-based project.
     143One of the main design philosophies of \CFA is to ``describe not prescribe'', which means \CFA tries to provide a pathway from low-level C programming to high-level \CFA programming, but it does not force programmers to ``do the right thing''.
     144Programmers can cautiously add \CFA extensions to their C programs in any order and at any time to incrementally move towards safer, higher-level programming features.
     145A programmer is always free to reach back to C from \CFA for any reason, and in many cases, new \CFA features have a fallback to a C mechanism.
     146There is no notion or requirement for rewriting a legacy C program in \CFA;
     147instead, a programmer evolves an existing C program into \CFA by incrementally incorporating \CFA features.
     148New programs can be written in \CFA using a combination of C and \CFA features.
     149\Index*[C++]{\CC{}} had a similar goal 30 years ago, but currently has the disadvantages of multiple legacy design-choices that cannot be updated and active divergence of the language model from C, requiring significant effort and training to incrementally add \CC to a C-based project.
    158150In contrast, \CFA has 30 years of hindsight and a clean starting point.
    159151
     
    162154\begin{quote2}
    163155\begin{tabular}{@{}l@{\hspace{1.5em}}l@{\hspace{1.5em}}l@{}}
    164 \multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{\CC}}      \\
    165 \begin{cfa}
     156\multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{\CFA}}      & \multicolumn{1}{c}{\textbf{C}}        & \multicolumn{1}{c}{\textbf{\CC}}      \\
     157\begin{cfa}
     158#include <fstream>§\indexc{fstream}§
     159
     160int main( void ) {
     161        int x = 0, y = 1, z = 2;
     162        ®sout | x | y | z | endl;®
     163}
     164\end{cfa}
     165&
     166\begin{lstlisting}
    166167#include <stdio.h>§\indexc{stdio.h}§
    167168
     
    170171        ®printf( "%d %d %d\n", x, y, z );®
    171172}
    172 \end{cfa}
     173\end{lstlisting}
    173174&
    174 \begin{cfa}
    175 #include <fstream>§\indexc{fstream}§
    176 
    177 int main( void ) {
    178         int x = 0, y = 1, z = 2;
    179         ®sout | x | y | z | endl;®§\indexc{sout}§
    180 }
    181 \end{cfa}
    182 &
    183 \begin{cfa}
     175\begin{lstlisting}
    184176#include <iostream>§\indexc{iostream}§
    185177using namespace std;
     
    188180        ®cout<<x<<" "<<y<<" "<<z<<endl;®
    189181}
    190 \end{cfa}
     182\end{lstlisting}
    191183\end{tabular}
    192184\end{quote2}
    193185While the \CFA I/O looks similar to the \Index*[C++]{\CC{}} output style, there are important differences, such as automatic spacing between variables as in \Index*{Python} (see~\VRef{s:IOLibrary}).
    194186
    195 \subsection{Background}
    196 
    197187This document is a programmer reference-manual for the \CFA programming language.
    198188The manual covers the core features of the language and runtime-system, with simple examples illustrating syntax and semantics of each feature.
    199189The manual does not teach programming, i.e., how to combine the new constructs to build complex programs.
    200 A reader should already have an intermediate knowledge of control flow, data structures, and concurrency issues to understand the ideas presented, as well as some experience programming in C/\CC.
    201 Implementers should refer to the \CFA Programming Language Specification for details about the language syntax and semantics.
     190A reader should already have an intermediate knowledge of control flow, data structures, and concurrency issues to understand the ideas presented as well as some experience programming in C/\CC.
     191Implementers may refer to the \CFA Programming Language Specification for details about the language syntax and semantics.
    202192Changes to the syntax and additional features are expected to be included in later revisions.
    203193
     
    208198This installation base and the programmers producing it represent a massive software-engineering investment spanning decades and likely to continue for decades more.
    209199Even with all its problems, C continues to be popular because it allows writing software at virtually any level in a computer system without restriction.
    210 For system programming, where direct access to hardware, storage management, and real-time issues are a requirement, C is usually the only language of choice.
     200For system programming, where direct access to hardware and dealing with real-time issues is a requirement, C is usually the language of choice.
    211201The TIOBE index~\cite{TIOBE} for March 2016 showed the following programming-language popularity: \Index*{Java} 20.5\%, C 14.5\%, \Index*[C++]{\CC{}} 6.7\%, \Csharp 4.3\%, \Index*{Python} 4.3\%, where the next 50 languages are less than 3\% each with a long tail.
    212202As well, for 30 years, C has been the number 1 and 2 most popular programming language:
     
    224214\end{center}
    225215Hence, C is still an extremely important programming language, with double the usage of \Index*[C++]{\CC{}}; in many cases, \CC is often used solely as a better C.
    226 Love it or hate it, C has been an important and influential part of computer science for 40 years and its appeal is not diminishing.
    227 Unfortunately, C has many problems and omissions that make it an unacceptable programming language for modern needs.
    228 
    229 As stated, the goal of the \CFA project is to engineer modern language-features into C in an evolutionary rather than revolutionary way.
     216Love it or hate it, C has been an important and influential part of computer science for 40 years and sit appeal is not diminishing.
     217Unfortunately, C has too many problems and omissions to make it an acceptable programming language for modern needs.
     218
     219As stated, the goal of the \CFA project is to engineer modern language features into C in an evolutionary rather than revolutionary way.
    230220\CC~\cite{C++14,C++} is an example of a similar project;
    231 however, it largely extended the C language, and did not address most of C's existing problems.\footnote{%
     221however, it largely extended the language, and did not address many existing problems.\footnote{%
    232222Two important existing problems addressed were changing the type of character literals from ©int© to ©char© and enumerator from ©int© to the type of its enumerators.}
    233 \Index*{Fortran}~\cite{Fortran08}, \Index*{Ada}~\cite{Ada12}, and \Index*{Cobol}~\cite{Cobol14} are examples of programming languages that took an evolutionary approach, where modern language-features (\eg objects, concurrency) are added and problems fixed within the framework of the existing language.
     223\Index*{Fortran}~\cite{Fortran08}, \Index*{Ada}~\cite{Ada12}, and \Index*{Cobol}~\cite{Cobol14} are examples of programming languages that took an evolutionary approach, where modern language features (\eg objects, concurrency) are added and problems fixed within the framework of the existing language.
    234224\Index*{Java}~\cite{Java8}, \Index*{Go}~\cite{Go}, \Index*{Rust}~\cite{Rust} and \Index*{D}~\cite{D} are examples of the revolutionary approach for modernizing C/\CC, resulting in a new language rather than an extension of the descendent.
    235 These languages have different syntax and semantics from C, do not interoperate directly with C, and are not systems languages because of restrictive memory-management or garbage collection.
     225These languages have different syntax and semantics from C, and do not interoperate directly with C, largely because of garbage collection.
    236226As a result, there is a significant learning curve to move to these languages, and C legacy-code must be rewritten.
    237 These costs can be prohibitive for many companies with a large software-base in C/\CC, and a significant number of programmers require retraining to the new programming language.
    238 
    239 The result of this project is a language that is largely backwards compatible with \Index*[C11]{\Celeven{}}~\cite{C11}, but fixes many of the well known C problems while containing modern language-features.
     227These costs can be prohibitive for many companies with a large software base in C/\CC, and a significant number of programmers requiring retraining to a new programming language.
     228
     229The result of this project is a language that is largely backwards compatible with \Index*[C11]{\Celeven{}}~\cite{C11}, but fixing some of the well known C problems and containing many modern language features.
    240230Without significant extension to the C programming language, it is becoming unable to cope with the needs of modern programming problems and programmers;
    241231as a result, it will fade into disuse.
    242232Considering the large body of existing C code and programmers, there is significant impetus to ensure C is transformed into a modern programming language.
    243 While \Index*[C11]{\Celeven{}} made a few simple extensions to the language, nothing was added to address existing problems in the language or to augment the language with modern language-features.
    244 While some may argue that modern language-features may make C complex and inefficient, it is clear a language without modern capabilities is insufficient for the advanced programming problems existing today.
     233While \Index*[C11]{\Celeven{}} made a few simple extensions to the language, nothing was added to address existing problems in the language or to augment the language with modern language features.
     234While some may argue that modern language features may make C complex and inefficient, it is clear a language without modern capabilities is insufficient for the advanced programming problems existing today.
    245235
    246236
    247237\section{History}
    248238
    249 The \CFA project started with \Index*{K-W C}~\cite{Buhr94a,Till89}, which extended C with new declaration syntax, multiple return values from routines, and advanced assignment capabilities using the notion of tuples.
     239The \CFA project started with \Index*{K-W C}~\cite{Buhr94a,Till89}, which extended C with new declaration syntax, multiple return values from routines, and extended assignment capabilities using the notion of tuples.
    250240(See~\cite{Werther96} for similar work in \Index*[C++]{\CC{}}.)
    251 The first \CFA implementation of these extensions was by Esteves~\cite{Esteves04}.
    252 
    253 The signature feature of \CFA is \Index{overload}able \Index{parametric-polymorphic} functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name):
     241A first \CFA implementation of these extensions was by Esteves~\cite{Esteves04}.
     242The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name):
    254243\begin{lstlisting}
    255244®forall( otype T )® T identity( T val ) { return val; }
     
    259248\CFA{}\hspace{1pt}'s polymorphism was originally formalized by Ditchfiled~\cite{Ditchfield92}, and first implemented by Bilson~\cite{Bilson03}.
    260249However, at that time, there was little interesting in extending C, so work did not continue.
    261 As the saying goes, ``\Index*{What goes around, comes around.}'', and there is now renewed interest in the C programming language because of legacy code-bases, so the \CFA project has been restarted.
     250As the saying goes, ``What goes around, comes around.'', and there is now renewed interest in the C programming language because of legacy code-bases, so the \CFA project has been restarted.
    262251
    263252
     
    266255
    267256\CFA is designed to integrate directly with existing C programs and libraries.
    268 The most important feature of \Index{interoperability} is using the same \Index{calling convention}s, so there is no complex interface or overhead to call existing C routines.
     257The most important feature of \Index{interoperability} is using the same \Index{calling convention}s, so there is no overhead to call existing C routines.
    269258This feature allows \CFA programmers to take advantage of the existing panoply of C libraries to access thousands of external software features.
    270259Language developers often state that adequate \Index{library support} takes more work than designing and implementing the language itself.
    271260Fortunately, \CFA, like \Index*[C++]{\CC{}}, starts with immediate access to all exiting C libraries, and in many cases, can easily wrap library routines with simpler and safer interfaces, at very low cost.
    272 Hence, \CFA begins by leveraging the large repository of C libraries at little cost.
     261Hence, \CFA begins by leveraging the large repository of C libraries with little cost.
    273262
    274263\begin{comment}
     
    313302\end{comment}
    314303
    315 However, it is necessary to differentiate between C and \CFA code because of name \Index{overload}ing, as for \CC.
     304However, it is necessary to differentiate between C and \CFA code because of name overloading, as for \CC.
    316305For example, the C math-library provides the following routines for computing the absolute value of the basic types: ©abs©, ©labs©, ©llabs©, ©fabs©, ©fabsf©, ©fabsl©, ©cabsf©, ©cabs©, and ©cabsl©.
    317 Whereas, \CFA wraps each of these routines into ones with the overloaded name ©abs©:
     306Whereas, \CFA wraps each of these routines into ones with the common name ©abs©:
    318307\begin{cfa}
    319308char abs( char );
     
    335324Hence, there is the same need as in \CC, to know if a name is a C or \CFA name, so it can be correctly formed.
    336325There is no way around this problem, other than C's approach of creating unique names for each pairing of operation and type.
    337 This example strongly illustrates a core idea in \CFA: \emph{the \Index{power of a name}}.
     326This example strongly illustrates a core idea in \CFA: \emph{the power of a name}.
    338327The name ``©abs©'' evokes the notion of absolute value, and many mathematical types provide the notion of absolute value.
    339 Hence, knowing the name ©abs© is sufficient to apply it to any type where it is applicable.
    340 The time savings and safety of using one name uniformly versus $N$ unique names cannot be underestimated.
    341 
    342 
    343 \section[Compiling a CFA Program]{Compiling a \CFA Program}
     328Hence, knowing the name ©abs© should be sufficient to apply it to any type where it is applicable.
     329The time savings and safety of using one name uniformly versus $N$ unique names should not be underestimated.
     330
     331
     332\section[Compiling CFA Program]{Compiling \CFA Program}
    344333
    345334The command ©cfa© is used to compile \CFA program(s), and is based on the GNU \Indexc{gcc} command, \eg:
    346335\begin{cfa}
    347 cfa§\indexc{cfa}\index{compilation!cfa@©cfa©}§ [ gcc-options ] C/§\CFA{}§-files [ assembler/loader-files ]
     336cfa§\indexc{cfa}\index{compilation!cfa@©cfa©}§ [ gcc-options ] C/§\CFA§-files [ assembler/loader-files ]
    348337\end{cfa}
    349338\CFA programs having the following ©gcc© flags turned on:
     
    353342The 1999 C standard plus GNU extensions.
    354343\item
    355 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}}
     344{\lstset{deletekeywords={inline}}
     345\Indexc{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{©-fgnu89-inline©}}
    356346Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files.
     347}%
    357348\end{description}
    358349The following new \CFA options are available:
     
    366357\Indexc{-debug}\index{compilation option!-debug@©-debug©}
    367358The program is linked with the debugging version of the runtime system.
    368 The debug version performs runtime checks to help during the debugging phase of a \CFA program, but can substantially slow program execution.
     359The debug version performs runtime checks to help during the debugging phase of a \CFA program, but substantially slows the execution of the program.
    369360The runtime checks should only be removed after the program is completely debugged.
    370361\textbf{This option is the default.}
     
    422413\end{description}
    423414These preprocessor variables allow conditional compilation of programs that must work differently in these situations.
    424 For example, to toggle between C and \CFA extensions, use the following:
     415For example, to toggle between C and \CFA extensions, using the following:
    425416\begin{cfa}
    426417#ifndef __CFORALL__
     
    433424
    434425
    435 \section{Constant Underscores}
    436 
    437 Numeric constants are extended to allow \Index{underscore}s\index{constant!underscore}, \eg:
     426\section{Constants Underscores}
     427
     428Numeric constants are extended to allow \Index{underscore}s within constants\index{constant!underscore}, \eg:
    438429\begin{cfa}
    4394302®_®147®_®483®_®648;                                    §\C{// decimal constant}§
     
    448439L®_®§"\texttt{\textbackslash{x}}§®_®§\texttt{ff}§®_®§\texttt{ee}"§;     §\C{// wide character constant}§
    449440\end{cfa}
    450 The rules for placement of underscores are:
    451 \begin{enumerate}[topsep=5pt,itemsep=5pt,parsep=0pt]
     441The rules for placement of underscores is as follows:
     442\begin{enumerate}
    452443\item
    453444A sequence of underscores is disallowed, \eg ©12__34© is invalid.
     
    470461\label{s:BackquoteIdentifiers}
    471462
    472 \CFA introduces in new keywords (see \VRef{s:CFAKeywords}) that can clash with existing C variable-names in legacy code.
    473 Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism:
     463\CFA accommodates keyword clashes with existing C variable-names by syntactic transformations using the \CFA backquote escape-mechanism:
    474464\begin{cfa}
    475465int ®`®otype®`® = 3;                    §\C{// make keyword an identifier}§
     
    477467\end{cfa}
    478468Existing C programs with keyword clashes can be converted by enclosing keyword identifiers in backquotes, and eventually the identifier name can be changed to a non-keyword name.
    479 \VRef[Figure]{f:HeaderFileInterposition} shows how clashes in C header files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©:
     469\VRef[Figure]{f:InterpositionHeaderFile} shows how clashes in C header files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©:
    480470
    481471\begin{figure}
     
    485475#define otype ®`®otype®`®               §\C{// make keyword an identifier}§
    486476#define __CFA_BFD_H__
    487 #endif
    488 
    489 ®#include_next <bfd.h>                  §\C{// must have internal check for multiple expansion}§
    490 ®
     477#endif // ! otype
     478
     479#include_next <bfd.h>                   §\C{// must have internal check for multiple expansion}§
     480
    491481#if defined( otype ) && defined( __CFA_BFD_H__ )        §\C{// reset only if set}§
    492482#undef otype
    493483#undef __CFA_BFD_H__
    494 #endif
    495 \end{cfa}
    496 \caption{Header-File Interposition}
    497 \label{f:HeaderFileInterposition}
     484#endif // otype && __CFA_BFD_H__
     485\end{cfa}
     486\caption{Interposition of Header File}
     487\label{f:InterpositionHeaderFile}
    498488\end{figure}
    499489
    500490
    501 \section{Exponentiation Operator}
    502 
    503 C, \CC, and Java (and many other programming languages) have no exponentiation operator\index{exponentiation!operator}\index{operator!exponentiation}, \ie $x^y$, and instead use a routine, like \Indexc{pow}, to perform the exponentiation operation.
    504 \CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@\lstinline$?\?$} and ©?\=?©\index{?\\=?@\lstinline$?\=?$}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$.
    505 The priority of the exponentiation operator is between the cast and multiplicative operators, so that ©w * (int)x \ (int)y * z© is parenthesized as ©((w * (((int)x) \ ((int)y))) * z)©.
    506 
    507 As for \Index{division}, there are exponentiation operators for integral and floating-point types, including the builtin \Index{complex} types.
    508 Unsigned integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication (or shifting if the base is 2).
    509 Signed integral exponentiation\index{exponentiation!signed integral} is performed with repeated multiplication (or shifting if the base is 2), but yields a floating-point result because $b^{-e}=1/b^e$.
    510 Hence, it is important to designate exponent integral-constants as unsigned or signed: ©3 \ 3u© return an integral result, while ©3 \ 3© returns a floating-point result.
    511 Floating-point exponentiation\index{exponentiation!floating point} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative.
    512 \begin{cfa}
    513 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl;
    514 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i
    515 \end{cfa}
    516 Parenthesis are necessary for the complex constants or the expresion is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©.
    517 The exponentiation operator is available for all the basic types, but for user-defined types, only the integral version is available, if the user type defines multiplication, ©*©, and one, ©1©.
    518 
    519 
    520 \section{\texorpdfstring{Labelled \LstKeywordStyle{continue} / \LstKeywordStyle{break}}{Labelled continue / break}}
     491\section{Declarations}
     492\label{s:Declarations}
     493
     494C declaration syntax is notoriously confusing and error prone.
     495For example, many C programmers are confused by a declaration as simple as:
     496\begin{quote2}
     497\begin{tabular}{@{}ll@{}}
     498\begin{cfa}
     499int * x[5]
     500\end{cfa}
     501&
     502\raisebox{-0.75\totalheight}{\input{Cdecl}}
     503\end{tabular}
     504\end{quote2}
     505Is this an array of 5 pointers to integers or a \Index{pointer} to an array of 5 integers?
     506The fact this declaration is unclear to many C programmers means there are \Index{productivity} and \Index{safety} issues even for basic programs.
     507Another example of confusion results from the fact that a routine name and its parameters are embedded within the return type, mimicking the way the return value is used at the routine's call site.
     508For example, a routine returning a \Index{pointer} to an array of integers is defined and used in the following way:
     509\begin{cfa}
     510int ®(*®f®())[®5®]® {...};                              §\C{definition}§
     511 ... ®(*®f®())[®3®]® += 1;                              §\C{usage}§
     512\end{cfa}
     513Essentially, the return type is wrapped around the routine name in successive layers (like an \Index{onion}).
     514While attempting to make the two contexts consistent is a laudable goal, it has not worked out in practice.
     515
     516\CFA provides its own type, variable and routine declarations, using a different syntax.
     517The new declarations place qualifiers to the left of the base type, while C declarations place qualifiers to the right of the base type.
     518In the following example, \R{red} is the base type and \B{blue} is qualifiers.
     519The \CFA declarations move the qualifiers to the left of the base type, \ie move the blue to the left of the red, while the qualifiers have the same meaning but are ordered left to right to specify a variable's type.
     520\begin{quote2}
     521\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     522\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     523\begin{cfa}
     524ß[5] *ß ®int® x1;
     525ß* [5]ß ®int® x2;
     526ß[* [5] int]ß f®( int p )®;
     527\end{cfa}
     528&
     529\begin{cfa}
     530®int® ß*ß x1 ß[5]ß;
     531®int® ß(*ßx2ß)[5]ß;
     532ßint (*ßf®( int p )®ß)[5]ß;
     533\end{cfa}
     534\end{tabular}
     535\end{quote2}
     536The only exception is \Index{bit field} specification, which always appear to the right of the base type.
     537% Specifically, the character ©*© is used to indicate a pointer, square brackets ©[©\,©]© are used to represent an array or function return value, and parentheses ©()© are used to indicate a routine parameter.
     538However, unlike C, \CFA type declaration tokens are distributed across all variables in the declaration list.
     539For instance, variables ©x© and ©y© of type \Index{pointer} to integer are defined in \CFA as follows:
     540\begin{quote2}
     541\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     542\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     543\begin{cfa}
     544®*® int x, y;
     545\end{cfa}
     546&
     547\begin{cfa}
     548int ®*®x, ®*®y;
     549\end{cfa}
     550\end{tabular}
     551\end{quote2}
     552The downside of this semantics is the need to separate regular and \Index{pointer} declarations:
     553\begin{quote2}
     554\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     555\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     556\begin{cfa}
     557®*® int x;
     558int y;
     559\end{cfa}
     560&
     561\begin{cfa}
     562int ®*®x, y;
     563
     564\end{cfa}
     565\end{tabular}
     566\end{quote2}
     567which is \Index{prescribing} a safety benefit.
     568Other examples are:
     569\begin{quote2}
     570\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
     571\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     572\begin{cfa}
     573[ 5 ] int z;
     574[ 5 ] * char w;
     575* [ 5 ] double v;
     576struct s {
     577        int f0:3;
     578        * int f1;
     579        [ 5 ] * int f2;
     580};
     581\end{cfa}
     582&
     583\begin{cfa}
     584int z[ 5 ];
     585char * w[ 5 ];
     586double (* v)[ 5 ];
     587struct s {
     588        int f0:3;
     589        int * f1;
     590        int * f2[ 5 ]
     591};
     592\end{cfa}
     593&
     594\begin{cfa}
     595// array of 5 integers
     596// array of 5 pointers to char
     597// pointer to array of 5 doubles
     598
     599// common bit field syntax
     600
     601
     602
     603\end{cfa}
     604\end{tabular}
     605\end{quote2}
     606
     607All type qualifiers, \eg ©const©, ©volatile©, etc., are used in the normal way with the new declarations and also appear left to right, \eg:
     608\begin{quote2}
     609\begin{tabular}{@{}l@{\hspace{1em}}l@{\hspace{1em}}l@{}}
     610\multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} \\
     611\begin{cfa}
     612const * const int x;
     613const * [ 5 ] const int y;
     614\end{cfa}
     615&
     616\begin{cfa}
     617int const * const x;
     618const int (* const y)[ 5 ]
     619\end{cfa}
     620&
     621\begin{cfa}
     622// const pointer to const integer
     623// const pointer to array of 5 const integers
     624\end{cfa}
     625\end{tabular}
     626\end{quote2}
     627All declaration qualifiers, \eg ©extern©, ©static©, etc., are used in the normal way with the new declarations but can only appear at the start of a \CFA routine declaration,\footnote{\label{StorageClassSpecifier}
     628The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature.~\cite[\S~6.11.5(1)]{C11}} \eg:
     629\begin{quote2}
     630\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
     631\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     632\begin{cfa}
     633extern [ 5 ] int x;
     634static * const int y;
     635\end{cfa}
     636&
     637\begin{cfa}
     638int extern x[ 5 ];
     639const int static * y;
     640\end{cfa}
     641&
     642\begin{cfa}
     643// externally visible array of 5 integers
     644// internally visible pointer to constant int
     645\end{cfa}
     646\end{tabular}
     647\end{quote2}
     648
     649The new declaration syntax can be used in other contexts where types are required, \eg casts and the pseudo-routine ©sizeof©:
     650\begin{quote2}
     651\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     652\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     653\begin{cfa}
     654y = (®* int®)x;
     655i = sizeof(®[ 5 ] * int®);
     656\end{cfa}
     657&
     658\begin{cfa}
     659y = (®int *®)x;
     660i = sizeof(®int * [ 5 ]®);
     661\end{cfa}
     662\end{tabular}
     663\end{quote2}
     664
     665Finally, new \CFA declarations may appear together with C declarations in the same program block, but cannot be mixed within a specific declaration.
     666Therefore, a programmer has the option of either continuing to use traditional C declarations or take advantage of the new style.
     667Clearly, both styles need to be supported for some time due to existing C-style header-files, particularly for UNIX systems.
     668
     669
     670\section{Pointer/Reference}
     671
     672C provides a \newterm{pointer type};
     673\CFA adds a \newterm{reference type}.
     674These types may be derived from an object or routine type, called the \newterm{referenced type}.
     675Objects of these types contain an \newterm{address}, which is normally a location in memory, but may also address memory-mapped registers in hardware devices.
     676An integer constant expression with the value 0, or such an expression cast to type ©void *©, is called a \newterm{null-pointer constant}.\footnote{
     677One way to conceptualize the null pointer is that no variable is placed at this address, so the null-pointer address can be used to denote an uninitialized pointer/reference object;
     678\ie the null pointer is guaranteed to compare unequal to a pointer to any object or routine.}
     679An address is \newterm{sound}, if it points to a valid memory location in scope, \ie within the program's execution-environment and has not been freed.
     680Dereferencing an \newterm{unsound} address, including the null pointer, is \Index{undefined}, often resulting in a \Index{memory fault}.
     681
     682A program \newterm{object} is a region of data storage in the execution environment, the contents of which can represent values.
     683In most cases, objects are located in memory at an address, and the variable name for an object is an implicit address to the object generated by the compiler and automatically dereferenced, as in:
     684\begin{quote2}
     685\begin{tabular}{@{}ll@{\hspace{2em}}l@{}}
     686\begin{cfa}
     687int x;
     688x = 3;
     689int y;
     690y = x;
     691\end{cfa}
     692&
     693\raisebox{-0.45\totalheight}{\input{pointer1}}
     694&
     695\begin{cfa}
     696int * ®const® x = (int *)100
     697*x = 3;                 // implicit dereference
     698int * ®const® y = (int *)104;
     699*y = *x;                // implicit dereference
     700\end{cfa}
     701\end{tabular}
     702\end{quote2}
     703where the right example is how the compiler logically interprets the variables in the left example.
     704Since a variable name only points to one address during its lifetime, it is an \Index{immutable} \Index{pointer};
     705hence, the implicit type of pointer variables ©x© and ©y© are constant pointers in the compiler interpretation.
     706In general, variable addresses are stored in instructions instead of loaded from memory, and hence may not occupy storage.
     707These approaches are contrasted in the following:
     708\begin{quote2}
     709\begin{tabular}{@{}l|l@{}}
     710\multicolumn{1}{c|}{explicit variable address} & \multicolumn{1}{c}{implicit variable address} \\
     711\hline
     712\begin{cfa}
     713lda             r1,100                  // load address of x
     714ld               r2,(r1)                  // load value of x
     715lda             r3,104                  // load address of y
     716st               r2,(r3)                  // store x into y
     717\end{cfa}
     718&
     719\begin{cfa}
     720
     721ld              r2,(100)                // load value of x
     722
     723st              r2,(104)                // store x into y
     724\end{cfa}
     725\end{tabular}
     726\end{quote2}
     727Finally, the immutable nature of a variable's address and the fact that there is no storage for the variable pointer means pointer assignment\index{pointer!assignment}\index{assignment!pointer} is impossible.
     728Therefore, the expression ©x = y© has only one meaning, ©*x = *y©, \ie manipulate values, which is why explicitly writing the dereferences is unnecessary even though it occurs implicitly as part of \Index{instruction decoding}.
     729
     730A \Index{pointer}/\Index{reference} object is a generalization of an object variable-name, \ie a mutable address that can point to more than one memory location during its lifetime.
     731(Similarly, an integer variable can contain multiple integer literals during its lifetime versus an integer constant representing a single literal during its lifetime, and like a variable name, may not occupy storage if the literal is embedded directly into instructions.)
     732Hence, a pointer occupies memory to store its current address, and the pointer's value is loaded by dereferencing, \eg:
     733\begin{quote2}
     734\begin{tabular}{@{}l@{\hspace{2em}}l@{}}
     735\begin{cfa}
     736int x, y, ®*® p1, ®*® p2, ®**® p3;
     737p1 = ®&®x;               // p1 points to x
     738p2 = p1;                 // p2 points to x
     739p1 = ®&®y;               // p1 points to y
     740p3 = &p2;               // p3 points to p2
     741\end{cfa}
     742&
     743\raisebox{-0.5\totalheight}{\input{pointer2.pstex_t}}
     744\end{tabular}
     745\end{quote2}
     746
     747Notice, an address has a \Index{duality}\index{address!duality}: a location in memory or the value at that location.
     748In many cases, a compiler might be able to infer the best meaning for these two cases.
     749For example, \Index*{Algol68}~\cite{Algol68} infers pointer dereferencing to select the best meaning for each pointer usage
     750\begin{cfa}
     751p2 = p1 + x;                                    §\C{// compiler infers *p2 = *p1 + x;}§
     752\end{cfa}
     753Algol68 infers the following dereferencing ©*p2 = *p1 + x©, because adding the arbitrary integer value in ©x© to the address of ©p1© and storing the resulting address into ©p2© is an unlikely operation.
     754Unfortunately, automatic dereferencing does not work in all cases, and so some mechanism is necessary to fix incorrect choices.
     755
     756Rather than inferring dereference, most programming languages pick one implicit dereferencing semantics, and the programmer explicitly indicates the other to resolve address-duality.
     757In C, objects of pointer type always manipulate the pointer object's address:
     758\begin{cfa}
     759p1 = p2;                                                §\C{// p1 = p2\ \ rather than\ \ *p1 = *p2}§
     760p2 = p1 + x;                                    §\C{// p2 = p1 + x\ \ rather than\ \ *p2 = *p1 + x}§
     761\end{cfa}
     762even though the assignment to ©p2© is likely incorrect, and the programmer probably meant:
     763\begin{cfa}
     764p1 = p2;                                                §\C{// pointer address assignment}§
     765®*®p2 = ®*®p1 + x;                              §\C{// pointed-to value assignment / operation}§
     766\end{cfa}
     767The C semantics work well for situations where manipulation of addresses is the primary meaning and data is rarely accessed, such as storage management (©malloc©/©free©).
     768
     769However, in most other situations, the pointed-to value is requested more often than the pointer address.
     770\begin{cfa}
     771*p2 = ((*p1 + *p2) * (**p3 - *p1)) / (**p3 - 15);
     772\end{cfa}
     773In this case, it is tedious to explicitly write the dereferencing, and error prone when pointer arithmetic is allowed.
     774It is better to have the compiler generate the dereferencing and have no implicit pointer arithmetic:
     775\begin{cfa}
     776p2 = ((p1 + p2) * (p3 - p1)) / (p3 - 15);
     777\end{cfa}
     778
     779To support this common case, a reference type is introduced in \CFA, denoted by ©&©, which is the opposite dereference semantics to a pointer type, making the value at the pointed-to location the implicit semantics for dereferencing (similar but not the same as \CC \Index{reference type}s).
     780\begin{cfa}
     781int x, y, ®&® r1, ®&® r2, ®&&® r3;
     782®&®r1 = &x;                                             §\C{// r1 points to x}§
     783®&®r2 = &r1;                                    §\C{// r2 points to x}§
     784®&®r1 = &y;                                             §\C{// r1 points to y}§
     785®&&®r3 = ®&®&r2;                                §\C{// r3 points to r2}§
     786r2 = ((r1 + r2) * (r3 - r1)) / (r3 - 15); §\C{// implicit dereferencing}§
     787\end{cfa}
     788Except for auto-dereferencing by the compiler, this reference example is the same as the previous pointer example.
     789Hence, a reference behaves like the variable name for the current variable it is pointing-to.
     790One way to conceptualize a reference is via a rewrite rule, where the compiler inserts a dereference operator before the reference variable for each reference qualifier in a declaration, so the previous example becomes:
     791\begin{cfa}
     792®*®r2 = ((®*®r1 + ®*®r2) ®*® (®**®r3 - ®*®r1)) / (®**®r3 - 15);
     793\end{cfa}
     794When a reference operation appears beside a dereference operation, \eg ©&*©, they cancel out.
     795However, in C, the cancellation always yields a value (\Index{rvalue}).\footnote{
     796The unary ©&© operator yields the address of its operand.
     797If the operand has type ``type'', the result has type ``pointer to type''.
     798If the operand is the result of a unary ©*© operator, neither that operator nor the ©&© operator is evaluated and the result is as if both were omitted, except that the constraints on the operators still apply and the result is not an lvalue.~\cite[\S~6.5.3.2--3]{C11}}
     799For a \CFA reference type, the cancellation on the left-hand side of assignment leaves the reference as an address (\Index{lvalue}):
     800\begin{cfa}
     801(&®*®)r1 = &x;                                  §\C{// (\&*) cancel giving address in r1 not variable pointed-to by r1}§
     802\end{cfa}
     803Similarly, the address of a reference can be obtained for assignment or computation (\Index{rvalue}):
     804\begin{cfa}
     805(&(&®*®)®*®)r3 = &(&®*®)r2;             §\C{// (\&*) cancel giving address in r2, (\&(\&*)*) cancel giving address in r3}§
     806\end{cfa}
     807Cancellation\index{cancellation!pointer/reference}\index{pointer!cancellation} works to arbitrary depth.
     808
     809Fundamentally, pointer and reference objects are functionally interchangeable because both contain addresses.
     810\begin{cfa}
     811int x, *p1 = &x, **p2 = &p1, ***p3 = &p2,
     812                 &r1 = x,    &&r2 = r1,   &&&r3 = r2;
     813***p3 = 3;                                              §\C{// change x}§
     814r3 = 3;                                                 §\C{// change x, ***r3}§
     815**p3 = ...;                                             §\C{// change p1}§
     816&r3 = ...;                                              §\C{// change r1, (\&*)**r3, 1 cancellation}§
     817*p3 = ...;                                              §\C{// change p2}§
     818&&r3 = ...;                                             §\C{// change r2, (\&(\&*)*)*r3, 2 cancellations}§
     819&&&r3 = p3;                                             §\C{// change r3 to p3, (\&(\&(\&*)*)*)r3, 3 cancellations}§
     820\end{cfa}
     821Furthermore, both types are equally performant, as the same amount of dereferencing occurs for both types.
     822Therefore, the choice between them is based solely on whether the address is dereferenced frequently or infrequently, which dictates the amount of implicit dereferencing aid from the compiler.
     823
     824As for a pointer type, a reference type may have qualifiers:
     825\begin{cfa}
     826const int cx = 5;                                       §\C{// cannot change cx;}§
     827const int & cr = cx;                            §\C{// cannot change what cr points to}§
     828®&®cr = &cx;                                            §\C{// can change cr}§
     829cr = 7;                                                         §\C{// error, cannot change cx}§
     830int & const rc = x;                                     §\C{// must be initialized}§
     831®&®rc = &x;                                                     §\C{// error, cannot change rc}§
     832const int & const crc = cx;                     §\C{// must be initialized}§
     833crc = 7;                                                        §\C{// error, cannot change cx}§
     834®&®crc = &cx;                                           §\C{// error, cannot change crc}§
     835\end{cfa}
     836Hence, for type ©& const©, there is no pointer assignment, so ©&rc = &x© is disallowed, and \emph{the address value cannot be the null pointer unless an arbitrary pointer is coerced\index{coercion} into the reference}:
     837\begin{cfa}
     838int & const cr = *0;                            §\C{// where 0 is the int * zero}§
     839\end{cfa}
     840Note, constant reference-types do not prevent \Index{addressing errors} because of explicit storage-management:
     841\begin{cfa}
     842int & const cr = *malloc();
     843cr = 5;
     844free( &cr );
     845cr = 7;                                                         §\C{// unsound pointer dereference}§
     846\end{cfa}
     847
     848The position of the ©const© qualifier \emph{after} the pointer/reference qualifier causes confuse for C programmers.
     849The ©const© qualifier cannot be moved before the pointer/reference qualifier for C style-declarations;
     850\CFA-style declarations (see \VRef{s:Declarations}) attempt to address this issue:
     851\begin{quote2}
     852\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     853\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     854\begin{cfa}
     855®const® * ®const® * const int ccp;
     856®const® & ®const® & const int ccr;
     857\end{cfa}
     858&
     859\begin{cfa}
     860const int * ®const® * ®const® ccp;
     861
     862\end{cfa}
     863\end{tabular}
     864\end{quote2}
     865where the \CFA declaration is read left-to-right.
     866
     867Finally, like pointers, references are usable and composable with other type operators and generators.
     868\begin{cfa}
     869int w, x, y, z, & ar[3] = { x, y, z }; §\C{// initialize array of references}§
     870&ar[1] = &w;                                            §\C{// change reference array element}§
     871typeof( ar[1] ) p;                                      §\C{// (gcc) is int, i.e., the type of referenced object}§
     872typeof( &ar[1] ) q;                                     §\C{// (gcc) is int \&, i.e., the type of reference}§
     873sizeof( ar[1] ) == sizeof( int );       §\C{// is true, i.e., the size of referenced object}§
     874sizeof( &ar[1] ) == sizeof( int *)      §\C{// is true, i.e., the size of a reference}§
     875\end{cfa}
     876
     877In contrast to \CFA reference types, \Index*[C++]{\CC{}}'s reference types are all ©const© references, preventing changes to the reference address, so only value assignment is possible, which eliminates half of the \Index{address duality}.
     878Also, \CC does not allow \Index{array}s\index{array!reference} of reference\footnote{
     879The reason for disallowing arrays of reference is unknown, but possibly comes from references being ethereal (like a textual macro), and hence, replaceable by the referant object.}
     880\Index*{Java}'s reference types to objects (all Java objects are on the heap) are like C pointers, which always manipulate the address, and there is no (bit-wise) object assignment, so objects are explicitly cloned by shallow or deep copying, which eliminates half of the address duality.
     881
     882
     883\subsection{Initialization}
     884
     885\Index{Initialization} is different than \Index{assignment} because initialization occurs on the empty (uninitialized) storage on an object, while assignment occurs on possibly initialized storage of an object.
     886There are three initialization contexts in \CFA: declaration initialization, argument/parameter binding, return/temporary binding.
     887Because the object being initialized has no value, there is only one meaningful semantics with respect to address duality: it must mean address as there is no pointed-to value.
     888In contrast, the left-hand side of assignment has an address that has a duality.
     889Therefore, for pointer/reference initialization, the initializing value must be an address not a value.
     890\begin{cfa}
     891int * p = &x;                                           §\C{// assign address of x}§
     892®int * p = x;®                                          §\C{// assign value of x}§
     893int & r = x;                                            §\C{// must have address of x}§
     894\end{cfa}
     895Like the previous example with C pointer-arithmetic, it is unlikely assigning the value of ©x© into a pointer is meaningful (again, a warning is usually given).
     896Therefore, for safety, this context requires an address, so it is superfluous to require explicitly taking the address of the initialization object, even though the type is incorrect.
     897Note, this is strictly a convenience and safety feature for a programmer.
     898Hence, \CFA allows ©r© to be assigned ©x© because it infers a reference for ©x©, by implicitly inserting a address-of operator, ©&©, and it is an error to put an ©&© because the types no longer match due to the implicit dereference.
     899Unfortunately, C allows ©p© to be assigned with ©&x© (address) or ©x© (value), but most compilers warn about the latter assignment as being potentially incorrect.
     900Similarly, when a reference type is used for a parameter/return type, the call-site argument does not require a reference operator for the same reason.
     901\begin{cfa}
     902int & f( int & r );                                     §\C{// reference parameter and return}§
     903z = f( x ) + f( y );                            §\C{// reference operator added, temporaries needed for call results}§
     904\end{cfa}
     905Within routine ©f©, it is possible to change the argument by changing the corresponding parameter, and parameter ©r© can be locally reassigned within ©f©.
     906Since operator routine ©?+?© takes its arguments by value, the references returned from ©f© are used to initialize compiler generated temporaries with value semantics that copy from the references.
     907\begin{cfa}
     908int temp1 = f( x ), temp2 = f( y );
     909z = temp1 + temp2;
     910\end{cfa}
     911This \Index{implicit referencing} is crucial for reducing the syntactic burden for programmers when using references;
     912otherwise references have the same syntactic  burden as pointers in these contexts.
     913
     914When a pointer/reference parameter has a ©const© value (immutable), it is possible to pass literals and expressions.
     915\begin{cfa}
     916void f( ®const® int & cr );
     917void g( ®const® int * cp );
     918f( 3 );                   g( ®&®3 );
     919f( x + y );             g( ®&®(x + y) );
     920\end{cfa}
     921Here, the compiler passes the address to the literal 3 or the temporary for the expression ©x + y©, knowing the argument cannot be changed through the parameter.
     922The ©&© before the constant/expression for the pointer-type parameter (©g©) is a \CFA extension necessary to type match and is a common requirement before a variable in C (\eg ©scanf©).
     923Importantly, ©&3© may not be equal to ©&3©, where the references occur across calls because the temporaries maybe different on each call.
     924
     925\CFA \emph{extends} this semantics to a mutable pointer/reference parameter, and the compiler implicitly creates the necessary temporary (copying the argument), which is subsequently pointed-to by the reference parameter and can be changed.\footnote{
     926If whole program analysis is possible, and shows the parameter is not assigned, \ie it is ©const©, the temporary is unnecessary.}
     927\begin{cfa}
     928void f( int & r );
     929void g( int * p );
     930f( 3 );                   g( ®&®3 );            §\C{// compiler implicit generates temporaries}§
     931f( x + y );             g( ®&®(x + y) );        §\C{// compiler implicit generates temporaries}§
     932\end{cfa}
     933Essentially, there is an implicit \Index{rvalue} to \Index{lvalue} conversion in this case.\footnote{
     934This conversion attempts to address the \newterm{const hell} problem, when the innocent addition of a ©const© qualifier causes a cascade of type failures, requiring an unknown number of additional ©const© qualifiers, until it is discovered a ©const© qualifier cannot be added and all the ©const© qualifiers must be removed.}
     935The implicit conversion allows seamless calls to any routine without having to explicitly name/copy the literal/expression to allow the call.
     936
     937%\CFA attempts to handle pointers and references in a uniform, symmetric manner.
     938Finally, C handles \Index{routine object}s in an inconsistent way.
     939A routine object is both a pointer and a reference (\Index{particle and wave}).
     940\begin{cfa}
     941void f( int i );
     942void (*fp)( int );                                      §\C{// routine pointer}§
     943fp = f;                                                         §\C{// reference initialization}§
     944fp = &f;                                                        §\C{// pointer initialization}§
     945fp = *f;                                                        §\C{// reference initialization}§
     946fp(3);                                                          §\C{// reference invocation}§
     947(*fp)(3);                                                       §\C{// pointer invocation}§
     948\end{cfa}
     949While C's treatment of routine objects has similarity to inferring a reference type in initialization contexts, the examples are assignment not initialization, and all possible forms of assignment are possible (©f©, ©&f©, ©*f©) without regard for type.
     950Instead, a routine object should be referenced by a ©const© reference:
     951\begin{cfa}
     952®const® void (®&® fr)( int ) = f;       §\C{// routine reference}§
     953fr = ...                                                        §\C{// error, cannot change code}§
     954&fr = ...;                                                      §\C{// changing routine reference}§
     955fr( 3 );                                                        §\C{// reference call to f}§
     956(*fr)(3);                                                       §\C{// error, incorrect type}§
     957\end{cfa}
     958because the value of the routine object is a routine literal, \ie the routine code is normally immutable during execution.\footnote{
     959Dynamic code rewriting is possible but only in special circumstances.}
     960\CFA allows this additional use of references for routine objects in an attempt to give a more consistent meaning for them.
     961
     962
     963\subsection{Address-of Semantics}
     964
     965In C, ©&E© is an rvalue for any expression ©E©.
     966\CFA extends the ©&© (address-of) operator as follows:
     967\begin{itemize}
     968\item
     969if ©R© is an \Index{rvalue} of type ©T &$_1$...&$_r$© where $r \ge 1$ references (©&© symbols) than ©&R© has type ©T ®*®&$_{\color{red}2}$...&$_{\color{red}r}$©, \ie ©T© pointer with $r-1$ references (©&© symbols).
     970
     971\item
     972if ©L© is an \Index{lvalue} of type ©T &$_1$...&$_l$© where $l \ge 0$ references (©&© symbols) then ©&L© has type ©T ®*®&$_{\color{red}1}$...&$_{\color{red}l}$©, \ie ©T© pointer with $l$ references (©&© symbols).
     973\end{itemize}
     974The following example shows the first rule applied to different \Index{rvalue} contexts:
     975\begin{cfa}
     976int x, * px, ** ppx, *** pppx, **** ppppx;
     977int & rx = x, && rrx = rx, &&& rrrx = rrx ;
     978x = rrrx;               // rrrx is an lvalue with type int &&& (equivalent to x)
     979px = &rrrx;             // starting from rrrx, &rrrx is an rvalue with type int *&&& (&x)
     980ppx = &&rrrx;   // starting from &rrrx, &&rrrx is an rvalue with type int **&& (&rx)
     981pppx = &&&rrrx; // starting from &&rrrx, &&&rrrx is an rvalue with type int ***& (&rrx)
     982ppppx = &&&&rrrx; // starting from &&&rrrx, &&&&rrrx is an rvalue with type int **** (&rrrx)
     983\end{cfa}
     984The following example shows the second rule applied to different \Index{lvalue} contexts:
     985\begin{cfa}
     986int x, * px, ** ppx, *** pppx;
     987int & rx = x, && rrx = rx, &&& rrrx = rrx ;
     988rrrx = 2;               // rrrx is an lvalue with type int &&& (equivalent to x)
     989&rrrx = px;             // starting from rrrx, &rrrx is an rvalue with type int *&&& (rx)
     990&&rrrx = ppx;   // starting from &rrrx, &&rrrx is an rvalue with type int **&& (rrx)
     991&&&rrrx = pppx; // starting from &&rrrx, &&&rrrx is an rvalue with type int ***& (rrrx)
     992\end{cfa}
     993
     994
     995\subsection{Conversions}
     996
     997C provides a basic implicit conversion to simplify variable usage:
     998\begin{enumerate}
     999\setcounter{enumi}{-1}
     1000\item
     1001lvalue to rvalue conversion: ©cv T© converts to ©T©, which allows implicit variable dereferencing.
     1002\begin{cfa}
     1003int x;
     1004x + 1;                  // lvalue variable (int) converts to rvalue for expression
     1005\end{cfa}
     1006An rvalue has no type qualifiers (©cv©), so the lvalue qualifiers are dropped.
     1007\end{enumerate}
     1008\CFA provides three new implicit conversion for reference types to simplify reference usage.
     1009\begin{enumerate}
     1010\item
     1011reference to rvalue conversion: ©cv T &© converts to ©T©, which allows implicit reference dereferencing.
     1012\begin{cfa}
     1013int x, &r = x, f( int p );
     1014x = ®r® + f( ®r® );  // lvalue reference converts to rvalue
     1015\end{cfa}
     1016An rvalue has no type qualifiers (©cv©), so the reference qualifiers are dropped.
     1017
     1018\item
     1019lvalue to reference conversion: \lstinline[deletekeywords={lvalue}]@lvalue-type cv1 T@ converts to ©cv2 T &©, which allows implicitly converting variables to references.
     1020\begin{cfa}
     1021int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &)
     1022f( ®x® );               // lvalue variable (int) convert to reference (int &)
     1023\end{cfa}
     1024Conversion can restrict a type, where ©cv1© $\le$ ©cv2©, \eg passing an ©int© to a ©const volatile int &©, which has low cost.
     1025Conversion can expand a type, where ©cv1© $>$ ©cv2©, \eg passing a ©const volatile int© to an ©int &©, which has high cost (\Index{warning});
     1026furthermore, if ©cv1© has ©const© but not ©cv2©, a temporary variable is created to preserve the immutable lvalue.
     1027
     1028\item
     1029rvalue to reference conversion: ©T© converts to ©cv T &©, which allows binding references to temporaries.
     1030\begin{cfa}
     1031int x, & f( int & p );
     1032f( ®x + 3® );   // rvalue parameter (int) implicitly converts to lvalue temporary reference (int &)
     1033®&f®(...) = &x; // rvalue result (int &) implicitly converts to lvalue temporary reference (int &)
     1034\end{cfa}
     1035In both case, modifications to the temporary are inaccessible (\Index{warning}).
     1036Conversion expands the temporary-type with ©cv©, which is low cost since the temporary is inaccessible.
     1037\end{enumerate}
     1038
     1039
     1040\begin{comment}
     1041From: Richard Bilson <rcbilson@gmail.com>
     1042Date: Wed, 13 Jul 2016 01:58:58 +0000
     1043Subject: Re: pointers / references
     1044To: "Peter A. Buhr" <pabuhr@plg2.cs.uwaterloo.ca>
     1045
     1046As a general comment I would say that I found the section confusing, as you move back and forth
     1047between various real and imagined programming languages. If it were me I would rewrite into two
     1048subsections, one that specifies precisely the syntax and semantics of reference variables and
     1049another that provides the rationale.
     1050
     1051I don't see any obvious problems with the syntax or semantics so far as I understand them. It's not
     1052obvious that the description you're giving is complete, but I'm sure you'll find the special cases
     1053as you do the implementation.
     1054
     1055My big gripes are mostly that you're not being as precise as you need to be in your terminology, and
     1056that you say a few things that aren't actually true even though I generally know what you mean.
     1057
     105820 C provides a pointer type; CFA adds a reference type. Both types contain an address, which is normally a
     105921 location in memory.
     1060
     1061An address is not a location in memory; an address refers to a location in memory. Furthermore it
     1062seems weird to me to say that a type "contains" an address; rather, objects of that type do.
     1063
     106421 Special addresses are used to denote certain states or access co-processor memory. By
     106522 convention, no variable is placed at address 0, so addresses like 0, 1, 2, 3 are often used to denote no-value
     106623 or other special states.
     1067
     1068This isn't standard C at all. There has to be one null pointer representation, but it doesn't have
     1069to be a literal zero representation and there doesn't have to be more than one such representation.
     1070
     107123 Often dereferencing a special state causes a memory fault, so checking is necessary
     107224 during execution.
     1073
     1074I don't see the connection between the two clauses here. I feel like if a bad pointer will not cause
     1075a memory fault then I need to do more checking, not less.
     1076
     107724 If the programming language assigns addresses, a program's execution is sound, \ie all
     107825 addresses are to valid memory locations.
     1079
     1080You haven't said what it means to "assign" an address, but if I use my intuitive understanding of
     1081the term I don't see how this can be true unless you're assuming automatic storage management.
     1082
     10831 Program variables are implicit pointers to memory locations generated by the compiler and automatically
     10842 dereferenced, as in:
     1085
     1086There is no reason why a variable needs to have a location in memory, and indeed in a typical
     1087program many variables will not. In standard terminology an object identifier refers to data in the
     1088execution environment, but not necessarily in memory.
     1089
     109013 A pointer/reference is a generalization of a variable name, \ie a mutable address that can point to more
     109114 than one memory location during its lifetime.
     1092
     1093I feel like you're off the reservation here. In my world there are objects of pointer type, which
     1094seem to be what you're describing here, but also pointer values, which can be stored in an object of
     1095pointer type but don't necessarily have to be. For example, how would you describe the value denoted
     1096by "&main" in a C program? I would call it a (function) pointer, but that doesn't satisfy your
     1097definition.
     1098
     109916 not occupy storage as the literal is embedded directly into instructions.) Hence, a pointer occupies memory
     110017 to store its current address, and the pointer's value is loaded by dereferencing, e.g.:
     1101
     1102As with my general objection regarding your definition of variables, there is no reason why a
     1103pointer variable (object of pointer type) needs to occupy memory.
     1104
     110521 p2 = p1 + x; // compiler infers *p2 = *p1 + x;
     1106
     1107What language are we in now?
     1108
     110924 pointer usage. However, in C, the following cases are ambiguous, especially with pointer arithmetic:
     111025 p1 = p2; // p1 = p2 or *p1 = *p2
     1111
     1112This isn't ambiguous. it's defined to be the first option.
     1113
     111426 p1 = p1 + 1; // p1 = p1 + 1 or *p1 = *p1 + 1
     1115
     1116Again, this statement is not ambiguous.
     1117
     111813 example. Hence, a reference behaves like the variable name for the current variable it is pointing-to. The
     111914 simplest way to understand a reference is to imagine the compiler inserting a dereference operator before
     112015 the reference variable for each reference qualifier in a declaration, e.g.:
     1121
     1122It's hard for me to understand who the audience for this part is. I think a practical programmer is
     1123likely to be satisfied with "a reference behaves like the variable name for the current variable it
     1124is pointing-to," maybe with some examples. Your "simplest way" doesn't strike me as simpler than
     1125that. It feels like you're trying to provide a more precise definition for the semantics of
     1126references, but it isn't actually precise enough to be a formal specification. If you want to
     1127express the semantics of references using rewrite rules that's a great way to do it, but lay the
     1128rules out clearly, and when you're showing an example of rewriting keep your
     1129references/pointers/values separate (right now, you use \eg "r3" to mean a reference, a pointer,
     1130and a value).
     1131
     113224 Cancellation works to arbitrary depth, and pointer and reference values are interchangeable because both
     113325 contain addresses.
     1134
     1135Except they're not interchangeable, because they have different and incompatible types.
     1136
     113740 Interestingly, C++ deals with the address duality by making the pointed-to value the default, and prevent-
     113841 ing changes to the reference address, which eliminates half of the duality. Java deals with the address duality
     113942 by making address assignment the default and requiring field assignment (direct or indirect via methods),
     114043 \ie there is no builtin bit-wise or method-wise assignment, which eliminates half of the duality.
     1141
     1142I can follow this but I think that's mostly because I already understand what you're trying to
     1143say. I don't think I've ever heard the term "method-wise assignment" and I don't see you defining
     1144it. Furthermore Java does have value assignment of basic (non-class) types, so your summary here
     1145feels incomplete. (If it were me I'd drop this paragraph rather than try to save it.)
     1146
     114711 Hence, for type & const, there is no pointer assignment, so &rc = &x is disallowed, and the address value
     114812 cannot be 0 unless an arbitrary pointer is assigned to the reference.
     1149
     1150Given the pains you've taken to motivate every little bit of the semantics up until now, this last
     1151clause ("the address value cannot be 0") comes out of the blue. It seems like you could have
     1152perfectly reasonable semantics that allowed the initialization of null references.
     1153
     115412 In effect, the compiler is managing the
     115513 addresses for type & const not the programmer, and by a programming discipline of only using references
     115614 with references, address errors can be prevented.
     1157
     1158Again, is this assuming automatic storage management?
     1159
     116018 rary binding. For reference initialization (like pointer), the initializing value must be an address (lvalue) not
     116119 a value (rvalue).
     1162
     1163This sentence appears to suggest that an address and an lvalue are the same thing.
     1164
     116520 int * p = &x; // both &x and x are possible interpretations
     1166
     1167Are you saying that we should be considering "x" as a possible interpretation of the initializer
     1168"&x"? It seems to me that this expression has only one legitimate interpretation in context.
     1169
     117021 int & r = x; // x unlikely interpretation, because of auto-dereferencing
     1171
     1172You mean, we can initialize a reference using an integer value? Surely we would need some sort of
     1173cast to induce that interpretation, no?
     1174
     117522 Hence, the compiler implicitly inserts a reference operator, &, before the initialization expression.
     1176
     1177But then the expression would have pointer type, which wouldn't be compatible with the type of r.
     1178
     117922 Similarly,
     118023 when a reference is used for a parameter/return type, the call-site argument does not require a reference
     118124 operator.
     1182
     1183Furthermore, it would not be correct to use a reference operator.
     1184
     118545 The implicit conversion allows
     11861 seamless calls to any routine without having to explicitly name/copy the literal/expression to allow the call.
     11872 While C' attempts to handle pointers and references in a uniform, symmetric manner, C handles routine
     11883 variables in an inconsistent way: a routine variable is both a pointer and a reference (particle and wave).
     1189
     1190After all this talk of how expressions can have both pointer and value interpretations, you're
     1191disparaging C because it has expressions that have both pointer and value interpretations?
     1192
     1193On Sat, Jul 9, 2016 at 4:18 PM Peter A. Buhr <pabuhr@plg.uwaterloo.ca> wrote:
     1194> Aaron discovered a few places where "&"s are missing and where there are too many "&", which are
     1195> corrected in the attached updated. None of the text has changed, if you have started reading
     1196> already.
     1197\end{comment}
     1198
     1199
     1200\section{Routine Definition}
     1201
     1202\CFA also supports a new syntax for routine definition, as well as \Celeven and K\&R routine syntax.
     1203The point of the new syntax is to allow returning multiple values from a routine~\cite{Galletly96,CLU}, \eg:
     1204\begin{cfa}
     1205®[ int o1, int o2, char o3 ]® f( int i1, char i2, char i3 ) {
     1206        §\emph{routine body}§
     1207}
     1208\end{cfa}
     1209where routine ©f© has three output (return values) and three input parameters.
     1210Existing C syntax cannot be extended with multiple return types because it is impossible to embed a single routine name within multiple return type specifications.
     1211
     1212In detail, the brackets, ©[]©, enclose the result type, where each return value is named and that name is a local variable of the particular return type.\footnote{
     1213\Index*{Michael Tiemann}, with help from \Index*{Doug Lea}, provided named return values in g++, circa 1989.}
     1214The value of each local return variable is automatically returned at routine termination.
     1215Declaration qualifiers can only appear at the start of a routine definition, \eg:
     1216\begin{cfa}
     1217®extern® [ int x ] g( int y ) {§\,§}
     1218\end{cfa}
     1219Lastly, if there are no output parameters or input parameters, the brackets and/or parentheses must still be specified;
     1220in both cases the type is assumed to be void as opposed to old style C defaults of int return type and unknown parameter types, respectively, as in:
     1221\begin{cfa}
     1222[§\,§] g();                                                     §\C{// no input or output parameters}§
     1223[ void ] g( void );                                     §\C{// no input or output parameters}§
     1224\end{cfa}
     1225
     1226Routine f is called as follows:
     1227\begin{cfa}
     1228[ i, j, ch ] = f( 3, 'a', ch );
     1229\end{cfa}
     1230The list of return values from f and the grouping on the left-hand side of the assignment is called a \newterm{return list} and discussed in Section 12.
     1231
     1232\CFA style declarations cannot be used to declare parameters for K\&R style routine definitions because of the following ambiguity:
     1233\begin{cfa}
     1234int (*f(x))[ 5 ] int x; {}
     1235\end{cfa}
     1236The string ``©int (*f(x))[ 5 ]©'' declares a K\&R style routine of type returning a pointer to an array of 5 integers, while the string ``©[ 5 ] int x©'' declares a \CFA style parameter x of type array of 5 integers.
     1237Since the strings overlap starting with the open bracket, ©[©, there is an ambiguous interpretation for the string.
     1238As well, \CFA-style declarations cannot be used to declare parameters for C-style routine-definitions because of the following ambiguity:
     1239\begin{cfa}
     1240typedef int foo;
     1241int f( int (* foo) );                           §\C{// foo is redefined as a parameter name}§
     1242\end{cfa}
     1243The string ``©int (* foo)©'' declares a C-style named-parameter of type pointer to an integer (the parenthesis are superfluous), while the same string declares a \CFA style unnamed parameter of type routine returning integer with unnamed parameter of type pointer to foo.
     1244The redefinition of a type name in a parameter list is the only context in C where the character ©*© can appear to the left of a type name, and \CFA relies on all type qualifier characters appearing to the right of the type name.
     1245The inability to use \CFA declarations in these two contexts is probably a blessing because it precludes programmers from arbitrarily switching between declarations forms within a declaration contexts.
     1246
     1247C-style declarations can be used to declare parameters for \CFA style routine definitions, \eg:
     1248\begin{cfa}
     1249[ int ] f( * int, int * );                      §\C{// returns an integer, accepts 2 pointers to integers}§
     1250[ * int, int * ] f( int );                      §\C{// returns 2 pointers to integers, accepts an integer}§
     1251\end{cfa}
     1252The reason for allowing both declaration styles in the new context is for backwards compatibility with existing preprocessor macros that generate C-style declaration-syntax, as in:
     1253\begin{cfa}
     1254#define ptoa( n, d ) int (*n)[ d ]
     1255int f( ptoa( p, 5 ) ) ...                       §\C{// expands to int f( int (*p)[ 5 ] )}§
     1256[ int ] f( ptoa( p, 5 ) ) ...           §\C{// expands to [ int ] f( int (*p)[ 5 ] )}§
     1257\end{cfa}
     1258Again, programmers are highly encouraged to use one declaration form or the other, rather than mixing the forms.
     1259
     1260
     1261\subsection{Named Return Values}
     1262
     1263\Index{Named return values} handle the case where it is necessary to define a local variable whose value is then returned in a ©return© statement, as in:
     1264\begin{cfa}
     1265int f() {
     1266        int x;
     1267        ... x = 0; ... x = y; ...
     1268        return x;
     1269}
     1270\end{cfa}
     1271Because the value in the return variable is automatically returned when a \CFA routine terminates, the ©return© statement \emph{does not} contain an expression, as in:
     1272\newline
     1273\begin{minipage}{\linewidth}
     1274\begin{cfa}
     1275®[ int x, int y ]® f() {
     1276        int z;
     1277        ... x = 0; ... y = z; ...
     1278        ®return;®                                                       §\C{// implicitly return x, y}§
     1279}
     1280\end{cfa}
     1281\end{minipage}
     1282\newline
     1283When the return is encountered, the current values of ©x© and ©y© are returned to the calling routine.
     1284As well, ``falling off the end'' of a routine without a ©return© statement is permitted, as in:
     1285\begin{cfa}
     1286[ int x, int y ] f() {
     1287        ...
     1288}                                                                               §\C{// implicitly return x, y}§
     1289\end{cfa}
     1290In this case, the current values of ©x© and ©y© are returned to the calling routine just as if a ©return© had been encountered.
     1291
     1292Named return values may be used in conjunction with named parameter values;
     1293specifically, a return and parameter can have the same name.
     1294\begin{cfa}
     1295[ int x, int y ] f( int, x, int y ) {
     1296        ...
     1297}                                                                               §\C{// implicitly return x, y}§
     1298\end{cfa}
     1299This notation allows the compiler to eliminate temporary variables in nested routine calls.
     1300\begin{cfa}
     1301[ int x, int y ] f( int, x, int y );    §\C{// prototype declaration}§
     1302int a, b;
     1303[a, b] = f( f( f( a, b ) ) );
     1304\end{cfa}
     1305While the compiler normally ignores parameters names in prototype declarations, here they are used to eliminate temporary return-values by inferring that the results of each call are the inputs of the next call, and ultimately, the left-hand side of the assignment.
     1306Hence, even without the body of routine ©f© (separate compilation), it is possible to perform a global optimization across routine calls.
     1307The compiler warns about naming inconsistencies between routine prototype and definition in this case, and behaviour is \Index{undefined} if the programmer is inconsistent.
     1308
     1309
     1310\subsection{Routine Prototype}
     1311
     1312The syntax of the new routine prototype declaration follows directly from the new routine definition syntax;
     1313as well, parameter names are optional, \eg:
     1314\begin{cfa}
     1315[ int x ] f ();                                                 §\C{// returning int with no parameters}§
     1316[ * int ] g (int y);                                    §\C{// returning pointer to int with int parameter}§
     1317[ ] h ( int, char );                                    §\C{// returning no result with int and char parameters}§
     1318[ * int, int ] j ( int );                               §\C{// returning pointer to int and int, with int parameter}§
     1319\end{cfa}
     1320This syntax allows a prototype declaration to be created by cutting and pasting source text from the routine definition header (or vice versa).
     1321It is possible to declare multiple routine-prototypes in a single declaration, but the entire type specification is distributed across \emph{all} routine names in the declaration list (see~\VRef{s:Declarations}), \eg:
     1322\begin{quote2}
     1323\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     1324\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1325\begin{cfa}
     1326[ int ] f( int ), g;
     1327\end{cfa}
     1328&
     1329\begin{cfa}
     1330int f( int ), g( int );
     1331\end{cfa}
     1332\end{tabular}
     1333\end{quote2}
     1334Declaration qualifiers can only appear at the start of a \CFA routine declaration,\footref{StorageClassSpecifier} \eg:
     1335\begin{cfa}
     1336extern [ int ] f ( int );
     1337static [ int ] g ( int );
     1338\end{cfa}
     1339
     1340
     1341\section{Routine Pointers}
     1342
     1343The syntax for pointers to \CFA routines specifies the pointer name on the right, \eg:
     1344\begin{cfa}
     1345* [ int x ] () fp;                                              §\C{// pointer to routine returning int with no parameters}§
     1346* [ * int ] (int y) gp;                                 §\C{// pointer to routine returning pointer to int with int parameter}§
     1347* [ ] (int,char) hp;                                    §\C{// pointer to routine returning no result with int and char parameters}§
     1348* [ * int,int ] ( int ) jp;                             §\C{// pointer to routine returning pointer to int and int, with int parameter}§
     1349\end{cfa}
     1350While parameter names are optional, \emph{a routine name cannot be specified};
     1351for example, the following is incorrect:
     1352\begin{cfa}
     1353* [ int x ] f () fp;                                    §\C{// routine name "f" is not allowed}§
     1354\end{cfa}
     1355
     1356
     1357\section{Named and Default Arguments}
     1358
     1359Named\index{named arguments}\index{arguments!named} and default\index{default arguments}\index{arguments!default} arguments~\cite{Hardgrave76}\footnote{
     1360Francez~\cite{Francez77} proposed a further extension to the named-parameter passing style, which specifies what type of communication (by value, by reference, by name) the argument is passed to the routine.}
     1361are two mechanisms to simplify routine call.
     1362Both mechanisms are discussed with respect to \CFA.
     1363\begin{description}
     1364\item[Named (or Keyword) Arguments:]
     1365provide the ability to specify an argument to a routine call using the parameter name rather than the position of the parameter.
     1366For example, given the routine:
     1367\begin{cfa}
     1368void p( int x, int y, int z ) {...}
     1369\end{cfa}
     1370a positional call is:
     1371\begin{cfa}
     1372p( 4, 7, 3 );
     1373\end{cfa}
     1374whereas a named (keyword) call may be:
     1375\begin{cfa}
     1376p( z : 3, x : 4, y : 7 );       §\C{// rewrite $\Rightarrow$ p( 4, 7, 3 )}§
     1377\end{cfa}
     1378Here the order of the arguments is unimportant, and the names of the parameters are used to associate argument values with the corresponding parameters.
     1379The compiler rewrites a named call into a positional call.
     1380The advantages of named parameters are:
     1381\begin{itemize}
     1382\item
     1383Remembering the names of the parameters may be easier than the order in the routine definition.
     1384\item
     1385Parameter names provide documentation at the call site (assuming the names are descriptive).
     1386\item
     1387Changes can be made to the order or number of parameters without affecting the call (although the call must still be recompiled).
     1388\end{itemize}
     1389
     1390Unfortunately, named arguments do not work in C-style programming-languages because a routine prototype is not required to specify parameter names, nor do the names in the prototype have to match with the actual definition.
     1391For example, the following routine prototypes and definition are all valid.
     1392\begin{cfa}
     1393void p( int, int, int );                        §\C{// equivalent prototypes}§
     1394void p( int x, int y, int z );
     1395void p( int y, int x, int z );
     1396void p( int z, int y, int x );
     1397void p( int q, int r, int s ) {}        §\C{// match with this definition}§
     1398\end{cfa}
     1399Forcing matching parameter names in routine prototypes with corresponding routine definitions is possible, but goes against a strong tradition in C programming.
     1400Alternatively, prototype definitions can be eliminated by using a two-pass compilation, and implicitly creating header files for exports.
     1401The former is easy to do, while the latter is more complex.
     1402
     1403Furthermore, named arguments do not work well in a \CFA-style programming-languages because they potentially introduces a new criteria for type matching.
     1404For example, it is technically possible to disambiguate between these two overloaded definitions of ©f© based on named arguments at the call site:
     1405\begin{cfa}
     1406int f( int i, int j );
     1407int f( int x, double y );
     1408
     1409f( j : 3, i : 4 );                              §\C{// 1st f}§
     1410f( x : 7, y : 8.1 );                    §\C{// 2nd f}§
     1411f( 4, 5 );                                              §\C{// ambiguous call}§
     1412\end{cfa}
     1413However, named arguments compound routine resolution in conjunction with conversions:
     1414\begin{cfa}
     1415f( i : 3, 5.7 );                                §\C{// ambiguous call ?}§
     1416\end{cfa}
     1417Depending on the cost associated with named arguments, this call could be resolvable or ambiguous.
     1418Adding named argument into the routine resolution algorithm does not seem worth the complexity.
     1419Therefore, \CFA does \emph{not} attempt to support named arguments.
     1420
     1421\item[Default Arguments]
     1422provide the ability to associate a default value with a parameter so it can be optionally specified in the argument list.
     1423For example, given the routine:
     1424\begin{cfa}
     1425void p( int x = 1, int y = 2, int z = 3 ) {...}
     1426\end{cfa}
     1427the allowable positional calls are:
     1428\begin{cfa}
     1429p();                                                    §\C{// rewrite $\Rightarrow$ p( 1, 2, 3 )}§
     1430p( 4 );                                                 §\C{// rewrite $\Rightarrow$ p( 4, 2, 3 )}§
     1431p( 4, 4 );                                              §\C{// rewrite $\Rightarrow$ p( 4, 4, 3 )}§
     1432p( 4, 4, 4 );                                   §\C{// rewrite $\Rightarrow$ p( 4, 4, 4 )}§
     1433// empty arguments
     1434p(  , 4, 4 );                                   §\C{// rewrite $\Rightarrow$ p( 1, 4, 4 )}§
     1435p( 4,  , 4 );                                   §\C{// rewrite $\Rightarrow$ p( 4, 2, 4 )}§
     1436p( 4, 4,   );                                   §\C{// rewrite $\Rightarrow$ p( 4, 4, 3 )}§
     1437p( 4,  ,   );                                   §\C{// rewrite $\Rightarrow$ p( 4, 2, 3 )}§
     1438p(  , 4,   );                                   §\C{// rewrite $\Rightarrow$ p( 1, 4, 3 )}§
     1439p(  ,  , 4 );                                   §\C{// rewrite $\Rightarrow$ p( 1, 2, 4 )}§
     1440p(  ,  ,   );                                   §\C{// rewrite $\Rightarrow$ p( 1, 2, 3 )}§
     1441\end{cfa}
     1442Here the missing arguments are inserted from the default values in the parameter list.
     1443The compiler rewrites missing default values into explicit positional arguments.
     1444The advantages of default values are:
     1445\begin{itemize}
     1446\item
     1447Routines with a large number of parameters are often very generalized, giving a programmer a number of different options on how a computation is performed.
     1448For many of these kinds of routines, there are standard or default settings that work for the majority of computations.
     1449Without default values for parameters, a programmer is forced to specify these common values all the time, resulting in long argument lists that are error prone.
     1450\item
     1451When a routine's interface is augmented with new parameters, it extends the interface providing generalizability\footnote{
     1452``It should be possible for the implementor of an abstraction to increase its generality.
     1453So long as the modified abstraction is a generalization of the original, existing uses of the abstraction will not require change.
     1454It might be possible to modify an abstraction in a manner which is not a generalization without affecting existing uses, but, without inspecting the modules in which the uses occur, this possibility cannot be determined.
     1455This criterion precludes the addition of parameters, unless these parameters have default or inferred values that are valid for all possible existing applications.''~\cite[p.~128]{Cormack90}}
     1456(somewhat like the generalization provided by inheritance for classes).
     1457That is, all existing calls are still valid, although the call must still be recompiled.
     1458\end{itemize}
     1459The only disadvantage of default arguments is that unintentional omission of an argument may not result in a compiler-time error.
     1460Instead, a default value is used, which may not be the programmer's intent.
     1461
     1462Default values may only appear in a prototype versus definition context:
     1463\begin{cfa}
     1464void p( int x, int y = 2, int z = 3 );          §\C{// prototype: allowed}§
     1465void p( int, int = 2, int = 3 );                        §\C{// prototype: allowed}§
     1466void p( int x, int y = 2, int z = 3 ) {}        §\C{// definition: not allowed}§
     1467\end{cfa}
     1468The reason for this restriction is to allow separate compilation.
     1469Multiple prototypes with different default values is an error.
     1470\end{description}
     1471
     1472Ellipse (``...'') arguments present problems when used with default arguments.
     1473The conflict occurs because both named and ellipse arguments must appear after positional arguments, giving two possibilities:
     1474\begin{cfa}
     1475p( /* positional */, ... , /* named */ );
     1476p( /* positional */, /* named */, ... );
     1477\end{cfa}
     1478While it is possible to implement both approaches, the first possibly is more complex than the second, \eg:
     1479\begin{cfa}
     1480p( int x, int y, int z, ... );
     1481p( 1, 4, 5, 6, z : 3, y : 2 ); §\C{// assume p( /* positional */, ... , /* named */ );}§
     1482p( 1, z : 3, y : 2, 4, 5, 6 ); §\C{// assume p( /* positional */, /* named */, ... );}§
     1483\end{cfa}
     1484In the first call, it is necessary for the programmer to conceptually rewrite the call, changing named arguments into positional, before knowing where the ellipse arguments begin.
     1485Hence, this approach seems significantly more difficult, and hence, confusing and error prone.
     1486In the second call, the named arguments separate the positional and ellipse arguments, making it trivial to read the call.
     1487
     1488The problem is exacerbated with default arguments, \eg:
     1489\begin{cfa}
     1490void p( int x, int y = 2, int z = 3... );
     1491p( 1, 4, 5, 6, z : 3 );         §\C{// assume p( /* positional */, ... , /* named */ );}§
     1492p( 1, z : 3, 4, 5, 6 );         §\C{// assume p( /* positional */, /* named */, ... );}§
     1493\end{cfa}
     1494The first call is an error because arguments 4 and 5 are actually positional not ellipse arguments;
     1495therefore, argument 5 subsequently conflicts with the named argument z : 3.
     1496In the second call, the default value for y is implicitly inserted after argument 1 and the named arguments separate the positional and ellipse arguments, making it trivial to read the call.
     1497For these reasons, \CFA requires named arguments before ellipse arguments.
     1498Finally, while ellipse arguments are needed for a small set of existing C routines, like printf, the extended \CFA type system largely eliminates the need for ellipse arguments (see Section 24), making much of this discussion moot.
     1499
     1500Default arguments and overloading (see Section 24) are complementary.
     1501While in theory default arguments can be simulated with overloading, as in:
     1502\begin{quote2}
     1503\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
     1504\multicolumn{1}{c@{\hspace{3em}}}{\textbf{default arguments}}   & \multicolumn{1}{c}{\textbf{overloading}}      \\
     1505\begin{cfa}
     1506void p( int x, int y = 2, int z = 3 ) {...}
     1507
     1508
     1509\end{cfa}
     1510&
     1511\begin{cfa}
     1512void p( int x, int y, int z ) {...}
     1513void p( int x ) { p( x, 2, 3 ); }
     1514void p( int x, int y ) { p( x, y, 3 ); }
     1515\end{cfa}
     1516\end{tabular}
     1517\end{quote2}
     1518the number of required overloaded routines is linear in the number of default values, which is unacceptable growth.
     1519In general, overloading should only be used over default arguments if the body of the routine is significantly different.
     1520Furthermore, overloading cannot handle accessing default arguments in the middle of a positional list, via a missing argument, such as:
     1521\begin{cfa}
     1522p( 1, /* default */, 5 );               §\C{// rewrite $\Rightarrow$ p( 1, 2, 5 )}§
     1523\end{cfa}
     1524
     1525Given the \CFA restrictions above, both named and default arguments are backwards compatible.
     1526\Index*[C++]{\CC{}} only supports default arguments;
     1527\Index*{Ada} supports both named and default arguments.
     1528
     1529
     1530\section{Unnamed Structure Fields}
     1531
     1532C requires each field of a structure to have a name, except for a bit field associated with a basic type, \eg:
     1533\begin{cfa}
     1534struct {
     1535        int f1;                                 §\C{// named field}§
     1536        int f2 : 4;                             §\C{// named field with bit field size}§
     1537        int : 3;                                §\C{// unnamed field for basic type with bit field size}§
     1538        int ;                                   §\C{// disallowed, unnamed field}§
     1539        int *;                                  §\C{// disallowed, unnamed field}§
     1540        int (*)( int );                 §\C{// disallowed, unnamed field}§
     1541};
     1542\end{cfa}
     1543This requirement is relaxed by making the field name optional for all field declarations; therefore, all the field declarations in the example are allowed.
     1544As for unnamed bit fields, an unnamed field is used for padding a structure to a particular size.
     1545A list of unnamed fields is also supported, \eg:
     1546\begin{cfa}
     1547struct {
     1548        int , , ;                               §\C{// 3 unnamed fields}§
     1549}
     1550\end{cfa}
     1551
     1552
     1553\section{Nesting}
     1554
     1555Nesting of types and routines is useful for controlling name visibility (\newterm{name hiding}).
     1556
     1557
     1558\subsection{Type Nesting}
     1559
     1560\CFA allows \Index{type nesting}, and type qualification of the nested types (see \VRef[Figure]{f:TypeNestingQualification}), where as C hoists\index{type hoisting} (refactors) nested types into the enclosing scope and has no type qualification.
     1561\begin{figure}
     1562\centering
     1563\begin{tabular}{@{}l@{\hspace{3em}}l|l@{}}
     1564\multicolumn{1}{c@{\hspace{3em}}}{\textbf{C Type Nesting}}      & \multicolumn{1}{c}{\textbf{C Implicit Hoisting}}      & \multicolumn{1}{|c}{\textbf{\CFA}}    \\
     1565\hline
     1566\begin{cfa}
     1567struct S {
     1568        enum C { R, G, B };
     1569        struct T {
     1570                union U { int i, j; };
     1571                enum C c;
     1572                short int i, j;
     1573        };
     1574        struct T t;
     1575} s;
     1576
     1577int fred() {
     1578        s.t.c = R;
     1579        struct T t = { R, 1, 2 };
     1580        enum C c;
     1581        union U u;
     1582}
     1583\end{cfa}
     1584&
     1585\begin{cfa}
     1586enum C { R, G, B };
     1587union U { int i, j; };
     1588struct T {
     1589        enum C c;
     1590        short int i, j;
     1591};
     1592struct S {
     1593        struct T t;
     1594} s;
     1595       
     1596
     1597
     1598
     1599
     1600
     1601
     1602\end{cfa}
     1603&
     1604\begin{cfa}
     1605struct S {
     1606        enum C { R, G, B };
     1607        struct T {
     1608                union U { int i, j; };
     1609                enum C c;
     1610                short int i, j;
     1611        };
     1612        struct T t;
     1613} s;
     1614
     1615int fred() {
     1616        s.t.c = ®S.®R;  // type qualification
     1617        struct ®S.®T t = { ®S.®R, 1, 2 };
     1618        enum ®S.®C c;
     1619        union ®S.T.®U u;
     1620}
     1621\end{cfa}
     1622\end{tabular}
     1623\caption{Type Nesting / Qualification}
     1624\label{f:TypeNestingQualification}
     1625\end{figure}
     1626In the left example in C, types ©C©, ©U© and ©T© are implicitly hoisted outside of type ©S© into the containing block scope.
     1627In the right example in \CFA, the types are not hoisted and accessed using the field-selection operator ``©.©'' for type qualification, as does \Index*{Java}, rather than the \CC type-selection operator ``©::©''.
     1628
     1629
     1630\subsection{Routine Nesting}
     1631
     1632While \CFA does not provide object programming by putting routines into structures, it does rely heavily on locally nested routines to redefine operations at or close to a call site.
     1633For example, the C quick-sort is wrapped into the following polymorphic \CFA routine:
     1634\begin{cfa}
     1635forall( otype T | { int ?<?( T, T ); } )
     1636void qsort( const T * arr, size_t dimension );
     1637\end{cfa}
     1638which can be used to sort in ascending and descending order by locally redefining the less-than operator into greater-than.
     1639\begin{cfa}
     1640const unsigned int size = 5;
     1641int ia[size];
     1642...                                             §\C{// assign values to array ia}§
     1643qsort( ia, size );              §\C{// sort ascending order using builtin ?<?}§
     1644{
     1645        ®int ?<?( int x, int y ) { return x > y; }® §\C{// nested routine}§
     1646        qsort( ia, size );      §\C{// sort descending order by local redefinition}§
     1647}
     1648\end{cfa}
     1649
     1650Nested routines are not first-class, meaning a nested routine cannot be returned if it has references to variables in its enclosing blocks;
     1651the only exception is references to the external block of the translation unit, as these variables persist for the duration of the program.
     1652The following program in undefined in \CFA (and Indexc{gcc})
     1653\begin{cfa}
     1654[* [int]( int )] foo() {                §\C{// int (*foo())( int )}§
     1655        int ®i® = 7;
     1656        int bar( int p ) {
     1657                ®i® += 1;                               §\C{// dependent on local variable}§
     1658                sout | ®i® | endl;
     1659        }
     1660        return bar;                                     §\C{// undefined because of local dependence}§
     1661}
     1662int main() {
     1663        * [int]( int ) fp = foo();      §\C{// int (*fp)( int )}§
     1664        sout | fp( 3 ) | endl;
     1665}
     1666\end{cfa}
     1667because
     1668
     1669Currently, there are no \Index{lambda} expressions, \ie unnamed routines because routine names are very important to properly select the correct routine.
     1670
     1671
     1672\section{Tuples}
     1673
     1674In C and \CFA, lists of elements appear in several contexts, such as the parameter list for a routine call.
     1675(More contexts are added shortly.)
     1676A list of such elements is called a \newterm{lexical list}.
     1677The general syntax of a lexical list is:
     1678\begin{cfa}
     1679[ §\emph{exprlist}§ ]
     1680\end{cfa}
     1681where ©$\emph{exprlist}$© is a list of one or more expressions separated by commas.
     1682The brackets, ©[]©, allow differentiating between lexical lists and expressions containing the C comma operator.
     1683The following are examples of lexical lists:
     1684\begin{cfa}
     1685[ x, y, z ]
     1686[ 2 ]
     1687[ v+w, x*y, 3.14159, f() ]
     1688\end{cfa}
     1689Tuples are permitted to contain sub-tuples (\ie nesting), such as ©[ [ 14, 21 ], 9 ]©, which is a 2-element tuple whose first element is itself a tuple.
     1690Note, a tuple is not a record (structure);
     1691a record denotes a single value with substructure, whereas a tuple is multiple values with no substructure (see flattening coercion in Section 12.1).
     1692In essence, tuples are largely a compile time phenomenon, having little or no runtime presence.
     1693
     1694Tuples can be organized into compile-time tuple variables;
     1695these variables are of \newterm{tuple type}.
     1696Tuple variables and types can be used anywhere lists of conventional variables and types can be used.
     1697The general syntax of a tuple type is:
     1698\begin{cfa}
     1699[ §\emph{typelist}§ ]
     1700\end{cfa}
     1701where ©$\emph{typelist}$© is a list of one or more legal \CFA or C type specifications separated by commas, which may include other tuple type specifications.
     1702Examples of tuple types include:
     1703\begin{cfa}
     1704[ unsigned int, char ]
     1705[ double, double, double ]
     1706[ * int, int * ]                §\C{// mix of CFA and ANSI}§
     1707[ * [ 5 ] int, * * char, * [ [ int, int ] ] (int, int) ]
     1708\end{cfa}
     1709Like tuples, tuple types may be nested, such as ©[ [ int, int ], int ]©, which is a 2-element tuple type whose first element is itself a tuple type.
     1710
     1711Examples of declarations using tuple types are:
     1712\begin{cfa}
     1713[ int, int ] x;                 §\C{// 2 element tuple, each element of type int}§
     1714* [ char, char ] y;             §\C{// pointer to a 2 element tuple}§
     1715[ [ int, int ] ] z ([ int, int ]);
     1716\end{cfa}
     1717The last example declares an external routine that expects a 2 element tuple as an input parameter and returns a 2 element tuple as its result.
     1718
     1719As mentioned, tuples can appear in contexts requiring a list of value, such as an argument list of a routine call.
     1720In unambiguous situations, the tuple brackets may be omitted, \eg a tuple that appears as an argument may have its
     1721square brackets omitted for convenience; therefore, the following routine invocations are equivalent:
     1722\begin{cfa}
     1723f( [ 1, x+2, fred() ] );
     1724f( 1, x+2, fred() );
     1725\end{cfa}
     1726Also, a tuple or a tuple variable may be used to supply all or part of an argument list for a routine expecting multiple input parameters or for a routine expecting a tuple as an input parameter.
     1727For example, the following are all legal:
     1728\begin{cfa}
     1729[ int, int ] w1;
     1730[ int, int, int ] w2;
     1731[ void ] f (int, int, int); /* three input parameters of type int */
     1732[ void ] g ([ int, int, int ]); /* 3 element tuple as input */
     1733f( [ 1, 2, 3 ] );
     1734f( w1, 3 );
     1735f( 1, w1 );
     1736f( w2 );
     1737g( [ 1, 2, 3 ] );
     1738g( w1, 3 );
     1739g( 1, w1 );
     1740g( w2 );
     1741\end{cfa}
     1742Note, in all cases 3 arguments are supplied even though the syntax may appear to supply less than 3. As mentioned, a
     1743tuple does not have structure like a record; a tuple is simply converted into a list of components.
     1744\begin{rationale}
     1745The present implementation of \CFA does not support nested routine calls when the inner routine returns multiple values; \ie a statement such as ©g( f() )© is not supported.
     1746Using a temporary variable to store the  results of the inner routine and then passing this variable to the outer routine works, however.
     1747\end{rationale}
     1748
     1749A tuple can contain a C comma expression, provided the expression containing the comma operator is enclosed in parentheses.
     1750For instance, the following tuples are equivalent:
     1751\begin{cfa}
     1752[ 1, 3, 5 ]
     1753[ 1, (2, 3), 5 ]
     1754\end{cfa}
     1755The second element of the second tuple is the expression (2, 3), which yields the result 3.
     1756This requirement is the same as for comma expressions in argument lists.
     1757
     1758Type qualifiers, \ie const and volatile, may modify a tuple type.
     1759The meaning is the same as for a type qualifier modifying an aggregate type [Int99, x 6.5.2.3(7),x 6.7.3(11)], \ie the qualifier is distributed across all of the types in the tuple, \eg:
     1760\begin{cfa}
     1761const volatile [ int, float, const int ] x;
     1762\end{cfa}
     1763is equivalent to:
     1764\begin{cfa}
     1765[ const volatile int, const volatile float, const volatile int ] x;
     1766\end{cfa}
     1767Declaration qualifiers can only appear at the start of a \CFA tuple declaration4, \eg:
     1768\begin{cfa}
     1769extern [ int, int ] w1;
     1770static [ int, int, int ] w2;
     1771\end{cfa}
     1772\begin{rationale}
     1773Unfortunately, C's syntax for subscripts precluded treating them as tuples.
     1774The C subscript list has the form ©[i][j]...© and not ©[i, j, ...]©.
     1775Therefore, there is no syntactic way for a routine returning multiple values to specify the different subscript values, \eg ©f[g()]© always means a single subscript value because there is only one set of brackets.
     1776Fixing this requires a major change to C because the syntactic form ©M[i, j, k]© already has a particular meaning: ©i, j, k© is a comma expression.
     1777\end{rationale}
     1778
     1779
     1780\subsection{Tuple Coercions}
     1781
     1782There are four coercions that can be performed on tuples and tuple variables: closing, opening, flattening and structuring.
     1783In addition, the coercion of dereferencing can be performed on a tuple variable to yield its value(s), as for other variables.
     1784A \newterm{closing coercion} takes a set of values and converts it into a tuple value, which is a contiguous set of values, as in:
     1785\begin{cfa}
     1786[ int, int, int, int ] w;
     1787w = [ 1, 2, 3, 4 ];
     1788\end{cfa}
     1789First the right-hand tuple is closed into a tuple value and then the tuple value is assigned.
     1790
     1791An \newterm{opening coercion} is the opposite of closing; a tuple value is converted into a tuple of values, as in:
     1792\begin{cfa}
     1793[ a, b, c, d ] = w
     1794\end{cfa}
     1795©w© is implicitly opened to yield a tuple of four values, which are then assigned individually.
     1796
     1797A \newterm{flattening coercion} coerces a nested tuple, \ie a tuple with one or more components, which are themselves tuples, into a flattened tuple, which is a tuple whose components are not tuples, as in:
     1798\begin{cfa}
     1799[ a, b, c, d ] = [ 1, [ 2, 3 ], 4 ];
     1800\end{cfa}
     1801First the right-hand tuple is flattened and then the values are assigned individually.
     1802Flattening is also performed on tuple types.
     1803For example, the type ©[ int, [ int, int ], int ]© can be coerced, using flattening, into the type ©[ int, int, int, int ]©.
     1804
     1805A \newterm{structuring coercion} is the opposite of flattening;
     1806a tuple is structured into a more complex nested tuple.
     1807For example, structuring the tuple ©[ 1, 2, 3, 4 ]© into the tuple ©[ 1, [ 2, 3 ], 4 ]© or the tuple type ©[ int, int, int, int ]© into the tuple type ©[ int, [ int, int ], int ]©.
     1808In the following example, the last assignment illustrates all the tuple coercions:
     1809\begin{cfa}
     1810[ int, int, int, int ] w = [ 1, 2, 3, 4 ];
     1811int x = 5;
     1812[ x, w ] = [ w, x ];            §\C{// all four tuple coercions}§
     1813\end{cfa}
     1814Starting on the right-hand tuple in the last assignment statement, w is opened, producing a tuple of four values;
     1815therefore, the right-hand tuple is now the tuple ©[ [ 1, 2, 3, 4 ], 5 ]©.
     1816This tuple is then flattened, yielding ©[ 1, 2, 3, 4, 5 ]©, which is structured into ©[ 1, [ 2, 3, 4, 5 ] ]© to match the tuple type of the left-hand side.
     1817The tuple ©[ 2, 3, 4, 5 ]© is then closed to create a tuple value.
     1818Finally, ©x© is assigned ©1© and ©w© is assigned the tuple value using multiple assignment (see Section 14).
     1819\begin{rationale}
     1820A possible additional language extension is to use the structuring coercion for tuples to initialize a complex record with a tuple.
     1821\end{rationale}
     1822
     1823
     1824\section{Mass Assignment}
     1825
     1826\CFA permits assignment to several variables at once using mass assignment~\cite{CLU}.
     1827Mass assignment has the following form:
     1828\begin{cfa}
     1829[ §\emph{lvalue}§, ... , §\emph{lvalue}§ ] = §\emph{expr}§;
     1830\end{cfa}
     1831\index{lvalue}
     1832The left-hand side is a tuple of \emph{lvalues}, which is a list of expressions each yielding an address, \ie any data object that can appear on the left-hand side of a conventional assignment statement.
     1833©$\emph{expr}$© is any standard arithmetic expression.
     1834Clearly, the types of the entities being assigned must be type compatible with the value of the expression.
     1835
     1836Mass assignment has parallel semantics, \eg the statement:
     1837\begin{cfa}
     1838[ x, y, z ] = 1.5;
     1839\end{cfa}
     1840is equivalent to:
     1841\begin{cfa}
     1842x = 1.5; y = 1.5; z = 1.5;
     1843\end{cfa}
     1844This semantics is not the same as the following in C:
     1845\begin{cfa}
     1846x = y = z = 1.5;
     1847\end{cfa}
     1848as conversions between intermediate assignments may lose information.
     1849A more complex example is:
     1850\begin{cfa}
     1851[ i, y[i], z ] = a + b;
     1852\end{cfa}
     1853which is equivalent to:
     1854\begin{cfa}
     1855t = a + b;
     1856a1 = &i; a2 = &y[i]; a3 = &z;
     1857*a1 = t; *a2 = t; *a3 = t;
     1858\end{cfa}
     1859The temporary ©t© is necessary to store the value of the expression to eliminate conversion issues.
     1860The temporaries for the addresses are needed so that locations on the left-hand side do not change as the values are assigned.
     1861In this case, ©y[i]© uses the previous value of ©i© and not the new value set at the beginning of the mass assignment.
     1862
     1863
     1864\section{Multiple Assignment}
     1865
     1866\CFA also supports the assignment of several values at once, known as multiple assignment~\cite{CLU,Galletly96}.
     1867Multiple assignment has the following form:
     1868\begin{cfa}
     1869[ §\emph{lvalue}§, ... , §\emph{lvalue}§ ] = [ §\emph{expr}§, ... , §\emph{expr}§ ];
     1870\end{cfa}
     1871\index{lvalue}
     1872The left-hand side is a tuple of \emph{lvalues}, and the right-hand side is a tuple of \emph{expr}s.
     1873Each \emph{expr} appearing on the right-hand side of a multiple assignment statement is assigned to the corresponding \emph{lvalues} on the left-hand side of the statement using parallel semantics for each assignment.
     1874An example of multiple assignment is:
     1875\begin{cfa}
     1876[ x, y, z ] = [ 1, 2, 3 ];
     1877\end{cfa}
     1878Here, the values ©1©, ©2© and ©3© are assigned, respectively, to the variables ©x©, ©y© and ©z©.
     1879 A more complex example is:
     1880\begin{cfa}
     1881[ i, y[ i ], z ] = [ 1, i, a + b ];
     1882\end{cfa}
     1883Here, the values ©1©, ©i© and ©a + b© are assigned to the variables ©i©, ©y[i]© and ©z©, respectively.
     1884 Note, the parallel semantics of
     1885multiple assignment ensures:
     1886\begin{cfa}
     1887[ x, y ] = [ y, x ];
     1888\end{cfa}
     1889correctly interchanges (swaps) the values stored in ©x© and ©y©.
     1890The following cases are errors:
     1891\begin{cfa}
     1892[ a, b, c ] = [ 1, 2, 3, 4 ];
     1893[ a, b, c ] = [ 1, 2 ];
     1894\end{cfa}
     1895because the number of entities in the left-hand tuple is unequal with the right-hand tuple.
     1896
     1897As for all tuple contexts in C, side effects should not be used because C does not define an ordering for the evaluation of the elements of a tuple;
     1898both these examples produce indeterminate results:
     1899\begin{cfa}
     1900f( x++, x++ );                          §\C{// C routine call with side effects in arguments}§
     1901[ v1, v2 ] = [ x++, x++ ];      §\C{// side effects in righthand side of multiple assignment}§
     1902\end{cfa}
     1903
     1904
     1905\section{Cascade Assignment}
     1906
     1907As in C, \CFA mass and multiple assignments can be cascaded, producing cascade assignment.
     1908Cascade assignment has the following form:
     1909\begin{cfa}
     1910§\emph{tuple}§ = §\emph{tuple}§ = ... = §\emph{tuple}§;
     1911\end{cfa}
     1912and it has the same parallel semantics as for mass and multiple assignment.
     1913Some examples of cascade assignment are:
     1914\begin{cfa}
     1915x1 = y1 = x2 = y2 = 0;
     1916[ x1, y1 ] = [ x2, y2 ] = [ x3, y3 ];
     1917[ x1, y1 ] = [ x2, y2 ] = 0;
     1918[ x1, y1 ] = z = 0;
     1919\end{cfa}
     1920As in C, the rightmost assignment is performed first, \ie assignment parses right to left.
     1921
     1922
     1923\section{Field Tuples}
     1924
     1925Tuples may be used to select multiple fields of a record by field name.
     1926Its general form is:
     1927\begin{cfa}
     1928§\emph{expr}§ . [ §\emph{fieldlist}§ ]
     1929§\emph{expr}§ -> [ §\emph{fieldlist}§ ]
     1930\end{cfa}
     1931\emph{expr} is any expression yielding a value of type record, \eg ©struct©, ©union©.
     1932Each element of \emph{ fieldlist} is an element of the record specified by \emph{expr}.
     1933A record-field tuple may be used anywhere a tuple can be used. An example of the use of a record-field tuple is
     1934the following:
     1935\begin{cfa}
     1936struct s {
     1937        int f1, f2;
     1938        char f3;
     1939        double f4;
     1940} v;
     1941v.[ f3, f1, f2 ] = ['x', 11, 17 ];      §\C{// equivalent to v.f3 = 'x', v.f1 = 11, v.f2 = 17}§
     1942f( v.[ f3, f1, f2 ] );                          §\C{// equivalent to f( v.f3, v.f1, v.f2 )}§
     1943\end{cfa}
     1944Note, the fields appearing in a record-field tuple may be specified in any order;
     1945also, it is unnecessary to specify all the fields of a struct in a multiple record-field tuple.
     1946
     1947If a field of a ©struct© is itself another ©struct©, multiple fields of this subrecord can be specified using a nested record-field tuple, as in the following example:
     1948\begin{cfa}
     1949struct inner {
     1950        int f2, f3;
     1951};
     1952struct outer {
     1953        int f1;
     1954        struct inner i;
     1955        double f4;
     1956} o;
     1957
     1958o.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
     1959\end{cfa}
     1960
     1961
     1962\section{Labelled Continue/Break}
    5211963
    5221964While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure.
    5231965Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting.
    524 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline $continue$!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline $break$!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85}.
     1966To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline $continue$!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline $break$!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85,Java}.
    5251967For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement;
    5261968for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement.
    5271969\VRef[Figure]{f:MultiLevelResumeTermination} shows the labelled ©continue© and ©break©, specifying which control structure is the target for exit, and the corresponding C program using only ©goto©.
    5281970The innermost loop has 7 exit points, which cause resumption or termination of one or more of the 7 \Index{nested control-structure}s.
    529 Java supports both labelled ©continue© and ©break© statements.
    5301971
    5311972\begin{figure}
     
    6502091
    6512092
    652 \section{\texorpdfstring{\LstKeywordStyle{switch} Statement}{switch Statement}}
     2093\section{Switch Statement}
    6532094
    6542095C allows a number of questionable forms for the ©switch© statement:
     
    6912132        ®// open input file
    6922133®} else if ( argc == 2 ) {
    693         ®// open input file (duplicate)
     2134        ®// open input file
    6942135
    6952136®} else {
     
    7042145\begin{cfa}
    7052146switch ( i ) {
    706   ®case 1: case 3: case 5:®     // odd values
    707         // odd action
     2147  case 1: case 3: case 5:       // odd values
     2148        // same action
    7082149        break;
    709   ®case 2: case 4: case 6:®     // even values
    710         // even action
     2150  case 2: case 4: case 6:       // even values
     2151        // same action
    7112152        break;
    7122153}
     
    7142155However, this situation is handled in other languages without fall-through by allowing a list of case values.
    7152156While fall-through itself is not a problem, the problem occurs when fall-through is the default, as this semantics is unintuitive to many programmers and is different from virtually all other programming languages with a ©switch© statement.
    716 Hence, default fall-through semantics results in a large number of programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.
     2157Hence, default fall-through semantics results in a large number of programming errors as programmers often forget the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.
    7172158
    7182159\item
     
    7982239and there is only a medium amount of fall-through from one ©case© clause to the next, and most of these result from a list of case values executing common code, rather than a sequence of case actions that compound.
    7992240\end{itemize}
    800 These observations put into perspective the \CFA changes to the ©switch©.
     2241These observations help to put the \CFA changes to the ©switch© into perspective.
    8012242\begin{enumerate}
    8022243\item
     
    8082249still works.
    8092250Nevertheless, reversing the default action would have a non-trivial effect on case actions that compound, such as the above example of processing shell arguments.
    810 Therefore, to preserve backwards compatibility, it is necessary to introduce a new kind of ©switch© statement, called ©choose©, with no implicit fall-through semantics and an explicit fall-through if the last statement of a case-clause ends with the new keyword ©fallthrough©/©fallthru©, \eg:
     2251Therefore, to preserve backwards compatibility, it is necessary to introduce a new kind of ©switch© statement, called ©choose©, with no implicit fall-through semantics and an explicit fall-through if the last statement of a case-clause ends with the new keyword ©fallthrough©/©fallthru©, e.g.:
    8112252\begin{cfa}
    8122253®choose® ( i ) {
     
    8192260  case 7:
    8202261        ...
    821         ®break®                                         §\C{// redundant explicit end of switch}§
     2262        ®break®                                         §\C{// explicit end of switch}§
    8222263  default:
    8232264        j = 3;
     
    8252266\end{cfa}
    8262267Like the ©switch© statement, the ©choose© statement retains the fall-through semantics for a list of ©case© clauses;
    827 An implicit ©break© is applied only at the end of the \emph{statements} following a ©case© clause.
    828 An explicit ©fallthru© is retained because it is a C-idiom most C programmers expect, and its absence might discourage programmers from using the ©choose© statement.
     2268the implicit ©break© is applied only at the end of the \emph{statements} following a ©case© clause.
     2269The explicit ©fallthru© is retained because it is a C-idiom most C programmers expect, and its absence might discourage programmers from using the ©choose© statement.
    8292270As well, allowing an explicit ©break© from the ©choose© is a carry over from the ©switch© statement, and expected by C programmers.
    8302271\item
     
    8552296
    8562297
    857 \section{\texorpdfstring{\LstKeywordStyle{case} Clause}{case Clause}}
     2298\section{Case Clause}
    8582299
    8592300C restricts the ©case© clause of a ©switch© statement to a single value.
     
    9312372
    9322373
    933 \section{\texorpdfstring{\LstKeywordStyle{with} Clause / Statement}{with Clause / Statement}}
    934 \label{s:WithClauseStatement}
    935 
    936 In \Index{object-oriented} programming, there is an implicit first parameter, often names \textbf{©self©} or \textbf{©this©}, which is elided.
    937 \begin{C++}
    938 class C {
    939         int i, j;
    940         int mem() {              ®// implicit "this" parameter
    941 ®               i = 1;          ®// this->i
    942 ®               j = 3;          ®// this->j
    943 ®       }
    944 }
    945 \end{C++}
    946 Since CFA is non-object-oriented, the equivalent object-oriented program looks like:
    947 \begin{cfa}
    948 struct S { int i, j; };
    949 int mem( S &this ) {    // explicit "this" parameter
    950         ®this.®i = 1;                     // "this" is not elided
    951         ®this.®j = 2;
    952 }
    953 \end{cfa}
    954 but it is cumbersome having to write "©this.©" many times in a member.
    955 
    956 \CFA provides a ©with© clause/statement to elided the "©this.©" by opening a scope containing field identifiers and changing the qualified fields into variables, giving an opportunity for optimizing qualified references.\footnote{
    957 The ©with© statement comes from Pascal~\cite[\S~4.F]{Pascal}.}
    958 \begin{cfa}
    959 int mem( S &this ) ®with this® {
    960         i = 1;                  ®// this.i
    961 ®       j = 2;                  ®// this.j
    962 ®}
    963 \end{cfa}
    964 which extends to multiple routine parameters:
    965 \begin{cfa}
    966 struct T { double m, n; };
    967 int mem2( S &this1, T &this2 ) ®with this1, this2® {
    968         i = 1; j = 2;
    969         m = 1.0; n = 2.0;
    970 }
    971 \end{cfa}
    972 
    973 The statement form is used within a block:
    974 \begin{cfa}
    975 int foo() {
    976         struct S1 { ... } s1;
    977         struct S2 { ... } s2;
    978         ®with s1® {
    979                 // access fields of s1 without qualification
    980                 ®with s2® {  // nesting
    981                         // access fields of s1 and s2 without qualification
    982                 }
    983         }
    984         ®with s1, s2® {
    985                 // access unambiguous fields of s1 and s2 without qualification
    986         }
    987 }
    988 \end{cfa}
    989 
    990 When opening multiple structures, fields with the same name and type are ambiguous and must be fully qualified.
    991 For fields with the same name but different type, context/cast can be used to disambiguate.
    992 \begin{cfa}
    993 struct S { int i; int j; double m; } a, c;
    994 struct T { int i; int k; int m } b, c;
    995 ®with a, b® {
    996         j + k;                                          §\C{// unambiguous, unique names define unique type}§
    997         i;                                                      §\C{// ambiguous, same name and type}§
    998         a.i + b.i;                                      §\C{// unambiguous, qualification defines unique type}§
    999         m;                                                      §\C{// ambiguous, no context to define unique type}§
    1000         m = 5.0;                                        §\C{// unambiguous, context defines unique type}§
    1001         m = 1;                                          §\C{// unambiguous, context defines unique type}§
    1002 }
    1003 ®with c® { ... }                                §\C{// ambiguous, no context}§
    1004 ®with (S)c® { ... }                             §\C{// unambiguous, cast defines unique type}§
    1005 \end{cfa}
    1006 
    1007 
    10082374\section{Exception Handling}
    1009 \label{s:ExceptionHandling}
    10102375
    10112376Exception handling provides two mechanism: change of control flow from a raise to a handler, and communication from the raise to the handler.
    1012 Transfer of control can be local, within a routine, or non-local, among routines.
    1013 Non-local transfer can cause stack unwinding, i.e., non-local routine termination, depending on the kind of raise.
    1014 \begin{cfa}
    1015 exception_t E {};                               §\C{// exception type}§
     2377\begin{cfa}
     2378exception void h( int i );
     2379exception int h( int i, double d );
     2380
    10162381void f(...) {
    1017         ... throw E{}; ...                      §\C{// termination}§
    1018         ... throwResume E{}; ...        §\C{// resumption}§
    1019 }
     2382        ... throw h( 3 );
     2383        ... i = resume h( 3, 5.1 );
     2384}
     2385
    10202386try {
    10212387        f(...);
    1022 } catch( E e : §boolean-predicate§ ) {                  §\C{// termination handler}§
    1023         // recover and continue
    1024 } catchResume( E e : §boolean-predicate§ ) {    §\C{// resumption handler}§
    1025         // repair and return
     2388} catch h( int w ) {
     2389        // reset
     2390} resume h( int p, double x ) {
     2391        return 17;  // recover
    10262392} finally {
    1027         // always executed
    1028 }
    1029 \end{cfa}
    1030 The kind of raise and handler match: ©throw© with ©catch© and @throwResume@ with @catchResume@.
    1031 Then the exception type must match along with any additonal predicate must be true.
    1032 The ©catch© and ©catchResume© handlers may appear in any oder.
    1033 However, the ©finally© clause must
    1034 
    1035 
    1036 \subsection{Exception Hierarchy}
    1037 
    1038 An exception type can be derived from another exception type, just like deriving a subclass from a class, providing a kind of polymorphism among exception types.
    1039 The exception-type hierarchy that is created is used to organize exception types, similar to a class hierarchy in object-oriented languages, \eg:
    1040 \begin{center}
    1041 \input{EHMHierarchy}
    1042 \end{center}
    1043 A programmer can then choose to handle an exception at different degrees of specificity along the hierarchy;
    1044 derived exception-types support a more flexible programming style.
    1045 For example, higher-level code should catch general exceptions to reduce coupling to the specific implementation at the lower levels;
    1046 unnecessary coupling may force changes in higher-level code when low-level code changes.
    1047 A consequence of derived exception-types is that multiple exceptions may match, \eg:
    1048 \begin{cfa}
    1049 catch( Arithmetic )
    1050 \end{cfa}
    1051 matches all three derived exception-types: ©DivideByZero©, ©Overflow©, and ©Underflow©.
    1052 Because the propagation mechanisms perform a simple linear search of the handler clause for a guarded block, and selects the first matching handler, the order of catch clauses in the handler clause becomes important, \eg:
    1053 \begin{cfa}
    1054 try {
    1055         ...
    1056 } catch( Overflow ) {   // must appear first
    1057         // handle overflow
    1058 } catch( Arithmetic )
    1059         // handle other arithmetic issues
    1060 }
    1061 \end{cfa}
    1062 \newterm{Multiple derivation} among exception is not supported.
    1063 
    1064 
    1065 \section{Declarations}
    1066 \label{s:Declarations}
    1067 
    1068 C declaration syntax is notoriously confusing and error prone.
    1069 For example, many C programmers are confused by a declaration as simple as:
    1070 \begin{quote2}
    1071 \begin{tabular}{@{}ll@{}}
    1072 \begin{cfa}
    1073 int * x[5]
    1074 \end{cfa}
    1075 &
    1076 \raisebox{-0.75\totalheight}{\input{Cdecl}}
    1077 \end{tabular}
    1078 \end{quote2}
    1079 Is this an array of 5 pointers to integers or a \Index{pointer} to an array of 5 integers?
    1080 The fact this declaration is unclear to many C programmers means there are \Index{productivity} and \Index{safety} issues even for basic programs.
    1081 Another example of confusion results from the fact that a routine name and its parameters are embedded within the return type, mimicking the way the return value is used at the routine's call site.
    1082 For example, a routine returning a \Index{pointer} to an array of integers is defined and used in the following way:
    1083 \begin{cfa}
    1084 int ®(*®f®())[®5®]® {...};                              §\C{definition}§
    1085  ... ®(*®f®())[®3®]® += 1;                              §\C{usage}§
    1086 \end{cfa}
    1087 Essentially, the return type is wrapped around the routine name in successive layers (like an \Index{onion}).
    1088 While attempting to make the two contexts consistent is a laudable goal, it has not worked out in practice.
    1089 
    1090 \CFA provides its own type, variable and routine declarations, using a different syntax.
    1091 The new declarations place qualifiers to the left of the base type, while C declarations place qualifiers to the right of the base type.
    1092 In the following example, \R{red} is the base type and \B{blue} is qualifiers.
    1093 The \CFA declarations move the qualifiers to the left of the base type, \ie move the blue to the left of the red, while the qualifiers have the same meaning but are ordered left to right to specify a variable's type.
    1094 \begin{quote2}
    1095 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1096 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1097 \begin{cfa}
    1098 ß[5] *ß ®int® x1;
    1099 ß* [5]ß ®int® x2;
    1100 ß[* [5] int]ß f®( int p )®;
    1101 \end{cfa}
    1102 &
    1103 \begin{cfa}
    1104 ®int® ß*ß x1 ß[5]ß;
    1105 ®int® ß(*ßx2ß)[5]ß;
    1106 ßint (*ßf®( int p )®ß)[5]ß;
    1107 \end{cfa}
    1108 \end{tabular}
    1109 \end{quote2}
    1110 The only exception is \Index{bit field} specification, which always appear to the right of the base type.
    1111 % Specifically, the character ©*© is used to indicate a pointer, square brackets ©[©\,©]© are used to represent an array or function return value, and parentheses ©()© are used to indicate a routine parameter.
    1112 However, unlike C, \CFA type declaration tokens are distributed across all variables in the declaration list.
    1113 For instance, variables ©x© and ©y© of type \Index{pointer} to integer are defined in \CFA as follows:
    1114 \begin{quote2}
    1115 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1116 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1117 \begin{cfa}
    1118 ®*® int x, y;
    1119 \end{cfa}
    1120 &
    1121 \begin{cfa}
    1122 int ®*®x, ®*®y;
    1123 \end{cfa}
    1124 \end{tabular}
    1125 \end{quote2}
    1126 The downside of this semantics is the need to separate regular and \Index{pointer} declarations:
    1127 \begin{quote2}
    1128 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1129 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1130 \begin{cfa}
    1131 ®*® int x;
    1132 int y;
    1133 \end{cfa}
    1134 &
    1135 \begin{cfa}
    1136 int ®*®x, y;
    1137 
    1138 \end{cfa}
    1139 \end{tabular}
    1140 \end{quote2}
    1141 which is \Index{prescribing} a safety benefit.
    1142 Other examples are:
    1143 \begin{quote2}
    1144 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    1145 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
    1146 \begin{cfa}
    1147 [ 5 ] int z;
    1148 [ 5 ] * char w;
    1149 * [ 5 ] double v;
    1150 struct s {
    1151         int f0:3;
    1152         * int f1;
    1153         [ 5 ] * int f2;
    1154 };
    1155 \end{cfa}
    1156 &
    1157 \begin{cfa}
    1158 int z[ 5 ];
    1159 char * w[ 5 ];
    1160 double (* v)[ 5 ];
    1161 struct s {
    1162         int f0:3;
    1163         int * f1;
    1164         int * f2[ 5 ]
    1165 };
    1166 \end{cfa}
    1167 &
    1168 \begin{cfa}
    1169 // array of 5 integers
    1170 // array of 5 pointers to char
    1171 // pointer to array of 5 doubles
    1172 
    1173 // common bit field syntax
    1174 
    1175 
    1176 
    1177 \end{cfa}
    1178 \end{tabular}
    1179 \end{quote2}
    1180 
    1181 All type qualifiers, \eg ©const©, ©volatile©, etc., are used in the normal way with the new declarations and also appear left to right, \eg:
    1182 \begin{quote2}
    1183 \begin{tabular}{@{}l@{\hspace{1em}}l@{\hspace{1em}}l@{}}
    1184 \multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} \\
    1185 \begin{cfa}
    1186 const * const int x;
    1187 const * [ 5 ] const int y;
    1188 \end{cfa}
    1189 &
    1190 \begin{cfa}
    1191 int const * const x;
    1192 const int (* const y)[ 5 ]
    1193 \end{cfa}
    1194 &
    1195 \begin{cfa}
    1196 // const pointer to const integer
    1197 // const pointer to array of 5 const integers
    1198 \end{cfa}
    1199 \end{tabular}
    1200 \end{quote2}
    1201 All declaration qualifiers, \eg ©extern©, ©static©, etc., are used in the normal way with the new declarations but can only appear at the start of a \CFA routine declaration,\footnote{\label{StorageClassSpecifier}
    1202 The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature.~\cite[\S~6.11.5(1)]{C11}} \eg:
    1203 \begin{quote2}
    1204 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    1205 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
    1206 \begin{cfa}
    1207 extern [ 5 ] int x;
    1208 static * const int y;
    1209 \end{cfa}
    1210 &
    1211 \begin{cfa}
    1212 int extern x[ 5 ];
    1213 const int static * y;
    1214 \end{cfa}
    1215 &
    1216 \begin{cfa}
    1217 // externally visible array of 5 integers
    1218 // internally visible pointer to constant int
    1219 \end{cfa}
    1220 \end{tabular}
    1221 \end{quote2}
    1222 
    1223 The new declaration syntax can be used in other contexts where types are required, \eg casts and the pseudo-routine ©sizeof©:
    1224 \begin{quote2}
    1225 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1226 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1227 \begin{cfa}
    1228 y = (®* int®)x;
    1229 i = sizeof(®[ 5 ] * int®);
    1230 \end{cfa}
    1231 &
    1232 \begin{cfa}
    1233 y = (®int *®)x;
    1234 i = sizeof(®int * [ 5 ]®);
    1235 \end{cfa}
    1236 \end{tabular}
    1237 \end{quote2}
    1238 
    1239 Finally, new \CFA declarations may appear together with C declarations in the same program block, but cannot be mixed within a specific declaration.
    1240 Therefore, a programmer has the option of either continuing to use traditional C declarations or take advantage of the new style.
    1241 Clearly, both styles need to be supported for some time due to existing C-style header-files, particularly for UNIX systems.
    1242 
    1243 
    1244 \section{Pointer / Reference}
    1245 
    1246 C provides a \newterm{pointer type};
    1247 \CFA adds a \newterm{reference type}.
    1248 These types may be derived from an object or routine type, called the \newterm{referenced type}.
    1249 Objects of these types contain an \newterm{address}, which is normally a location in memory, but may also address memory-mapped registers in hardware devices.
    1250 An integer constant expression with the value 0, or such an expression cast to type ©void *©, is called a \newterm{null-pointer constant}.\footnote{
    1251 One way to conceptualize the null pointer is that no variable is placed at this address, so the null-pointer address can be used to denote an uninitialized pointer/reference object;
    1252 \ie the null pointer is guaranteed to compare unequal to a pointer to any object or routine.}
    1253 An address is \newterm{sound}, if it points to a valid memory location in scope, \ie within the program's execution-environment and has not been freed.
    1254 Dereferencing an \newterm{unsound} address, including the null pointer, is \Index{undefined}, often resulting in a \Index{memory fault}.
    1255 
    1256 A program \newterm{object} is a region of data storage in the execution environment, the contents of which can represent values.
    1257 In most cases, objects are located in memory at an address, and the variable name for an object is an implicit address to the object generated by the compiler and automatically dereferenced, as in:
    1258 \begin{quote2}
    1259 \begin{tabular}{@{}ll@{\hspace{2em}}l@{}}
    1260 \begin{cfa}
    1261 int x;
    1262 x = 3;
    1263 int y;
    1264 y = x;
    1265 \end{cfa}
    1266 &
    1267 \raisebox{-0.45\totalheight}{\input{pointer1}}
    1268 &
    1269 \begin{cfa}
    1270 int * ®const® x = (int *)100
    1271 *x = 3;                 // implicit dereference
    1272 int * ®const® y = (int *)104;
    1273 *y = *x;                // implicit dereference
    1274 \end{cfa}
    1275 \end{tabular}
    1276 \end{quote2}
    1277 where the right example is how the compiler logically interprets the variables in the left example.
    1278 Since a variable name only points to one address during its lifetime, it is an \Index{immutable} \Index{pointer};
    1279 hence, the implicit type of pointer variables ©x© and ©y© are constant pointers in the compiler interpretation.
    1280 In general, variable addresses are stored in instructions instead of loaded from memory, and hence may not occupy storage.
    1281 These approaches are contrasted in the following:
    1282 \begin{quote2}
    1283 \begin{tabular}{@{}l|l@{}}
    1284 \multicolumn{1}{c|}{explicit variable address} & \multicolumn{1}{c}{implicit variable address} \\
    1285 \hline
    1286 \begin{cfa}
    1287 lda             r1,100                  // load address of x
    1288 ld               r2,(r1)                  // load value of x
    1289 lda             r3,104                  // load address of y
    1290 st               r2,(r3)                  // store x into y
    1291 \end{cfa}
    1292 &
    1293 \begin{cfa}
    1294 
    1295 ld              r2,(100)                // load value of x
    1296 
    1297 st              r2,(104)                // store x into y
    1298 \end{cfa}
    1299 \end{tabular}
    1300 \end{quote2}
    1301 Finally, the immutable nature of a variable's address and the fact that there is no storage for the variable pointer means pointer assignment\index{pointer!assignment}\index{assignment!pointer} is impossible.
    1302 Therefore, the expression ©x = y© has only one meaning, ©*x = *y©, \ie manipulate values, which is why explicitly writing the dereferences is unnecessary even though it occurs implicitly as part of \Index{instruction decoding}.
    1303 
    1304 A \Index{pointer}/\Index{reference} object is a generalization of an object variable-name, \ie a mutable address that can point to more than one memory location during its lifetime.
    1305 (Similarly, an integer variable can contain multiple integer literals during its lifetime versus an integer constant representing a single literal during its lifetime, and like a variable name, may not occupy storage if the literal is embedded directly into instructions.)
    1306 Hence, a pointer occupies memory to store its current address, and the pointer's value is loaded by dereferencing, \eg:
    1307 \begin{quote2}
    1308 \begin{tabular}{@{}l@{\hspace{2em}}l@{}}
    1309 \begin{cfa}
    1310 int x, y, ®*® p1, ®*® p2, ®**® p3;
    1311 p1 = ®&®x;               // p1 points to x
    1312 p2 = p1;                 // p2 points to x
    1313 p1 = ®&®y;               // p1 points to y
    1314 p3 = &p2;               // p3 points to p2
    1315 \end{cfa}
    1316 &
    1317 \raisebox{-0.5\totalheight}{\input{pointer2.pstex_t}}
    1318 \end{tabular}
    1319 \end{quote2}
    1320 
    1321 Notice, an address has a \Index{duality}\index{address!duality}: a location in memory or the value at that location.
    1322 In many cases, a compiler might be able to infer the best meaning for these two cases.
    1323 For example, \Index*{Algol68}~\cite{Algol68} infers pointer dereferencing to select the best meaning for each pointer usage
    1324 \begin{cfa}
    1325 p2 = p1 + x;                                    §\C{// compiler infers *p2 = *p1 + x;}§
    1326 \end{cfa}
    1327 Algol68 infers the following dereferencing ©*p2 = *p1 + x©, because adding the arbitrary integer value in ©x© to the address of ©p1© and storing the resulting address into ©p2© is an unlikely operation.
    1328 Unfortunately, automatic dereferencing does not work in all cases, and so some mechanism is necessary to fix incorrect choices.
    1329 
    1330 Rather than inferring dereference, most programming languages pick one implicit dereferencing semantics, and the programmer explicitly indicates the other to resolve address-duality.
    1331 In C, objects of pointer type always manipulate the pointer object's address:
    1332 \begin{cfa}
    1333 p1 = p2;                                                §\C{// p1 = p2\ \ rather than\ \ *p1 = *p2}§
    1334 p2 = p1 + x;                                    §\C{// p2 = p1 + x\ \ rather than\ \ *p2 = *p1 + x}§
    1335 \end{cfa}
    1336 even though the assignment to ©p2© is likely incorrect, and the programmer probably meant:
    1337 \begin{cfa}
    1338 p1 = p2;                                                §\C{// pointer address assignment}§
    1339 ®*®p2 = ®*®p1 + x;                              §\C{// pointed-to value assignment / operation}§
    1340 \end{cfa}
    1341 The C semantics work well for situations where manipulation of addresses is the primary meaning and data is rarely accessed, such as storage management (©malloc©/©free©).
    1342 
    1343 However, in most other situations, the pointed-to value is requested more often than the pointer address.
    1344 \begin{cfa}
    1345 *p2 = ((*p1 + *p2) * (**p3 - *p1)) / (**p3 - 15);
    1346 \end{cfa}
    1347 In this case, it is tedious to explicitly write the dereferencing, and error prone when pointer arithmetic is allowed.
    1348 It is better to have the compiler generate the dereferencing and have no implicit pointer arithmetic:
    1349 \begin{cfa}
    1350 p2 = ((p1 + p2) * (p3 - p1)) / (p3 - 15);
    1351 \end{cfa}
    1352 
    1353 To support this common case, a reference type is introduced in \CFA, denoted by ©&©, which is the opposite dereference semantics to a pointer type, making the value at the pointed-to location the implicit semantics for dereferencing (similar but not the same as \CC \Index{reference type}s).
    1354 \begin{cfa}
    1355 int x, y, ®&® r1, ®&® r2, ®&&® r3;
    1356 ®&®r1 = &x;                                             §\C{// r1 points to x}§
    1357 ®&®r2 = &r1;                                    §\C{// r2 points to x}§
    1358 ®&®r1 = &y;                                             §\C{// r1 points to y}§
    1359 ®&&®r3 = ®&®&r2;                                §\C{// r3 points to r2}§
    1360 r2 = ((r1 + r2) * (r3 - r1)) / (r3 - 15); §\C{// implicit dereferencing}§
    1361 \end{cfa}
    1362 Except for auto-dereferencing by the compiler, this reference example is the same as the previous pointer example.
    1363 Hence, a reference behaves like the variable name for the current variable it is pointing-to.
    1364 One way to conceptualize a reference is via a rewrite rule, where the compiler inserts a dereference operator before the reference variable for each reference qualifier in a declaration, so the previous example becomes:
    1365 \begin{cfa}
    1366 ®*®r2 = ((®*®r1 + ®*®r2) ®*® (®**®r3 - ®*®r1)) / (®**®r3 - 15);
    1367 \end{cfa}
    1368 When a reference operation appears beside a dereference operation, \eg ©&*©, they cancel out.
    1369 However, in C, the cancellation always yields a value (\Index{rvalue}).\footnote{
    1370 The unary ©&© operator yields the address of its operand.
    1371 If the operand has type ``type'', the result has type ``pointer to type''.
    1372 If the operand is the result of a unary ©*© operator, neither that operator nor the ©&© operator is evaluated and the result is as if both were omitted, except that the constraints on the operators still apply and the result is not an lvalue.~\cite[\S~6.5.3.2--3]{C11}}
    1373 For a \CFA reference type, the cancellation on the left-hand side of assignment leaves the reference as an address (\Index{lvalue}):
    1374 \begin{cfa}
    1375 (&®*®)r1 = &x;                                  §\C{// (\&*) cancel giving address in r1 not variable pointed-to by r1}§
    1376 \end{cfa}
    1377 Similarly, the address of a reference can be obtained for assignment or computation (\Index{rvalue}):
    1378 \begin{cfa}
    1379 (&(&®*®)®*®)r3 = &(&®*®)r2;             §\C{// (\&*) cancel giving address in r2, (\&(\&*)*) cancel giving address in r3}§
    1380 \end{cfa}
    1381 Cancellation\index{cancellation!pointer/reference}\index{pointer!cancellation} works to arbitrary depth.
    1382 
    1383 Fundamentally, pointer and reference objects are functionally interchangeable because both contain addresses.
    1384 \begin{cfa}
    1385 int x, *p1 = &x, **p2 = &p1, ***p3 = &p2,
    1386                  &r1 = x,    &&r2 = r1,   &&&r3 = r2;
    1387 ***p3 = 3;                                              §\C{// change x}§
    1388 r3 = 3;                                                 §\C{// change x, ***r3}§
    1389 **p3 = ...;                                             §\C{// change p1}§
    1390 &r3 = ...;                                              §\C{// change r1, (\&*)**r3, 1 cancellation}§
    1391 *p3 = ...;                                              §\C{// change p2}§
    1392 &&r3 = ...;                                             §\C{// change r2, (\&(\&*)*)*r3, 2 cancellations}§
    1393 &&&r3 = p3;                                             §\C{// change r3 to p3, (\&(\&(\&*)*)*)r3, 3 cancellations}§
    1394 \end{cfa}
    1395 Furthermore, both types are equally performant, as the same amount of dereferencing occurs for both types.
    1396 Therefore, the choice between them is based solely on whether the address is dereferenced frequently or infrequently, which dictates the amount of implicit dereferencing aid from the compiler.
    1397 
    1398 As for a pointer type, a reference type may have qualifiers:
    1399 \begin{cfa}
    1400 const int cx = 5;                                       §\C{// cannot change cx;}§
    1401 const int & cr = cx;                            §\C{// cannot change what cr points to}§
    1402 ®&®cr = &cx;                                            §\C{// can change cr}§
    1403 cr = 7;                                                         §\C{// error, cannot change cx}§
    1404 int & const rc = x;                                     §\C{// must be initialized}§
    1405 ®&®rc = &x;                                                     §\C{// error, cannot change rc}§
    1406 const int & const crc = cx;                     §\C{// must be initialized}§
    1407 crc = 7;                                                        §\C{// error, cannot change cx}§
    1408 ®&®crc = &cx;                                           §\C{// error, cannot change crc}§
    1409 \end{cfa}
    1410 Hence, for type ©& const©, there is no pointer assignment, so ©&rc = &x© is disallowed, and \emph{the address value cannot be the null pointer unless an arbitrary pointer is coerced\index{coercion} into the reference}:
    1411 \begin{cfa}
    1412 int & const cr = *0;                            §\C{// where 0 is the int * zero}§
    1413 \end{cfa}
    1414 Note, constant reference-types do not prevent \Index{addressing errors} because of explicit storage-management:
    1415 \begin{cfa}
    1416 int & const cr = *malloc();
    1417 cr = 5;
    1418 free( &cr );
    1419 cr = 7;                                                         §\C{// unsound pointer dereference}§
    1420 \end{cfa}
    1421 
    1422 The position of the ©const© qualifier \emph{after} the pointer/reference qualifier causes confuse for C programmers.
    1423 The ©const© qualifier cannot be moved before the pointer/reference qualifier for C style-declarations;
    1424 \CFA-style declarations (see \VRef{s:Declarations}) attempt to address this issue:
    1425 \begin{quote2}
    1426 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1427 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1428 \begin{cfa}
    1429 ®const® * ®const® * const int ccp;
    1430 ®const® & ®const® & const int ccr;
    1431 \end{cfa}
    1432 &
    1433 \begin{cfa}
    1434 const int * ®const® * ®const® ccp;
    1435 
    1436 \end{cfa}
    1437 \end{tabular}
    1438 \end{quote2}
    1439 where the \CFA declaration is read left-to-right.
    1440 
    1441 Finally, like pointers, references are usable and composable with other type operators and generators.
    1442 \begin{cfa}
    1443 int w, x, y, z, & ar[3] = { x, y, z }; §\C{// initialize array of references}§
    1444 &ar[1] = &w;                                            §\C{// change reference array element}§
    1445 typeof( ar[1] ) p;                                      §\C{// (gcc) is int, i.e., the type of referenced object}§
    1446 typeof( &ar[1] ) q;                                     §\C{// (gcc) is int \&, i.e., the type of reference}§
    1447 sizeof( ar[1] ) == sizeof( int );       §\C{// is true, i.e., the size of referenced object}§
    1448 sizeof( &ar[1] ) == sizeof( int *)      §\C{// is true, i.e., the size of a reference}§
    1449 \end{cfa}
    1450 
    1451 In contrast to \CFA reference types, \Index*[C++]{\CC{}}'s reference types are all ©const© references, preventing changes to the reference address, so only value assignment is possible, which eliminates half of the \Index{address duality}.
    1452 Also, \CC does not allow \Index{array}s\index{array!reference} of reference\footnote{
    1453 The reason for disallowing arrays of reference is unknown, but possibly comes from references being ethereal (like a textual macro), and hence, replaceable by the referant object.}
    1454 \Index*{Java}'s reference types to objects (all Java objects are on the heap) are like C pointers, which always manipulate the address, and there is no (bit-wise) object assignment, so objects are explicitly cloned by shallow or deep copying, which eliminates half of the address duality.
    1455 
    1456 
    1457 \subsection{Initialization}
    1458 
    1459 \Index{Initialization} is different than \Index{assignment} because initialization occurs on the empty (uninitialized) storage on an object, while assignment occurs on possibly initialized storage of an object.
    1460 There are three initialization contexts in \CFA: declaration initialization, argument/parameter binding, return/temporary binding.
    1461 Because the object being initialized has no value, there is only one meaningful semantics with respect to address duality: it must mean address as there is no pointed-to value.
    1462 In contrast, the left-hand side of assignment has an address that has a duality.
    1463 Therefore, for pointer/reference initialization, the initializing value must be an address not a value.
    1464 \begin{cfa}
    1465 int * p = &x;                                           §\C{// assign address of x}§
    1466 ®int * p = x;®                                          §\C{// assign value of x}§
    1467 int & r = x;                                            §\C{// must have address of x}§
    1468 \end{cfa}
    1469 Like the previous example with C pointer-arithmetic, it is unlikely assigning the value of ©x© into a pointer is meaningful (again, a warning is usually given).
    1470 Therefore, for safety, this context requires an address, so it is superfluous to require explicitly taking the address of the initialization object, even though the type is incorrect.
    1471 Note, this is strictly a convenience and safety feature for a programmer.
    1472 Hence, \CFA allows ©r© to be assigned ©x© because it infers a reference for ©x©, by implicitly inserting a address-of operator, ©&©, and it is an error to put an ©&© because the types no longer match due to the implicit dereference.
    1473 Unfortunately, C allows ©p© to be assigned with ©&x© (address) or ©x© (value), but most compilers warn about the latter assignment as being potentially incorrect.
    1474 Similarly, when a reference type is used for a parameter/return type, the call-site argument does not require a reference operator for the same reason.
    1475 \begin{cfa}
    1476 int & f( int & r );                                     §\C{// reference parameter and return}§
    1477 z = f( x ) + f( y );                            §\C{// reference operator added, temporaries needed for call results}§
    1478 \end{cfa}
    1479 Within routine ©f©, it is possible to change the argument by changing the corresponding parameter, and parameter ©r© can be locally reassigned within ©f©.
    1480 Since operator routine ©?+?© takes its arguments by value, the references returned from ©f© are used to initialize compiler generated temporaries with value semantics that copy from the references.
    1481 \begin{cfa}
    1482 int temp1 = f( x ), temp2 = f( y );
    1483 z = temp1 + temp2;
    1484 \end{cfa}
    1485 This \Index{implicit referencing} is crucial for reducing the syntactic burden for programmers when using references;
    1486 otherwise references have the same syntactic  burden as pointers in these contexts.
    1487 
    1488 When a pointer/reference parameter has a ©const© value (immutable), it is possible to pass literals and expressions.
    1489 \begin{cfa}
    1490 void f( ®const® int & cr );
    1491 void g( ®const® int * cp );
    1492 f( 3 );                   g( ®&®3 );
    1493 f( x + y );             g( ®&®(x + y) );
    1494 \end{cfa}
    1495 Here, the compiler passes the address to the literal 3 or the temporary for the expression ©x + y©, knowing the argument cannot be changed through the parameter.
    1496 The ©&© before the constant/expression for the pointer-type parameter (©g©) is a \CFA extension necessary to type match and is a common requirement before a variable in C (\eg ©scanf©).
    1497 Importantly, ©&3© may not be equal to ©&3©, where the references occur across calls because the temporaries maybe different on each call.
    1498 
    1499 \CFA \emph{extends} this semantics to a mutable pointer/reference parameter, and the compiler implicitly creates the necessary temporary (copying the argument), which is subsequently pointed-to by the reference parameter and can be changed.\footnote{
    1500 If whole program analysis is possible, and shows the parameter is not assigned, \ie it is ©const©, the temporary is unnecessary.}
    1501 \begin{cfa}
    1502 void f( int & r );
    1503 void g( int * p );
    1504 f( 3 );                   g( ®&®3 );            §\C{// compiler implicit generates temporaries}§
    1505 f( x + y );             g( ®&®(x + y) );        §\C{// compiler implicit generates temporaries}§
    1506 \end{cfa}
    1507 Essentially, there is an implicit \Index{rvalue} to \Index{lvalue} conversion in this case.\footnote{
    1508 This conversion attempts to address the \newterm{const hell} problem, when the innocent addition of a ©const© qualifier causes a cascade of type failures, requiring an unknown number of additional ©const© qualifiers, until it is discovered a ©const© qualifier cannot be added and all the ©const© qualifiers must be removed.}
    1509 The implicit conversion allows seamless calls to any routine without having to explicitly name/copy the literal/expression to allow the call.
    1510 
    1511 %\CFA attempts to handle pointers and references in a uniform, symmetric manner.
    1512 Finally, C handles \Index{routine object}s in an inconsistent way.
    1513 A routine object is both a pointer and a reference (\Index{particle and wave}).
    1514 \begin{cfa}
    1515 void f( int i );
    1516 void (*fp)( int );                                      §\C{// routine pointer}§
    1517 fp = f;                                                         §\C{// reference initialization}§
    1518 fp = &f;                                                        §\C{// pointer initialization}§
    1519 fp = *f;                                                        §\C{// reference initialization}§
    1520 fp(3);                                                          §\C{// reference invocation}§
    1521 (*fp)(3);                                                       §\C{// pointer invocation}§
    1522 \end{cfa}
    1523 While C's treatment of routine objects has similarity to inferring a reference type in initialization contexts, the examples are assignment not initialization, and all possible forms of assignment are possible (©f©, ©&f©, ©*f©) without regard for type.
    1524 Instead, a routine object should be referenced by a ©const© reference:
    1525 \begin{cfa}
    1526 ®const® void (®&® fr)( int ) = f;       §\C{// routine reference}§
    1527 fr = ...                                                        §\C{// error, cannot change code}§
    1528 &fr = ...;                                                      §\C{// changing routine reference}§
    1529 fr( 3 );                                                        §\C{// reference call to f}§
    1530 (*fr)(3);                                                       §\C{// error, incorrect type}§
    1531 \end{cfa}
    1532 because the value of the routine object is a routine literal, \ie the routine code is normally immutable during execution.\footnote{
    1533 Dynamic code rewriting is possible but only in special circumstances.}
    1534 \CFA allows this additional use of references for routine objects in an attempt to give a more consistent meaning for them.
    1535 
    1536 
    1537 \subsection{Address-of Semantics}
    1538 
    1539 In C, ©&E© is an rvalue for any expression ©E©.
    1540 \CFA extends the ©&© (address-of) operator as follows:
    1541 \begin{itemize}
    1542 \item
    1543 if ©R© is an \Index{rvalue} of type ©T &$_1$...&$_r$© where $r \ge 1$ references (©&© symbols) than ©&R© has type ©T ®*®&$_{\color{red}2}$...&$_{\color{red}r}$©, \ie ©T© pointer with $r-1$ references (©&© symbols).
    1544 
    1545 \item
    1546 if ©L© is an \Index{lvalue} of type ©T &$_1$...&$_l$© where $l \ge 0$ references (©&© symbols) then ©&L© has type ©T ®*®&$_{\color{red}1}$...&$_{\color{red}l}$©, \ie ©T© pointer with $l$ references (©&© symbols).
    1547 \end{itemize}
    1548 The following example shows the first rule applied to different \Index{rvalue} contexts:
    1549 \begin{cfa}
    1550 int x, * px, ** ppx, *** pppx, **** ppppx;
    1551 int & rx = x, && rrx = rx, &&& rrrx = rrx ;
    1552 x = rrrx;               // rrrx is an lvalue with type int &&& (equivalent to x)
    1553 px = &rrrx;             // starting from rrrx, &rrrx is an rvalue with type int *&&& (&x)
    1554 ppx = &&rrrx;   // starting from &rrrx, &&rrrx is an rvalue with type int **&& (&rx)
    1555 pppx = &&&rrrx; // starting from &&rrrx, &&&rrrx is an rvalue with type int ***& (&rrx)
    1556 ppppx = &&&&rrrx; // starting from &&&rrrx, &&&&rrrx is an rvalue with type int **** (&rrrx)
    1557 \end{cfa}
    1558 The following example shows the second rule applied to different \Index{lvalue} contexts:
    1559 \begin{cfa}
    1560 int x, * px, ** ppx, *** pppx;
    1561 int & rx = x, && rrx = rx, &&& rrrx = rrx ;
    1562 rrrx = 2;               // rrrx is an lvalue with type int &&& (equivalent to x)
    1563 &rrrx = px;             // starting from rrrx, &rrrx is an rvalue with type int *&&& (rx)
    1564 &&rrrx = ppx;   // starting from &rrrx, &&rrrx is an rvalue with type int **&& (rrx)
    1565 &&&rrrx = pppx; // starting from &&rrrx, &&&rrrx is an rvalue with type int ***& (rrrx)
    1566 \end{cfa}
    1567 
    1568 
    1569 \subsection{Conversions}
    1570 
    1571 C provides a basic implicit conversion to simplify variable usage:
    1572 \begin{enumerate}
    1573 \setcounter{enumi}{-1}
    1574 \item
    1575 lvalue to rvalue conversion: ©cv T© converts to ©T©, which allows implicit variable dereferencing.
    1576 \begin{cfa}
    1577 int x;
    1578 x + 1;                  // lvalue variable (int) converts to rvalue for expression
    1579 \end{cfa}
    1580 An rvalue has no type qualifiers (©cv©), so the lvalue qualifiers are dropped.
    1581 \end{enumerate}
    1582 \CFA provides three new implicit conversion for reference types to simplify reference usage.
    1583 \begin{enumerate}
    1584 \item
    1585 reference to rvalue conversion: ©cv T &© converts to ©T©, which allows implicit reference dereferencing.
    1586 \begin{cfa}
    1587 int x, &r = x, f( int p );
    1588 x = ®r® + f( ®r® );  // lvalue reference converts to rvalue
    1589 \end{cfa}
    1590 An rvalue has no type qualifiers (©cv©), so the reference qualifiers are dropped.
    1591 
    1592 \item
    1593 lvalue to reference conversion: \lstinline[deletekeywords=lvalue]$lvalue-type cv1 T$ converts to ©cv2 T &©, which allows implicitly converting variables to references.
    1594 \begin{cfa}
    1595 int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &)
    1596 f( ®x® );               // lvalue variable (int) convert to reference (int &)
    1597 \end{cfa}
    1598 Conversion can restrict a type, where ©cv1© $\le$ ©cv2©, \eg passing an ©int© to a ©const volatile int &©, which has low cost.
    1599 Conversion can expand a type, where ©cv1© $>$ ©cv2©, \eg passing a ©const volatile int© to an ©int &©, which has high cost (\Index{warning});
    1600 furthermore, if ©cv1© has ©const© but not ©cv2©, a temporary variable is created to preserve the immutable lvalue.
    1601 
    1602 \item
    1603 rvalue to reference conversion: ©T© converts to ©cv T &©, which allows binding references to temporaries.
    1604 \begin{cfa}
    1605 int x, & f( int & p );
    1606 f( ®x + 3® );   // rvalue parameter (int) implicitly converts to lvalue temporary reference (int &)
    1607 ®&f®(...) = &x; // rvalue result (int &) implicitly converts to lvalue temporary reference (int &)
    1608 \end{cfa}
    1609 In both case, modifications to the temporary are inaccessible (\Index{warning}).
    1610 Conversion expands the temporary-type with ©cv©, which is low cost since the temporary is inaccessible.
    1611 \end{enumerate}
    1612 
    1613 
    1614 \begin{comment}
    1615 From: Richard Bilson <rcbilson@gmail.com>
    1616 Date: Wed, 13 Jul 2016 01:58:58 +0000
    1617 Subject: Re: pointers / references
    1618 To: "Peter A. Buhr" <pabuhr@plg2.cs.uwaterloo.ca>
    1619 
    1620 As a general comment I would say that I found the section confusing, as you move back and forth
    1621 between various real and imagined programming languages. If it were me I would rewrite into two
    1622 subsections, one that specifies precisely the syntax and semantics of reference variables and
    1623 another that provides the rationale.
    1624 
    1625 I don't see any obvious problems with the syntax or semantics so far as I understand them. It's not
    1626 obvious that the description you're giving is complete, but I'm sure you'll find the special cases
    1627 as you do the implementation.
    1628 
    1629 My big gripes are mostly that you're not being as precise as you need to be in your terminology, and
    1630 that you say a few things that aren't actually true even though I generally know what you mean.
    1631 
    1632 20 C provides a pointer type; CFA adds a reference type. Both types contain an address, which is normally a
    1633 21 location in memory.
    1634 
    1635 An address is not a location in memory; an address refers to a location in memory. Furthermore it
    1636 seems weird to me to say that a type "contains" an address; rather, objects of that type do.
    1637 
    1638 21 Special addresses are used to denote certain states or access co-processor memory. By
    1639 22 convention, no variable is placed at address 0, so addresses like 0, 1, 2, 3 are often used to denote no-value
    1640 23 or other special states.
    1641 
    1642 This isn't standard C at all. There has to be one null pointer representation, but it doesn't have
    1643 to be a literal zero representation and there doesn't have to be more than one such representation.
    1644 
    1645 23 Often dereferencing a special state causes a memory fault, so checking is necessary
    1646 24 during execution.
    1647 
    1648 I don't see the connection between the two clauses here. I feel like if a bad pointer will not cause
    1649 a memory fault then I need to do more checking, not less.
    1650 
    1651 24 If the programming language assigns addresses, a program's execution is sound, \ie all
    1652 25 addresses are to valid memory locations.
    1653 
    1654 You haven't said what it means to "assign" an address, but if I use my intuitive understanding of
    1655 the term I don't see how this can be true unless you're assuming automatic storage management.
    1656 
    1657 1 Program variables are implicit pointers to memory locations generated by the compiler and automatically
    1658 2 dereferenced, as in:
    1659 
    1660 There is no reason why a variable needs to have a location in memory, and indeed in a typical
    1661 program many variables will not. In standard terminology an object identifier refers to data in the
    1662 execution environment, but not necessarily in memory.
    1663 
    1664 13 A pointer/reference is a generalization of a variable name, \ie a mutable address that can point to more
    1665 14 than one memory location during its lifetime.
    1666 
    1667 I feel like you're off the reservation here. In my world there are objects of pointer type, which
    1668 seem to be what you're describing here, but also pointer values, which can be stored in an object of
    1669 pointer type but don't necessarily have to be. For example, how would you describe the value denoted
    1670 by "&main" in a C program? I would call it a (function) pointer, but that doesn't satisfy your
    1671 definition.
    1672 
    1673 16 not occupy storage as the literal is embedded directly into instructions.) Hence, a pointer occupies memory
    1674 17 to store its current address, and the pointer's value is loaded by dereferencing, \eg:
    1675 
    1676 As with my general objection regarding your definition of variables, there is no reason why a
    1677 pointer variable (object of pointer type) needs to occupy memory.
    1678 
    1679 21 p2 = p1 + x; // compiler infers *p2 = *p1 + x;
    1680 
    1681 What language are we in now?
    1682 
    1683 24 pointer usage. However, in C, the following cases are ambiguous, especially with pointer arithmetic:
    1684 25 p1 = p2; // p1 = p2 or *p1 = *p2
    1685 
    1686 This isn't ambiguous. it's defined to be the first option.
    1687 
    1688 26 p1 = p1 + 1; // p1 = p1 + 1 or *p1 = *p1 + 1
    1689 
    1690 Again, this statement is not ambiguous.
    1691 
    1692 13 example. Hence, a reference behaves like the variable name for the current variable it is pointing-to. The
    1693 14 simplest way to understand a reference is to imagine the compiler inserting a dereference operator before
    1694 15 the reference variable for each reference qualifier in a declaration, \eg:
    1695 
    1696 It's hard for me to understand who the audience for this part is. I think a practical programmer is
    1697 likely to be satisfied with "a reference behaves like the variable name for the current variable it
    1698 is pointing-to," maybe with some examples. Your "simplest way" doesn't strike me as simpler than
    1699 that. It feels like you're trying to provide a more precise definition for the semantics of
    1700 references, but it isn't actually precise enough to be a formal specification. If you want to
    1701 express the semantics of references using rewrite rules that's a great way to do it, but lay the
    1702 rules out clearly, and when you're showing an example of rewriting keep your
    1703 references/pointers/values separate (right now, you use \eg "r3" to mean a reference, a pointer,
    1704 and a value).
    1705 
    1706 24 Cancellation works to arbitrary depth, and pointer and reference values are interchangeable because both
    1707 25 contain addresses.
    1708 
    1709 Except they're not interchangeable, because they have different and incompatible types.
    1710 
    1711 40 Interestingly, C++ deals with the address duality by making the pointed-to value the default, and prevent-
    1712 41 ing changes to the reference address, which eliminates half of the duality. Java deals with the address duality
    1713 42 by making address assignment the default and requiring field assignment (direct or indirect via methods),
    1714 43 \ie there is no builtin bit-wise or method-wise assignment, which eliminates half of the duality.
    1715 
    1716 I can follow this but I think that's mostly because I already understand what you're trying to
    1717 say. I don't think I've ever heard the term "method-wise assignment" and I don't see you defining
    1718 it. Furthermore Java does have value assignment of basic (non-class) types, so your summary here
    1719 feels incomplete. (If it were me I'd drop this paragraph rather than try to save it.)
    1720 
    1721 11 Hence, for type & const, there is no pointer assignment, so &rc = &x is disallowed, and the address value
    1722 12 cannot be 0 unless an arbitrary pointer is assigned to the reference.
    1723 
    1724 Given the pains you've taken to motivate every little bit of the semantics up until now, this last
    1725 clause ("the address value cannot be 0") comes out of the blue. It seems like you could have
    1726 perfectly reasonable semantics that allowed the initialization of null references.
    1727 
    1728 12 In effect, the compiler is managing the
    1729 13 addresses for type & const not the programmer, and by a programming discipline of only using references
    1730 14 with references, address errors can be prevented.
    1731 
    1732 Again, is this assuming automatic storage management?
    1733 
    1734 18 rary binding. For reference initialization (like pointer), the initializing value must be an address (lvalue) not
    1735 19 a value (rvalue).
    1736 
    1737 This sentence appears to suggest that an address and an lvalue are the same thing.
    1738 
    1739 20 int * p = &x; // both &x and x are possible interpretations
    1740 
    1741 Are you saying that we should be considering "x" as a possible interpretation of the initializer
    1742 "&x"? It seems to me that this expression has only one legitimate interpretation in context.
    1743 
    1744 21 int & r = x; // x unlikely interpretation, because of auto-dereferencing
    1745 
    1746 You mean, we can initialize a reference using an integer value? Surely we would need some sort of
    1747 cast to induce that interpretation, no?
    1748 
    1749 22 Hence, the compiler implicitly inserts a reference operator, &, before the initialization expression.
    1750 
    1751 But then the expression would have pointer type, which wouldn't be compatible with the type of r.
    1752 
    1753 22 Similarly,
    1754 23 when a reference is used for a parameter/return type, the call-site argument does not require a reference
    1755 24 operator.
    1756 
    1757 Furthermore, it would not be correct to use a reference operator.
    1758 
    1759 45 The implicit conversion allows
    1760 1 seamless calls to any routine without having to explicitly name/copy the literal/expression to allow the call.
    1761 2 While C' attempts to handle pointers and references in a uniform, symmetric manner, C handles routine
    1762 3 variables in an inconsistent way: a routine variable is both a pointer and a reference (particle and wave).
    1763 
    1764 After all this talk of how expressions can have both pointer and value interpretations, you're
    1765 disparaging C because it has expressions that have both pointer and value interpretations?
    1766 
    1767 On Sat, Jul 9, 2016 at 4:18 PM Peter A. Buhr <pabuhr@plg.uwaterloo.ca> wrote:
    1768 > Aaron discovered a few places where "&"s are missing and where there are too many "&", which are
    1769 > corrected in the attached updated. None of the text has changed, if you have started reading
    1770 > already.
    1771 \end{comment}
    1772 
    1773 
    1774 \section{Routine Definition}
    1775 
    1776 \CFA also supports a new syntax for routine definition, as well as \Celeven and K\&R routine syntax.
    1777 The point of the new syntax is to allow returning multiple values from a routine~\cite{Galletly96,CLU}, \eg:
    1778 \begin{cfa}
    1779 ®[ int o1, int o2, char o3 ]® f( int i1, char i2, char i3 ) {
    1780         §\emph{routine body}§
    1781 }
    1782 \end{cfa}
    1783 where routine ©f© has three output (return values) and three input parameters.
    1784 Existing C syntax cannot be extended with multiple return types because it is impossible to embed a single routine name within multiple return type specifications.
    1785 
    1786 In detail, the brackets, ©[]©, enclose the result type, where each return value is named and that name is a local variable of the particular return type.\footnote{
    1787 \Index*{Michael Tiemann}, with help from \Index*{Doug Lea}, provided named return values in g++, circa 1989.}
    1788 The value of each local return variable is automatically returned at routine termination.
    1789 Declaration qualifiers can only appear at the start of a routine definition, \eg:
    1790 \begin{cfa}
    1791 ®extern® [ int x ] g( int y ) {§\,§}
    1792 \end{cfa}
    1793 Lastly, if there are no output parameters or input parameters, the brackets and/or parentheses must still be specified;
    1794 in both cases the type is assumed to be void as opposed to old style C defaults of int return type and unknown parameter types, respectively, as in:
    1795 \begin{cfa}
    1796 [§\,§] g();                                                     §\C{// no input or output parameters}§
    1797 [ void ] g( void );                                     §\C{// no input or output parameters}§
    1798 \end{cfa}
    1799 
    1800 Routine f is called as follows:
    1801 \begin{cfa}
    1802 [ i, j, ch ] = f( 3, 'a', ch );
    1803 \end{cfa}
    1804 The list of return values from f and the grouping on the left-hand side of the assignment is called a \newterm{return list} and discussed in Section 12.
    1805 
    1806 \CFA style declarations cannot be used to declare parameters for K\&R style routine definitions because of the following ambiguity:
    1807 \begin{cfa}
    1808 int (*f(x))[ 5 ] int x; {}
    1809 \end{cfa}
    1810 The string ``©int (*f(x))[ 5 ]©'' declares a K\&R style routine of type returning a pointer to an array of 5 integers, while the string ``©[ 5 ] int x©'' declares a \CFA style parameter x of type array of 5 integers.
    1811 Since the strings overlap starting with the open bracket, ©[©, there is an ambiguous interpretation for the string.
    1812 As well, \CFA-style declarations cannot be used to declare parameters for C-style routine-definitions because of the following ambiguity:
    1813 \begin{cfa}
    1814 typedef int foo;
    1815 int f( int (* foo) );                           §\C{// foo is redefined as a parameter name}§
    1816 \end{cfa}
    1817 The string ``©int (* foo)©'' declares a C-style named-parameter of type pointer to an integer (the parenthesis are superfluous), while the same string declares a \CFA style unnamed parameter of type routine returning integer with unnamed parameter of type pointer to foo.
    1818 The redefinition of a type name in a parameter list is the only context in C where the character ©*© can appear to the left of a type name, and \CFA relies on all type qualifier characters appearing to the right of the type name.
    1819 The inability to use \CFA declarations in these two contexts is probably a blessing because it precludes programmers from arbitrarily switching between declarations forms within a declaration contexts.
    1820 
    1821 C-style declarations can be used to declare parameters for \CFA style routine definitions, \eg:
    1822 \begin{cfa}
    1823 [ int ] f( * int, int * );                      §\C{// returns an integer, accepts 2 pointers to integers}§
    1824 [ * int, int * ] f( int );                      §\C{// returns 2 pointers to integers, accepts an integer}§
    1825 \end{cfa}
    1826 The reason for allowing both declaration styles in the new context is for backwards compatibility with existing preprocessor macros that generate C-style declaration-syntax, as in:
    1827 \begin{cfa}
    1828 #define ptoa( n, d ) int (*n)[ d ]
    1829 int f( ptoa( p, 5 ) ) ...                       §\C{// expands to int f( int (*p)[ 5 ] )}§
    1830 [ int ] f( ptoa( p, 5 ) ) ...           §\C{// expands to [ int ] f( int (*p)[ 5 ] )}§
    1831 \end{cfa}
    1832 Again, programmers are highly encouraged to use one declaration form or the other, rather than mixing the forms.
    1833 
    1834 
    1835 \subsection{Named Return Values}
    1836 
    1837 \Index{Named return values} handle the case where it is necessary to define a local variable whose value is then returned in a ©return© statement, as in:
    1838 \begin{cfa}
    1839 int f() {
    1840         int x;
    1841         ... x = 0; ... x = y; ...
    1842         return x;
    1843 }
    1844 \end{cfa}
    1845 Because the value in the return variable is automatically returned when a \CFA routine terminates, the ©return© statement \emph{does not} contain an expression, as in:
    1846 \newline
    1847 \begin{minipage}{\linewidth}
    1848 \begin{cfa}
    1849 ®[ int x, int y ]® f() {
    1850         int z;
    1851         ... x = 0; ... y = z; ...
    1852         ®return;®                                                       §\C{// implicitly return x, y}§
    1853 }
    1854 \end{cfa}
    1855 \end{minipage}
    1856 \newline
    1857 When the return is encountered, the current values of ©x© and ©y© are returned to the calling routine.
    1858 As well, ``falling off the end'' of a routine without a ©return© statement is permitted, as in:
    1859 \begin{cfa}
    1860 [ int x, int y ] f() {
    1861         ...
    1862 }                                                                               §\C{// implicitly return x, y}§
    1863 \end{cfa}
    1864 In this case, the current values of ©x© and ©y© are returned to the calling routine just as if a ©return© had been encountered.
    1865 
    1866 Named return values may be used in conjunction with named parameter values;
    1867 specifically, a return and parameter can have the same name.
    1868 \begin{cfa}
    1869 [ int x, int y ] f( int, x, int y ) {
    1870         ...
    1871 }                                                                               §\C{// implicitly return x, y}§
    1872 \end{cfa}
    1873 This notation allows the compiler to eliminate temporary variables in nested routine calls.
    1874 \begin{cfa}
    1875 [ int x, int y ] f( int, x, int y );    §\C{// prototype declaration}§
    1876 int a, b;
    1877 [a, b] = f( f( f( a, b ) ) );
    1878 \end{cfa}
    1879 While the compiler normally ignores parameters names in prototype declarations, here they are used to eliminate temporary return-values by inferring that the results of each call are the inputs of the next call, and ultimately, the left-hand side of the assignment.
    1880 Hence, even without the body of routine ©f© (separate compilation), it is possible to perform a global optimization across routine calls.
    1881 The compiler warns about naming inconsistencies between routine prototype and definition in this case, and behaviour is \Index{undefined} if the programmer is inconsistent.
    1882 
    1883 
    1884 \subsection{Routine Prototype}
    1885 
    1886 The syntax of the new routine prototype declaration follows directly from the new routine definition syntax;
    1887 as well, parameter names are optional, \eg:
    1888 \begin{cfa}
    1889 [ int x ] f ();                                                 §\C{// returning int with no parameters}§
    1890 [ * int ] g (int y);                                    §\C{// returning pointer to int with int parameter}§
    1891 [ ] h ( int, char );                                    §\C{// returning no result with int and char parameters}§
    1892 [ * int, int ] j ( int );                               §\C{// returning pointer to int and int, with int parameter}§
    1893 \end{cfa}
    1894 This syntax allows a prototype declaration to be created by cutting and pasting source text from the routine definition header (or vice versa).
    1895 It is possible to declare multiple routine-prototypes in a single declaration, but the entire type specification is distributed across \emph{all} routine names in the declaration list (see~\VRef{s:Declarations}), \eg:
    1896 \begin{quote2}
    1897 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1898 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1899 \begin{cfa}
    1900 [ int ] f( int ), g;
    1901 \end{cfa}
    1902 &
    1903 \begin{cfa}
    1904 int f( int ), g( int );
    1905 \end{cfa}
    1906 \end{tabular}
    1907 \end{quote2}
    1908 Declaration qualifiers can only appear at the start of a \CFA routine declaration,\footref{StorageClassSpecifier} \eg:
    1909 \begin{cfa}
    1910 extern [ int ] f ( int );
    1911 static [ int ] g ( int );
    1912 \end{cfa}
    1913 
    1914 
    1915 \section{Routine Pointers}
    1916 
    1917 The syntax for pointers to \CFA routines specifies the pointer name on the right, \eg:
    1918 \begin{cfa}
    1919 * [ int x ] () fp;                                              §\C{// pointer to routine returning int with no parameters}§
    1920 * [ * int ] (int y) gp;                                 §\C{// pointer to routine returning pointer to int with int parameter}§
    1921 * [ ] (int,char) hp;                                    §\C{// pointer to routine returning no result with int and char parameters}§
    1922 * [ * int,int ] ( int ) jp;                             §\C{// pointer to routine returning pointer to int and int, with int parameter}§
    1923 \end{cfa}
    1924 While parameter names are optional, \emph{a routine name cannot be specified};
    1925 for example, the following is incorrect:
    1926 \begin{cfa}
    1927 * [ int x ] f () fp;                                    §\C{// routine name "f" is not allowed}§
    1928 \end{cfa}
    1929 
    1930 
    1931 \section{Named and Default Arguments}
    1932 
    1933 Named\index{named arguments}\index{arguments!named} and default\index{default arguments}\index{arguments!default} arguments~\cite{Hardgrave76}\footnote{
    1934 Francez~\cite{Francez77} proposed a further extension to the named-parameter passing style, which specifies what type of communication (by value, by reference, by name) the argument is passed to the routine.}
    1935 are two mechanisms to simplify routine call.
    1936 Both mechanisms are discussed with respect to \CFA.
    1937 \begin{description}
    1938 \item[Named (or Keyword) Arguments:]
    1939 provide the ability to specify an argument to a routine call using the parameter name rather than the position of the parameter.
    1940 For example, given the routine:
    1941 \begin{cfa}
    1942 void p( int x, int y, int z ) {...}
    1943 \end{cfa}
    1944 a positional call is:
    1945 \begin{cfa}
    1946 p( 4, 7, 3 );
    1947 \end{cfa}
    1948 whereas a named (keyword) call may be:
    1949 \begin{cfa}
    1950 p( z : 3, x : 4, y : 7 );       §\C{// rewrite $\Rightarrow$ p( 4, 7, 3 )}§
    1951 \end{cfa}
    1952 Here the order of the arguments is unimportant, and the names of the parameters are used to associate argument values with the corresponding parameters.
    1953 The compiler rewrites a named call into a positional call.
    1954 The advantages of named parameters are:
    1955 \begin{itemize}
    1956 \item
    1957 Remembering the names of the parameters may be easier than the order in the routine definition.
    1958 \item
    1959 Parameter names provide documentation at the call site (assuming the names are descriptive).
    1960 \item
    1961 Changes can be made to the order or number of parameters without affecting the call (although the call must still be recompiled).
    1962 \end{itemize}
    1963 
    1964 Unfortunately, named arguments do not work in C-style programming-languages because a routine prototype is not required to specify parameter names, nor do the names in the prototype have to match with the actual definition.
    1965 For example, the following routine prototypes and definition are all valid.
    1966 \begin{cfa}
    1967 void p( int, int, int );                        §\C{// equivalent prototypes}§
    1968 void p( int x, int y, int z );
    1969 void p( int y, int x, int z );
    1970 void p( int z, int y, int x );
    1971 void p( int q, int r, int s ) {}        §\C{// match with this definition}§
    1972 \end{cfa}
    1973 Forcing matching parameter names in routine prototypes with corresponding routine definitions is possible, but goes against a strong tradition in C programming.
    1974 Alternatively, prototype definitions can be eliminated by using a two-pass compilation, and implicitly creating header files for exports.
    1975 The former is easy to do, while the latter is more complex.
    1976 
    1977 Furthermore, named arguments do not work well in a \CFA-style programming-languages because they potentially introduces a new criteria for type matching.
    1978 For example, it is technically possible to disambiguate between these two overloaded definitions of ©f© based on named arguments at the call site:
    1979 \begin{cfa}
    1980 int f( int i, int j );
    1981 int f( int x, double y );
    1982 
    1983 f( j : 3, i : 4 );                              §\C{// 1st f}§
    1984 f( x : 7, y : 8.1 );                    §\C{// 2nd f}§
    1985 f( 4, 5 );                                              §\C{// ambiguous call}§
    1986 \end{cfa}
    1987 However, named arguments compound routine resolution in conjunction with conversions:
    1988 \begin{cfa}
    1989 f( i : 3, 5.7 );                                §\C{// ambiguous call ?}§
    1990 \end{cfa}
    1991 Depending on the cost associated with named arguments, this call could be resolvable or ambiguous.
    1992 Adding named argument into the routine resolution algorithm does not seem worth the complexity.
    1993 Therefore, \CFA does \emph{not} attempt to support named arguments.
    1994 
    1995 \item[Default Arguments]
    1996 provide the ability to associate a default value with a parameter so it can be optionally specified in the argument list.
    1997 For example, given the routine:
    1998 \begin{cfa}
    1999 void p( int x = 1, int y = 2, int z = 3 ) {...}
    2000 \end{cfa}
    2001 the allowable positional calls are:
    2002 \begin{cfa}
    2003 p();                                                    §\C{// rewrite $\Rightarrow$ p( 1, 2, 3 )}§
    2004 p( 4 );                                                 §\C{// rewrite $\Rightarrow$ p( 4, 2, 3 )}§
    2005 p( 4, 4 );                                              §\C{// rewrite $\Rightarrow$ p( 4, 4, 3 )}§
    2006 p( 4, 4, 4 );                                   §\C{// rewrite $\Rightarrow$ p( 4, 4, 4 )}§
    2007 // empty arguments
    2008 p(  , 4, 4 );                                   §\C{// rewrite $\Rightarrow$ p( 1, 4, 4 )}§
    2009 p( 4,  , 4 );                                   §\C{// rewrite $\Rightarrow$ p( 4, 2, 4 )}§
    2010 p( 4, 4,   );                                   §\C{// rewrite $\Rightarrow$ p( 4, 4, 3 )}§
    2011 p( 4,  ,   );                                   §\C{// rewrite $\Rightarrow$ p( 4, 2, 3 )}§
    2012 p(  , 4,   );                                   §\C{// rewrite $\Rightarrow$ p( 1, 4, 3 )}§
    2013 p(  ,  , 4 );                                   §\C{// rewrite $\Rightarrow$ p( 1, 2, 4 )}§
    2014 p(  ,  ,   );                                   §\C{// rewrite $\Rightarrow$ p( 1, 2, 3 )}§
    2015 \end{cfa}
    2016 Here the missing arguments are inserted from the default values in the parameter list.
    2017 The compiler rewrites missing default values into explicit positional arguments.
    2018 The advantages of default values are:
    2019 \begin{itemize}
    2020 \item
    2021 Routines with a large number of parameters are often very generalized, giving a programmer a number of different options on how a computation is performed.
    2022 For many of these kinds of routines, there are standard or default settings that work for the majority of computations.
    2023 Without default values for parameters, a programmer is forced to specify these common values all the time, resulting in long argument lists that are error prone.
    2024 \item
    2025 When a routine's interface is augmented with new parameters, it extends the interface providing generalizability\footnote{
    2026 ``It should be possible for the implementor of an abstraction to increase its generality.
    2027 So long as the modified abstraction is a generalization of the original, existing uses of the abstraction will not require change.
    2028 It might be possible to modify an abstraction in a manner which is not a generalization without affecting existing uses, but, without inspecting the modules in which the uses occur, this possibility cannot be determined.
    2029 This criterion precludes the addition of parameters, unless these parameters have default or inferred values that are valid for all possible existing applications.''~\cite[p.~128]{Cormack90}}
    2030 (somewhat like the generalization provided by inheritance for classes).
    2031 That is, all existing calls are still valid, although the call must still be recompiled.
    2032 \end{itemize}
    2033 The only disadvantage of default arguments is that unintentional omission of an argument may not result in a compiler-time error.
    2034 Instead, a default value is used, which may not be the programmer's intent.
    2035 
    2036 Default values may only appear in a prototype versus definition context:
    2037 \begin{cfa}
    2038 void p( int x, int y = 2, int z = 3 );          §\C{// prototype: allowed}§
    2039 void p( int, int = 2, int = 3 );                        §\C{// prototype: allowed}§
    2040 void p( int x, int y = 2, int z = 3 ) {}        §\C{// definition: not allowed}§
    2041 \end{cfa}
    2042 The reason for this restriction is to allow separate compilation.
    2043 Multiple prototypes with different default values is an error.
    2044 \end{description}
    2045 
    2046 Ellipse (``...'') arguments present problems when used with default arguments.
    2047 The conflict occurs because both named and ellipse arguments must appear after positional arguments, giving two possibilities:
    2048 \begin{cfa}
    2049 p( /* positional */, ... , /* named */ );
    2050 p( /* positional */, /* named */, ... );
    2051 \end{cfa}
    2052 While it is possible to implement both approaches, the first possibly is more complex than the second, \eg:
    2053 \begin{cfa}
    2054 p( int x, int y, int z, ... );
    2055 p( 1, 4, 5, 6, z : 3, y : 2 ); §\C{// assume p( /* positional */, ... , /* named */ );}§
    2056 p( 1, z : 3, y : 2, 4, 5, 6 ); §\C{// assume p( /* positional */, /* named */, ... );}§
    2057 \end{cfa}
    2058 In the first call, it is necessary for the programmer to conceptually rewrite the call, changing named arguments into positional, before knowing where the ellipse arguments begin.
    2059 Hence, this approach seems significantly more difficult, and hence, confusing and error prone.
    2060 In the second call, the named arguments separate the positional and ellipse arguments, making it trivial to read the call.
    2061 
    2062 The problem is exacerbated with default arguments, \eg:
    2063 \begin{cfa}
    2064 void p( int x, int y = 2, int z = 3... );
    2065 p( 1, 4, 5, 6, z : 3 );         §\C{// assume p( /* positional */, ... , /* named */ );}§
    2066 p( 1, z : 3, 4, 5, 6 );         §\C{// assume p( /* positional */, /* named */, ... );}§
    2067 \end{cfa}
    2068 The first call is an error because arguments 4 and 5 are actually positional not ellipse arguments;
    2069 therefore, argument 5 subsequently conflicts with the named argument z : 3.
    2070 In the second call, the default value for y is implicitly inserted after argument 1 and the named arguments separate the positional and ellipse arguments, making it trivial to read the call.
    2071 For these reasons, \CFA requires named arguments before ellipse arguments.
    2072 Finally, while ellipse arguments are needed for a small set of existing C routines, like printf, the extended \CFA type system largely eliminates the need for ellipse arguments (see Section 24), making much of this discussion moot.
    2073 
    2074 Default arguments and overloading (see Section 24) are complementary.
    2075 While in theory default arguments can be simulated with overloading, as in:
    2076 \begin{quote2}
    2077 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    2078 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{default arguments}}   & \multicolumn{1}{c}{\textbf{overloading}}      \\
    2079 \begin{cfa}
    2080 void p( int x, int y = 2, int z = 3 ) {...}
    2081 
    2082 
    2083 \end{cfa}
    2084 &
    2085 \begin{cfa}
    2086 void p( int x, int y, int z ) {...}
    2087 void p( int x ) { p( x, 2, 3 ); }
    2088 void p( int x, int y ) { p( x, y, 3 ); }
    2089 \end{cfa}
    2090 \end{tabular}
    2091 \end{quote2}
    2092 the number of required overloaded routines is linear in the number of default values, which is unacceptable growth.
    2093 In general, overloading should only be used over default arguments if the body of the routine is significantly different.
    2094 Furthermore, overloading cannot handle accessing default arguments in the middle of a positional list, via a missing argument, such as:
    2095 \begin{cfa}
    2096 p( 1, /* default */, 5 );               §\C{// rewrite $\Rightarrow$ p( 1, 2, 5 )}§
    2097 \end{cfa}
    2098 
    2099 Given the \CFA restrictions above, both named and default arguments are backwards compatible.
    2100 \Index*[C++]{\CC{}} only supports default arguments;
    2101 \Index*{Ada} supports both named and default arguments.
    2102 
    2103 
    2104 \section{Unnamed Structure Fields}
    2105 
    2106 C requires each field of a structure to have a name, except for a bit field associated with a basic type, \eg:
    2107 \begin{cfa}
    2108 struct {
    2109         int f1;                                 §\C{// named field}§
    2110         int f2 : 4;                             §\C{// named field with bit field size}§
    2111         int : 3;                                §\C{// unnamed field for basic type with bit field size}§
    2112         int ;                                   §\C{// disallowed, unnamed field}§
    2113         int *;                                  §\C{// disallowed, unnamed field}§
    2114         int (*)( int );                 §\C{// disallowed, unnamed field}§
    2115 };
    2116 \end{cfa}
    2117 This requirement is relaxed by making the field name optional for all field declarations; therefore, all the field declarations in the example are allowed.
    2118 As for unnamed bit fields, an unnamed field is used for padding a structure to a particular size.
    2119 A list of unnamed fields is also supported, \eg:
    2120 \begin{cfa}
    2121 struct {
    2122         int , , ;                               §\C{// 3 unnamed fields}§
    2123 }
    2124 \end{cfa}
    2125 
    2126 
    2127 \section{Nesting}
    2128 
    2129 Nesting of types and routines is useful for controlling name visibility (\newterm{name hiding}).
    2130 
    2131 
    2132 \subsection{Type Nesting}
    2133 
    2134 \CFA allows \Index{type nesting}, and type qualification of the nested types (see \VRef[Figure]{f:TypeNestingQualification}), where as C hoists\index{type hoisting} (refactors) nested types into the enclosing scope and has no type qualification.
    2135 \begin{figure}
    2136 \centering
    2137 \begin{tabular}{@{}l@{\hspace{3em}}l|l@{}}
    2138 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C Type Nesting}}      & \multicolumn{1}{c}{\textbf{C Implicit Hoisting}}      & \multicolumn{1}{|c}{\textbf{\CFA}}    \\
    2139 \hline
    2140 \begin{cfa}
    2141 struct S {
    2142         enum C { R, G, B };
    2143         struct T {
    2144                 union U { int i, j; };
    2145                 enum C c;
    2146                 short int i, j;
    2147         };
    2148         struct T t;
    2149 } s;
    2150 
    2151 int fred() {
    2152         s.t.c = R;
    2153         struct T t = { R, 1, 2 };
    2154         enum C c;
    2155         union U u;
    2156 }
    2157 \end{cfa}
    2158 &
    2159 \begin{cfa}
    2160 enum C { R, G, B };
    2161 union U { int i, j; };
    2162 struct T {
    2163         enum C c;
    2164         short int i, j;
    2165 };
    2166 struct S {
    2167         struct T t;
    2168 } s;
    2169        
    2170 
    2171 
    2172 
    2173 
    2174 
    2175 
    2176 \end{cfa}
    2177 &
    2178 \begin{cfa}
    2179 struct S {
    2180         enum C { R, G, B };
    2181         struct T {
    2182                 union U { int i, j; };
    2183                 enum C c;
    2184                 short int i, j;
    2185         };
    2186         struct T t;
    2187 } s;
    2188 
    2189 int fred() {
    2190         s.t.c = ®S.®R;  // type qualification
    2191         struct ®S.®T t = { ®S.®R, 1, 2 };
    2192         enum ®S.®C c;
    2193         union ®S.T.®U u;
    2194 }
    2195 \end{cfa}
    2196 \end{tabular}
    2197 \caption{Type Nesting / Qualification}
    2198 \label{f:TypeNestingQualification}
    2199 \end{figure}
    2200 In the left example in C, types ©C©, ©U© and ©T© are implicitly hoisted outside of type ©S© into the containing block scope.
    2201 In the right example in \CFA, the types are not hoisted and accessed using the field-selection operator ``©.©'' for type qualification, as does \Index*{Java}, rather than the \CC type-selection operator ``©::©''.
    2202 
    2203 
    2204 \subsection{Routine Nesting}
    2205 
    2206 While \CFA does not provide object programming by putting routines into structures, it does rely heavily on locally nested routines to redefine operations at or close to a call site.
    2207 For example, the C quick-sort is wrapped into the following polymorphic \CFA routine:
    2208 \begin{cfa}
    2209 forall( otype T | { int ?<?( T, T ); } )
    2210 void qsort( const T * arr, size_t dimension );
    2211 \end{cfa}
    2212 which can be used to sort in ascending and descending order by locally redefining the less-than operator into greater-than.
    2213 \begin{cfa}
    2214 const unsigned int size = 5;
    2215 int ia[size];
    2216 ...                                             §\C{// assign values to array ia}§
    2217 qsort( ia, size );              §\C{// sort ascending order using builtin ?<?}§
    2218 {
    2219         ®int ?<?( int x, int y ) { return x > y; }® §\C{// nested routine}§
    2220         qsort( ia, size );      §\C{// sort descending order by local redefinition}§
    2221 }
    2222 \end{cfa}
    2223 
    2224 Nested routines are not first-class, meaning a nested routine cannot be returned if it has references to variables in its enclosing blocks;
    2225 the only exception is references to the external block of the translation unit, as these variables persist for the duration of the program.
    2226 The following program in undefined in \CFA (and Indexc{gcc})
    2227 \begin{cfa}
    2228 [* [int]( int )] foo() {                §\C{// int (*foo())( int )}§
    2229         int ®i® = 7;
    2230         int bar( int p ) {
    2231                 ®i® += 1;                               §\C{// dependent on local variable}§
    2232                 sout | ®i® | endl;
    2233         }
    2234         return bar;                                     §\C{// undefined because of local dependence}§
    2235 }
    2236 int main() {
    2237         * [int]( int ) fp = foo();      §\C{// int (*fp)( int )}§
    2238         sout | fp( 3 ) | endl;
    2239 }
    2240 \end{cfa}
    2241 because
    2242 
    2243 Currently, there are no \Index{lambda} expressions, \ie unnamed routines because routine names are very important to properly select the correct routine.
    2244 
    2245 
    2246 \section{Tuples}
    2247 
    2248 In C and \CFA, lists of elements appear in several contexts, such as the parameter list for a routine call.
    2249 (More contexts are added shortly.)
    2250 A list of such elements is called a \newterm{lexical list}.
    2251 The general syntax of a lexical list is:
    2252 \begin{cfa}
    2253 [ §\emph{exprlist}§ ]
    2254 \end{cfa}
    2255 where ©$\emph{exprlist}$© is a list of one or more expressions separated by commas.
    2256 The brackets, ©[]©, allow differentiating between lexical lists and expressions containing the C comma operator.
    2257 The following are examples of lexical lists:
    2258 \begin{cfa}
    2259 [ x, y, z ]
    2260 [ 2 ]
    2261 [ v+w, x*y, 3.14159, f() ]
    2262 \end{cfa}
    2263 Tuples are permitted to contain sub-tuples (\ie nesting), such as ©[ [ 14, 21 ], 9 ]©, which is a 2-element tuple whose first element is itself a tuple.
    2264 Note, a tuple is not a record (structure);
    2265 a record denotes a single value with substructure, whereas a tuple is multiple values with no substructure (see flattening coercion in Section 12.1).
    2266 In essence, tuples are largely a compile time phenomenon, having little or no runtime presence.
    2267 
    2268 Tuples can be organized into compile-time tuple variables;
    2269 these variables are of \newterm{tuple type}.
    2270 Tuple variables and types can be used anywhere lists of conventional variables and types can be used.
    2271 The general syntax of a tuple type is:
    2272 \begin{cfa}
    2273 [ §\emph{typelist}§ ]
    2274 \end{cfa}
    2275 where ©$\emph{typelist}$© is a list of one or more legal \CFA or C type specifications separated by commas, which may include other tuple type specifications.
    2276 Examples of tuple types include:
    2277 \begin{cfa}
    2278 [ unsigned int, char ]
    2279 [ double, double, double ]
    2280 [ * int, int * ]                §\C{// mix of CFA and ANSI}§
    2281 [ * [ 5 ] int, * * char, * [ [ int, int ] ] (int, int) ]
    2282 \end{cfa}
    2283 Like tuples, tuple types may be nested, such as ©[ [ int, int ], int ]©, which is a 2-element tuple type whose first element is itself a tuple type.
    2284 
    2285 Examples of declarations using tuple types are:
    2286 \begin{cfa}
    2287 [ int, int ] x;                 §\C{// 2 element tuple, each element of type int}§
    2288 * [ char, char ] y;             §\C{// pointer to a 2 element tuple}§
    2289 [ [ int, int ] ] z ([ int, int ]);
    2290 \end{cfa}
    2291 The last example declares an external routine that expects a 2 element tuple as an input parameter and returns a 2 element tuple as its result.
    2292 
    2293 As mentioned, tuples can appear in contexts requiring a list of value, such as an argument list of a routine call.
    2294 In unambiguous situations, the tuple brackets may be omitted, \eg a tuple that appears as an argument may have its
    2295 square brackets omitted for convenience; therefore, the following routine invocations are equivalent:
    2296 \begin{cfa}
    2297 f( [ 1, x+2, fred() ] );
    2298 f( 1, x+2, fred() );
    2299 \end{cfa}
    2300 Also, a tuple or a tuple variable may be used to supply all or part of an argument list for a routine expecting multiple input parameters or for a routine expecting a tuple as an input parameter.
    2301 For example, the following are all legal:
    2302 \begin{cfa}
    2303 [ int, int ] w1;
    2304 [ int, int, int ] w2;
    2305 [ void ] f (int, int, int); /* three input parameters of type int */
    2306 [ void ] g ([ int, int, int ]); /* 3 element tuple as input */
    2307 f( [ 1, 2, 3 ] );
    2308 f( w1, 3 );
    2309 f( 1, w1 );
    2310 f( w2 );
    2311 g( [ 1, 2, 3 ] );
    2312 g( w1, 3 );
    2313 g( 1, w1 );
    2314 g( w2 );
    2315 \end{cfa}
    2316 Note, in all cases 3 arguments are supplied even though the syntax may appear to supply less than 3. As mentioned, a
    2317 tuple does not have structure like a record; a tuple is simply converted into a list of components.
    2318 \begin{rationale}
    2319 The present implementation of \CFA does not support nested routine calls when the inner routine returns multiple values; \ie a statement such as ©g( f() )© is not supported.
    2320 Using a temporary variable to store the  results of the inner routine and then passing this variable to the outer routine works, however.
    2321 \end{rationale}
    2322 
    2323 A tuple can contain a C comma expression, provided the expression containing the comma operator is enclosed in parentheses.
    2324 For instance, the following tuples are equivalent:
    2325 \begin{cfa}
    2326 [ 1, 3, 5 ]
    2327 [ 1, (2, 3), 5 ]
    2328 \end{cfa}
    2329 The second element of the second tuple is the expression (2, 3), which yields the result 3.
    2330 This requirement is the same as for comma expressions in argument lists.
    2331 
    2332 Type qualifiers, \ie const and volatile, may modify a tuple type.
    2333 The meaning is the same as for a type qualifier modifying an aggregate type [Int99, x 6.5.2.3(7),x 6.7.3(11)], \ie the qualifier is distributed across all of the types in the tuple, \eg:
    2334 \begin{cfa}
    2335 const volatile [ int, float, const int ] x;
    2336 \end{cfa}
    2337 is equivalent to:
    2338 \begin{cfa}
    2339 [ const volatile int, const volatile float, const volatile int ] x;
    2340 \end{cfa}
    2341 Declaration qualifiers can only appear at the start of a \CFA tuple declaration4, \eg:
    2342 \begin{cfa}
    2343 extern [ int, int ] w1;
    2344 static [ int, int, int ] w2;
    2345 \end{cfa}
    2346 \begin{rationale}
    2347 Unfortunately, C's syntax for subscripts precluded treating them as tuples.
    2348 The C subscript list has the form ©[i][j]...© and not ©[i, j, ...]©.
    2349 Therefore, there is no syntactic way for a routine returning multiple values to specify the different subscript values, \eg ©f[g()]© always means a single subscript value because there is only one set of brackets.
    2350 Fixing this requires a major change to C because the syntactic form ©M[i, j, k]© already has a particular meaning: ©i, j, k© is a comma expression.
    2351 \end{rationale}
    2352 
    2353 
    2354 \subsection{Tuple Coercions}
    2355 
    2356 There are four coercions that can be performed on tuples and tuple variables: closing, opening, flattening and structuring.
    2357 In addition, the coercion of dereferencing can be performed on a tuple variable to yield its value(s), as for other variables.
    2358 A \newterm{closing coercion} takes a set of values and converts it into a tuple value, which is a contiguous set of values, as in:
    2359 \begin{cfa}
    2360 [ int, int, int, int ] w;
    2361 w = [ 1, 2, 3, 4 ];
    2362 \end{cfa}
    2363 First the right-hand tuple is closed into a tuple value and then the tuple value is assigned.
    2364 
    2365 An \newterm{opening coercion} is the opposite of closing; a tuple value is converted into a tuple of values, as in:
    2366 \begin{cfa}
    2367 [ a, b, c, d ] = w
    2368 \end{cfa}
    2369 ©w© is implicitly opened to yield a tuple of four values, which are then assigned individually.
    2370 
    2371 A \newterm{flattening coercion} coerces a nested tuple, \ie a tuple with one or more components, which are themselves tuples, into a flattened tuple, which is a tuple whose components are not tuples, as in:
    2372 \begin{cfa}
    2373 [ a, b, c, d ] = [ 1, [ 2, 3 ], 4 ];
    2374 \end{cfa}
    2375 First the right-hand tuple is flattened and then the values are assigned individually.
    2376 Flattening is also performed on tuple types.
    2377 For example, the type ©[ int, [ int, int ], int ]© can be coerced, using flattening, into the type ©[ int, int, int, int ]©.
    2378 
    2379 A \newterm{structuring coercion} is the opposite of flattening;
    2380 a tuple is structured into a more complex nested tuple.
    2381 For example, structuring the tuple ©[ 1, 2, 3, 4 ]© into the tuple ©[ 1, [ 2, 3 ], 4 ]© or the tuple type ©[ int, int, int, int ]© into the tuple type ©[ int, [ int, int ], int ]©.
    2382 In the following example, the last assignment illustrates all the tuple coercions:
    2383 \begin{cfa}
    2384 [ int, int, int, int ] w = [ 1, 2, 3, 4 ];
    2385 int x = 5;
    2386 [ x, w ] = [ w, x ];            §\C{// all four tuple coercions}§
    2387 \end{cfa}
    2388 Starting on the right-hand tuple in the last assignment statement, w is opened, producing a tuple of four values;
    2389 therefore, the right-hand tuple is now the tuple ©[ [ 1, 2, 3, 4 ], 5 ]©.
    2390 This tuple is then flattened, yielding ©[ 1, 2, 3, 4, 5 ]©, which is structured into ©[ 1, [ 2, 3, 4, 5 ] ]© to match the tuple type of the left-hand side.
    2391 The tuple ©[ 2, 3, 4, 5 ]© is then closed to create a tuple value.
    2392 Finally, ©x© is assigned ©1© and ©w© is assigned the tuple value using multiple assignment (see Section 14).
    2393 \begin{rationale}
    2394 A possible additional language extension is to use the structuring coercion for tuples to initialize a complex record with a tuple.
    2395 \end{rationale}
    2396 
    2397 
    2398 \section{Mass Assignment}
    2399 
    2400 \CFA permits assignment to several variables at once using mass assignment~\cite{CLU}.
    2401 Mass assignment has the following form:
    2402 \begin{cfa}
    2403 [ §\emph{lvalue}§, ... , §\emph{lvalue}§ ] = §\emph{expr}§;
    2404 \end{cfa}
    2405 \index{lvalue}
    2406 The left-hand side is a tuple of \emph{lvalues}, which is a list of expressions each yielding an address, \ie any data object that can appear on the left-hand side of a conventional assignment statement.
    2407 ©$\emph{expr}$© is any standard arithmetic expression.
    2408 Clearly, the types of the entities being assigned must be type compatible with the value of the expression.
    2409 
    2410 Mass assignment has parallel semantics, \eg the statement:
    2411 \begin{cfa}
    2412 [ x, y, z ] = 1.5;
    2413 \end{cfa}
    2414 is equivalent to:
    2415 \begin{cfa}
    2416 x = 1.5; y = 1.5; z = 1.5;
    2417 \end{cfa}
    2418 This semantics is not the same as the following in C:
    2419 \begin{cfa}
    2420 x = y = z = 1.5;
    2421 \end{cfa}
    2422 as conversions between intermediate assignments may lose information.
    2423 A more complex example is:
    2424 \begin{cfa}
    2425 [ i, y[i], z ] = a + b;
    2426 \end{cfa}
    2427 which is equivalent to:
    2428 \begin{cfa}
    2429 t = a + b;
    2430 a1 = &i; a2 = &y[i]; a3 = &z;
    2431 *a1 = t; *a2 = t; *a3 = t;
    2432 \end{cfa}
    2433 The temporary ©t© is necessary to store the value of the expression to eliminate conversion issues.
    2434 The temporaries for the addresses are needed so that locations on the left-hand side do not change as the values are assigned.
    2435 In this case, ©y[i]© uses the previous value of ©i© and not the new value set at the beginning of the mass assignment.
    2436 
    2437 
    2438 \section{Multiple Assignment}
    2439 
    2440 \CFA also supports the assignment of several values at once, known as multiple assignment~\cite{CLU,Galletly96}.
    2441 Multiple assignment has the following form:
    2442 \begin{cfa}
    2443 [ §\emph{lvalue}§, ... , §\emph{lvalue}§ ] = [ §\emph{expr}§, ... , §\emph{expr}§ ];
    2444 \end{cfa}
    2445 \index{lvalue}
    2446 The left-hand side is a tuple of \emph{lvalues}, and the right-hand side is a tuple of \emph{expr}s.
    2447 Each \emph{expr} appearing on the right-hand side of a multiple assignment statement is assigned to the corresponding \emph{lvalues} on the left-hand side of the statement using parallel semantics for each assignment.
    2448 An example of multiple assignment is:
    2449 \begin{cfa}
    2450 [ x, y, z ] = [ 1, 2, 3 ];
    2451 \end{cfa}
    2452 Here, the values ©1©, ©2© and ©3© are assigned, respectively, to the variables ©x©, ©y© and ©z©.
    2453  A more complex example is:
    2454 \begin{cfa}
    2455 [ i, y[ i ], z ] = [ 1, i, a + b ];
    2456 \end{cfa}
    2457 Here, the values ©1©, ©i© and ©a + b© are assigned to the variables ©i©, ©y[i]© and ©z©, respectively.
    2458  Note, the parallel semantics of
    2459 multiple assignment ensures:
    2460 \begin{cfa}
    2461 [ x, y ] = [ y, x ];
    2462 \end{cfa}
    2463 correctly interchanges (swaps) the values stored in ©x© and ©y©.
    2464 The following cases are errors:
    2465 \begin{cfa}
    2466 [ a, b, c ] = [ 1, 2, 3, 4 ];
    2467 [ a, b, c ] = [ 1, 2 ];
    2468 \end{cfa}
    2469 because the number of entities in the left-hand tuple is unequal with the right-hand tuple.
    2470 
    2471 As for all tuple contexts in C, side effects should not be used because C does not define an ordering for the evaluation of the elements of a tuple;
    2472 both these examples produce indeterminate results:
    2473 \begin{cfa}
    2474 f( x++, x++ );                          §\C{// C routine call with side effects in arguments}§
    2475 [ v1, v2 ] = [ x++, x++ ];      §\C{// side effects in righthand side of multiple assignment}§
    2476 \end{cfa}
    2477 
    2478 
    2479 \section{Cascade Assignment}
    2480 
    2481 As in C, \CFA mass and multiple assignments can be cascaded, producing cascade assignment.
    2482 Cascade assignment has the following form:
    2483 \begin{cfa}
    2484 §\emph{tuple}§ = §\emph{tuple}§ = ... = §\emph{tuple}§;
    2485 \end{cfa}
    2486 and it has the same parallel semantics as for mass and multiple assignment.
    2487 Some examples of cascade assignment are:
    2488 \begin{cfa}
    2489 x1 = y1 = x2 = y2 = 0;
    2490 [ x1, y1 ] = [ x2, y2 ] = [ x3, y3 ];
    2491 [ x1, y1 ] = [ x2, y2 ] = 0;
    2492 [ x1, y1 ] = z = 0;
    2493 \end{cfa}
    2494 As in C, the rightmost assignment is performed first, \ie assignment parses right to left.
    2495 
    2496 
    2497 \section{Field Tuples}
    2498 
    2499 Tuples may be used to select multiple fields of a record by field name.
    2500 Its general form is:
    2501 \begin{cfa}
    2502 §\emph{expr}§ . [ §\emph{fieldlist}§ ]
    2503 §\emph{expr}§ -> [ §\emph{fieldlist}§ ]
    2504 \end{cfa}
    2505 \emph{expr} is any expression yielding a value of type record, \eg ©struct©, ©union©.
    2506 Each element of \emph{ fieldlist} is an element of the record specified by \emph{expr}.
    2507 A record-field tuple may be used anywhere a tuple can be used. An example of the use of a record-field tuple is
    2508 the following:
    2509 \begin{cfa}
    2510 struct s {
    2511         int f1, f2;
    2512         char f3;
    2513         double f4;
    2514 } v;
    2515 v.[ f3, f1, f2 ] = ['x', 11, 17 ];      §\C{// equivalent to v.f3 = 'x', v.f1 = 11, v.f2 = 17}§
    2516 f( v.[ f3, f1, f2 ] );                          §\C{// equivalent to f( v.f3, v.f1, v.f2 )}§
    2517 \end{cfa}
    2518 Note, the fields appearing in a record-field tuple may be specified in any order;
    2519 also, it is unnecessary to specify all the fields of a struct in a multiple record-field tuple.
    2520 
    2521 If a field of a ©struct© is itself another ©struct©, multiple fields of this subrecord can be specified using a nested record-field tuple, as in the following example:
    2522 \begin{cfa}
    2523 struct inner {
    2524         int f2, f3;
    2525 };
    2526 struct outer {
    2527         int f1;
    2528         struct inner i;
    2529         double f4;
    2530 } o;
    2531 
    2532 o.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
    2533 \end{cfa}
     2393}
     2394\end{cfa}
     2395So the type raised would be the mangled name of the exception prototype and that name would be matched at the handler clauses by comparing the strings.
     2396The arguments for the call would have to be packed in a message and unpacked at handler clause and then a call made to the handler.
    25342397
    25352398
     
    25392402
    25402403The goal of \CFA I/O is to simplify the common cases\index{I/O!common case}, while fully supporting polymorphism and user defined types in a consistent way.
    2541 The approach combines ideas from \CC and Python.
    25422404The \CFA header file for the I/O library is \Indexc{fstream}.
    25432405
     
    25562418\end{cfa}
    25572419\\
    2558 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2559 1® ®2® ®3
     2420\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     24211 2 3
    25602422\end{cfa}
    25612423&
    2562 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     2424\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    256324251 2 3
    25642426\end{cfa}
    25652427\end{tabular}
    25662428\end{quote2}
    2567 The \CFA form has half the characters of the \CC form, and is similar to \Index*{Python} I/O with respect to implicit separators.
    2568 Similar simplification occurs for \Index{tuple} I/O, which prints all tuple values separated by ``\lstinline[showspaces=true]@, @''.
    2569 \begin{cfa}
    2570 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
     2429The \CFA form has half as many characters as the \CC form, and is similar to \Index*{Python} I/O with respect to implicit separators.
     2430A tuple prints all the tuple's values, each separated by ©", "©.
     2431\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2432[int, int] t1 = [1, 2], t2 = [3, 4];
    25712433sout | t1 | t2 | endl;                                  §\C{// print tuples}§
    25722434\end{cfa}
    2573 \begin{cfa}[showspaces=true,aboveskip=0pt]
    2574 1®, ®2®, ®3 4®, ®5®, ®6
    2575 \end{cfa}
    2576 Finally, \CFA uses the logical-or operator for I/O as it is the lowest-priority overloadable operator, other than assignment.
     2435\begin{cfa}[mathescape=off,showspaces=true,belowskip=0pt]
     24361, 2, 3, 4
     2437\end{cfa}
     2438\CFA uses the logical-or operator for I/O because it is the lowest-priority overloadable operator, other than assignment.
    25772439Therefore, fewer output expressions require parenthesis.
    25782440\begin{quote2}
     
    25912453\\
    25922454&
    2593 \begin{cfa}[showspaces=true,aboveskip=0pt]
     2455\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    259424563 3 12 0 3 1 2
    25952457\end{cfa}
    25962458\end{tabular}
    25972459\end{quote2}
    2598 There is a weak similarity between the \CFA logical-or operator and the Shell pipe-operator for moving data, where data flows in the correct direction for input but the opposite direction for output.
    2599 
    2600 
    2601 \subsection{Implicit Separator}
    2602 
    2603 The \Index{implicit separator}\index{I/O!separator} character (space/blank) is a separator not a terminator.
     2460Finally, the logical-or operator has a link with the Shell pipe-operator for moving data, where data flows in the correct direction for input but the opposite direction for output.
     2461
     2462
     2463The implicit separator\index{I/O!separator} character (space/blank) is a separator not a terminator.
    26042464The rules for implicitly adding the separator are:
    26052465\begin{enumerate}
     
    26092469sout | 1 | 2 | 3 | endl;
    26102470\end{cfa}
    2611 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     2471\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    261224721 2 3
    26132473\end{cfa}
     
    26732533\end{enumerate}
    26742534
    2675 
    2676 \subsection{Manipulator}
    2677 
    2678 The following \CC-style \Index{manipulator}s and routines control implicit seperation.
     2535The following routines and \CC-style \Index{manipulator}s control implicit seperation.
    26792536\begin{enumerate}
    26802537\item
    2681 Routines \Indexc{sepSet}\index{manipulator!sepSet@©sepSet©} and \Indexc{sep}\index{manipulator!sep@©sep©}/\Indexc{sepGet}\index{manipulator!sepGet@©sepGet©} set and get the separator string.
     2538Routines \Indexc{sepSet}\index{manipulator!sepSet@©sepSet©} and \Indexc{sepGet}\index{manipulator!sepGet@©sepGet©} set and get the separator string.
    26822539The separator string can be at most 16 characters including the ©'\0'© string terminator (15 printable characters).
    2683 \begin{cfa}[mathescape=off,belowskip=0pt]
     2540\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    26842541sepSet( sout, ", $" );                                          §\C{// set separator from " " to ", \$"}§
    2685 sout | 1 | 2 | 3 | " \"" | ®sep® | "\"" | endl;
     2542sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl;
    26862543\end{cfa}
    26872544%$
    26882545\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
    2689 1®, $®2®, $®3 ®", $"®
     25461, $2, $3 ®", $"®
    26902547\end{cfa}
    26912548%$
    2692 \begin{cfa}[belowskip=0pt]
     2549\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    26932550sepSet( sout, " " );                                            §\C{// reset separator to " "}§
    26942551sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl;
    26952552\end{cfa}
    2696 \begin{cfa}[showspaces=true,aboveskip=0pt]
    2697 1® ®2® ®3 ®" "®
    2698 \end{cfa}
    2699 ©sepGet© can be used to store a separator and then restore it:
    2700 \begin{cfa}[belowskip=0pt]
    2701 char store[®sepSize®];                                          §\C{// sepSize is the maximum separator size}§
    2702 strcpy( store, sepGet( sout ) );                          §\C{// copy current separator}§
    2703 sepSet( sout, "_" );                                            §\C{// change separator to underscore}§
    2704 sout | 1 | 2 | 3 | endl;
    2705 \end{cfa}
    2706 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2707 1®_®2®_®3
    2708 \end{cfa}
    2709 \begin{cfa}[belowskip=0pt]
    2710 sepSet( sout, store );                                          §\C{// change separator back to original}§
    2711 sout | 1 | 2 | 3 | endl;
    2712 \end{cfa}
    2713 \begin{cfa}[showspaces=true,aboveskip=0pt]
    2714 1® ®2® ®3
    2715 \end{cfa}
    2716 
    2717 \item
    2718 Routine \Indexc{sepSetTuple}\index{manipulator!sepSetTuple@©sepSetTuple©} and \Indexc{sepTuple}\index{manipulator!sepTuple@©sepTuple©}/\Indexc{sepGetTuple}\index{manipulator!sepGetTuple@©sepGetTuple©} get and set the tuple separator-string.
     2553\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     25541 2 3 ®" "®
     2555\end{cfa}
     2556
     2557\item
     2558Manipulators \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} \emph{locally} toggle printing the separator, \ie the seperator is adjusted only with respect to the next printed item.
     2559\begin{cfa}[mathescape=off,belowskip=0pt]
     2560sout | sepOn | 1 | 2 | 3 | sepOn | endl;        §\C{// separator at start of line}§
     2561\end{cfa}
     2562\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     2563 1 2 3
     2564\end{cfa}
     2565\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2566sout | 1 | sepOff | 2 | 3 | endl;                       §\C{// locally turn off implicit separator}§
     2567\end{cfa}
     2568\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     256912 3
     2570\end{cfa}
     2571
     2572\item
     2573Manipulators \Indexc{sepDisable}\index{manipulator!sepDisable@©sepDisable©} and \Indexc{sepEnable}\index{manipulator!sepEnable@©sepEnable©} \emph{globally} toggle printing the separator, \ie the seperator is adjusted with respect to all subsequent printed items, unless locally adjusted.
     2574\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2575sout | sepDisable | 1 | 2 | 3 | endl;           §\C{// globally turn off implicit separation}§
     2576\end{cfa}
     2577\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     2578123
     2579\end{cfa}
     2580\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2581sout | 1 | sepOn | 2 | 3 | endl;                        §\C{// locally turn on implicit separator}§
     2582\end{cfa}
     2583\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     25841 23
     2585\end{cfa}
     2586\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2587sout | sepEnable | 1 | 2 | 3 | endl;            §\C{// globally turn on implicit separation}§
     2588\end{cfa}
     2589\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     25901 2 3
     2591\end{cfa}
     2592
     2593\item
     2594Routine \Indexc{sepSetTuple}\index{manipulator!sepSetTuple@©sepSetTuple©} and \Indexc{sepGetTuple}\index{manipulator!sepGetTuple@©sepGetTuple©} get and set the tuple separator-string.
    27192595The tuple separator-string can be at most 16 characters including the ©'\0'© string terminator (15 printable characters).
    2720 \begin{cfa}[belowskip=0pt]
     2596\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    27212597sepSetTuple( sout, " " );                                       §\C{// set tuple separator from ", " to " "}§
    2722 sout | t1 | t2 | " \"" | ®sepTuple® | "\"" | endl;
    2723 \end{cfa}
    2724 \begin{cfa}[showspaces=true,aboveskip=0pt]
    2725 1 2 3 4 5 6 ®" "®
    2726 \end{cfa}
    2727 \begin{cfa}[belowskip=0pt]
     2598sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl;
     2599\end{cfa}
     2600\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     26011 2 3 4 ®" "®
     2602\end{cfa}
     2603\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    27282604sepSetTuple( sout, ", " );                                      §\C{// reset tuple separator to ", "}§
    27292605sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl;
    27302606\end{cfa}
    2731 \begin{cfa}[showspaces=true,aboveskip=0pt]
    2732 1, 2, 3 4, 5, 6 ®", "®
    2733 \end{cfa}
    2734 As for ©sepGet©, ©sepGetTuple© can be use to store a tuple separator and then restore it.
    2735 
    2736 \item
    2737 Manipulators \Indexc{sepDisable}\index{manipulator!sepDisable@©sepDisable©} and \Indexc{sepEnable}\index{manipulator!sepEnable@©sepEnable©} \emph{globally} toggle printing the separator, \ie the seperator is adjusted with respect to all subsequent printed items.
    2738 \begin{cfa}[belowskip=0pt]
    2739 sout | sepDisable | 1 | 2 | 3 | endl;           §\C{// globally turn off implicit separator}§
    2740 \end{cfa}
    2741 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2742 123
    2743 \end{cfa}
    2744 \begin{cfa}[belowskip=0pt]
    2745 sout | sepEnable | 1 | 2 | 3 | endl;            §\C{// globally turn on implicit separator}§
     2607\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     26081, 2, 3, 4 ®", "®
     2609\end{cfa}
     2610
     2611\item
     2612The tuple separator can also be turned on and off.
     2613\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2614sout | sepOn | t1 | sepOff | t2 | endl;         §\C{// locally turn on/off implicit separation}§
    27462615\end{cfa}
    27472616\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    2748 1 2 3
    2749 \end{cfa}
    2750 
    2751 \item
    2752 Manipulators \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} \emph{locally} toggle printing the separator, \ie the seperator is adjusted only with respect to the next printed item.
    2753 \begin{cfa}[belowskip=0pt]
    2754 sout | 1 | sepOff | 2 | 3 | endl;                       §\C{// locally turn off implicit separator}§
    2755 \end{cfa}
    2756 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2757 12 3
    2758 \end{cfa}
    2759 \begin{cfa}[belowskip=0pt]
    2760 sout | sepDisable | 1 | sepOn | 2 | 3 | endl; §\C{// locally turn on implicit separator}§
    2761 \end{cfa}
    2762 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2763 1 23
    2764 \end{cfa}
    2765 The tuple separator also responses to being turned on and off.
    2766 \begin{cfa}[belowskip=0pt]
    2767 sout | t1 | sepOff | t2 | endl;                         §\C{// locally turn on/off implicit separator}§
    2768 \end{cfa}
    2769 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2770 1, 2, 34, 5, 6
    2771 \end{cfa}
    2772 ©sepOn© \emph{cannot} be used to start/end a line with a separator because separators do not appear at the start/end of a line;
    2773 use ©sep© to accomplish this functionality.
    2774 \begin{cfa}[belowskip=0pt]
    2775 sout | sepOn | 1 | 2 | 3 | sepOn | endl ;       §\C{// sepOn does nothing at start/end of line}§
    2776 \end{cfa}
    2777 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2778 1 2 3
    2779 \end{cfa}
    2780 \begin{cfa}[belowskip=0pt]
    2781 sout | sep | 1 | 2 | 3 | sep | endl ;           §\C{// use sep to print separator at start/end of line}§
    2782 \end{cfa}
    2783 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
    2784 ® ®1 2 3® ®
    2785 \end{cfa}
     2617, 1, 23, 4
     2618\end{cfa}
     2619Notice a tuple seperator starts the line because the next item is a tuple.
    27862620\end{enumerate}
    27872621
    27882622\begin{comment}
    27892623#include <fstream>
    2790 #include <string.h>                                                                             // strcpy
    27912624
    27922625int main( void ) {
    27932626        int x = 1, y = 2, z = 3;
    27942627        sout | x | y | z | endl;
    2795         [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
    2796         sout | t1 | t2 | endl;                                          // print tuples
     2628        [int, int] t1 = [1, 2], t2 = [3, 4];
     2629        sout | t1 | t2 | endl;                                          // print tuple
    27972630        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
    27982631        sout | 1 | 2 | 3 | endl;
     
    28072640
    28082641        sepSet( sout, ", $" );                                          // set separator from " " to ", $"
    2809         sout | 1 | 2 | 3 | " \"" | sep | "\"" | endl;
     2642        sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    28102643        sepSet( sout, " " );                                            // reset separator to " "
    28112644        sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    28122645
    2813         char store[sepSize];
    2814         strcpy( store, sepGet( sout ) );
    2815         sepSet( sout, "_" );
    2816         sout | 1 | 2 | 3 | endl;
    2817         sepSet( sout, store );
    2818         sout | 1 | 2 | 3 | endl;
     2646        sout | sepOn | 1 | 2 | 3 | sepOn | endl;        // separator at start of line
     2647        sout | 1 | sepOff | 2 | 3 | endl;                       // locally turn off implicit separator
     2648
     2649        sout | sepDisable | 1 | 2 | 3 | endl;           // globally turn off implicit separation
     2650        sout | 1 | sepOn | 2 | 3 | endl;                        // locally turn on implicit separator
     2651        sout | sepEnable | 1 | 2 | 3 | endl;            // globally turn on implicit separation
    28192652
    28202653        sepSetTuple( sout, " " );                                       // set tuple separator from ", " to " "
    2821         sout | t1 | t2 | " \"" | sepTuple | "\"" | endl;
     2654        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
    28222655        sepSetTuple( sout, ", " );                                      // reset tuple separator to ", "
    28232656        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
    28242657
    2825         sout | sepDisable | 1 | 2 | 3 | endl;           // globally turn off implicit separator
    2826         sout | sepEnable | 1 | 2 | 3 | endl;            // globally turn on implicit separator
    2827        
    2828         sout | 1 | sepOff | 2 | 3 | endl;                       // locally turn on implicit separator
    2829         sout | sepDisable | 1 | sepOn | 2 | 3 | endl; // globally turn off implicit separator
    2830         sout | sepEnable;
    2831         sout | t1 | sepOff | t2 | endl;                         // locally turn on/off implicit separator
    2832 
    2833         sout | sepOn | 1 | 2 | 3 | sepOn | endl ;       // sepOn does nothing at start/end of line
    2834         sout | sep | 1 | 2 | 3 | sep | endl ;           // use sep to print separator at start/end of line
     2658        sout | t1 | t2 | endl;                                          // print tuple
     2659        sout | sepOn | t1 | sepOff | t2 | endl;         // locally turn on/off implicit separation
    28352660}
    28362661
     
    53645189
    53655190
    5366 \section{\texorpdfstring{\CFA Keywords}{Cforall Keywords}}
     5191\section{\protect\CFA Keywords}
    53675192\label{s:CFAKeywords}
    53685193
    5369 \CFA introduces the following new keywords.
    5370 
    53715194\begin{quote2}
    5372 \begin{tabular}{lllll}
     5195\begin{tabular}{llll}
    53735196\begin{tabular}{@{}l@{}}
    5374 ©_At©                   \\
     5197©_AT©                   \\
    53755198©catch©                 \\
    53765199©catchResume©   \\
    53775200©choose©                \\
    53785201©coroutine©             \\
     5202©disable©               \\
    53795203\end{tabular}
    53805204&
    53815205\begin{tabular}{@{}l@{}}
    5382 ©disable©               \\
    53835206©dtype©                 \\
    53845207©enable©                \\
    53855208©fallthrough©   \\
    53865209©fallthru©              \\
     5210©finally©               \\
     5211©forall©                \\
    53875212\end{tabular}
    53885213&
    53895214\begin{tabular}{@{}l@{}}
    5390 ©finally©               \\
    5391 ©forall©                \\
    53925215©ftype©                 \\
    53935216©lvalue©                \\
    53945217©monitor©               \\
     5218©mutex©                 \\
     5219©one_t©                 \\
     5220©otype©                 \\
    53955221\end{tabular}
    53965222&
    53975223\begin{tabular}{@{}l@{}}
    5398 ©mutex©                 \\
    5399 ©one_t©                 \\
    5400 ©otype©                 \\
    54015224©throw©                 \\
    54025225©throwResume©   \\
    5403 \end{tabular}
    5404 &
    5405 \begin{tabular}{@{}l@{}}
    54065226©trait©                 \\
    54075227©try©                   \\
    54085228©ttype©                 \\
    54095229©zero_t©                \\
    5410                                 \\
    54115230\end{tabular}
    54125231\end{tabular}
     
    55835402\Celeven prescribes the following standard header-files~\cite[\S~7.1.2]{C11} and \CFA adds to this list:
    55845403\begin{quote2}
    5585 \begin{tabular}{@{}lllll|l@{}}
    5586 \multicolumn{5}{c|}{C11} & \multicolumn{1}{c}{\CFA}             \\
     5404\lstset{deletekeywords={float}}
     5405\begin{tabular}{@{}llll|l@{}}
     5406\multicolumn{4}{c|}{C11} & \multicolumn{1}{c}{\CFA}             \\
    55875407\hline
    55885408\begin{tabular}{@{}l@{}}
     
    55925412\Indexc{errno.h}                \\
    55935413\Indexc{fenv.h}                 \\
    5594 \Indexc[deletekeywords=float]{float.h} \\
     5414\Indexc{float.h}                \\
     5415\Indexc{inttypes.h}             \\
     5416\Indexc{iso646.h}               \\
    55955417\end{tabular}
    55965418&
    55975419\begin{tabular}{@{}l@{}}
    5598 \Indexc{inttypes.h}             \\
    5599 \Indexc{iso646.h}               \\
    56005420\Indexc{limits.h}               \\
    56015421\Indexc{locale.h}               \\
    56025422\Indexc{math.h}                 \\
    56035423\Indexc{setjmp.h}               \\
    5604 \end{tabular}
    5605 &
    5606 \begin{tabular}{@{}l@{}}
    56075424\Indexc{signal.h}               \\
    56085425\Indexc{stdalign.h}             \\
    56095426\Indexc{stdarg.h}               \\
    56105427\Indexc{stdatomic.h}    \\
    5611 \Indexc{stdbool.h}              \\
    5612 \Indexc{stddef.h}               \\
    56135428\end{tabular}
    56145429&
    56155430\begin{tabular}{@{}l@{}}
     5431\Indexc{stdbool.h}              \\
     5432\Indexc{stddef.h}               \\
    56165433\Indexc{stdint.h}               \\
    56175434\Indexc{stdio.h}                \\
     
    56295446\Indexc{wctype.h}               \\
    56305447                                                \\
     5448                                                \\
     5449                                                \\
    56315450\end{tabular}
    56325451&
     
    56345453\Indexc{unistd.h}               \\
    56355454\Indexc{gmp.h}                  \\
     5455                                                \\
     5456                                                \\
    56365457                                                \\
    56375458                                                \\
     
    56665487For an increase in storage size, new storage after the copied data may be filled.
    56675488\item[alignment]
    5668 an allocation starts on a specified memory boundary, \eg, an address multiple of 64 or 128 for cache-line purposes.
     5489an allocation starts on a specified memory boundary, e.g., an address multiple of 64 or 128 for cache-line purposes.
    56695490\item[array]
    56705491the allocation size is scaled to the specified number of array elements.
     
    56735494The table shows allocation routines supporting different combinations of storage-management capabilities:
    56745495\begin{center}
    5675 \begin{tabular}{@{}r|r|l|l|l|l@{}}
    5676 \multicolumn{1}{c}{}&           & \multicolumn{1}{c|}{fill}     & resize        & alignment     & array \\
     5496\begin{tabular}{@{}lr|l|l|l|l@{}}
     5497                &                                       & \multicolumn{1}{c|}{fill}     & resize        & alignment     & array \\
    56775498\hline
    56785499C               & ©malloc©                      & no                    & no            & no            & no    \\
     
    56815502                & ©memalign©            & no                    & no            & yes           & no    \\
    56825503                & ©posix_memalign©      & no                    & no            & yes           & no    \\
    5683 \hline
    56845504C11             & ©aligned_alloc©       & no                    & no            & yes           & no    \\
    5685 \hline
    56865505\CFA    & ©alloc©                       & no/copy/yes   & no/yes        & no            & yes   \\
    56875506                & ©align_alloc©         & no/yes                & no            & yes           & yes   \\
     
    56945513// C unsafe allocation
    56955514extern "C" {
    5696 void * malloc( size_t size );§\indexc{memset}§
     5515void * mallac( size_t size );§\indexc{memset}§
    56975516void * calloc( size_t dim, size_t size );§\indexc{calloc}§
    56985517void * realloc( void * ptr, size_t size );§\indexc{realloc}§
  • src/CodeGen/CodeGenerator.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include <cassert>                   // for assert, assertf
    17 #include <list>                      // for _List_iterator, list, list<>::it...
     16#include <algorithm>
     17#include <iostream>
     18#include <cassert>
     19#include <list>
     20
     21#include "Parser/ParseNode.h"
     22
     23#include "SynTree/Declaration.h"
     24#include "SynTree/Expression.h"
     25#include "SynTree/Initializer.h"
     26#include "SynTree/Statement.h"
     27#include "SynTree/Type.h"
     28#include "SynTree/Attribute.h"
     29
     30#include "Common/utility.h"
     31#include "Common/UnimplementedError.h"
    1832
    1933#include "CodeGenerator.h"
    20 #include "Common/SemanticError.h"    // for SemanticError
    21 #include "Common/UniqueName.h"       // for UniqueName
    22 #include "Common/utility.h"          // for CodeLocation, toString
    23 #include "GenType.h"                 // for genType
    24 #include "InitTweak/InitTweak.h"     // for getPointerBase
    25 #include "OperatorTable.h"           // for OperatorInfo, operatorLookup
    26 #include "Parser/LinkageSpec.h"      // for Spec, Intrinsic
    27 #include "SynTree/Attribute.h"       // for Attribute
    28 #include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
    29 #include "SynTree/Constant.h"        // for Constant
    30 #include "SynTree/Declaration.h"     // for DeclarationWithType, TypeDecl
    31 #include "SynTree/Expression.h"      // for Expression, UntypedExpr, Applica...
    32 #include "SynTree/Initializer.h"     // for Initializer, ListInit, Designation
    33 #include "SynTree/Label.h"           // for Label, operator<<
    34 #include "SynTree/Statement.h"       // for Statement, AsmStmt, BranchStmt
    35 #include "SynTree/Type.h"            // for Type, Type::StorageClasses, Func...
     34#include "OperatorTable.h"
     35#include "GenType.h"
     36
     37#include "InitTweak/InitTweak.h"
    3638
    3739using namespace std;
     
    286288        }
    287289
    288         void CodeGenerator::visit( Designation * designation ) {
    289                 std::list< Expression * > designators = designation->get_designators();
     290        void CodeGenerator::printDesignators( std::list< Expression * > & designators ) {
     291                typedef std::list< Expression * > DesignatorList;
    290292                if ( designators.size() == 0 ) return;
    291                 for ( Expression * des : designators ) {
    292                         if ( dynamic_cast< NameExpr * >( des ) || dynamic_cast< VariableExpr * >( des ) ) {
    293                                 // if expression is a NameExpr or VariableExpr, then initializing aggregate member
     293                for ( DesignatorList::iterator iter = designators.begin(); iter != designators.end(); ++iter ) {
     294                        if ( dynamic_cast< NameExpr * >( *iter ) ) {
     295                                // if expression is a name, then initializing aggregate member
    294296                                output << ".";
    295                                 des->accept( *this );
     297                                (*iter)->accept( *this );
    296298                        } else {
    297                                 // otherwise, it has to be a ConstantExpr or CastExpr, initializing array eleemnt
     299                                // if not a simple name, it has to be a constant expression, i.e. an array designator
    298300                                output << "[";
    299                                 des->accept( *this );
     301                                (*iter)->accept( *this );
    300302                                output << "]";
    301303                        } // if
     
    305307
    306308        void CodeGenerator::visit( SingleInit * init ) {
     309                printDesignators( init->get_designators() );
    307310                init->get_value()->accept( *this );
    308311        }
    309312
    310313        void CodeGenerator::visit( ListInit * init ) {
    311                 auto initBegin = init->begin();
    312                 auto initEnd = init->end();
    313                 auto desigBegin = init->get_designations().begin();
    314                 auto desigEnd = init->get_designations().end();
    315 
     314                printDesignators( init->get_designators() );
    316315                output << "{ ";
    317                 for ( ; initBegin != initEnd && desigBegin != desigEnd; ) {
    318                         (*desigBegin)->accept( *this );
    319                         (*initBegin)->accept( *this );
    320                         ++initBegin, ++desigBegin;
    321                         if ( initBegin != initEnd ) {
    322                                 output << ", ";
    323                         }
    324                 }
     316                genCommaList( init->begin(), init->end() );
    325317                output << " }";
    326                 assertf( initBegin == initEnd && desigBegin == desigEnd, "Initializers and designators not the same length. %s", toString( init ).c_str() );
    327318        }
    328319
     
    725716
    726717        void CodeGenerator::visit( TypeExpr * typeExpr ) {
    727                 // if ( genC ) std::cerr << "typeexpr still exists: " << typeExpr << std::endl;
    728                 // assertf( ! genC, "TypeExpr should not reach code generation." );
    729                 if ( ! genC ) {
    730                         output<< genType( typeExpr->get_type(), "", pretty, genC );
    731                 }
     718                assertf( ! genC, "TypeExpr should not reach code generation." );
     719                output<< genType( typeExpr->get_type(), "", pretty, genC );
    732720        }
    733721
  • src/CodeGen/CodeGenerator.h

    rb826e6b rfea3faa  
    1717#define CODEGENV_H
    1818
    19 #include <list>                   // for list
    20 #include <ostream>                // for ostream, operator<<
    21 #include <string>                 // for string
     19#include <list>
    2220
    23 #include "SynTree/Declaration.h"  // for DeclarationWithType (ptr only), Fun...
    24 #include "SynTree/Visitor.h"      // for Visitor
    25 #include "SynTree/SynTree.h"      // for Visitor Nodes
     21#include "SynTree/Declaration.h"
     22#include "SynTree/SynTree.h"
     23#include "SynTree/Visitor.h"
     24
     25#include "SymTab/Indexer.h"
     26
     27#include "Common/utility.h"
    2628
    2729namespace CodeGen {
     
    4547
    4648                //*** Initializer
    47                 virtual void visit( Designation * );
    4849                virtual void visit( SingleInit * );
    4950                virtual void visit( ListInit * );
     
    136137                bool lineMarks = false;
    137138
     139                void printDesignators( std::list< Expression * > & );
    138140                void handleStorageClass( DeclarationWithType *decl );
    139141                void handleAggregate( AggregateDecl *aggDecl, const std::string & kind );
  • src/CodeGen/FixMain.cc

    rb826e6b rfea3faa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixMain.cc --
     7// FixMain.cc -- 
    88//
    99// Author           : Thierry Delisle
    1010// Created On       : Thr Jan 12 14:11:09 2017
    11 // Last Modified By :
    12 // Last Modified On :
     11// Last Modified By : 
     12// Last Modified On : 
    1313// Update Count     : 0
    1414//
    1515
    1616
    17 #include "FixMain.h"
     17#include "FixMain.h"   
    1818
    19 #include <cassert>                 // for assert, assertf
    20 #include <fstream>                 // for operator<<, basic_ostream::operator<<
    21 #include <list>                    // for list
    22 #include <string>                  // for operator<<
     19#include <fstream>
     20#include <iostream>
    2321
    24 #include "Common/SemanticError.h"  // for SemanticError
    25 #include "SynTree/Declaration.h"   // for FunctionDecl, operator<<
    26 #include "SynTree/Type.h"          // for FunctionType
     22#include "Common/SemanticError.h"
     23#include "SynTree/Declaration.h"
    2724
    2825namespace CodeGen {
    2926        bool FixMain::replace_main = false;
    3027        std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr;
    31 
    32         void FixMain::registerMain(FunctionDecl* functionDecl)
     28       
     29        void FixMain::registerMain(FunctionDecl* functionDecl) 
    3330        {
    34                 if(main_signature) {
    35                         throw SemanticError("Multiple definition of main routine\n", functionDecl);
     31                if(main_signature) { 
     32                        throw SemanticError("Multiple definition of main routine\n", functionDecl); 
    3633                }
    3734                main_signature.reset( functionDecl->clone() );
  • src/CodeGen/FixNames.cc

    rb826e6b rfea3faa  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:26:00 2017
    13 // Update Count     : 20
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Jun 21 14:22:59 2017
     13// Update Count     : 19
    1414//
    1515
     16#include <memory>
     17
    1618#include "FixNames.h"
    17 
    18 #include <memory>                  // for unique_ptr
    19 #include <string>                  // for string, operator!=, operator==
    20 
    21 #include "Common/SemanticError.h"  // for SemanticError
    22 #include "FixMain.h"               // for FixMain
    23 #include "Parser/LinkageSpec.h"    // for Cforall, isMangled
    24 #include "SymTab/Mangler.h"        // for Mangler
    25 #include "SynTree/Constant.h"      // for Constant
    26 #include "SynTree/Declaration.h"   // for FunctionDecl, ObjectDecl, Declarat...
    27 #include "SynTree/Expression.h"    // for ConstantExpr
    28 #include "SynTree/Label.h"         // for Label, noLabels
    29 #include "SynTree/Statement.h"     // for ReturnStmt, CompoundStmt
    30 #include "SynTree/Type.h"          // for Type, BasicType, Type::Qualifiers
    31 #include "SynTree/Visitor.h"       // for Visitor, acceptAll
     19#include "SynTree/Declaration.h"
     20#include "SynTree/Expression.h"
     21#include "SynTree/Visitor.h"
     22#include "SymTab/Mangler.h"
     23#include "OperatorTable.h"
     24#include "FixMain.h"
    3225
    3326namespace CodeGen {
     
    4942                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    5043                                };
    51                 main_type->get_returnVals().push_back(
     44                main_type->get_returnVals().push_back( 
    5245                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5346                );
     
    5952        std::string mangle_main_args() {
    6053                FunctionType* main_type;
    61                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
     54                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall, 
    6255                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    6356                                };
    64                 main_type->get_returnVals().push_back(
     57                main_type->get_returnVals().push_back( 
    6558                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6659                );
    6760
    68                 mainDecl->get_functionType()->get_parameters().push_back(
     61                mainDecl->get_functionType()->get_parameters().push_back( 
    6962                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    7063                );
    7164
    72                 mainDecl->get_functionType()->get_parameters().push_back(
    73                         new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
    74                         new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
     65                mainDecl->get_functionType()->get_parameters().push_back( 
     66                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, 
     67                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ), 
    7568                        nullptr )
    7669                );
     
    8275
    8376        bool is_main(const std::string& name) {
    84                 static std::string mains[] = {
    85                         mangle_main(),
     77                static std::string mains[] = { 
     78                        mangle_main(), 
    8679                        mangle_main_args()
    8780                };
     
    10093        void FixNames::fixDWT( DeclarationWithType *dwt ) {
    10194                if ( dwt->get_name() != "" ) {
    102                         if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) {
     95                        if ( LinkageSpec::isDecoratable( dwt->get_linkage() ) ) {
    10396                                dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) );
    10497                                dwt->set_scopeLevel( scopeLevel );
     
    119112                        int nargs = functionDecl->get_functionType()->get_parameters().size();
    120113                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
    121                                 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
     114                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 
    122115                        }
    123116                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) );
  • src/CodeGen/FixNames.h

    rb826e6b rfea3faa  
    1717#define FIXNAMES_H
    1818
    19 #include <list>  // for list
    20 
    21 class Declaration;
     19#include "SynTree/SynTree.h"
    2220
    2321namespace CodeGen {
  • src/CodeGen/GenType.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include <cassert>                // for assert, assertf
    17 #include <list>                   // for _List_iterator, _List_const_iterator
    18 #include <sstream>                // for operator<<, ostringstream, basic_os...
    19 
    20 #include "CodeGenerator.h"        // for CodeGenerator
     16#include <sstream>
     17#include <cassert>
     18
    2119#include "GenType.h"
    22 #include "SynTree/Declaration.h"  // for DeclarationWithType
    23 #include "SynTree/Expression.h"   // for Expression
    24 #include "SynTree/Type.h"         // for PointerType, Type, FunctionType
    25 #include "SynTree/Visitor.h"      // for Visitor
     20#include "CodeGenerator.h"
     21
     22#include "SynTree/Declaration.h"
     23#include "SynTree/Expression.h"
     24#include "SynTree/Type.h"
     25#include "SynTree/Visitor.h"
    2626
    2727namespace CodeGen {
  • src/CodeGen/GenType.h

    rb826e6b rfea3faa  
    1717#define _GENTYPE_H
    1818
    19 #include <string>  // for string
    20 
    21 class Type;
     19#include <string>
     20#include "SynTree/SynTree.h"
    2221
    2322namespace CodeGen {
  • src/CodeGen/Generate.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include <iostream>                  // for ostream, endl, operator<<
    17 #include <list>                      // for list
    18 #include <string>                    // for operator<<
     16#include <algorithm>
     17#include <iostream>
     18#include <cassert>
     19#include <list>
    1920
    20 #include "CodeGenerator.h"           // for CodeGenerator, doSemicolon, oper...
    21 #include "GenType.h"                 // for genPrettyType
    2221#include "Generate.h"
    23 #include "Parser/LinkageSpec.h"      // for isBuiltin, isGeneratable
    24 #include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
    25 #include "SynTree/Declaration.h"     // for Declaration
    26 #include "SynTree/Type.h"            // for Type
     22#include "SynTree/Declaration.h"
     23#include "CodeGenerator.h"
     24#include "GenType.h"
     25#include "SynTree/SynTree.h"
     26#include "SynTree/Type.h"
     27#include "SynTree/BaseSyntaxNode.h"
     28// #include "Tuples/Tuples.h"
    2729
    2830using namespace std;
  • src/CodeGen/Generate.h

    rb826e6b rfea3faa  
    1717#define GENERATE_H
    1818
    19 #include <iostream>  // for ostream
    20 #include <list>      // for list
     19#include <list>
     20#include <iostream>
    2121
    22 class BaseSyntaxNode;
    23 class Declaration;
     22#include "SynTree/SynTree.h"
    2423
    2524namespace CodeGen {
  • src/CodeGen/OperatorTable.cc

    rb826e6b rfea3faa  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 15 17:12:22 2017
    13 // Update Count     : 15
     12// Last Modified On : Tue Dec 13 14:33:05 2016
     13// Update Count     : 10
    1414//
    1515
    16 #include <map>      // for map, _Rb_tree_const_iterator, map<>::const_iterator
    17 #include <utility>  // for pair
    18 
     16#include <map>
    1917#include "OperatorTable.h"
    2018
     
    3533                        {       "++?",          "++",   "_operator_preincr",                    OT_PREFIXASSIGN         },
    3634                        {       "--?",          "--",   "_operator_predecr",                    OT_PREFIXASSIGN         },
    37                         {       "?\\?",         "\\",   "_operator_exponential",                OT_INFIX                        },
    3835                        {       "?*?",          "*",    "_operator_multiply",                   OT_INFIX                        },
    3936                        {       "?/?",          "/",    "_operator_divide",                             OT_INFIX                        },
     
    5350                        {       "?|?",          "|",    "_operator_bitor",                              OT_INFIX                        },
    5451                        {       "?=?",          "=",    "_operator_assign",                             OT_INFIXASSIGN          },
    55                         {       "?\\=?",        "\\=",  "_operator_expassign",                  OT_INFIXASSIGN          },
    5652                        {       "?*=?",         "*=",   "_operator_multassign",                 OT_INFIXASSIGN          },
    5753                        {       "?/=?",         "/=",   "_operator_divassign",                  OT_INFIXASSIGN          },
  • src/CodeTools/DeclStats.cc

    rb826e6b rfea3faa  
    1616#include "DeclStats.h"
    1717
    18 #include <iostream>                // for operator<<, basic_ostream, cout
    19 #include <map>                     // for map
    20 #include <string>                  // for string, operator+, operator<<, cha...
    21 #include <unordered_map>           // for unordered_map
    22 #include <unordered_set>           // for unordered_set
    23 #include <utility>                 // for pair, make_pair
    24 
    25 #include "Common/SemanticError.h"  // for SemanticError
    26 #include "Common/VectorMap.h"      // for VectorMap
    27 #include "GenPoly/GenPoly.h"       // for hasPolyBase
    28 #include "Parser/LinkageSpec.h"    // for ::NoOfSpecs, Spec
    29 #include "SynTree/Declaration.h"   // for FunctionDecl, TypeDecl, Declaration
    30 #include "SynTree/Expression.h"    // for UntypedExpr, Expression
    31 #include "SynTree/Statement.h"     // for CompoundStmt
    32 #include "SynTree/Type.h"          // for Type, FunctionType, PointerType
    33 #include "SynTree/Visitor.h"       // for maybeAccept, Visitor, acceptAll
     18#include <iostream>
     19#include <map>
     20#include <sstream>
     21#include <string>
     22#include <unordered_map>
     23#include <unordered_set>
     24
     25#include "Common/VectorMap.h"
     26#include "GenPoly/GenPoly.h"
     27#include "Parser/LinkageSpec.h"
     28#include "SynTree/Declaration.h"
     29#include "SynTree/Visitor.h"
    3430
    3531namespace CodeTools {
    36 
     32       
    3733        class DeclStats : public Visitor {
    3834                template<typename T>
     
    7975                                sum(n_types, o.n_types);
    8076                                sum(p_new, o.p_new);
    81 
     77                               
    8278                                return *this;
    8379                        }
    8480                };
    85 
     81               
    8682                struct Stats {
    8783                        unsigned n_decls;     ///< Total number of declarations
     
    10298                        /// Stats for the return list
    10399                        ArgPackStats returns;
    104 
     100                       
    105101                        /// Count of declarations with each number of assertions
    106102                        std::map<unsigned, unsigned> n_assns;
     
    109105                        /// Stats for the assertions' return types
    110106                        ArgPackStats assn_returns;
    111 
     107                       
    112108                        Stats() : n_decls(0), n_type_params(), by_name(), basic_type_names(), compound_type_names(), basic_type_decls(), compound_type_decls(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
    113109
     
    126122                                sum( assn_params, o.assn_params );
    127123                                sum( assn_returns, o.assn_returns );
    128 
     124                               
    129125                                return *this;
    130126                        }
     
    148144
    149145                                n += dt->size();
    150 
     146                               
    151147                                std::stringstream ss;
    152148                                dt->print( ss );
     
    180176                        ++pstats.n_types.at( types.size() );
    181177                }
    182 
     178               
    183179                void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) {
    184180                        std::unordered_set<std::string> seen;
     
    190186                        auto& args = expr->get_args();
    191187                        unsigned fanout = args.size();
    192 
     188                       
    193189                        ++exprs_by_fanout_at_depth[ std::make_pair(depth, fanout) ];
    194190                        for ( Expression* arg : args ) {
     
    209205                                return;
    210206                        }
    211 
     207                       
    212208                        Stats& stats = for_linkage[ decl->get_linkage() ];
    213209
     
    327323                }
    328324
    329                 void printPairMap( const std::string& name,
     325                void printPairMap( const std::string& name, 
    330326                                   const std::map<std::pair<unsigned, unsigned>, unsigned>& map ) {
    331327                        for ( const auto& entry : map ) {
    332328                                const auto& key = entry.first;
    333                                 std::cout << "\"" << name << "\"," << key.first << "," << key.second << ","
     329                                std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 
    334330                                          << entry.second << std::endl;
    335331                        }
    336332                }
    337 
     333               
    338334        public:
    339335                void print() {
     
    370366                stats.print();
    371367        }
    372 
     368       
    373369} // namespace CodeTools
    374370
  • src/CodeTools/DeclStats.h

    rb826e6b rfea3faa  
    1717#define DECLSTATS_H
    1818
    19 #include <list>  // for list
    20 
    21 class Declaration;
     19#include "SynTree/SynTree.h"
    2220
    2321namespace CodeTools {
  • src/CodeTools/TrackLoc.cc

    rb826e6b rfea3faa  
    1616#include "TrackLoc.h"
    1717
    18 #include <cstdlib>                    // for size_t, exit, EXIT_FAILURE
    19 #include <iostream>                   // for operator<<, ostream, basic_ostream
    20 #include <iterator>                   // for back_inserter, inserter
    21 #include <stack>                      // for stack
    22 #include <string>                     // for operator<<, string
    23 #include <typeindex>                  // for type_index
     18#include <cstdlib>
    2419
    25 #include "Common/PassVisitor.h"       // for PassVisitor
    26 #include "Common/PassVisitor.impl.h"  // for acceptAll
    27 #include "Common/SemanticError.h"     // for SemanticError
    28 #include "Common/utility.h"           // for CodeLocation
    29 #include "SynTree/BaseSyntaxNode.h"   // for BaseSyntaxNode
    30 #include "SynTree/Mutator.h"          // for mutateAll
    31 #include "SynTree/Visitor.h"          // for acceptAll
     20#include <iostream>
     21#include <sstream>
     22#include <stack>
     23#include <string>
     24#include <typeindex>
    3225
    33 class Declaration;
     26#include "Common/utility.h"
     27#include "Common/PassVisitor.h"
     28#include "Common/VectorMap.h"
     29#include "GenPoly/GenPoly.h"
     30#include "Parser/LinkageSpec.h"
     31#include "SynTree/Declaration.h"
     32#include "SynTree/Initializer.h"
    3433
    3534namespace CodeTools {
  • src/CodeTools/TrackLoc.h

    rb826e6b rfea3faa  
    1717#define TRACKLOC_H
    1818
    19 #include <cstddef>   // for size_t
    20 #include <list>      // for list
    21 
    22 class Declaration;
     19#include "SynTree/SynTree.h"
    2320
    2421namespace CodeTools {
  • src/Common/Assert.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include <cstdarg>  // for va_end, va_list, va_start
    17 #include <cstdio>   // for fprintf, stderr, vfprintf
    18 #include <cstdlib>  // for abort
     16#include <assert.h>
     17#include <cstdarg>                                                                              // varargs
     18#include <cstdio>                                                                               // fprintf
     19#include <cstdlib>                                                                              // abort
    1920
    2021extern const char * __progname;                                                 // global name of running executable (argv[0])
  • src/Common/PassVisitor.h

    rb826e6b rfea3faa  
    1212#include "SynTree/Expression.h"
    1313#include "SynTree/Constant.h"
    14 #include "SynTree/TypeSubstitution.h"
    1514
    1615#include "PassVisitor.proto.h"
     
    2726//                          stmtsToAddBefore or stmtsToAddAfter respectively.
    2827// | WithShortCircuiting  - provides the ability to skip visiting child nodes; set visit_children to false in pre{visit,mutate} to skip visiting children
    29 // | WithGuards           - provides the ability to save/restore data like a LIFO stack; to save, call GuardValue with the variable to save, the variable
     28// | WithScopes           - provides the ability to save/restore data like a LIFO stack; to save, call GuardValue with the variable to save, the variable
    3029//                          will automatically be restored to its previous value after the corresponding postvisit/postmutate teminates.
    3130//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    3332class PassVisitor final : public Visitor, public Mutator {
    3433public:
     34        PassVisitor() = default;
    3535
    3636        template< typename... Args >
     
    257257
    258258        void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
     259
     260        guard_value_impl init_guard() {
     261                guard_value_impl guard;
     262                auto at_cleanup = at_cleanup_impl(pass, 0);
     263                if( at_cleanup ) {
     264                        *at_cleanup = [&guard]( cleanup_func_t && func, void* val ) {
     265                                guard.push( std::move( func ), val );
     266                        };
     267                }
     268                return guard;
     269        }
    259270};
    260271
     
    272283
    273284public:
    274         TypeSubstitution * env = nullptr;
     285        TypeSubstitution * env;
    275286};
    276287
     
    284295        std::list< Statement* > stmtsToAddAfter;
    285296};
    286 
    287 class WithDeclsToAdd {
    288 protected:
    289         WithDeclsToAdd() = default;
    290         ~WithDeclsToAdd() = default;
    291 
    292 public:
    293         std::list< Declaration* > declsToAddBefore;
    294         std::list< Declaration* > declsToAddAfter;
    295 };
    296 
    297297class WithShortCircuiting {
    298298protected:
     
    304304};
    305305
    306 class WithGuards {
    307 protected:
    308         WithGuards() = default;
    309         ~WithGuards() = default;
     306class WithScopes {
     307protected:
     308        WithScopes() = default;
     309        ~WithScopes() = default;
    310310
    311311public:
     
    318318                }, static_cast< void * >( & val ) );
    319319        }
    320 
    321         template< typename T >
    322         void GuardScope( T& val ) {
    323                 val.beginScope();
    324                 at_cleanup( []( void * val ) {
    325                         static_cast< T * >( val )->endScope();
    326                 }, static_cast< void * >( & val ) );
    327         }
    328 
    329         template< typename Func >
    330         void GuardAction( Func func ) {
    331                 at_cleanup( [func](__attribute__((unused)) void *) { func(); }, nullptr );
    332         }
    333320};
    334321
     
    336323class WithVisitorRef {
    337324protected:
    338         WithVisitorRef() {}
    339         ~WithVisitorRef() {}
    340 
    341 public:
    342         PassVisitor<pass_type> * const visitor = nullptr;
     325        WithVisitorRef() = default;
     326        ~WithVisitorRef() = default;
     327
     328public:
     329        PassVisitor<pass_type> * const visitor;
    343330};
    344331
  • src/Common/PassVisitor.impl.h

    rb826e6b rfea3faa  
    33#define VISIT_START( node )                     \
    44        __attribute__((unused))                   \
    5         guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
     5        const auto & guard = init_guard();        \
    66        bool visit_children = true;               \
    77        set_visit_children( visit_children );   \
     
    1515#define MUTATE_START( node )                    \
    1616        __attribute__((unused))                   \
    17         guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
     17        const auto & guard = init_guard();        \
    1818        bool visit_children = true;               \
    1919        set_visit_children( visit_children );   \
     
    6868        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    6969                // splice in new declarations after previous decl
    70                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     70                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 
    7171
    7272                if ( i == decls.end() ) break;
     
    8888        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    8989                // splice in new declarations after previous decl
    90                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     90                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 
    9191
    9292                if ( i == decls.end() ) break;
     
    104104void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
    105105        SemanticError errors;
    106 
    107         // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    108         ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
    109         ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
    110         ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
    111         ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
    112106
    113107        StmtList_t* beforeStmts = get_beforeStmts();
     
    187181Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
    188182        return handleStatement( stmt, [this]( Statement * stmt ) {
    189                 maybeAccept( stmt, *this );
     183                maybeAccept( stmt, *this ); 
    190184                return stmt;
    191185        });
     
    218212                expr->accept( *this );
    219213                return expr;
    220         });
     214        });             
    221215}
    222216
     
    571565        VISIT_START( node );
    572566
    573         // maybeAccept( node->get_env(), *this );
    574         maybeAccept( node->get_result(), *this );
    575 
    576567        for ( auto expr : node->get_args() ) {
    577568                visitExpression( expr );
     
    584575Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
    585576        MUTATE_START( node );
    586 
    587         node->set_env( maybeMutate( node->get_env(), *this ) );
    588         node->set_result( maybeMutate( node->get_result(), *this ) );
    589577
    590578        for ( auto& expr : node->get_args() ) {
  • src/Common/PassVisitor.proto.h

    rb826e6b rfea3faa  
    55
    66typedef std::function<void( void * )> cleanup_func_t;
    7 typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
    87
    98class guard_value_impl {
    109public:
    11         guard_value_impl( at_cleanup_t * at_cleanup ) {
    12                 if( at_cleanup ) {
    13                         *at_cleanup = [this]( cleanup_func_t && func, void* val ) {
    14                                 push( std::move( func ), val );
    15                         };
    16                 }
    17         }
     10        guard_value_impl() = default;
    1811
    1912        ~guard_value_impl() {
     
    4033};
    4134
     35typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
    4236
    4337class bool_ref {
     
    6256// Deep magic (a.k.a template meta programming) to make the templated visitor work
    6357// Basically the goal is to make 2 previsit_impl
    64 // 1 - Use when a pass implements a valid previsit. This uses overloading which means the any overload of
     58// 1 - Use when a pass implements a valid previsit. This uses overloading which means the any overload of 
    6559//     'pass.previsit( node )' that compiles will be used for that node for that type
    6660//     This requires that this option only compile for passes that actually define an appropriate visit.
  • src/Common/SemanticError.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include <cstdio>            // for fileno, stderr
    17 #include <unistd.h>          // for isatty
    18 #include <iostream>          // for basic_ostream, operator<<, ostream
    19 #include <list>              // for list, _List_iterator
    20 #include <string>            // for string, operator<<, operator+, to_string
     16#include <iostream>
     17#include <list>
     18#include <string>
     19#include <algorithm>
     20#include <iterator>
    2121
    22 #include "Common/utility.h"  // for to_string, CodeLocation (ptr only)
    2322#include "SemanticError.h"
     23
     24#include <unistd.h>
    2425
    2526inline const std::string& error_str() {
  • src/Common/SemanticError.h

    rb826e6b rfea3faa  
    1717#define SEMANTICERROR_H
    1818
    19 #include <exception>  // for exception
    20 #include <iostream>   // for ostream
    21 #include <list>       // for list
    22 #include <string>     // for string
     19#include <exception>
     20#include <string>
     21#include <sstream>
     22#include <list>
     23#include <iostream>
    2324
    24 #include "utility.h"  // for CodeLocation, toString
     25#include "utility.h"
    2526
    2627struct error {
  • src/Common/utility.h

    rb826e6b rfea3faa  
    305305// for ( val : group_iterate( container1, container2, ... ) ) {}
    306306// syntax to have a for each that iterates multiple containers of the same length
    307 // TODO: update to use variadic arguments, perfect forwarding
     307// TODO: update to use variadic arguments
    308308
    309309template< typename T1, typename T2 >
  • src/Concurrency/Keywords.cc

    rb826e6b rfea3faa  
    1717#include "Concurrency/Keywords.h"
    1818
    19 #include <cassert>                 // for assert
    20 #include <string>                  // for string, operator==
    21 
    22 #include "Common/SemanticError.h"  // for SemanticError
    23 #include "Common/utility.h"        // for deleteAll, map_range
    24 #include "InitTweak/InitTweak.h"   // for isConstructor
    25 #include "Parser/LinkageSpec.h"    // for Cforall
    26 #include "SymTab/AddVisit.h"       // for acceptAndAdd
    27 #include "SynTree/Constant.h"      // for Constant
    28 #include "SynTree/Declaration.h"   // for StructDecl, FunctionDecl, ObjectDecl
    29 #include "SynTree/Expression.h"    // for VariableExpr, ConstantExpr, Untype...
    30 #include "SynTree/Initializer.h"   // for SingleInit, ListInit, Initializer ...
    31 #include "SynTree/Label.h"         // for Label
    32 #include "SynTree/Statement.h"     // for CompoundStmt, DeclStmt, ExprStmt
    33 #include "SynTree/Type.h"          // for StructInstType, Type, PointerType
    34 #include "SynTree/Visitor.h"       // for Visitor, acceptAll
    35 
    36 class Attribute;
     19#include "InitTweak/InitTweak.h"
     20#include "SymTab/AddVisit.h"
     21#include "SynTree/Declaration.h"
     22#include "SynTree/Expression.h"
     23#include "SynTree/Initializer.h"
     24#include "SynTree/Statement.h"
     25#include "SynTree/Type.h"
     26#include "SynTree/Visitor.h"
    3727
    3828namespace Concurrency {
     
    332322                if( needs_main ) {
    333323                        FunctionType * main_type = new FunctionType( noQualifiers, false );
    334 
     324                       
    335325                        main_type->get_parameters().push_back( this_decl->clone() );
    336326
     
    371361        void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) {
    372362                CompoundStmt * statement = new CompoundStmt( noLabels );
    373                 statement->push_back(
     363                statement->push_back( 
    374364                        new ReturnStmt(
    375365                                noLabels,
     
    396386        //=============================================================================================
    397387        void MutexKeyword::visit(FunctionDecl* decl) {
    398                 Visitor::visit(decl);
     388                Visitor::visit(decl);           
    399389
    400390                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
     
    520510        void ThreadStarter::visit(FunctionDecl * decl) {
    521511                Visitor::visit(decl);
    522 
     512               
    523513                if( ! InitTweak::isConstructor(decl->get_name()) ) return;
    524514
     
    538528                if( ! stmt ) return;
    539529
    540                 stmt->push_back(
     530                stmt->push_back( 
    541531                        new ExprStmt(
    542532                                noLabels,
  • src/Concurrency/Keywords.h

    rb826e6b rfea3faa  
    1818#define KEYWORDS_H
    1919
    20 #include <list>  // for list
     20#include <list>
    2121
    22 class Declaration;
     22#include "SynTree/Declaration.h"
    2323
    2424namespace Concurrency {
  • src/ControlStruct/ExceptTranslate.cc

    rb826e6b rfea3faa  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 18 10:09:00 2017
    13 // Update Count     : 4
     12// Last Modified On : Thr Jun 22 15:57:00 2017
     13// Update Count     : 0
    1414//
    1515
    1616#include "ExceptTranslate.h"
    1717#include "Common/PassVisitor.h"
    18 #include "SynTree/Statement.h"
    19 #include "SynTree/Declaration.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Type.h"
    22 #include "SynTree/Attribute.h"
    23 
    24 namespace ControlStruct {
     18
     19namespace ControlFlow {
    2520
    2621        // This (large) section could probably be moved out of the class
     
    2924        // Type(Qualifiers &, false, std::list<Attribute *> &)
    3025
    31         // void (*function)();
    32         static FunctionType try_func_t(Type::Qualifiers(), false);
     26        // void (*function)()
     27        static FunctionType void_func_t(Type::Qualifiers(), false);
    3328        // void (*function)(int, exception);
    3429        static FunctionType catch_func_t(Type::Qualifiers(), false);
     
    3732        // bool (*function)(exception);
    3833        static FunctionType handle_func_t(Type::Qualifiers(), false);
    39         // void (*function)(__attribute__((unused)) void *);
    40         static FunctionType finally_func_t(Type::Qualifiers(), false);
    4134
    4235        static void init_func_types() {
    43                 static bool init_complete = false;
     36                static init_complete = false;
    4437                if (init_complete) {
    4538                        return;
    4639                }
    4740                ObjectDecl index_obj(
    48                         "__handler_index",
     41                        "index_t",
    4942                        Type::StorageClasses(),
    5043                        LinkageSpec::Cforall,
    5144                        /*bitfieldWidth*/ NULL,
    52                         new BasicType( noQualifiers, BasicType::SignedInt ),
     45                        new BasicType(emptyQualifiers, BasicType::UnsignedInt),
    5346                        /*init*/ NULL
    54                         );
     47                );
    5548                ObjectDecl exception_obj(
    56                         "__exception_inst",
     49                        "exception_t",
    5750                        Type::StorageClasses(),
    5851                        LinkageSpec::Cforall,
    5952                        /*bitfieldWidth*/ NULL,
    60                         new PointerType(
    61                                 noQualifiers,
    62                                 new BasicType( noQualifiers, BasicType::SignedInt )
    63                                 ),
     53                        new BasicType(emptyQualifiers, BasicType::UnsignedInt),
    6454                        /*init*/ NULL
    65                         );
     55                );
    6656                ObjectDecl bool_obj(
    67                         "__ret_bool",
     57                        "bool_t",
    6858                        Type::StorageClasses(),
    6959                        LinkageSpec::Cforall,
    7060                        /*bitfieldWidth*/ NULL,
    71                         new BasicType(noQualifiers, BasicType::Bool),
     61                        new BasicType(emptyQualifiers, BasicType::Bool),
    7262                        /*init*/ NULL
    73                         );
    74                 ObjectDecl voidptr_obj(
    75                         "__hook",
    76                         Type::StorageClasses(),
    77                         LinkageSpec::Cforall,
    78                         NULL,
    79                         new PointerType(
    80                                 noQualifiers,
    81                                 new VoidType(
    82                                         noQualifiers
    83                                         ),
    84                                 std::list<Attribute *>{new Attribute("unused")}
    85                                 ),
    86                         NULL
    87                         );
    88 
    89                 catch_func_t.get_parameters().push_back( index_obj.clone() );
    90                 catch_func_t.get_parameters().push_back( exception_obj.clone() );
    91                 match_func_t.get_returnVals().push_back( index_obj.clone() );
    92                 match_func_t.get_parameters().push_back( exception_obj.clone() );
    93                 handle_func_t.get_returnVals().push_back( bool_obj.clone() );
    94                 handle_func_t.get_parameters().push_back( exception_obj.clone() );
    95                 finally_func_t.get_parameters().push_back( voidptr_obj.clone() );
     63                );
     64
     65                catch_func_t.get_parameters().push_back(index_obj.clone());
     66                catch_func_t.get_parameters().push_back(exception_obj.clone());
     67                match_func_t.get_returnVals().push_back(index_obj.clone());
     68                match_func_t.get_parameters().push_back(exception_obj.clone());
     69                handle_func_t.get_returnVals().push_back(bool_obj.clone());
     70                handle_func_t.get_parameters().push_back(exception_obj.clone());
    9671
    9772                init_complete = true;
     
    10378
    10479        void split( CatchList& allHandlers, CatchList& terHandlers,
    105                                 CatchList& resHandlers ) {
     80                    CatchList& resHandlers ) {
    10681                while ( !allHandlers.empty() ) {
    107                         CatchStmt * stmt = allHandlers.front();
     82                        Statement * stmt = allHandlers.front();
    10883                        allHandlers.pop_front();
    109                         if (CatchStmt::Terminate == stmt->get_kind()) {
     84                        if (CaseStmt::Terminate == stmt->get_kind()) {
    11085                                terHandlers.push_back(stmt);
    11186                        } else {
     
    11792        template<typename T>
    11893        void free_all( std::list<T *> &list ) {
    119                 typename std::list<T *>::iterator it;
     94                std::list<T *>::iterator it;
    12095                for ( it = list.begin() ; it != list.end() ; ++it ) {
    12196                        delete *it;
     
    125100
    126101        void appendDeclStmt( CompoundStmt * block, Declaration * item ) {
    127                 block->push_back(new DeclStmt(noLabels, item));
    128         }
    129 
    130         Expression * nameOf( DeclarationWithType * decl ) {
    131                 return new VariableExpr( decl );
     102                block->push_back(new DeclStmt(no_labels, item));
     103        }
     104
     105        Expression * nameOf( FunctionDecl * function ) {
     106                return new VariableExpr( function );
    132107        }
    133108
    134109        // ThrowStmt Mutation Helpers
    135110
    136         Statement * create_given_throw(
    137                         const char * throwFunc, ThrowStmt * throwStmt ) {
    138                 // { int NAME = EXPR; throwFunc( &NAME ); }
    139                 CompoundStmt * result = new CompoundStmt( noLabels );
    140                 ObjectDecl * local = new ObjectDecl(
    141                         "__local_exception_copy",
    142                         Type::StorageClasses(),
    143                         LinkageSpec::Cforall,
    144                         NULL,
    145                         new BasicType( noQualifiers, BasicType::SignedInt ),
    146                         new SingleInit( throwStmt->get_expr() )
    147                         );
    148                 appendDeclStmt( result, local );
    149                 UntypedExpr * call = new UntypedExpr( new NameExpr( throwFunc ) );
    150                 call->get_args().push_back( new AddressExpr( nameOf( local ) ) );
    151                 result->push_back( new ExprStmt( throwStmt->get_labels(), call ) );
     111        Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
     112                // __throw_terminate( EXPR );
     113                ApplicationExpr * call = new ApplicationExpr( /* ... */ );
     114                call->get_args.push_back( throwStmt->get_expr() );
     115                Statement * result = new ExprStmt( throwStmt->get_labels(), call );
    152116                throwStmt->set_expr( nullptr );
    153117                delete throwStmt;
    154118                return result;
    155119        }
    156 
    157         Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
    158                 // { int NAME = EXPR; __throw_terminate( &NAME ); }
    159                 return create_given_throw( "__cfaehm__throw_terminate", throwStmt );
    160         }
    161120        Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) {
    162121                // __rethrow_terminate();
    163                 assert( nullptr == throwStmt->get_expr() );
    164122                Statement * result = new ExprStmt(
    165123                        throwStmt->get_labels(),
    166                         new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminate" ) )
     124                        new ApplicationExpr( /* ... */ );
    167125                        );
    168126                delete throwStmt;
     
    171129        Statement * create_resume_throw( ThrowStmt *throwStmt ) {
    172130                // __throw_resume( EXPR );
    173                 return create_given_throw( "__cfaehm__throw_resume", throwStmt );
     131                ApplicationExpr * call = new ApplicationExpr( /* ... */ );
     132                call->get_args.push_back( throwStmt->get_expr() );
     133                Statement * result = new ExprStmt( throwStmt->get_labels(), call );
     134                throwStmt->set_expr( nullptr );
     135                delete throwStmt;
     136                return result;
    174137        }
    175138        Statement * create_resume_rethrow( ThrowStmt *throwStmt ) {
     
    177140                Statement * result = new ReturnStmt(
    178141                        throwStmt->get_labels(),
    179                         new ConstantExpr( Constant::from_bool( false ) )
     142                        new ConstantExpr(
     143                                Constant(
     144                                        new BasicType(
     145                                                Type::Qualifiers(),
     146                                                BasicType::Bool
     147                                                ),
     148                                        "0")
     149                                )
    180150                        );
    181151                delete throwStmt;
     
    190160                return block;
    191161        }
    192         FunctionDecl * create_try_wrapper( CompoundStmt *body ) {
    193 
    194                 return new FunctionDecl( "try", Type::StorageClasses(),
    195                         LinkageSpec::Cforall, try_func_t.clone(), body );
     162        FunctionDecl * create_try_wrapper( TryStmt *tryStmt ) {
     163                CompoundStmt * body = base_try->get_block();
     164                base_try->set_block(nullptr);
     165
     166                return new FunctionDecl("try", Type::StorageClasses(),
     167                        LinkageSpec::Cforall, void_func_t, body);
    196168        }
    197169
    198170        FunctionDecl * create_terminate_catch( CatchList &handlers ) {
    199171                std::list<CaseStmt *> handler_wrappers;
    200 
    201                 FunctionType *func_type = catch_func_t.clone();
    202                 DeclarationWithType * index_obj = func_type->get_parameters().front();
    203         //      DeclarationWithType * except_obj = func_type->get_parameters().back();
    204172
    205173                // Index 1..{number of handlers}
     
    210178                        CatchStmt * handler = *it;
    211179
    212                         // INTEGERconstant Version
    213                         // case `index`:
    214                         // {
    215                         //     `handler.body`
    216                         // }
    217                         // return;
    218                         std::list<Statement *> caseBody;
    219                         caseBody.push_back( handler->get_body() );
    220                         handler->set_body( nullptr );
    221                         caseBody.push_back( new ReturnStmt( noLabels, nullptr ) );
    222 
    223                         handler_wrappers.push_back( new CaseStmt(
     180                        std::list<Statement *> core;
     181                        if ( /*the exception is named*/ ) {
     182                                ObjectDecl * local_except = /* Dynamic case, same */;
     183                                core->push_back( new DeclStmt( noLabel, local_except ) );
     184                        }
     185                        // Append the provided statement to the handler.
     186                        core->push_back( cur_handler->get_body() );
     187                        // Append return onto the inner block? case stmt list?
     188                        CaseStmt * wrapper = new CaseStmt(
    224189                                noLabels,
    225190                                new ConstantExpr( Constant::from_int( index ) ),
    226                                 caseBody
    227                                 ) );
     191                                core
     192                                );
     193                        handler_wrappers.push_back(wrapper);
    228194                }
    229195                // TODO: Some sort of meaningful error on default perhaps?
    230 
    231                 std::list<Statement*> stmt_handlers;
    232                 while ( !handler_wrappers.empty() ) {
    233                         stmt_handlers.push_back( handler_wrappers.front() );
    234                         handler_wrappers.pop_front();
    235                 }
    236196
    237197                SwitchStmt * handler_lookup = new SwitchStmt(
    238198                        noLabels,
    239                         nameOf( index_obj ),
    240                         stmt_handlers
     199                        /*parameter 0: index*/,
     200                        handler_wrappers,
     201                        false
    241202                        );
    242203                CompoundStmt * body = new CompoundStmt( noLabels );
     
    244205
    245206                return new FunctionDecl("catch", Type::StorageClasses(),
    246                         LinkageSpec::Cforall, func_type, body);
     207                        LinkageSpec::Cforall, catch_func_t, body);
    247208        }
    248209
    249210        // Create a single check from a moddified handler.
    250         // except_obj is referenced, modded_handler will be freed.
    251         CompoundStmt *create_single_matcher(
    252                         DeclarationWithType * except_obj, CatchStmt * modded_handler ) {
    253                 CompoundStmt * block = new CompoundStmt( noLabels );
    254 
    255                 // INTEGERconstant Version
    256                 assert( nullptr == modded_handler->get_decl() );
    257                 ConstantExpr * number =
    258                         dynamic_cast<ConstantExpr*>( modded_handler->get_cond() );
    259                 assert( number );
    260                 modded_handler->set_cond( nullptr );
    261 
    262                 Expression * cond;
    263                 {
    264                         std::list<Expression *> args;
    265                         args.push_back( number );
    266 
    267                         std::list<Expression *> rhs_args;
    268                         rhs_args.push_back( nameOf( except_obj ) );
    269                         Expression * rhs = new UntypedExpr(
    270                                 new NameExpr( "*?" ), rhs_args );
    271                         args.push_back( rhs );
    272 
    273                         cond = new UntypedExpr( new NameExpr( "?==?" /*???*/), args );
    274                 }
     211        CompoundStmt *create_single_matcher( CatchStmt * modded_handler ) {
     212                CompoundStmt * block = new CompoundStmt( noLables );
     213
     214                appendDeclStmt( block, modded_handler->get_decl() );
     215
     216                // TODO: This is not the actual check.
     217                LogicalExpr * cond = new ConstantExpr( Constant::from_bool( false ) );
    275218
    276219                if ( modded_handler->get_cond() ) {
    277                         cond = new LogicalExpr( cond, modded_handler->get_cond() );
     220                        cond = new LogicalExpr( cond, modded_handler->get_cond() )q
    278221                }
    279222                block->push_back( new IfStmt( noLabels,
    280                         cond, modded_handler->get_body(), nullptr ) );
     223                        cond, modded_handler->get_body() );
    281224
    282225                modded_handler->set_decl( nullptr );
     
    289232        FunctionDecl * create_terminate_match( CatchList &handlers ) {
    290233                CompoundStmt * body = new CompoundStmt( noLabels );
    291 
    292                 FunctionType * func_type = match_func_t.clone();
    293                 DeclarationWithType * except_obj = func_type->get_parameters().back();
    294234
    295235                // Index 1..{number of handlers}
     
    300240                        CatchStmt * handler = *it;
    301241
    302                         // Body should have been taken by create_terminate_catch.
    303                         assert( nullptr == handler->get_body() );
    304 
    305                         // Create new body.
     242                        // body should have been taken by create_terminate_catch.
     243                        // assert( nullptr == handler->get_body() );
    306244                        handler->set_body( new ReturnStmt( noLabels,
    307245                                new ConstantExpr( Constant::from_int( index ) ) ) );
    308246
    309                         // Create the handler.
    310                         body->push_back( create_single_matcher( except_obj, handler ) );
    311                         *it = nullptr;
    312                 }
    313 
    314                 body->push_back( new ReturnStmt( noLabels, new ConstantExpr(
    315                         Constant::from_int( 0 ) ) ) );
     247                        body->push_back( create_single_matcher( handler ) );
     248                }
    316249
    317250                return new FunctionDecl("match", Type::StorageClasses(),
    318                         LinkageSpec::Cforall, func_type, body);
    319         }
    320 
    321         CompoundStmt * create_terminate_caller(
     251                        LinkageSpec::Cforall, match_func_t, body);
     252        }
     253
     254        Statement * create_terminate_caller(
    322255                        FunctionDecl * try_wrapper,
    323256                        FunctionDecl * terminate_catch,
    324257                        FunctionDecl * terminate_match) {
    325258
    326                 UntypedExpr * caller = new UntypedExpr( new NameExpr(
    327                         "__cfaehm__try_terminate" ) );
    328                 std::list<Expression *>& args = caller->get_args();
     259                ApplicationExpr * caller = new ApplicationExpr( /* ... */ );
     260                std::list<Expression *>& args = caller.get_args();
    329261                args.push_back( nameOf( try_wrapper ) );
    330262                args.push_back( nameOf( terminate_catch ) );
    331263                args.push_back( nameOf( terminate_match ) );
    332264
    333                 CompoundStmt * callStmt = new CompoundStmt( noLabels );
    334                 callStmt->push_back( new ExprStmt( noLabels, caller ) );
    335                 return callStmt;
     265                return new ExprStmt( noLabels, caller );
    336266        }
    337267
    338268        FunctionDecl * create_resume_handler( CatchList &handlers ) {
    339                 CompoundStmt * body = new CompoundStmt( noLabels );
    340 
    341                 FunctionType * func_type = match_func_t.clone();
    342                 DeclarationWithType * except_obj = func_type->get_parameters().back();
     269                CompoundStmt * body = new CompountStmt( noLabels );
    343270
    344271                CatchList::iterator it;
     
    353280                                handling_code->push_back( handler->get_body() );
    354281                        }
    355                         handling_code->push_back( new ReturnStmt( noLabels,
    356                                 new ConstantExpr( Constant::from_bool( true ) ) ) );
     282                        handling_code->push_back( new ReturnStmt( noLabel,
     283                                new ConstantExpr( Constant::from_bool( false ) ) ) );
    357284                        handler->set_body( handling_code );
    358285
    359286                        // Create the handler.
    360                         body->push_back( create_single_matcher( except_obj, handler ) );
    361                         *it = nullptr;
    362                 }
    363 
    364                 body->push_back( new ReturnStmt( noLabels, new ConstantExpr(
    365                         Constant::from_bool( false ) ) ) );
     287                        body->push_back( create_single_matcher( handler ) );
     288                }
    366289
    367290                return new FunctionDecl("handle", Type::StorageClasses(),
    368                         LinkageSpec::Cforall, func_type, body);
    369         }
    370 
    371         CompoundStmt * create_resume_wrapper(
    372                         StructDecl * node_decl,
     291                        LinkageSpec::Cforall, handle_func_t, body);
     292        }
     293
     294        Statement * create_resume_wrapper(
    373295                        Statement * wraps,
    374296                        FunctionDecl * resume_handler ) {
    375297                CompoundStmt * body = new CompoundStmt( noLabels );
    376298
    377                 // struct __try_resume_node __resume_node
    378                 //      __attribute__((cleanup( __cfaehm__try_resume_cleanup )));
    379                 // ** unwinding of the stack here could cause problems **
    380                 // ** however I don't think that can happen currently **
    381                 // __cfaehm__try_resume_setup( &__resume_node, resume_handler );
     299                // struct node = {current top resume handler, call to resume_handler};
     300                // __attribute__((cleanup( ... )));
     301                // set top resume handler to node.
     302                // The wrapped statement.
     303
     304                ListInit * node_init;
     305                {
     306                        std::list<Initializer*> field_inits;
     307                        field_inits.push_back( new SingleInit( /* ... */ ) );
     308                        field_inits.push_back( new SingleInit( nameOf( resume_handler ) ) );
     309                        node_init = new ListInit( field_inits );
     310                }
    382311
    383312                std::list< Attribute * > attributes;
    384313                {
    385314                        std::list< Expression * > attr_params;
    386                         attr_params.push_back( new NameExpr(
    387                                 "__cfaehm__try_resume_cleanup" ) );
    388                         attributes.push_back( new Attribute( "cleanup", attr_params ) );
    389                 }
    390 
    391                 ObjectDecl * obj = new ObjectDecl(
    392                         "__resume_node",
     315                        attr_params.push_back( nameOf( /* ... deconstructor ... */ ) );
     316                        attrributes.push_back( new Attribute( "cleanup", attr_params ) );
     317                }
     318
     319                appendDeclStmt( body,
     320                /**/ ObjectDecl(
     321                        "resume_node",
    393322                        Type::StorageClasses(),
    394323                        LinkageSpec::Cforall,
    395324                        nullptr,
    396                         new StructInstType(
    397                                 Type::Qualifiers(),
    398                                 node_decl
    399                                 ),
    400                         nullptr,
     325                        /* Type* = resume_node */,
     326                        node_init,
    401327                        attributes
    402                         );
    403                 appendDeclStmt( body, obj );
    404 
    405                 UntypedExpr *setup = new UntypedExpr( new NameExpr(
    406                         "__cfaehm__try_resume_setup" ) );
    407                 setup->get_args().push_back( new AddressExpr( nameOf( obj ) ) );
    408                 setup->get_args().push_back( nameOf( resume_handler ) );
    409 
    410                 body->push_back( new ExprStmt( noLabels, setup ) );
    411 
     328                        )
     329                );
    412330                body->push_back( wraps );
    413331                return body;
     
    415333
    416334        FunctionDecl * create_finally_wrapper( TryStmt * tryStmt ) {
    417                 FinallyStmt * finally = tryStmt->get_finally();
    418                 CompoundStmt * body = finally->get_block();
    419                 finally->set_block( nullptr );
    420                 delete finally;
     335                CompoundStmt * body = tryStmt->get_finally();
    421336                tryStmt->set_finally( nullptr );
    422337
    423338                return new FunctionDecl("finally", Type::StorageClasses(),
    424                         LinkageSpec::Cforall, finally_func_t.clone(), body);
    425         }
    426 
    427         ObjectDecl * create_finally_hook(
    428                         StructDecl * hook_decl, FunctionDecl * finally_wrapper ) {
    429                 // struct __cfaehm__cleanup_hook __finally_hook
    430                 //      __attribute__((cleanup( finally_wrapper )));
     339                        LinkageSpec::Cforall, void_func_t, body);
     340        }
     341
     342        ObjectDecl * create_finally_hook( FunctionDecl * finally_wrapper ) {
     343                // struct _cleanup_hook NAME __attribute__((cleanup( ... )));
    431344
    432345                // Make Cleanup Attribute.
     
    435348                        std::list< Expression * > attr_params;
    436349                        attr_params.push_back( nameOf( finally_wrapper ) );
    437                         attributes.push_back( new Attribute( "cleanup", attr_params ) );
    438                 }
    439 
    440                 return new ObjectDecl(
    441                         "__finally_hook",
     350                        attrributes.push_back( new Attribute( "cleanup", attr_params ) );
     351                }
     352
     353                return ObjectDecl( /* ... */
     354                        const std::string &name "finally_hook",
    442355                        Type::StorageClasses(),
    443356                        LinkageSpec::Cforall,
    444357                        nullptr,
    445                         new StructInstType(
    446                                 noQualifiers,
    447                                 hook_decl
    448                                 ),
     358                        /* ... Type * ... */,
    449359                        nullptr,
    450360                        attributes
     
    453363
    454364
    455         class ExceptionMutatorCore : public WithGuards {
     365        class ExceptionMutatorCore : public WithScoping {
    456366                enum Context { NoHandler, TerHandler, ResHandler };
    457367
     
    460370                // loop, switch or the goto stays within the function.
    461371
    462                 Context cur_context;
     372                Context curContext;
    463373
    464374                // We might not need this, but a unique base for each try block's
     
    467377                //unsigned int try_count = 0;
    468378
    469                 StructDecl *node_decl;
    470                 StructDecl *hook_decl;
    471379
    472380        public:
    473381                ExceptionMutatorCore() :
    474                         cur_context(NoHandler),
    475                         node_decl(nullptr), hook_decl(nullptr)
     382                        curContext(NoHandler)
    476383                {}
    477384
    478                 void premutate( CatchStmt *catchStmt );
    479                 void premutate( StructDecl *structDecl );
     385                void premutate( CatchStmt *tryStmt );
    480386                Statement * postmutate( ThrowStmt *throwStmt );
    481387                Statement * postmutate( TryStmt *tryStmt );
     
    487393                        if ( throwStmt->get_expr() ) {
    488394                                return create_terminate_throw( throwStmt );
    489                         } else if ( TerHandler == cur_context ) {
     395                        } else if ( TerHandler == curContext ) {
    490396                                return create_terminate_rethrow( throwStmt );
    491397                        } else {
    492398                                assertf(false, "Invalid throw in %s at %i\n",
    493                                         throwStmt->location.filename.c_str(),
     399                                        throwStmt->location.filename,
    494400                                        throwStmt->location.linenumber);
    495401                                return nullptr;
     
    498404                        if ( throwStmt->get_expr() ) {
    499405                                return create_resume_throw( throwStmt );
    500                         } else if ( ResHandler == cur_context ) {
     406                        } else if ( ResHandler == curContext ) {
    501407                                return create_resume_rethrow( throwStmt );
    502408                        } else {
    503409                                assertf(false, "Invalid throwResume in %s at %i\n",
    504                                         throwStmt->location.filename.c_str(),
     410                                        throwStmt->location.filename,
    505411                                        throwStmt->location.linenumber);
    506412                                return nullptr;
     
    510416
    511417        Statement * ExceptionMutatorCore::postmutate( TryStmt *tryStmt ) {
    512                 assert( node_decl );
    513                 assert( hook_decl );
    514 
    515418                // Generate a prefix for the function names?
    516419
    517                 CompoundStmt * block = new CompoundStmt( noLabels );
    518                 CompoundStmt * inner = take_try_block( tryStmt );
     420                CompoundStmt * block = new CompoundStmt();
     421                Statement * inner = take_try_block( tryStmt );
    519422
    520423                if ( tryStmt->get_finally() ) {
     
    524427                        appendDeclStmt( block, finally_block );
    525428                        // Create and add the finally cleanup hook.
    526                         appendDeclStmt( block,
    527                                 create_finally_hook( hook_decl, finally_block ) );
    528                 }
    529 
    530                 CatchList termination_handlers;
    531                 CatchList resumption_handlers;
    532                 split( tryStmt->get_catchers(),
    533                            termination_handlers, resumption_handlers );
    534 
    535                 if ( resumption_handlers.size() ) {
     429                        appendDeclStmt( block, create_finally_hook( finally_block ) );
     430                }
     431
     432                StatementList termination_handlers;
     433                StatementList resumption_handlers;
     434                split( tryStmt->get_handlers(),
     435                       termination_handlers, resumption_handlers );
     436
     437                if ( resumeption_handlers.size() ) {
    536438                        // Define the helper function.
    537439                        FunctionDecl * resume_handler =
     
    539441                        appendDeclStmt( block, resume_handler );
    540442                        // Prepare hooks
    541                         inner = create_resume_wrapper( node_decl, inner, resume_handler );
     443                        inner = create_resume_wrapper( inner, resume_handler );
    542444                }
    543445
     
    560462                block->push_back( inner );
    561463
    562                 //free_all( termination_handlers );
    563                 //free_all( resumption_handlers );
     464                free_all( termination_handlers );
     465                free_all( resumption_handlers );
    564466
    565467                return block;
     
    567469
    568470        void ExceptionMutatorCore::premutate( CatchStmt *catchStmt ) {
    569                 GuardValue( cur_context );
    570                 if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
    571                         cur_context = TerHandler;
     471                GuardValue( curContext );
     472                if ( CatchStmt::Termination == catchStmt->get_kind() ) {
     473                        curContext = TerHandler;
    572474                } else {
    573                         cur_context = ResHandler;
    574                 }
    575         }
    576 
    577         void ExceptionMutatorCore::premutate( StructDecl *structDecl ) {
    578                 if ( !structDecl->has_body() ) {
    579                         // Skip children?
    580                         return;
    581                 } else if ( structDecl->get_name() == "__cfaehm__try_resume_node" ) {
    582                         assert( nullptr == node_decl );
    583                         node_decl = structDecl;
    584                 } else if ( structDecl->get_name() == "__cfaehm__cleanup_hook" ) {
    585                         assert( nullptr == hook_decl );
    586                         hook_decl = structDecl;
    587                 }
    588                 // Later we might get the exception type as well.
    589         }
    590 
    591         void translateEHM( std::list< Declaration *> & translationUnit ) {
    592                 init_func_types();
    593 
     475                        curContext = ResHandler;
     476                }
     477        }
     478
     479    void translateEHM( std::list< Declaration *> & translationUnit ) {
    594480                PassVisitor<ExceptionMutatorCore> translator;
    595                 mutateAll( translationUnit, translator );
     481                for ( Declaration * decl : translationUnit ) {
     482                        decl->mutate( translator );
     483                }
    596484        }
    597485}
  • src/ControlStruct/ExceptTranslate.h

    rb826e6b rfea3faa  
    1010// Created On       : Tus Jun 06 10:13:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jun 30 10:20:00 2017
    13 // Update Count     : 2
     12// Last Modified On : Thr Jun 22 15:57:00 2017
     13// Update Count     : 0
    1414//
    1515
     
    1717#define EXCEPT_TRANSLATE_H
    1818
    19 #include <list>
    20 #include "SynTree/SynTree.h"
    21 
    22 namespace ControlStruct {
     19namespace ControlFlow {
    2320        void translateEHM( std::list< Declaration *> & translationUnit );
    2421        /* Converts exception handling structures into their underlying C code.
  • src/ControlStruct/module.mk

    rb826e6b rfea3faa  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jun 28 16:15:00 2017
    14 ## Update Count     : 4
     12## Last Modified By : Peter A. Buhr
     13## Last Modified On : Thu Aug  4 11:38:06 2016
     14## Update Count     : 3
    1515###############################################################################
    1616
    1717SRC +=  ControlStruct/LabelGenerator.cc \
    1818        ControlStruct/LabelFixer.cc \
    19         ControlStruct/MLEMutator.cc \
     19        ControlStruct/MLEMutator.cc \
    2020        ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc \
    22         ControlStruct/ExceptTranslate.cc
     21        ControlStruct/ForExprMutator.cc
     22
  • src/GenPoly/Box.cc

    rb826e6b rfea3faa  
    506506                DeclarationWithType *Pass1::mutate( FunctionDecl *functionDecl ) {
    507507                        if ( functionDecl->get_statements() ) {         // empty routine body ?
    508                                 // std::cerr << "mutating function: " << functionDecl->get_mangleName() << std::endl;
    509508                                doBeginScope();
    510509                                scopeTyVars.beginScope();
     
    551550                                retval = oldRetval;
    552551                                doEndScope();
    553                                 // std::cerr << "end function: " << functionDecl->get_mangleName() << std::endl;
    554552                        } // if
    555553                        return functionDecl;
     
    11201118
    11211119                Expression *Pass1::mutate( ApplicationExpr *appExpr ) {
    1122                         // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;
     1120                        // std::cerr << "mutate appExpr: ";
    11231121                        // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
    11241122                        //      std::cerr << i->first << " ";
     
    11451143                        ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
    11461144
    1147                         // std::cerr << function << std::endl;
    1148                         // std::cerr << "scopeTyVars: ";
    1149                         // printTyVarMap( std::cerr, scopeTyVars );
    1150                         // std::cerr << "exprTyVars: ";
    1151                         // printTyVarMap( std::cerr, exprTyVars );
    1152                         // std::cerr << "env: " << *env << std::endl;
    1153                         // std::cerr << needsAdapter( function, scopeTyVars ) << ! needsAdapter( function, exprTyVars) << std::endl;
    1154 
    11551145                        // NOTE: addDynRetParam needs to know the actual (generated) return type so it can make a temp variable, so pass the result type from the appExpr
    11561146                        // passTypeVars needs to know the program-text return type (i.e. the distinction between _conc_T30 and T3(int))
    11571147                        // concRetType may not be a good name in one or both of these places. A more appropriate name change is welcome.
    11581148                        if ( dynRetType ) {
    1159                                 // std::cerr << "dynRetType: " << dynRetType << std::endl;
    11601149                                Type *concRetType = appExpr->get_result()->isVoid() ? nullptr : appExpr->get_result();
    11611150                                ret = addDynRetParam( appExpr, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType
  • src/GenPoly/InstantiateGeneric.cc

    rb826e6b rfea3faa  
    2222#include "InstantiateGeneric.h"
    2323
     24#include "DeclMutator.h"
    2425#include "GenPoly.h"
    2526#include "ScopedSet.h"
    2627#include "ScrubTyVars.h"
    27 
    28 #include "Common/PassVisitor.h"
     28#include "PolyMutator.h"
     29
     30#include "ResolvExpr/typeops.h"
     31
     32#include "SynTree/Declaration.h"
     33#include "SynTree/Expression.h"
     34#include "SynTree/Type.h"
     35
    2936#include "Common/ScopedMap.h"
    3037#include "Common/UniqueName.h"
    3138#include "Common/utility.h"
    32 
    33 #include "ResolvExpr/typeops.h"
    34 
    35 #include "SynTree/Declaration.h"
    36 #include "SynTree/Expression.h"
    37 #include "SynTree/Type.h"
    38 
    39 
    40 #include "InitTweak/InitTweak.h"
    41 
    4239
    4340namespace GenPoly {
     
    156153        }
    157154
     155        // collect the environments of each TypeInstType so that type variables can be replaced
     156        // xxx - possibly temporary solution. Access to type environments is required in GenericInstantiator, but it needs to be a DeclMutator which does not provide easy access to the type environments.
     157        class EnvFinder final : public GenPoly::PolyMutator {
     158        public:
     159                using GenPoly::PolyMutator::mutate;
     160                virtual Type * mutate( TypeInstType * inst ) override {
     161                        if ( env ) envMap[inst] = env;
     162                        return inst;
     163                }
     164
     165                // don't want to associate an environment with TypeInstTypes that occur in function types - this may actually only apply to function types belonging to DeclarationWithTypes (or even just FunctionDecl)?
     166                virtual Type * mutate( FunctionType * ftype ) override {
     167                        return ftype;
     168                }
     169                std::unordered_map< ReferenceToType *, TypeSubstitution * > envMap;
     170        };
     171
    158172        /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately
    159         struct GenericInstantiator final : public WithTypeSubstitution, public WithDeclsToAdd, public WithVisitorRef<GenericInstantiator>, public WithGuards {
     173        class GenericInstantiator final : public DeclMutator {
    160174                /// Map of (generic type, parameter list) pairs to concrete type instantiations
    161175                InstantiationMap< AggregateDecl, AggregateDecl > instantiations;
     
    164178                /// Namer for concrete types
    165179                UniqueName typeNamer;
    166                 /// Should not make use of type environment to replace types of function parameter and return values.
    167                 bool inFunctionType = false;
    168                 GenericInstantiator() : instantiations(), dtypeStatics(), typeNamer("_conc_") {}
    169 
    170                 Type* postmutate( StructInstType *inst );
    171                 Type* postmutate( UnionInstType *inst );
    172 
    173                 void premutate( __attribute__((unused)) FunctionType * ftype ) {
    174                         GuardValue( inFunctionType );
    175                         inFunctionType = true;
    176                 }
    177 
    178                 void beginScope();
    179                 void endScope();
     180                /// Reference to mapping of environments
     181                const std::unordered_map< ReferenceToType *, TypeSubstitution * > & envMap;
     182        public:
     183                GenericInstantiator( const std::unordered_map< ReferenceToType *, TypeSubstitution * > & envMap ) : DeclMutator(), instantiations(), dtypeStatics(), typeNamer("_conc_"), envMap( envMap ) {}
     184
     185                using DeclMutator::mutate;
     186                virtual Type* mutate( StructInstType *inst ) override;
     187                virtual Type* mutate( UnionInstType *inst ) override;
     188
     189                virtual void doBeginScope() override;
     190                virtual void doEndScope() override;
    180191        private:
    181192                /// Wrap instantiation lookup for structs
     
    196207
    197208        void instantiateGeneric( std::list< Declaration* > &translationUnit ) {
    198                 PassVisitor<GenericInstantiator> instantiator;
    199                 mutateAll( translationUnit, instantiator );
     209                EnvFinder finder;
     210                mutateAll( translationUnit, finder );
     211                GenericInstantiator instantiator( finder.envMap );
     212                instantiator.mutateDeclarationList( translationUnit );
    200213        }
    201214
     
    293306        Type *GenericInstantiator::replaceWithConcrete( Type *type, bool doClone ) {
    294307                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) {
    295                         if ( env && ! inFunctionType ) {
     308                        if ( envMap.count( typeInst ) ) {
     309                                TypeSubstitution * env = envMap.at( typeInst );
    296310                                Type *concrete = env->lookup( typeInst->get_name() );
    297311                                if ( concrete ) {
     
    317331
    318332
    319         Type* GenericInstantiator::postmutate( StructInstType *inst ) {
     333        Type* GenericInstantiator::mutate( StructInstType *inst ) {
     334                // mutate subtypes
     335                Type *mutated = Mutator::mutate( inst );
     336                inst = dynamic_cast< StructInstType* >( mutated );
     337                if ( ! inst ) return mutated;
     338
    320339                // exit early if no need for further mutation
    321340                if ( inst->get_parameters().empty() ) return inst;
     
    349368                                substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
    350369                                insert( inst, typeSubs, concDecl ); // must insert before recursion
    351                                 concDecl->acceptMutator( *visitor ); // recursively instantiate members
    352                                 declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first
     370                                concDecl->acceptMutator( *this ); // recursively instantiate members
     371                                DeclMutator::addDeclaration( concDecl ); // must occur before declaration is added so that member instantiations appear first
    353372                        }
    354373                        StructInstType *newInst = new StructInstType( inst->get_qualifiers(), concDecl->get_name() );
     
    369388        }
    370389
    371         Type* GenericInstantiator::postmutate( UnionInstType *inst ) {
     390        Type* GenericInstantiator::mutate( UnionInstType *inst ) {
     391                // mutate subtypes
     392                Type *mutated = Mutator::mutate( inst );
     393                inst = dynamic_cast< UnionInstType* >( mutated );
     394                if ( ! inst ) return mutated;
     395
    372396                // exit early if no need for further mutation
    373397                if ( inst->get_parameters().empty() ) return inst;
     
    399423                                substituteMembers( inst->get_baseUnion()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
    400424                                insert( inst, typeSubs, concDecl ); // must insert before recursion
    401                                 concDecl->acceptMutator( *visitor ); // recursively instantiate members
    402                                 declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first
     425                                concDecl->acceptMutator( *this ); // recursively instantiate members
     426                                DeclMutator::addDeclaration( concDecl ); // must occur before declaration is added so that member instantiations appear first
    403427                        }
    404428                        UnionInstType *newInst = new UnionInstType( inst->get_qualifiers(), concDecl->get_name() );
     
    418442        }
    419443
    420         void GenericInstantiator::beginScope() {
     444        void GenericInstantiator::doBeginScope() {
     445                DeclMutator::doBeginScope();
    421446                instantiations.beginScope();
    422447                dtypeStatics.beginScope();
    423448        }
    424449
    425         void GenericInstantiator::endScope() {
     450        void GenericInstantiator::doEndScope() {
     451                DeclMutator::doEndScope();
    426452                instantiations.endScope();
    427453                dtypeStatics.endScope();
  • src/InitTweak/FixInit.cc

    rb826e6b rfea3faa  
    104104                        typedef AddStmtVisitor Parent;
    105105                        using Parent::visit;
    106                         // use ordered data structure to maintain ordering for set_difference and for consistent error messages
    107                         typedef std::list< ObjectDecl * > ObjectSet;
     106                        typedef std::set< ObjectDecl * > ObjectSet;
    108107                        virtual void visit( CompoundStmt *compoundStmt ) override;
    109108                        virtual void visit( DeclStmt *stmt ) override;
     
    117116
    118117                // debug
    119                 template<typename ObjectSet>
    120                 struct PrintSet {
    121                         PrintSet( const ObjectSet & objs ) : objs( objs ) {}
     118                struct printSet {
     119                        typedef ObjDeclCollector::ObjectSet ObjectSet;
     120                        printSet( const ObjectSet & objs ) : objs( objs ) {}
    122121                        const ObjectSet & objs;
    123122                };
    124                 template<typename ObjectSet>
    125                 PrintSet<ObjectSet> printSet( const ObjectSet & objs ) { return PrintSet<ObjectSet>( objs ); }
    126                 template<typename ObjectSet>
    127                 std::ostream & operator<<( std::ostream & out, const PrintSet<ObjectSet> & set) {
     123                std::ostream & operator<<( std::ostream & out, const printSet & set) {
    128124                        out << "{ ";
    129125                        for ( ObjectDecl * obj : set.objs ) {
     
    728724                                                // static bool __objName_uninitialized = true
    729725                                                BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    730                                                 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant::from_int( 1 ) ) );
     726                                                SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant::from_int( 1 ) ), noDesignators );
    731727                                                ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );
    732728                                                isUninitializedVar->fixUniqueId();
     
    749745
    750746                                                Statement * dtor = ctorInit->get_dtor();
    751                                                 objDecl->set_init( nullptr );
    752                                                 ctorInit->set_ctor( nullptr );
     747                                                objDecl->set_init( NULL );
     748                                                ctorInit->set_ctor( NULL );
    753749                                                ctorInit->set_dtor( nullptr );
    754750                                                if ( dtor ) {
     
    803799                                                } else {
    804800                                                        stmtsToAddAfter.push_back( ctor );
    805                                                         objDecl->set_init( nullptr );
    806                                                         ctorInit->set_ctor( nullptr );
     801                                                        objDecl->set_init( NULL );
     802                                                        ctorInit->set_ctor( NULL );
    807803                                                }
    808804                                        } // if
    809805                                } else if ( Initializer * init = ctorInit->get_init() ) {
    810806                                        objDecl->set_init( init );
    811                                         ctorInit->set_init( nullptr );
     807                                        ctorInit->set_init( NULL );
    812808                                } else {
    813809                                        // no constructor and no initializer, which is okay
    814                                         objDecl->set_init( nullptr );
     810                                        objDecl->set_init( NULL );
    815811                                } // if
    816812                                delete ctorInit;
     
    820816
    821817                void ObjDeclCollector::visit( CompoundStmt * compoundStmt ) {
    822                         ObjectSet prevVars = curVars;
     818                        std::set< ObjectDecl * > prevVars = curVars;
    823819                        Parent::visit( compoundStmt );
    824820                        curVars = prevVars;
     
    828824                        // keep track of all variables currently in scope
    829825                        if ( ObjectDecl * objDecl = dynamic_cast< ObjectDecl * > ( stmt->get_decl() ) ) {
    830                                 curVars.push_back( objDecl );
     826                                curVars.insert( objDecl );
    831827                        } // if
    832828                        Parent::visit( stmt );
     
    943939                        )
    944940                        if ( ! diff.empty() ) {
    945                                 // create an auxilliary set for fast lookup -- can't make diff a set, because diff ordering should be consistent for error messages.
    946                                 std::unordered_set<ObjectDecl *> needsDestructor( diff.begin(), diff.end() );
    947 
    948941                                // go through decl ordered list of objectdecl. for each element that occurs in diff, output destructor
    949942                                OrderedDecls ordered;
    950943                                for ( OrderedDecls & rdo : reverseDeclOrder ) {
    951944                                        // add elements from reverseDeclOrder into ordered if they occur in diff - it is key that this happens in reverse declaration order.
    952                                         copy_if( rdo.begin(), rdo.end(), back_inserter( ordered ), [&]( ObjectDecl * objDecl ) { return needsDestructor.count( objDecl ); } );
     945                                        copy_if( rdo.begin(), rdo.end(), back_inserter( ordered ), [&]( ObjectDecl * objDecl ) { return diff.count( objDecl ); } );
    953946                                } // for
    954947                                insertDtors( ordered.begin(), ordered.end(), back_inserter( stmtsToAdd ) );
  • src/InitTweak/GenInit.cc

    rb826e6b rfea3faa  
    4444        }
    4545
    46         struct ReturnFixer : public WithStmtsToAdd, public WithGuards {
     46        class ReturnFixer : public WithStmtsToAdd, public WithScopes {
     47          public:
    4748                /// consistently allocates a temporary variable for the return value
    4849                /// of a function so that anything which the resolver decides can be constructed
     
    5859        };
    5960
    60         struct CtorDtor : public WithGuards, public WithShortCircuiting  {
     61        class CtorDtor final : public GenPoly::PolyMutator {
     62          public:
     63                typedef GenPoly::PolyMutator Parent;
     64                using Parent::mutate;
    6165                /// create constructor and destructor statements for object declarations.
    6266                /// the actual call statements will be added in after the resolver has run
     
    6569                static void generateCtorDtor( std::list< Declaration * > &translationUnit );
    6670
    67                 void previsit( ObjectDecl * );
    68                 void previsit( FunctionDecl *functionDecl );
    69 
     71                virtual DeclarationWithType * mutate( ObjectDecl * ) override;
     72                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
    7073                // should not traverse into any of these declarations to find objects
    7174                // that need to be constructed or destructed
    72                 void previsit( StructDecl *aggregateDecl );
    73                 void previsit( __attribute__((unused)) UnionDecl    * aggregateDecl ) { visit_children = false; }
    74                 void previsit( __attribute__((unused)) EnumDecl     * aggregateDecl ) { visit_children = false; }
    75                 void previsit( __attribute__((unused)) TraitDecl    * aggregateDecl ) { visit_children = false; }
    76                 void previsit( __attribute__((unused)) TypeDecl     * typeDecl )      { visit_children = false; }
    77                 void previsit( __attribute__((unused)) TypedefDecl  * typeDecl )      { visit_children = false; }
    78                 void previsit( __attribute__((unused)) FunctionType * funcType )      { visit_children = false; }
    79 
    80                 void previsit( CompoundStmt * compoundStmt );
     75                virtual Declaration* mutate( StructDecl *aggregateDecl ) override;
     76                virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
     77                virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
     78                virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
     79                virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
     80                virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
     81
     82                virtual Type * mutate( FunctionType *funcType ) override { return funcType; }
     83
     84                virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override;
    8185
    8286          private:
     
    207211
    208212        void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) {
    209                 PassVisitor<CtorDtor> ctordtor;
    210                 acceptAll( translationUnit, ctordtor );
     213                CtorDtor ctordtor;
     214                mutateAll( translationUnit, ctordtor );
    211215        }
    212216
     
    285289        }
    286290
    287         void CtorDtor::previsit( ObjectDecl * objDecl ) {
     291        DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {
    288292                handleDWT( objDecl );
    289293                // hands off if @=, extern, builtin, etc.
     
    297301                        objDecl->set_init( genCtorInit( objDecl ) );
    298302                }
    299         }
    300 
    301         void CtorDtor::previsit( FunctionDecl *functionDecl ) {
    302                 GuardValue( inFunction );
     303                return Parent::mutate( objDecl );
     304        }
     305
     306        DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) {
     307                ValueGuard< bool > oldInFunc = inFunction;
    303308                inFunction = true;
    304309
    305310                handleDWT( functionDecl );
    306311
    307                 GuardScope( managedTypes );
     312                managedTypes.beginScope();
    308313                // go through assertions and recursively add seen ctor/dtors
    309314                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
     
    312317                        }
    313318                }
    314 
    315                 PassVisitor<CtorDtor> newCtorDtor;
    316                 newCtorDtor.pass = *this;
    317                 maybeAccept( functionDecl->get_statements(), newCtorDtor );
    318                 visit_children = false;  // do not try and construct parameters or forall parameters - must happen after maybeAccept
    319         }
    320 
    321         void CtorDtor::previsit( StructDecl *aggregateDecl ) {
    322                 visit_children = false; // do not try to construct and destruct aggregate members
    323 
     319                // parameters should not be constructed and destructed, so don't mutate FunctionType
     320                functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
     321
     322                managedTypes.endScope();
     323                return functionDecl;
     324        }
     325
     326        Declaration* CtorDtor::mutate( StructDecl *aggregateDecl ) {
    324327                // don't construct members, but need to take note if there is a managed member,
    325328                // because that means that this type is also managed
     
    333336                        }
    334337                }
    335         }
    336 
    337         void CtorDtor::previsit( __attribute__((unused)) CompoundStmt * compoundStmt ) {
    338                 GuardScope( managedTypes );
    339         }
     338                return aggregateDecl;
     339        }
     340
     341        CompoundStmt * CtorDtor::mutate( CompoundStmt * compoundStmt ) {
     342                managedTypes.beginScope();
     343                CompoundStmt * stmt = Parent::mutate( compoundStmt );
     344                managedTypes.endScope();
     345                return stmt;
     346        }
     347
    340348} // namespace InitTweak
    341349
  • src/InitTweak/InitTweak.cc

    rb826e6b rfea3faa  
    1414                public:
    1515                        bool hasDesignations = false;
    16                         virtual void visit( Designation * des ) {
    17                                 if ( ! des->get_designators().empty() ) hasDesignations = true;
    18                                 else Visitor::visit( des );
    19                         }
     16                        template<typename Init>
     17                        void handleInit( Init * init ) {
     18                                if ( ! init->get_designators().empty() ) hasDesignations = true;
     19                                else Visitor::visit( init );
     20                        }
     21                        virtual void visit( SingleInit * singleInit ) { handleInit( singleInit); }
     22                        virtual void visit( ListInit * listInit ) { handleInit( listInit); }
    2023                };
    2124
  • src/MakeLibCfa.cc

    rb826e6b rfea3faa  
    1515
    1616#include "MakeLibCfa.h"
    17 
    18 #include <cassert>                 // for assert
    19 #include <string>                   // for operator==, string
    20 
    21 #include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup, Ope...
    22 #include "Common/SemanticError.h"   // for SemanticError
    23 #include "Common/UniqueName.h"      // for UniqueName
    24 #include "Parser/LinkageSpec.h"     // for Spec, Intrinsic, C
    25 #include "SynTree/Declaration.h"    // for FunctionDecl, ObjectDecl, Declara...
    26 #include "SynTree/Expression.h"     // for NameExpr, UntypedExpr, VariableExpr
    27 #include "SynTree/Initializer.h"    // for SingleInit
    28 #include "SynTree/Label.h"          // for Label
    29 #include "SynTree/Statement.h"      // for CompoundStmt, ReturnStmt
    30 #include "SynTree/Type.h"           // for FunctionType
    31 #include "SynTree/Visitor.h"        // for acceptAll, Visitor
     17#include "SynTree/Visitor.h"
     18#include "SynTree/Declaration.h"
     19#include "SynTree/Type.h"
     20#include "SynTree/Expression.h"
     21#include "SynTree/Statement.h"
     22#include "SynTree/Initializer.h"
     23#include "CodeGen/OperatorTable.h"
     24#include "Common/UniqueName.h"
    3225
    3326namespace LibCfa {
     
    9992                assert( ! objDecl->get_init() );
    10093                std::list< Expression* > noDesignators;
    101                 objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), false ) ); // cannot be constructed
     94                objDecl->set_init( new SingleInit( new NameExpr( objDecl->get_name() ), noDesignators, false ) ); // cannot be constructed
    10295                newDecls.push_back( objDecl );
    10396        }
  • src/MakeLibCfa.h

    rb826e6b rfea3faa  
    1717#define LIBCFA_MAKELIBCFA_H
    1818
    19 #include <list>  // for list
    20 
    21 class Declaration;
     19#include <list>
     20#include <SynTree/SynTree.h>
    2221
    2322namespace LibCfa {
  • src/Makefile.am

    rb826e6b rfea3faa  
    4343driver_cfa_cpp_SOURCES = ${SRC}
    4444driver_cfa_cpp_LDADD = ${LEXLIB} -ldl                   # yywrap
    45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
     45driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    4646driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
    4747
  • src/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    5859
    5960VPATH = @srcdir@
    60 am__is_gnu_make = { \
    61   if test -z '$(MAKELEVEL)'; then \
    62     false; \
    63   elif test -n '$(MAKE_HOST)'; then \
    64     true; \
    65   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    66     true; \
    67   else \
    68     false; \
    69   fi; \
    70 }
    71 am__make_running_with_option = \
    72   case $${target_option-} in \
    73       ?) ;; \
    74       *) echo "am__make_running_with_option: internal error: invalid" \
    75               "target option '$${target_option-}' specified" >&2; \
    76          exit 1;; \
    77   esac; \
    78   has_opt=no; \
    79   sane_makeflags=$$MAKEFLAGS; \
    80   if $(am__is_gnu_make); then \
    81     sane_makeflags=$$MFLAGS; \
    82   else \
    83     case $$MAKEFLAGS in \
    84       *\\[\ \   ]*) \
    85         bs=\\; \
    86         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    87           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    88     esac; \
    89   fi; \
    90   skip_next=no; \
    91   strip_trailopt () \
    92   { \
    93     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    94   }; \
    95   for flg in $$sane_makeflags; do \
    96     test $$skip_next = yes && { skip_next=no; continue; }; \
    97     case $$flg in \
    98       *=*|--*) continue;; \
    99         -*I) strip_trailopt 'I'; skip_next=yes;; \
    100       -*I?*) strip_trailopt 'I';; \
    101         -*O) strip_trailopt 'O'; skip_next=yes;; \
    102       -*O?*) strip_trailopt 'O';; \
    103         -*l) strip_trailopt 'l'; skip_next=yes;; \
    104       -*l?*) strip_trailopt 'l';; \
    105       -[dEDm]) skip_next=yes;; \
    106       -[JT]) skip_next=yes;; \
    107     esac; \
    108     case $$flg in \
    109       *$$target_option*) has_opt=yes; break;; \
    110     esac; \
    111   done; \
    112   test $$has_opt = yes
    113 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    114 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    11561pkgdatadir = $(datadir)/@PACKAGE@
    11662pkgincludedir = $(includedir)/@PACKAGE@
     
    13177build_triplet = @build@
    13278host_triplet = @host@
     79DIST_COMMON = $(srcdir)/CodeGen/module.mk \
     80        $(srcdir)/CodeTools/module.mk $(srcdir)/Common/module.mk \
     81        $(srcdir)/Concurrency/module.mk \
     82        $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk \
     83        $(srcdir)/InitTweak/module.mk $(srcdir)/Makefile.am \
     84        $(srcdir)/Makefile.in $(srcdir)/Parser/module.mk \
     85        $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk \
     86        $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk \
     87        Parser/lex.cc Parser/parser.cc Parser/parser.h
    13388cfa_cpplib_PROGRAMS = driver/cfa-cpp$(EXEEXT)
    13489subdir = src
     
    13792am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    13893        $(ACLOCAL_M4)
    139 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    14094mkinstalldirs = $(install_sh) -d
    14195CONFIG_HEADER = $(top_builddir)/config.h
     
    165119        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    166120        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
    167         ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \
    168121        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    169122        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    190143        Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \
    191144        Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \
    192         Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \
     145        Parser/driver_cfa_cpp-parseutility.$(OBJEXT) \
    193146        ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \
    194147        ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \
     
    208161        ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT) \
    209162        ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT) \
    210         ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT) \
    211163        SymTab/driver_cfa_cpp-Indexer.$(OBJEXT) \
    212164        SymTab/driver_cfa_cpp-Mangler.$(OBJEXT) \
     
    216168        SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \
    217169        SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \
    218         SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \
    219170        SynTree/driver_cfa_cpp-Type.$(OBJEXT) \
    220171        SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \
     
    262213driver_cfa_cpp_LINK = $(CXXLD) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) \
    263214        $(driver_cfa_cpp_LDFLAGS) $(LDFLAGS) -o $@
    264 AM_V_P = $(am__v_P_@AM_V@)
    265 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    266 am__v_P_0 = false
    267 am__v_P_1 = :
    268 AM_V_GEN = $(am__v_GEN_@AM_V@)
    269 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    270 am__v_GEN_0 = @echo "  GEN     " $@;
    271 am__v_GEN_1 =
    272 AM_V_at = $(am__v_at_@AM_V@)
    273 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    274 am__v_at_0 = @
    275 am__v_at_1 =
    276215DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    277216depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    281220am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    282221am__v_lt_0 = --silent
    283 am__v_lt_1 =
    284222CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    285223        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
    286224AM_V_CXX = $(am__v_CXX_@AM_V@)
    287225am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
    288 am__v_CXX_0 = @echo "  CXX     " $@;
    289 am__v_CXX_1 =
     226am__v_CXX_0 = @echo "  CXX   " $@;
     227AM_V_at = $(am__v_at_@AM_V@)
     228am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     229am__v_at_0 = @
    290230CXXLD = $(CXX)
    291231CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
     
    293233AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
    294234am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
    295 am__v_CXXLD_0 = @echo "  CXXLD   " $@;
    296 am__v_CXXLD_1 =
     235am__v_CXXLD_0 = @echo "  CXXLD " $@;
    297236@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
    298237LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
    299238AM_V_LEX = $(am__v_LEX_@AM_V@)
    300239am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@)
    301 am__v_LEX_0 = @echo "  LEX     " $@;
    302 am__v_LEX_1 =
     240am__v_LEX_0 = @echo "  LEX   " $@;
    303241YLWRAP = $(top_srcdir)/automake/ylwrap
    304242@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
    305 am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
    306                    -e s/c++$$/h++/ -e s/c$$/h/
    307243YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
    308244AM_V_YACC = $(am__v_YACC_@AM_V@)
    309245am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@)
    310 am__v_YACC_0 = @echo "  YACC    " $@;
    311 am__v_YACC_1 =
     246am__v_YACC_0 = @echo "  YACC  " $@;
    312247COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    313248        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    314249AM_V_CC = $(am__v_CC_@AM_V@)
    315250am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    316 am__v_CC_0 = @echo "  CC      " $@;
    317 am__v_CC_1 =
     251am__v_CC_0 = @echo "  CC    " $@;
    318252CCLD = $(CC)
    319253LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    320254AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    321255am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    322 am__v_CCLD_0 = @echo "  CCLD    " $@;
    323 am__v_CCLD_1 =
     256am__v_CCLD_0 = @echo "  CCLD  " $@;
     257AM_V_GEN = $(am__v_GEN_@AM_V@)
     258am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     259am__v_GEN_0 = @echo "  GEN   " $@;
    324260SOURCES = $(driver_cfa_cpp_SOURCES)
    325261DIST_SOURCES = $(driver_cfa_cpp_SOURCES)
    326 am__can_run_installinfo = \
    327   case $$AM_UPDATE_INFO_DIR in \
    328     n|no|NO) false;; \
    329     *) (install-info --version) >/dev/null 2>&1;; \
    330   esac
    331 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    332 # Read a list of newline-separated strings from the standard input,
    333 # and print each of them once, without duplicates.  Input order is
    334 # *not* preserved.
    335 am__uniquify_input = $(AWK) '\
    336   BEGIN { nonempty = 0; } \
    337   { items[$$0] = 1; nonempty = 1; } \
    338   END { if (nonempty) { for (i in items) print i; }; } \
    339 '
    340 # Make sure the list of sources is unique.  This is necessary because,
    341 # e.g., the same source file might be shared among _SOURCES variables
    342 # for different programs/libraries.
    343 am__define_uniq_tagged_files = \
    344   list='$(am__tagged_files)'; \
    345   unique=`for i in $$list; do \
    346     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    347   done | $(am__uniquify_input)`
    348262ETAGS = etags
    349263CTAGS = ctags
    350 am__DIST_COMMON = $(srcdir)/CodeGen/module.mk \
    351         $(srcdir)/CodeTools/module.mk $(srcdir)/Common/module.mk \
    352         $(srcdir)/Concurrency/module.mk \
    353         $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk \
    354         $(srcdir)/InitTweak/module.mk $(srcdir)/Makefile.in \
    355         $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk \
    356         $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk \
    357         $(srcdir)/Tuples/module.mk $(top_srcdir)/automake/depcomp \
    358         $(top_srcdir)/automake/ylwrap Parser/lex.cc Parser/parser.cc \
    359         Parser/parser.hh
    360264DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    361265ACLOCAL = @ACLOCAL@
     
    470374program_transform_name = @program_transform_name@
    471375psdir = @psdir@
    472 runstatedir = @runstatedir@
    473376sbindir = @sbindir@
    474377sharedstatedir = @sharedstatedir@
     
    491394        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    492395        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    493         ControlStruct/ForExprMutator.cc \
    494         ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
     396        ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
    495397        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    496398        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    503405        Parser/ExpressionNode.cc Parser/StatementNode.cc \
    504406        Parser/InitializerNode.cc Parser/TypeData.cc \
    505         Parser/LinkageSpec.cc Parser/parserutility.cc \
     407        Parser/LinkageSpec.cc Parser/parseutility.cc \
    506408        ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    507409        ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
     
    512414        ResolvExpr/RenameVars.cc ResolvExpr/FindOpenVars.cc \
    513415        ResolvExpr/PolyCost.cc ResolvExpr/Occurs.cc \
    514         ResolvExpr/TypeEnvironment.cc ResolvExpr/CurrentObject.cc \
    515         SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
    516         SymTab/FixFunction.cc SymTab/ImplementationType.cc \
    517         SymTab/TypeEquality.cc SymTab/Autogen.cc SymTab/TreeStruct.cc \
    518         SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
    519         SynTree/PointerType.cc SynTree/ArrayType.cc \
    520         SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
    521         SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \
     416        ResolvExpr/TypeEnvironment.cc SymTab/Indexer.cc \
     417        SymTab/Mangler.cc SymTab/Validate.cc SymTab/FixFunction.cc \
     418        SymTab/ImplementationType.cc SymTab/TypeEquality.cc \
     419        SymTab/Autogen.cc SynTree/Type.cc SynTree/VoidType.cc \
     420        SynTree/BasicType.cc SynTree/PointerType.cc \
     421        SynTree/ArrayType.cc SynTree/FunctionType.cc \
     422        SynTree/ReferenceToType.cc SynTree/TupleType.cc \
     423        SynTree/TypeofType.cc SynTree/AttrType.cc \
    522424        SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
    523425        SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
     
    536438MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    537439        ${cfa_cpplib_PROGRAMS}}
    538 BUILT_SOURCES = Parser/parser.hh
     440BUILT_SOURCES = Parser/parser.h
    539441AM_YFLAGS = -d -t -v
    540442
     
    545447driver_cfa_cpp_SOURCES = ${SRC}
    546448driver_cfa_cpp_LDADD = ${LEXLIB} -ldl                   # yywrap
    547 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
     449driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    548450driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
    549451all: $(BUILT_SOURCES)
     
    564466        $(am__cd) $(top_srcdir) && \
    565467          $(AUTOMAKE) --foreign src/Makefile
     468.PRECIOUS: Makefile
    566469Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    567470        @case '$?' in \
     
    572475            cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
    573476        esac;
    574 $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(am__empty):
     477$(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk:
    575478
    576479$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
     
    584487install-cfa_cpplibPROGRAMS: $(cfa_cpplib_PROGRAMS)
    585488        @$(NORMAL_INSTALL)
     489        test -z "$(cfa_cpplibdir)" || $(MKDIR_P) "$(DESTDIR)$(cfa_cpplibdir)"
    586490        @list='$(cfa_cpplib_PROGRAMS)'; test -n "$(cfa_cpplibdir)" || list=; \
    587         if test -n "$$list"; then \
    588           echo " $(MKDIR_P) '$(DESTDIR)$(cfa_cpplibdir)'"; \
    589           $(MKDIR_P) "$(DESTDIR)$(cfa_cpplibdir)" || exit 1; \
    590         fi; \
    591491        for p in $$list; do echo "$$p $$p"; done | \
    592492        sed 's/$(EXEEXT)$$//' | \
    593         while read p p1; do if test -f $$p \
    594           ; then echo "$$p"; echo "$$p"; else :; fi; \
     493        while read p p1; do if test -f $$p; \
     494          then echo "$$p"; echo "$$p"; else :; fi; \
    595495        done | \
    596         sed -e 'p;s,.*/,,;n;h' \
    597             -e 's|.*|.|' \
     496        sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
    598497            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
    599498        sed 'N;N;N;s,\n, ,g' | \
     
    616515        files=`for p in $$list; do echo "$$p"; done | \
    617516          sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
    618               -e 's/$$/$(EXEEXT)/' \
    619         `; \
     517              -e 's/$$/$(EXEEXT)/' `; \
    620518        test -n "$$list" || exit 0; \
    621519        echo " ( cd '$(DESTDIR)$(cfa_cpplibdir)' && rm -f" $$files ")"; \
     
    696594        ControlStruct/$(am__dirstamp) \
    697595        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    698 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT):  \
    699         ControlStruct/$(am__dirstamp) \
    700         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    701596GenPoly/$(am__dirstamp):
    702597        @$(MKDIR_P) GenPoly
     
    739634InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT):  \
    740635        InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)
    741 Parser/parser.hh: Parser/parser.cc
     636Parser/parser.h: Parser/parser.cc
    742637        @if test ! -f $@; then rm -f Parser/parser.cc; else :; fi
    743638        @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) Parser/parser.cc; else :; fi
     
    768663Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
    769664        Parser/$(DEPDIR)/$(am__dirstamp)
    770 Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
     665Parser/driver_cfa_cpp-parseutility.$(OBJEXT): Parser/$(am__dirstamp) \
    771666        Parser/$(DEPDIR)/$(am__dirstamp)
    772667ResolvExpr/$(am__dirstamp):
     
    826721        ResolvExpr/$(am__dirstamp) \
    827722        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    828 ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT):  \
    829         ResolvExpr/$(am__dirstamp) \
    830         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    831723SymTab/$(am__dirstamp):
    832724        @$(MKDIR_P) SymTab
     
    848740        SymTab/$(DEPDIR)/$(am__dirstamp)
    849741SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    850         SymTab/$(DEPDIR)/$(am__dirstamp)
    851 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \
    852742        SymTab/$(DEPDIR)/$(am__dirstamp)
    853743SynTree/$(am__dirstamp):
     
    944834        @$(MKDIR_P) driver
    945835        @: > driver/$(am__dirstamp)
    946 
    947836driver/cfa-cpp$(EXEEXT): $(driver_cfa_cpp_OBJECTS) $(driver_cfa_cpp_DEPENDENCIES) $(EXTRA_driver_cfa_cpp_DEPENDENCIES) driver/$(am__dirstamp)
    948837        @rm -f driver/cfa-cpp$(EXEEXT)
     
    951840mostlyclean-compile:
    952841        -rm -f *.$(OBJEXT)
    953         -rm -f CodeGen/*.$(OBJEXT)
    954         -rm -f CodeTools/*.$(OBJEXT)
    955         -rm -f Common/*.$(OBJEXT)
    956         -rm -f Concurrency/*.$(OBJEXT)
    957         -rm -f ControlStruct/*.$(OBJEXT)
    958         -rm -f GenPoly/*.$(OBJEXT)
    959         -rm -f InitTweak/*.$(OBJEXT)
    960         -rm -f Parser/*.$(OBJEXT)
    961         -rm -f ResolvExpr/*.$(OBJEXT)
    962         -rm -f SymTab/*.$(OBJEXT)
    963         -rm -f SynTree/*.$(OBJEXT)
    964         -rm -f Tuples/*.$(OBJEXT)
     842        -rm -f CodeGen/driver_cfa_cpp-CodeGenerator.$(OBJEXT)
     843        -rm -f CodeGen/driver_cfa_cpp-FixMain.$(OBJEXT)
     844        -rm -f CodeGen/driver_cfa_cpp-FixNames.$(OBJEXT)
     845        -rm -f CodeGen/driver_cfa_cpp-GenType.$(OBJEXT)
     846        -rm -f CodeGen/driver_cfa_cpp-Generate.$(OBJEXT)
     847        -rm -f CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT)
     848        -rm -f CodeTools/driver_cfa_cpp-DeclStats.$(OBJEXT)
     849        -rm -f CodeTools/driver_cfa_cpp-TrackLoc.$(OBJEXT)
     850        -rm -f Common/driver_cfa_cpp-Assert.$(OBJEXT)
     851        -rm -f Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT)
     852        -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT)
     853        -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT)
     854        -rm -f Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT)
     855        -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT)
     856        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
     857        -rm -f ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT)
     858        -rm -f ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT)
     859        -rm -f ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT)
     860        -rm -f GenPoly/driver_cfa_cpp-Box.$(OBJEXT)
     861        -rm -f GenPoly/driver_cfa_cpp-CopyParams.$(OBJEXT)
     862        -rm -f GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT)
     863        -rm -f GenPoly/driver_cfa_cpp-FindFunction.$(OBJEXT)
     864        -rm -f GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT)
     865        -rm -f GenPoly/driver_cfa_cpp-InstantiateGeneric.$(OBJEXT)
     866        -rm -f GenPoly/driver_cfa_cpp-Lvalue.$(OBJEXT)
     867        -rm -f GenPoly/driver_cfa_cpp-PolyMutator.$(OBJEXT)
     868        -rm -f GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT)
     869        -rm -f GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT)
     870        -rm -f InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT)
     871        -rm -f InitTweak/driver_cfa_cpp-FixInit.$(OBJEXT)
     872        -rm -f InitTweak/driver_cfa_cpp-GenInit.$(OBJEXT)
     873        -rm -f InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT)
     874        -rm -f Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT)
     875        -rm -f Parser/driver_cfa_cpp-ExpressionNode.$(OBJEXT)
     876        -rm -f Parser/driver_cfa_cpp-InitializerNode.$(OBJEXT)
     877        -rm -f Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT)
     878        -rm -f Parser/driver_cfa_cpp-ParseNode.$(OBJEXT)
     879        -rm -f Parser/driver_cfa_cpp-StatementNode.$(OBJEXT)
     880        -rm -f Parser/driver_cfa_cpp-TypeData.$(OBJEXT)
     881        -rm -f Parser/driver_cfa_cpp-TypedefTable.$(OBJEXT)
     882        -rm -f Parser/driver_cfa_cpp-lex.$(OBJEXT)
     883        -rm -f Parser/driver_cfa_cpp-parser.$(OBJEXT)
     884        -rm -f Parser/driver_cfa_cpp-parseutility.$(OBJEXT)
     885        -rm -f ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT)
     886        -rm -f ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT)
     887        -rm -f ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT)
     888        -rm -f ResolvExpr/driver_cfa_cpp-AlternativePrinter.$(OBJEXT)
     889        -rm -f ResolvExpr/driver_cfa_cpp-CastCost.$(OBJEXT)
     890        -rm -f ResolvExpr/driver_cfa_cpp-CommonType.$(OBJEXT)
     891        -rm -f ResolvExpr/driver_cfa_cpp-ConversionCost.$(OBJEXT)
     892        -rm -f ResolvExpr/driver_cfa_cpp-FindOpenVars.$(OBJEXT)
     893        -rm -f ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT)
     894        -rm -f ResolvExpr/driver_cfa_cpp-PolyCost.$(OBJEXT)
     895        -rm -f ResolvExpr/driver_cfa_cpp-PtrsAssignable.$(OBJEXT)
     896        -rm -f ResolvExpr/driver_cfa_cpp-PtrsCastable.$(OBJEXT)
     897        -rm -f ResolvExpr/driver_cfa_cpp-RenameVars.$(OBJEXT)
     898        -rm -f ResolvExpr/driver_cfa_cpp-ResolveTypeof.$(OBJEXT)
     899        -rm -f ResolvExpr/driver_cfa_cpp-Resolver.$(OBJEXT)
     900        -rm -f ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT)
     901        -rm -f ResolvExpr/driver_cfa_cpp-Unify.$(OBJEXT)
     902        -rm -f SymTab/driver_cfa_cpp-Autogen.$(OBJEXT)
     903        -rm -f SymTab/driver_cfa_cpp-FixFunction.$(OBJEXT)
     904        -rm -f SymTab/driver_cfa_cpp-ImplementationType.$(OBJEXT)
     905        -rm -f SymTab/driver_cfa_cpp-Indexer.$(OBJEXT)
     906        -rm -f SymTab/driver_cfa_cpp-Mangler.$(OBJEXT)
     907        -rm -f SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT)
     908        -rm -f SymTab/driver_cfa_cpp-Validate.$(OBJEXT)
     909        -rm -f SynTree/driver_cfa_cpp-AddStmtVisitor.$(OBJEXT)
     910        -rm -f SynTree/driver_cfa_cpp-AddressExpr.$(OBJEXT)
     911        -rm -f SynTree/driver_cfa_cpp-AggregateDecl.$(OBJEXT)
     912        -rm -f SynTree/driver_cfa_cpp-ApplicationExpr.$(OBJEXT)
     913        -rm -f SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT)
     914        -rm -f SynTree/driver_cfa_cpp-AttrType.$(OBJEXT)
     915        -rm -f SynTree/driver_cfa_cpp-Attribute.$(OBJEXT)
     916        -rm -f SynTree/driver_cfa_cpp-BasicType.$(OBJEXT)
     917        -rm -f SynTree/driver_cfa_cpp-CommaExpr.$(OBJEXT)
     918        -rm -f SynTree/driver_cfa_cpp-CompoundStmt.$(OBJEXT)
     919        -rm -f SynTree/driver_cfa_cpp-Constant.$(OBJEXT)
     920        -rm -f SynTree/driver_cfa_cpp-DeclStmt.$(OBJEXT)
     921        -rm -f SynTree/driver_cfa_cpp-Declaration.$(OBJEXT)
     922        -rm -f SynTree/driver_cfa_cpp-DeclarationWithType.$(OBJEXT)
     923        -rm -f SynTree/driver_cfa_cpp-Expression.$(OBJEXT)
     924        -rm -f SynTree/driver_cfa_cpp-FunctionDecl.$(OBJEXT)
     925        -rm -f SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT)
     926        -rm -f SynTree/driver_cfa_cpp-Initializer.$(OBJEXT)
     927        -rm -f SynTree/driver_cfa_cpp-Mutator.$(OBJEXT)
     928        -rm -f SynTree/driver_cfa_cpp-NamedTypeDecl.$(OBJEXT)
     929        -rm -f SynTree/driver_cfa_cpp-ObjectDecl.$(OBJEXT)
     930        -rm -f SynTree/driver_cfa_cpp-PointerType.$(OBJEXT)
     931        -rm -f SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT)
     932        -rm -f SynTree/driver_cfa_cpp-Statement.$(OBJEXT)
     933        -rm -f SynTree/driver_cfa_cpp-TupleExpr.$(OBJEXT)
     934        -rm -f SynTree/driver_cfa_cpp-TupleType.$(OBJEXT)
     935        -rm -f SynTree/driver_cfa_cpp-Type.$(OBJEXT)
     936        -rm -f SynTree/driver_cfa_cpp-TypeDecl.$(OBJEXT)
     937        -rm -f SynTree/driver_cfa_cpp-TypeExpr.$(OBJEXT)
     938        -rm -f SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT)
     939        -rm -f SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT)
     940        -rm -f SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT)
     941        -rm -f SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT)
     942        -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT)
     943        -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
     944        -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT)
     945        -rm -f Tuples/driver_cfa_cpp-Explode.$(OBJEXT)
     946        -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT)
     947        -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
    965948
    966949distclean-compile:
     
    982965@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    983966@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@
    984 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@
    985967@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
    986968@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
     
    1012994@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@
    1013995@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po@am__quote@
    1014 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@
     996@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po@am__quote@
    1015997@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@
    1016998@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@
     
    10201002@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po@am__quote@
    10211003@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Po@am__quote@
    1022 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po@am__quote@
    10231004@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po@am__quote@
    10241005@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po@am__quote@
     
    10361017@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@
    10371018@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@
    1038 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po@am__quote@
    10391019@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@
    10401020@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@
     
    13751355@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    13761356
    1377 ControlStruct/driver_cfa_cpp-ExceptTranslate.o: ControlStruct/ExceptTranslate.cc
    1378 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
    1379 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
    1380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.o' libtool=no @AMDEPBACKSLASH@
    1381 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1382 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
    1383 
    1384 ControlStruct/driver_cfa_cpp-ExceptTranslate.obj: ControlStruct/ExceptTranslate.cc
    1385 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi`
    1386 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
    1387 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.obj' libtool=no @AMDEPBACKSLASH@
    1388 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1389 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi`
    1390 
    13911357GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    13921358@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
     
    17251691@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-LinkageSpec.obj `if test -f 'Parser/LinkageSpec.cc'; then $(CYGPATH_W) 'Parser/LinkageSpec.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/LinkageSpec.cc'; fi`
    17261692
    1727 Parser/driver_cfa_cpp-parserutility.o: Parser/parserutility.cc
    1728 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
    1729 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
    1730 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.o' libtool=no @AMDEPBACKSLASH@
    1731 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1732 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
    1733 
    1734 Parser/driver_cfa_cpp-parserutility.obj: Parser/parserutility.cc
    1735 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi`
    1736 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
    1737 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.obj' libtool=no @AMDEPBACKSLASH@
    1738 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1739 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi`
     1693Parser/driver_cfa_cpp-parseutility.o: Parser/parseutility.cc
     1694@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parseutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc
     1695@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
     1696@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.cc' object='Parser/driver_cfa_cpp-parseutility.o' libtool=no @AMDEPBACKSLASH@
     1697@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1698@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parseutility.o `test -f 'Parser/parseutility.cc' || echo '$(srcdir)/'`Parser/parseutility.cc
     1699
     1700Parser/driver_cfa_cpp-parseutility.obj: Parser/parseutility.cc
     1701@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parseutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo -c -o Parser/driver_cfa_cpp-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`
     1702@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parseutility.Po
     1703@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parseutility.cc' object='Parser/driver_cfa_cpp-parseutility.obj' libtool=no @AMDEPBACKSLASH@
     1704@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1705@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parseutility.obj `if test -f 'Parser/parseutility.cc'; then $(CYGPATH_W) 'Parser/parseutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parseutility.cc'; fi`
    17401706
    17411707ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc
     
    19771943@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj `if test -f 'ResolvExpr/TypeEnvironment.cc'; then $(CYGPATH_W) 'ResolvExpr/TypeEnvironment.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/TypeEnvironment.cc'; fi`
    19781944
    1979 ResolvExpr/driver_cfa_cpp-CurrentObject.o: ResolvExpr/CurrentObject.cc
    1980 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CurrentObject.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc
    1981 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po
    1982 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.o' libtool=no @AMDEPBACKSLASH@
    1983 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1984 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc
    1985 
    1986 ResolvExpr/driver_cfa_cpp-CurrentObject.obj: ResolvExpr/CurrentObject.cc
    1987 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CurrentObject.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.obj `if test -f 'ResolvExpr/CurrentObject.cc'; then $(CYGPATH_W) 'ResolvExpr/CurrentObject.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CurrentObject.cc'; fi`
    1988 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po
    1989 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.obj' libtool=no @AMDEPBACKSLASH@
    1990 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1991 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.obj `if test -f 'ResolvExpr/CurrentObject.cc'; then $(CYGPATH_W) 'ResolvExpr/CurrentObject.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CurrentObject.cc'; fi`
    1992 
    19931945SymTab/driver_cfa_cpp-Indexer.o: SymTab/Indexer.cc
    19941946@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Indexer.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Tpo -c -o SymTab/driver_cfa_cpp-Indexer.o `test -f 'SymTab/Indexer.cc' || echo '$(srcdir)/'`SymTab/Indexer.cc
     
    20892041@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi`
    20902042
    2091 SymTab/driver_cfa_cpp-TreeStruct.o: SymTab/TreeStruct.cc
    2092 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
    2093 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
    2094 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.o' libtool=no @AMDEPBACKSLASH@
    2095 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2096 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
    2097 
    2098 SymTab/driver_cfa_cpp-TreeStruct.obj: SymTab/TreeStruct.cc
    2099 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
    2100 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
    2101 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.obj' libtool=no @AMDEPBACKSLASH@
    2102 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2103 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
    2104 
    21052043SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc
    21062044@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Type.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Tpo -c -o SynTree/driver_cfa_cpp-Type.o `test -f 'SynTree/Type.cc' || echo '$(srcdir)/'`SynTree/Type.cc
     
    26532591
    26542592.yy.cc:
    2655         $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE)
    2656 
    2657 ID: $(am__tagged_files)
    2658         $(am__define_uniq_tagged_files); mkid -fID $$unique
    2659 tags: tags-am
    2660 TAGS: tags
    2661 
    2662 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     2593        $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
     2594
     2595ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     2596        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     2597        unique=`for i in $$list; do \
     2598            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     2599          done | \
     2600          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     2601              END { if (nonempty) { for (i in files) print i; }; }'`; \
     2602        mkid -fID $$unique
     2603tags: TAGS
     2604
     2605TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     2606                $(TAGS_FILES) $(LISP)
    26632607        set x; \
    26642608        here=`pwd`; \
    2665         $(am__define_uniq_tagged_files); \
     2609        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     2610        unique=`for i in $$list; do \
     2611            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     2612          done | \
     2613          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     2614              END { if (nonempty) { for (i in files) print i; }; }'`; \
    26662615        shift; \
    26672616        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    26752624          fi; \
    26762625        fi
    2677 ctags: ctags-am
    2678 
    2679 CTAGS: ctags
    2680 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    2681         $(am__define_uniq_tagged_files); \
     2626ctags: CTAGS
     2627CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     2628                $(TAGS_FILES) $(LISP)
     2629        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     2630        unique=`for i in $$list; do \
     2631            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     2632          done | \
     2633          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     2634              END { if (nonempty) { for (i in files) print i; }; }'`; \
    26822635        test -z "$(CTAGS_ARGS)$$unique" \
    26832636          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    26882641          && $(am__cd) $(top_srcdir) \
    26892642          && gtags -i $(GTAGS_ARGS) "$$here"
    2690 cscopelist: cscopelist-am
    2691 
    2692 cscopelist-am: $(am__tagged_files)
    2693         list='$(am__tagged_files)'; \
    2694         case "$(srcdir)" in \
    2695           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    2696           *) sdir=$(subdir)/$(srcdir) ;; \
    2697         esac; \
    2698         for i in $$list; do \
    2699           if test -f "$$i"; then \
    2700             echo "$(subdir)/$$i"; \
    2701           else \
    2702             echo "$$sdir/$$i"; \
    2703           fi; \
    2704         done >> $(top_builddir)/cscope.files
    27052643
    27062644distclean-tags:
     
    28032741        -rm -f Parser/lex.cc
    28042742        -rm -f Parser/parser.cc
    2805         -rm -f Parser/parser.hh
     2743        -rm -f Parser/parser.h
    28062744        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
    28072745        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
     
    28772815.MAKE: all check install install-am install-strip
    28782816
    2879 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
    2880         clean-cfa_cpplibPROGRAMS clean-generic cscopelist-am ctags \
    2881         ctags-am distclean distclean-compile distclean-generic \
    2882         distclean-tags distdir dvi dvi-am html html-am info info-am \
    2883         install install-am install-cfa_cpplibPROGRAMS install-data \
    2884         install-data-am install-dvi install-dvi-am install-exec \
    2885         install-exec-am install-html install-html-am install-info \
    2886         install-info-am install-man install-pdf install-pdf-am \
    2887         install-ps install-ps-am install-strip installcheck \
    2888         installcheck-am installdirs maintainer-clean \
    2889         maintainer-clean-generic mostlyclean mostlyclean-compile \
    2890         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    2891         uninstall-am uninstall-cfa_cpplibPROGRAMS
    2892 
    2893 .PRECIOUS: Makefile
     2817.PHONY: CTAGS GTAGS all all-am check check-am clean \
     2818        clean-cfa_cpplibPROGRAMS clean-generic ctags distclean \
     2819        distclean-compile distclean-generic distclean-tags distdir dvi \
     2820        dvi-am html html-am info info-am install install-am \
     2821        install-cfa_cpplibPROGRAMS install-data install-data-am \
     2822        install-dvi install-dvi-am install-exec install-exec-am \
     2823        install-html install-html-am install-info install-info-am \
     2824        install-man install-pdf install-pdf-am install-ps \
     2825        install-ps-am install-strip installcheck installcheck-am \
     2826        installdirs maintainer-clean maintainer-clean-generic \
     2827        mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
     2828        ps ps-am tags uninstall uninstall-am \
     2829        uninstall-cfa_cpplibPROGRAMS
    28942830
    28952831
  • src/Parser/DeclarationNode.cc

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 16:55:00 2017
    13 // Update Count     : 1020
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 15:46:33 2017
     13// Update Count     : 1018
    1414//
    1515
     
    253253        newnode->type->aggregate.fields = fields;
    254254        newnode->type->aggregate.body = body;
    255         newnode->type->aggregate.tagged = false;
    256         newnode->type->aggregate.parent = nullptr;
    257255        return newnode;
    258256} // DeclarationNode::newAggregate
     
    275273        return newnode;
    276274} // DeclarationNode::newEnumConstant
    277 
    278 DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
    279         assert( name );
    280         DeclarationNode * newnode = new DeclarationNode;
    281         newnode->type = new TypeData( TypeData::Aggregate );
    282         newnode->type->aggregate.kind = kind;
    283         newnode->type->aggregate.name = name;
    284         newnode->type->aggregate.actuals = actuals;
    285         newnode->type->aggregate.fields = fields;
    286         newnode->type->aggregate.body = body;
    287         newnode->type->aggregate.tagged = true;
    288         newnode->type->aggregate.parent = parent;
    289         return newnode;
    290 } // DeclarationNode::newTreeStruct
    291275
    292276DeclarationNode * DeclarationNode::newName( string * name ) {
     
    10791063          case TypeData::Enum:
    10801064          case TypeData::Aggregate: {
    1081                   ReferenceToType * ret = buildComAggInst( type, attributes, linkage );
     1065                  ReferenceToType * ret = buildComAggInst( type, attributes );
    10821066                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10831067                  return ret;
  • src/Parser/ExpressionNode.cc

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:17:07 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 18 10:08:00 2017
    13 // Update Count     : 550
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Jun 21 16:44:46 2017
     13// Update Count     : 541
    1414//
    1515
     
    2727#include "SynTree/Declaration.h"
    2828#include "Common/UnimplementedError.h"
    29 #include "parserutility.h"
     29#include "parseutility.h"
    3030#include "Common/utility.h"
    3131
     
    4646// type.
    4747
    48 Type::Qualifiers noQualifiers;                          // no qualifiers on constants
     48Type::Qualifiers emptyQualifiers;                               // no qualifiers on constants
    4949
    5050static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
     
    118118        } // if
    119119
    120         Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
     120        Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) );
    121121        delete &str;                                                                            // created by lex
    122122        return ret;
     
    153153        } // if
    154154
    155         Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
     155        Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) );
    156156        delete &str;                                                                            // created by lex
    157157        return ret;
     
    159159
    160160Expression *build_constantChar( const std::string & str ) {
    161         Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
     161        Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
    162162        delete &str;                                                                            // created by lex
    163163        return ret;
     
    166166ConstantExpr *build_constantStr( const std::string & str ) {
    167167        // string should probably be a primitive type
    168         ArrayType *at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
     168        ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
    169169                                                                   new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ),  // +1 for '\0' and -2 for '"'
    170170                                                                   false, false );
     
    176176
    177177Expression *build_constantZeroOne( const std::string & str ) {
    178         Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( noQualifiers ) : (Type*)new OneType( noQualifiers ), str,
     178        Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str,
    179179                                                                                                   str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) );
    180180        delete &str;                                                                            // created by lex
     
    231231}
    232232
    233 // Must harmonize with OperKinds.
    234233static const char *OperName[] = {
    235234        // diadic
    236         "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&",
     235        "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&",
    237236        "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
    238         "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
     237        "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
    239238        "?[?]", "...",
    240239        // monadic
  • src/Parser/InitializerNode.cc

    rb826e6b rfea3faa  
    7474
    7575        InitializerNode *moreInit;
    76         if ( (moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) ) {
     76        if  ( get_next() != 0 && ((moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) != 0) )
    7777                moreInit->printOneLine( os );
    78         }
    7978}
    8079
    8180Initializer *InitializerNode::build() const {
    8281        if ( aggregate ) {
    83                 // steal designators from children
    84                 std::list< Designation * > designlist;
    85                 InitializerNode * child = next_init();
    86                 for ( ; child != nullptr; child = dynamic_cast< InitializerNode * >( child->get_next() ) ) {
    87                         std::list< Expression * > desList;
    88                         buildList< Expression, ExpressionNode >( child->designator, desList );
    89                         designlist.push_back( new Designation( desList ) );
    90                 } // for
    9182                std::list< Initializer * > initlist;
    9283                buildList< Initializer, InitializerNode >( next_init(), initlist );
     84
     85                std::list< Expression * > designlist;
     86
     87                if ( designator != 0 ) {
     88                        buildList< Expression, ExpressionNode >( designator, designlist );
     89                } // if
     90
    9391                return new ListInit( initlist, designlist, maybeConstructed );
    9492        } else {
    95                 if ( get_expression() != 0) {
    96                         return new SingleInit( maybeBuild< Expression >( get_expression() ), maybeConstructed );
    97                 }
     93                std::list< Expression * > designators;
     94
     95                if ( designator != 0 )
     96                        buildList< Expression, ExpressionNode >( designator, designators );
     97
     98                if ( get_expression() != 0)
     99                        return new SingleInit( maybeBuild< Expression >( get_expression() ), designators, maybeConstructed );
    98100        } // if
     101
    99102        return 0;
    100103}
  • src/Parser/LinkageSpec.cc

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:22:09 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul  7 11:11:00 2017
    13 // Update Count     : 25
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Oct  2 23:16:21 2016
     13// Update Count     : 23
    1414//
    1515
     
    2222#include "Common/SemanticError.h"
    2323
    24 namespace LinkageSpec {
    25 
    26 Spec linkageCheck( const string * spec ) {
    27         assert( spec );
     24LinkageSpec::Spec LinkageSpec::linkageCheck( const string * spec ) {
    2825        unique_ptr<const string> guard( spec ); // allocated by lexer
    2926        if ( *spec == "\"Cforall\"" ) {
     
    3128        } else if ( *spec == "\"C\"" ) {
    3229                return C;
    33         } else if ( *spec == "\"BuiltinC\"" ) {
    34                 return BuiltinC;
    3530        } else {
    3631                throw SemanticError( "Invalid linkage specifier " + *spec );
     
    3833}
    3934
    40 Spec linkageUpdate( Spec old_spec, const string * cmd ) {
    41         assert( cmd );
    42         unique_ptr<const string> guard( cmd ); // allocated by lexer
    43         if ( *cmd == "\"Cforall\"" ) {
    44                 old_spec.is_mangled = true;
    45                 return old_spec;
    46         } else if ( *cmd == "\"C\"" ) {
    47                 old_spec.is_mangled = false;
    48                 return old_spec;
    49         } else {
    50                 throw SemanticError( "Invalid linkage specifier " + *cmd );
    51         } // if
     35string LinkageSpec::linkageName( LinkageSpec::Spec linkage ) {
     36        assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
     37        static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
     38                "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
     39        };
     40        return linkageKinds[linkage];
    5241}
    5342
    54 std::string linkageName( Spec linkage ) {
    55     switch ( linkage ) {
    56     case Intrinsic:
    57         return "intrinsic";
    58     case C:
    59         return "C";
    60     case Cforall:
    61         return "Cforall";
    62     case AutoGen:
    63         return "autogenerated cfa";
    64     case Compiler:
    65         return "compiler built-in";
    66     case BuiltinCFA:
    67         return "cfa built-in";
    68     case BuiltinC:
    69         return "c built-in";
    70     default:
    71         return "<unnamed linkage spec>";
    72     }
     43bool LinkageSpec::isDecoratable( Spec spec ) {
     44        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
     45        static bool decoratable[LinkageSpec::NoOfSpecs] = {
     46                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     47                        true,           true,           false,  true,           false,
     48        };
     49        return decoratable[spec];
    7350}
    7451
    75 } // LinkageSpec
     52bool LinkageSpec::isGeneratable( Spec spec ) {
     53        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
     54        static bool generatable[LinkageSpec::NoOfSpecs] = {
     55                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     56                        true,           true,           true,   true,           false,
     57        };
     58        return generatable[spec];
     59}
     60
     61bool LinkageSpec::isOverridable( Spec spec ) {
     62        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
     63        static bool overridable[LinkageSpec::NoOfSpecs] = {
     64                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     65                        true,           false,          false,  true,           false,
     66        };
     67        return overridable[spec];
     68}
     69
     70bool LinkageSpec::isBuiltin( Spec spec ) {
     71        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
     72        static bool builtin[LinkageSpec::NoOfSpecs] = {
     73                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     74                        true,           false,          false,  false,          true,
     75        };
     76        return builtin[spec];
     77}
    7678
    7779// Local Variables: //
  • src/Parser/LinkageSpec.h

    rb826e6b rfea3faa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LinkageSpec.h --
     7// LinkageSpec.h -- 
    88//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:24:28 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul  7 11:03:00 2017
    13 // Update Count     : 13
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Oct  1 23:03:17 2016
     13// Update Count     : 11
    1414//
    1515
     
    1919#include <string>
    2020
    21 namespace LinkageSpec {
    22         // All linkage specs are some combination of these flags:
    23         enum {
    24                 Mangle = 1 << 0,
    25                 Generate = 1 << 1,
    26                 Overrideable = 1 << 2,
    27                 Builtin = 1 << 3,
    28 
    29                 NoOfSpecs = 1 << 4,
     21struct LinkageSpec {
     22        enum Spec {
     23                Intrinsic,                                                                              // C built-in defined in prelude
     24                Cforall,                                                                                // ordinary
     25                C,                                                                                              // not overloadable, not mangled
     26                AutoGen,                                                                                // built by translator (struct assignment)
     27                Compiler,                                                                               // gcc internal
     28                NoOfSpecs
    3029        };
    31 
    32         union Spec {
    33                 unsigned int val;
    34                 struct {
    35                         bool is_mangled : 1;
    36                         bool is_generatable : 1;
    37                         bool is_overridable : 1;
    38                         bool is_builtin : 1;
    39                 };
    40                 constexpr Spec( unsigned int val ) : val( val ) {}
    41                 constexpr Spec( Spec const &other ) : val( other.val ) {}
    42                 // Operators may go here.
    43                 // Supports == and !=
    44                 constexpr operator unsigned int () const { return val; }
    45         };
    46 
    47 
    48         Spec linkageCheck( const std::string * );
    49         // Returns the Spec with the given name (limited to C, Cforall & BuiltinC)
    50         Spec linkageUpdate( Spec old_spec, const std::string * cmd );
    51         /* If cmd = "C" returns a Spec that is old_spec with is_mangled = false
    52          * If cmd = "Cforall" returns old_spec Spec with is_mangled = true
    53          */
    54 
    55         std::string linkageName( Spec );
    56 
    57         // To Update: LinkageSpec::isXyz( cur_spec ) -> cur_spec.is_xyz
    58         inline bool isMangled( Spec spec ) { return spec.is_mangled; }
    59         inline bool isGeneratable( Spec spec ) { return spec.is_generatable; }
    60         inline bool isOverridable( Spec spec ) { return spec.is_overridable; }
    61         inline bool isBuiltin( Spec spec ) { return spec.is_builtin; }
    62 
    63         // Pre-defined flag combinations:
    64         // C built-in defined in prelude
    65         constexpr Spec const Intrinsic = { Mangle | Generate | Overrideable | Builtin };
    66         // ordinary
    67         constexpr Spec const Cforall = { Mangle | Generate };
    68         // not overloadable, not mangled
    69         constexpr Spec const C = { Generate };
    70         // built by translator (struct assignment)
    71         constexpr Spec const AutoGen = { Mangle | Generate | Overrideable };
    72         // gcc internal
    73         constexpr Spec const Compiler = { Builtin };
    74         // mangled builtins
    75         constexpr Spec const BuiltinCFA = { Mangle | Generate | Builtin };
    76         // non-mangled builtins
    77         constexpr Spec const BuiltinC = { Generate | Builtin };
     30 
     31        static Spec linkageCheck( const std::string * );
     32        static std::string linkageName( Spec );
     33 
     34        static bool isDecoratable( Spec );
     35        static bool isGeneratable( Spec );
     36        static bool isOverridable( Spec );
     37        static bool isBuiltin( Spec );
    7838};
    7939
  • src/Parser/ParseNode.h

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 15 16:00:48 2017
    13 // Update Count     : 785
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun 12 13:00:00 2017
     13// Update Count     : 779
    1414//
    1515
     
    141141};
    142142
    143 // Must harmonize with OperName.
    144143enum class OperKinds {
    145144        // diadic
    146         SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp, Mul, Div, Mod, Or, And,
     145        SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And,
    147146        BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq,
    148         Assign, AtAssn, ExpAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
     147        Assign, AtAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
    149148        Index, Range,
    150149        // monadic
     
    249248        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    250249
    251         // Perhaps this would best fold into newAggragate.
    252         static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    253 
    254250        DeclarationNode();
    255251        ~DeclarationNode();
     
    336332
    337333        static UniqueName anonymous;
    338 
    339         // Temp to test TreeStruct
    340         const std::string * parent_name;
    341334}; // DeclarationNode
    342335
  • src/Parser/StatementNode.cc

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 14:59:41 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 11 21:23:15 2017
    13 // Update Count     : 331
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jun 12 13:03:00 2017
     13// Update Count     : 329
    1414//
    1515
     
    2121#include "SynTree/Statement.h"
    2222#include "SynTree/Expression.h"
    23 #include "parserutility.h"
     23#include "parseutility.h"
    2424#include "Common/utility.h"
    2525
     
    9393        std::list< Statement * > branches;
    9494        buildMoveList< Statement, StatementNode >( stmt, branches );
    95         // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
     95        assert( branches.size() >= 0 );                                         // size == 0 for switch (...) {}, i.e., no declaration or statements
    9696        return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
    9797}
  • src/Parser/TypeData.cc

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:12:51 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 18 10:10:00 2017
    13 // Update Count     : 566
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 15:52:43 2017
     13// Update Count     : 563
    1414//
    1515
     
    6363                aggregate.fields = nullptr;
    6464                aggregate.body = false;
    65                 aggregate.tagged = false;
    66                 aggregate.parent = nullptr;
    6765                break;
    6866          case AggregateInst:
     
    123121                delete aggregate.actuals;
    124122                delete aggregate.fields;
    125                 delete aggregate.parent;
    126123                // delete aggregate;
    127124                break;
     
    195192                newtype->aggregate.kind = aggregate.kind;
    196193                newtype->aggregate.body = aggregate.body;
    197                 newtype->aggregate.tagged = aggregate.tagged;
    198                 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;
    199194                break;
    200195          case AggregateInst:
     
    454449          case TypeData::Builtin:
    455450                if(td->builtintype == DeclarationNode::Zero) {
    456                         return new ZeroType( noQualifiers );
     451                        return new ZeroType( emptyQualifiers );
    457452                }
    458453                else if(td->builtintype == DeclarationNode::One) {
    459                         return new OneType( noQualifiers );
     454                        return new OneType( emptyQualifiers );
    460455                }
    461456                else {
     
    619614} // buildPointer
    620615
    621 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     616AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {
    622617        assert( td->kind == TypeData::Aggregate );
    623618        AggregateDecl * at;
    624619        switch ( td->aggregate.kind ) {
    625620          case DeclarationNode::Struct:
    626                 if ( td->aggregate.tagged ) {
    627                         at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage );
    628                         buildForall( td->aggregate.params, at->get_parameters() );
    629                         break;
    630                 }
    631621          case DeclarationNode::Coroutine:
    632622          case DeclarationNode::Monitor:
    633623          case DeclarationNode::Thread:
    634                 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage );
     624                at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );
    635625                buildForall( td->aggregate.params, at->get_parameters() );
    636626                break;
     
    653643} // buildAggregate
    654644
    655 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
     645ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
    656646        switch ( type->kind ) {
    657647          case TypeData::Enum: {
     
    666656                  ReferenceToType * ret;
    667657                  if ( type->aggregate.body ) {
    668                           AggregateDecl * typedecl = buildAggregate( type, attributes, linkage );
     658                          AggregateDecl * typedecl = buildAggregate( type, attributes );
    669659                          switch ( type->aggregate.kind ) {
    670660                                case DeclarationNode::Struct:
     
    770760                if ( cur->has_enumeratorValue() ) {
    771761                        ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members);
    772                         member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ) ) );
     762                        member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), list< Expression * >() ) );
    773763                } // if
    774764        } // for
     
    787777TupleType * buildTuple( const TypeData * td ) {
    788778        assert( td->kind == TypeData::Tuple );
    789         std::list< Type * > types;
    790         buildTypeList( td->tuple, types );
    791         TupleType * ret = new TupleType( buildQualifiers( td ), types );
     779        TupleType * ret = new TupleType( buildQualifiers( td ) );
     780        buildTypeList( td->tuple, ret->get_types() );
    792781        buildForall( td->forall, ret->get_forall() );
    793782        return ret;
     
    813802                return decl->set_asmName( asmName );
    814803        } else if ( td->kind == TypeData::Aggregate ) {
    815                 return buildAggregate( td, attributes, linkage );
     804                return buildAggregate( td, attributes );
    816805        } else if ( td->kind == TypeData::Enum ) {
    817806                return buildEnum( td, attributes );
  • src/Parser/TypeData.h

    rb826e6b rfea3faa  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:18:36 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 16:57:00 2017
    13 // Update Count     : 187
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 16 08:32:39 2017
     13// Update Count     : 185
    1414//
    1515
     
    3131                DeclarationNode * fields;
    3232                bool body;
    33 
    34                 bool tagged;
    35                 const std::string * parent;
    3633        };
    3734
     
    105102ArrayType * buildArray( const TypeData * );
    106103AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    107 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
     104ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
    108105ReferenceToType * buildAggInst( const TypeData * );
    109106TypeDecl * buildVariable( const TypeData * );
  • src/Parser/TypedefTable.h

    rb826e6b rfea3faa  
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:56:34 2017
    13 // Update Count     : 33
     12// Last Modified On : Mon Aug 15 18:25:04 2016
     13// Update Count     : 28
    1414//
    1515
     
    2222#include <stack>
    2323
    24 #include "ParserTypes.h"
    25 #include "parser.hh"
     24#include "lex.h"
     25#include "parser.h"
    2626
    2727class TypedefTable {
  • src/Parser/lex.ll

    rb826e6b rfea3faa  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Tue Jul 18 07:11:48 2017
    13  * Update Count     : 544
     12 * Last Modified On : Tue May 30 22:00:48 2017
     13 * Update Count     : 527
    1414 */
    1515
     
    2727#include <cstdio>                                                                               // FILENAME_MAX
    2828
     29#include "lex.h"
     30#include "parser.h"                                                                             // YACC generated definitions based on C++ grammar
    2931#include "ParseNode.h"
    3032#include "TypedefTable.h"
     
    5961}
    6062
    61 // Stop warning due to incorrectly generated flex code.
    62 #pragma GCC diagnostic ignored "-Wsign-compare"
    6363%}
    6464
     
    125125op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post}
    126126
    127 op_binary_only "/"|"%"|"\\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>="
     127op_binary_only "/"|"%"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="
    128128op_binary_over {op_unary_binary}|{op_binary_only}
    129129                                // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@="
     
    136136
    137137%%
    138                                 /* line directives */
     138                                   /* line directives */
    139139^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" {
    140140        /* " stop highlighting */
     
    232232int                             { KEYWORD_RETURN(INT); }
    233233__int128                { KEYWORD_RETURN(INT); }                                // GCC
    234 __int128_t              { KEYWORD_RETURN(INT); }                                // GCC
    235234__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    236235long                    { KEYWORD_RETURN(LONG); }
     
    267266__typeof                { KEYWORD_RETURN(TYPEOF); }                             // GCC
    268267__typeof__              { KEYWORD_RETURN(TYPEOF); }                             // GCC
    269 __uint128_t             { KEYWORD_RETURN(INT); }                                // GCC
    270268union                   { KEYWORD_RETURN(UNION); }
    271269unsigned                { KEYWORD_RETURN(UNSIGNED); }
     
    276274__volatile__    { KEYWORD_RETURN(VOLATILE); }                   // GCC
    277275while                   { KEYWORD_RETURN(WHILE); }
    278 with                    { KEYWORD_RETURN(WITH); }                               // CFA
    279276zero_t                  { NUMERIC_RETURN(ZERO_T); }                             // CFA
    280277
     
    339336"-"                             { ASCIIOP_RETURN(); }
    340337"*"                             { ASCIIOP_RETURN(); }
    341 "\\"                    { ASCIIOP_RETURN(); }                                   // CFA, exponentiation
    342338"/"                             { ASCIIOP_RETURN(); }
    343339"%"                             { ASCIIOP_RETURN(); }
     
    364360"+="                    { NAMEDOP_RETURN(PLUSassign); }
    365361"-="                    { NAMEDOP_RETURN(MINUSassign); }
    366 "\\="                   { NAMEDOP_RETURN(EXPassign); }                  // CFA, exponentiation
    367362"*="                    { NAMEDOP_RETURN(MULTassign); }
    368363"/="                    { NAMEDOP_RETURN(DIVassign); }
  • src/Parser/module.mk

    rb826e6b rfea3faa  
    1111## Created On       : Sat May 16 15:29:09 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Wed Jun 28 21:58:29 2017
    14 ## Update Count     : 104
     13## Last Modified On : Tue Aug 16 17:28:34 2016
     14## Update Count     : 101
    1515###############################################################################
    1616
    17 BUILT_SOURCES = Parser/parser.hh
     17BUILT_SOURCES = Parser/parser.h
    1818
    1919AM_YFLAGS = -d -t -v
     
    2929       Parser/TypeData.cc \
    3030       Parser/LinkageSpec.cc \
    31        Parser/parserutility.cc
     31       Parser/parseutility.cc
    3232
    3333MAINTAINERCLEANFILES += Parser/parser.output
  • src/Parser/parser.yy

    rb826e6b rfea3faa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // parser.yy --
     7// cfa.y --
    88//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jul 17 12:17:00 2017
    13 // Update Count     : 2455
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Jun 12 12:59:00 2017
     13// Update Count     : 2402
    1414//
    1515
     
    4848#include <cstdio>
    4949#include <stack>
     50#include "lex.h"
     51#include "parser.h"
    5052#include "ParseNode.h"
    5153#include "TypedefTable.h"
     
    8688bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    8789%}
    88 
    89 // Types declaration
    90 %union
    91 {
    92         Token tok;
    93         ParseNode * pn;
    94         ExpressionNode * en;
    95         DeclarationNode * decl;
    96         DeclarationNode::Aggregate aggKey;
    97         DeclarationNode::TypeClass tclass;
    98         StatementNode * sn;
    99         ConstantExpr * constant;
    100         ForCtl * fctl;
    101         LabelNode * label;
    102         InitializerNode * in;
    103         OperKinds op;
    104         std::string * str;
    105         bool flag;
    106         CatchStmt::Kind catch_kind;
    107 }
    10890
    10991//************************* TERMINAL TOKENS ********************************
     
    129111%token ATTRIBUTE EXTENSION                                                              // GCC
    130112%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    131 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH   // CFA
     113%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT        // CFA
    132114%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    133115%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    151133%token ELLIPSIS                                                                                 // ...
    152134
    153 %token EXPassign        MULTassign      DIVassign       MODassign       // \=   *=      /=      %=
     135%token MULTassign       DIVassign       MODassign                               // *=   /=      %=/
    154136%token PLUSassign       MINUSassign                                                     // +=   -=
    155137%token LSassign         RSassign                                                        // <<=  >>=
     
    157139
    158140%token ATassign                                                                                 // @=
     141
     142// Types declaration
     143%union
     144{
     145        Token tok;
     146        ParseNode * pn;
     147        ExpressionNode * en;
     148        DeclarationNode * decl;
     149        DeclarationNode::Aggregate aggKey;
     150        DeclarationNode::TypeClass tclass;
     151        StatementNode * sn;
     152        ConstantExpr * constant;
     153        ForCtl * fctl;
     154        LabelNode * label;
     155        InitializerNode * in;
     156        OperKinds op;
     157        std::string * str;
     158        bool flag;
     159}
    159160
    160161%type<tok> identifier  no_attr_identifier  zero_one
     
    168169%type<op> ptrref_operator                               unary_operator                          assignment_operator
    169170%type<en> primary_expression                    postfix_expression                      unary_expression
    170 %type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
    171 %type<en> shift_expression                              relational_expression           equality_expression
    172 %type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
    173 %type<en> logical_AND_expression                logical_OR_expression
    174 %type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
     171%type<en> cast_expression                               multiplicative_expression       additive_expression                     shift_expression
     172%type<en> relational_expression                 equality_expression                     AND_expression                          exclusive_OR_expression
     173%type<en> inclusive_OR_expression               logical_AND_expression          logical_OR_expression           conditional_expression
     174%type<en> constant_expression                   assignment_expression           assignment_expression_opt
    175175%type<en> comma_expression                              comma_expression_opt
    176 %type<en> argument_expression_list              argument_expression                     default_initialize_opt
     176%type<en> argument_expression_list              argument_expression                     assignment_opt
    177177%type<fctl> for_control_expression
    178178%type<en> subrange
     
    185185// statements
    186186%type<sn> labeled_statement                             compound_statement                      expression_statement            selection_statement
    187 %type<sn> iteration_statement                   jump_statement
    188 %type<sn> with_statement                                exception_statement                     asm_statement
     187%type<sn> iteration_statement                   jump_statement                          exception_statement                     asm_statement
    189188%type<sn> fall_through_opt                              fall_through
    190189%type<sn> statement                                             statement_list
    191190%type<sn> block_item_list                               block_item
    192 %type<sn> with_clause_opt
     191%type<sn> case_clause
    193192%type<en> case_value
    194 %type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
     193%type<sn> case_value_list                               case_label                                      case_label_list
    195194%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    196195%type<sn> /* handler_list */                    handler_clause                          finally_clause
    197 %type<catch_kind> handler_key
    198196
    199197// declarations
     
    574572        ;
    575573
    576 exponential_expression:
     574multiplicative_expression:
    577575        cast_expression
    578         | exponential_expression '\\' cast_expression
    579                 { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); }
    580         ;
    581 
    582 multiplicative_expression:
    583         exponential_expression
    584         | multiplicative_expression '*' exponential_expression
     576        | multiplicative_expression '*' cast_expression
    585577                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); }
    586         | multiplicative_expression '/' exponential_expression
     578        | multiplicative_expression '/' cast_expression
    587579                { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); }
    588         | multiplicative_expression '%' exponential_expression
     580        | multiplicative_expression '%' cast_expression
    589581                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); }
    590582        ;
     
    685677        '='                                                                                     { $$ = OperKinds::Assign; }
    686678        | ATassign                                                                      { $$ = OperKinds::AtAssn; }
    687         | EXPassign                                                                     { $$ = OperKinds::ExpAssn; }
    688679        | MULTassign                                                            { $$ = OperKinds::MulAssn; }
    689680        | DIVassign                                                                     { $$ = OperKinds::DivAssn; }
     
    738729        | iteration_statement
    739730        | jump_statement
    740         | with_statement
    741731        | exception_statement
    742732        | asm_statement
     
    946936        ;
    947937
    948 with_statement:
    949         WITH '(' tuple_expression_list ')' compound_statement
    950                 { $$ = (StatementNode *)0; }                                    // FIX ME
    951         ;
    952 
    953938exception_statement:
    954939        TRY compound_statement handler_clause
     
    974959
    975960handler_clause:
    976         // TEMPORARY, TEST EXCEPTIONS
    977         handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
    978                 { $$ = new StatementNode( build_catch( $1, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
    979         | handler_clause handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
    980                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    981 
    982         | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    983                 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); }
    984         | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    985                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); }
    986         ;
    987 
    988 handler_predicate_opt:
    989         //empty
    990         | ';' conditional_expression
    991         ;
    992 
    993 handler_key:
    994         CATCH
    995                 { $$ = CatchStmt::Terminate; }
    996         | CATCHRESUME
    997                 { $$ = CatchStmt::Resume; }
     961        CATCH '(' push push exception_declaration pop ')' compound_statement pop
     962                { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); }
     963        | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
     964                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, $6, nullptr, $9 ) ) ); }
     965        | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
     966                { $$ = new StatementNode( build_catch( CatchStmt::Resume, $5, nullptr, $8 ) ); }
     967        | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
     968                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Resume, $6, nullptr, $9 ) ) ); }
    998969        ;
    999970
     
    16801651        | aggregate_key attribute_list_opt typegen_name         // CFA
    16811652                { $$ = $3->addQualifiers( $2 ); }
    1682 
    1683 // Temp, testing TreeStruct
    1684     | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name
    1685         {
    1686             typedefTable.makeTypedef( *$4 );            // create typedef
    1687             if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
    1688             forall = false;                             // reset
    1689         }
    1690       '{' field_declaration_list '}'
    1691         {
    1692             $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
    1693                 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );
    1694         }
    1695     | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname
    1696         {
    1697             typedefTable.makeTypedef( *$4 );            // create typedef
    1698             if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
    1699             forall = false;                             // reset
    1700         }
    1701       '{' field_declaration_list '}'
    1702         {
    1703             $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
    1704                 $4, $5, nullptr, $8, true )->addQualifiers( $3 );
    1705         }
    17061653        ;
    17071654
     
    18821829cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    18831830        parameter_declaration
    1884         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
     1831        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt
    18851832                { $$ = $1->addName( $2 ); }
    1886         | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     1833        | cfa_abstract_tuple identifier_or_type_name assignment_opt
    18871834                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    18881835                { $$ = $1->addName( $2 ); }
    1889         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     1836        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt
    18901837                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    18911838        | cfa_function_specifier
     
    19041851parameter_declaration:
    19051852                // No SUE declaration in parameter list.
    1906         declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
     1853        declaration_specifier_nobody identifier_parameter_declarator assignment_opt
    19071854                {
    19081855                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    19091856                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    19101857                }
    1911         | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
     1858        | declaration_specifier_nobody type_parameter_redeclarator assignment_opt
    19121859                {
    19131860                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    19171864
    19181865abstract_parameter_declaration:
    1919         declaration_specifier_nobody default_initialize_opt
     1866        declaration_specifier_nobody assignment_opt
    19201867                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    1921         | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
     1868        | declaration_specifier_nobody abstract_parameter_declarator assignment_opt
    19221869                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    19231870        ;
     
    22202167                {
    22212168                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2222                         linkage = LinkageSpec::linkageUpdate( linkage, $2 );
     2169                        linkage = LinkageSpec::linkageCheck( $2 );
    22232170                }
    22242171          '{' external_definition_list_opt '}'
     
    22562203        ;
    22572204
    2258 with_clause_opt:
    2259         // empty
    2260                 { $$ = (StatementNode *)0; }                                    // FIX ME
    2261         | WITH '(' tuple_expression_list ')'
    2262                 { $$ = (StatementNode *)0; }                                    // FIX ME
    2263         ;
    2264 
    22652205function_definition:
    2266         cfa_function_declaration with_clause_opt compound_statement     // CFA
     2206        cfa_function_declaration compound_statement                     // CFA
    22672207                {
    22682208                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22692209                        typedefTable.leaveScope();
    2270                         $$ = $1->addFunctionBody( $3 );
    2271                 }
    2272         | declaration_specifier function_declarator with_clause_opt compound_statement
     2210                        $$ = $1->addFunctionBody( $2 );
     2211                }
     2212        | declaration_specifier function_declarator compound_statement
    22732213                {
    22742214                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22752215                        typedefTable.leaveScope();
    2276                         $$ = $2->addFunctionBody( $4 )->addType( $1 );
    2277                 }
    2278         | type_qualifier_list function_declarator with_clause_opt compound_statement
     2216                        $$ = $2->addFunctionBody( $3 )->addType( $1 );
     2217                }
     2218        | type_qualifier_list function_declarator compound_statement
    22792219                {
    22802220                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22812221                        typedefTable.leaveScope();
    2282                         $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 );
    2283                 }
    2284         | declaration_qualifier_list function_declarator with_clause_opt compound_statement
     2222                        $$ = $2->addFunctionBody( $3 )->addQualifiers( $1 );
     2223                }
     2224        | declaration_qualifier_list function_declarator compound_statement
    22852225                {
    22862226                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22872227                        typedefTable.leaveScope();
    2288                         $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 );
    2289                 }
    2290         | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
     2228                        $$ = $2->addFunctionBody( $3 )->addQualifiers( $1 );
     2229                }
     2230        | declaration_qualifier_list type_qualifier_list function_declarator compound_statement
    22912231                {
    22922232                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    22932233                        typedefTable.leaveScope();
    2294                         $$ = $3->addFunctionBody( $5 )->addQualifiers( $2 )->addQualifiers( $1 );
     2234                        $$ = $3->addFunctionBody( $4 )->addQualifiers( $2 )->addQualifiers( $1 );
    22952235                }
    22962236
    22972237                // Old-style K&R function definition, OBSOLESCENT (see 4)
    2298         | declaration_specifier KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2238        | declaration_specifier KR_function_declarator push KR_declaration_list_opt compound_statement
    22992239                {
    23002240                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    23012241                        typedefTable.leaveScope();
    2302                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addType( $1 );
    2303                 }
    2304         | type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2242                        $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addType( $1 );
     2243                }
     2244        | type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement
    23052245                {
    23062246                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    23072247                        typedefTable.leaveScope();
    2308                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 );
     2248                        $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addQualifiers( $1 );
    23092249                }
    23102250
    23112251                // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4)
    2312         | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2252        | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement
    23132253                {
    23142254                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    23152255                        typedefTable.leaveScope();
    2316                         $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 );
    2317                 }
    2318         | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement
     2256                        $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addQualifiers( $1 );
     2257                }
     2258        | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement
    23192259                {
    23202260                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    23212261                        typedefTable.leaveScope();
    2322                         $$ = $3->addOldDeclList( $5 )->addFunctionBody( $7 )->addQualifiers( $2 )->addQualifiers( $1 );
     2262                        $$ = $3->addOldDeclList( $5 )->addFunctionBody( $6 )->addQualifiers( $2 )->addQualifiers( $1 );
    23232263                }
    23242264        ;
     
    23832323        | TYPEGENname
    23842324        | CONST
    2385                 { $$ = Token{ new string( "__const__" ), { nullptr, -1 } }; }
     2325                { $$ = Token{ new string( "__const__" ) }; }
    23862326        ;
    23872327
     
    30823022        ;
    30833023
    3084 default_initialize_opt:
     3024assignment_opt:
    30853025        // empty
    30863026                { $$ = nullptr; }
  • src/ResolvExpr/AlternativeFinder.cc

    rb826e6b rfea3faa  
    604604//          )
    605605                SymTab::Indexer decls( indexer );
    606                 // PRINT(
    607                 //      std::cerr << "============= original indexer" << std::endl;
    608                 //      indexer.print( std::cerr );
    609                 //      std::cerr << "============= new indexer" << std::endl;
    610                 //      decls.print( std::cerr );
    611                 // )
     606                PRINT(
     607                        std::cerr << "============= original indexer" << std::endl;
     608                        indexer.print( std::cerr );
     609                        std::cerr << "============= new indexer" << std::endl;
     610                        decls.print( std::cerr );
     611                )
    612612                addToIndexer( have, decls );
    613613                AssertionSet newNeed;
     
    809809        }
    810810
    811         Expression * restructureCast( Expression * argExpr, Type * toType ) {
    812                 if ( argExpr->get_result()->size() > 1 && ! toType->isVoid() ) {
    813                         // Argument expression is a tuple and the target type is not void. Cast each member of the tuple
    814                         // to its corresponding target type, producing the tuple of those cast expressions. If there are
    815                         // more components of the tuple than components in the target type, then excess components do not
    816                         // come out in the result expression (but UniqueExprs ensure that side effects will still be done).
    817                         if ( Tuples::maybeImpure( argExpr ) && ! dynamic_cast< UniqueExpr * >( argExpr ) ) {
    818                                 // expressions which may contain side effects require a single unique instance of the expression.
    819                                 argExpr = new UniqueExpr( argExpr );
    820                         }
    821                         std::list< Expression * > componentExprs;
    822                         for ( unsigned int i = 0; i < toType->size(); i++ ) {
    823                                 // cast each component
    824                                 TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i );
    825                                 componentExprs.push_back( restructureCast( idx, toType->getComponent( i ) ) );
    826                         }
    827                         delete argExpr;
    828                         assert( componentExprs.size() > 0 );
    829                         // produce the tuple of casts
    830                         return new TupleExpr( componentExprs );
    831                 } else {
    832                         // handle normally
    833                         return new CastExpr( argExpr, toType->clone() );
    834                 }
    835         }
    836 
    837811        void AlternativeFinder::visit( CastExpr *castExpr ) {
    838812                Type *& toType = castExpr->get_result();
     
    866840                                thisCost += Cost( 0, 0, discardedValues );
    867841
    868                                 candidates.push_back( Alternative( restructureCast( i->expr->clone(), toType ), i->env, i->cost, thisCost ) );
     842                                Expression * argExpr = i->expr->clone();
     843                                if ( argExpr->get_result()->size() > 1 && ! castExpr->get_result()->isVoid() ) {
     844                                        // Argument expression is a tuple and the target type is not void. Cast each member of the tuple
     845                                        // to its corresponding target type, producing the tuple of those cast expressions. If there are
     846                                        // more components of the tuple than components in the target type, then excess components do not
     847                                        // come out in the result expression (but UniqueExprs ensure that side effects will still be done).
     848                                        if ( Tuples::maybeImpure( argExpr ) && ! dynamic_cast< UniqueExpr * >( argExpr ) ) {
     849                                                // expressions which may contain side effects require a single unique instance of the expression.
     850                                                argExpr = new UniqueExpr( argExpr );
     851                                        }
     852                                        std::list< Expression * > componentExprs;
     853                                        for ( unsigned int i = 0; i < castExpr->get_result()->size(); i++ ) {
     854                                                // cast each component
     855                                                TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i );
     856                                                componentExprs.push_back( new CastExpr( idx, castExpr->get_result()->getComponent( i )->clone() ) );
     857                                        }
     858                                        delete argExpr;
     859                                        assert( componentExprs.size() > 0 );
     860                                        // produce the tuple of casts
     861                                        candidates.push_back( Alternative( new TupleExpr( componentExprs ), i->env, i->cost, thisCost ) );
     862                                } else {
     863                                        // handle normally
     864                                        candidates.push_back( Alternative( new CastExpr( argExpr->clone(), toType->clone() ), i->env, i->cost, thisCost ) );
     865                                }
    869866                        } // if
    870867                } // for
     
    11851182        }
    11861183
    1187         void AlternativeFinder::visit( UntypedInitExpr *initExpr ) {
    1188                 // handle each option like a cast
    1189                 AltList candidates;
    1190                 PRINT( std::cerr << "untyped init expr: " << initExpr << std::endl; )
    1191                 // O(N^2) checks of d-types with e-types
    1192                 for ( InitAlternative & initAlt : initExpr->get_initAlts() ) {
    1193                         Type * toType = resolveTypeof( initAlt.type, indexer );
    1194                         SymTab::validateType( toType, &indexer );
    1195                         adjustExprType( toType, env, indexer );
    1196                         // Ideally the call to findWithAdjustment could be moved out of the loop, but unfortunately it currently has to occur inside or else
    1197                         // polymorphic return types are not properly bound to the initialization type, since return type variables are only open for the duration of resolving
    1198                         // the UntypedExpr. This is only actually an issue in initialization contexts that allow more than one possible initialization type, but it is still suboptimal.
    1199                         AlternativeFinder finder( indexer, env );
    1200                         finder.targetType = toType;
    1201                         finder.findWithAdjustment( initExpr->get_expr() );
    1202                         for ( Alternative & alt : finder.get_alternatives() ) {
    1203                                 TypeEnvironment newEnv( alt.env );
    1204                                 AssertionSet needAssertions, haveAssertions;
    1205                                 OpenVarSet openVars;  // find things in env that don't have a "representative type" and claim those are open vars?
    1206                                 PRINT( std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl; )
    1207                                 // It's possible that a cast can throw away some values in a multiply-valued expression.  (An example is a
    1208                                 // cast-to-void, which casts from one value to zero.)  Figure out the prefix of the subexpression results
    1209                                 // that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
    1210                                 // to.
    1211                                 int discardedValues = alt.expr->get_result()->size() - toType->size();
    1212                                 if ( discardedValues < 0 ) continue;
    1213                                 // xxx - may need to go into tuple types and extract relevant types and use unifyList. Note that currently, this does not
    1214                                 // allow casting a tuple to an atomic type (e.g. (int)([1, 2, 3]))
    1215                                 // unification run for side-effects
    1216                                 unify( toType, alt.expr->get_result(), newEnv, needAssertions, haveAssertions, openVars, indexer ); // xxx - do some inspecting on this line... why isn't result bound to initAlt.type??
    1217 
    1218                                 Cost thisCost = castCost( alt.expr->get_result(), toType, indexer, newEnv );
    1219                                 if ( thisCost != Cost::infinity ) {
    1220                                         // count one safe conversion for each value that is thrown away
    1221                                         thisCost += Cost( 0, 0, discardedValues );
    1222                                         candidates.push_back( Alternative( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost ) );
    1223                                 }
    1224                         }
    1225                 }
    1226 
    1227                 // findMinCost selects the alternatives with the lowest "cost" members, but has the side effect of copying the
    1228                 // cvtCost member to the cost member (since the old cost is now irrelevant).  Thus, calling findMinCost twice
    1229                 // selects first based on argument cost, then on conversion cost.
    1230                 AltList minArgCost;
    1231                 findMinCost( candidates.begin(), candidates.end(), std::back_inserter( minArgCost ) );
    1232                 findMinCost( minArgCost.begin(), minArgCost.end(), std::back_inserter( alternatives ) );
    1233         }
    12341184} // namespace ResolvExpr
    12351185
  • src/ResolvExpr/AlternativeFinder.h

    rb826e6b rfea3faa  
    7373                virtual void visit( UniqueExpr *unqExpr );
    7474                virtual void visit( StmtExpr *stmtExpr );
    75                 virtual void visit( UntypedInitExpr *initExpr );
    7675                /// Runs a new alternative finder on each element in [begin, end)
    7776                /// and writes each alternative finder to out.
  • src/ResolvExpr/Resolver.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include <iostream>
    17 
     16#include "Resolver.h"
     17#include "AlternativeFinder.h"
    1818#include "Alternative.h"
    19 #include "AlternativeFinder.h"
    20 #include "CurrentObject.h"
    2119#include "RenameVars.h"
    22 #include "Resolver.h"
    2320#include "ResolveTypeof.h"
    2421#include "typeops.h"
    25 
     22#include "SynTree/Statement.h"
     23#include "SynTree/Type.h"
    2624#include "SynTree/Expression.h"
    2725#include "SynTree/Initializer.h"
    28 #include "SynTree/Statement.h"
    29 #include "SynTree/Type.h"
    30 
     26#include "SymTab/Indexer.h"
    3127#include "SymTab/Autogen.h"
    32 #include "SymTab/Indexer.h"
    33 
    3428#include "Common/utility.h"
    35 
    3629#include "InitTweak/InitTweak.h"
    3730
     31#include <iostream>
    3832using namespace std;
    3933
     
    4539                        if ( const Resolver * res = dynamic_cast< const Resolver * >( &other ) ) {
    4640                                functionReturn = res->functionReturn;
    47                                 currentObject = res->currentObject;
     41                                initContext = res->initContext;
    4842                                inEnumDecl = res->inEnumDecl;
    4943                        }
     
    7064                virtual void visit( BranchStmt *branchStmt ) override;
    7165                virtual void visit( ReturnStmt *returnStmt ) override;
    72                 virtual void visit( ThrowStmt *throwStmt ) override;
    7366
    7467                virtual void visit( SingleInit *singleInit ) override;
     
    8679
    8780                Type * functionReturn = nullptr;
    88                 CurrentObject currentObject = nullptr;
     81                Type *initContext = nullptr;
    8982                bool inEnumDecl = false;
    9083        };
     
    193186                // each value of initContext is retained, so the type on the first analysis is preserved and used for selecting
    194187                // the RHS.
    195                 ValueGuard<CurrentObject> temp( currentObject );
    196                 currentObject = CurrentObject( objectDecl->get_type() );
    197                 if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) {
     188                Type *temp = initContext;
     189                initContext = new_type;
     190                if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext ) ) {
    198191                        // enumerator initializers should not use the enum type to initialize, since
    199192                        // the enum type is still incomplete at this point. Use signed int instead.
    200                         currentObject = CurrentObject( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
     193                        initContext = new BasicType( Type::Qualifiers(), BasicType::SignedInt );
    201194                }
    202195                Parent::visit( objectDecl );
    203                 if ( inEnumDecl && dynamic_cast< EnumInstType * >( objectDecl->get_type() ) ) {
     196                if ( inEnumDecl && dynamic_cast< EnumInstType * >( initContext ) ) {
    204197                        // delete newly created signed int type
    205                         // delete currentObject.getType();
    206                 }
     198                        delete initContext;
     199                }
     200                initContext = temp;
    207201        }
    208202
     
    321315
    322316        void Resolver::visit( SwitchStmt *switchStmt ) {
    323                 ValueGuard< CurrentObject > oldCurrentObject( currentObject );
     317                ValueGuard< Type * > oldInitContext( initContext );
    324318                Expression *newExpr;
    325319                newExpr = findIntegralExpression( switchStmt->get_condition(), *this );
     
    327321                switchStmt->set_condition( newExpr );
    328322
    329                 currentObject = CurrentObject( newExpr->get_result() );
     323                initContext = newExpr->get_result();
    330324                Parent::visit( switchStmt );
    331325        }
     
    333327        void Resolver::visit( CaseStmt *caseStmt ) {
    334328                if ( caseStmt->get_condition() ) {
    335                         std::list< InitAlternative > initAlts = currentObject.getOptions();
    336                         assertf( initAlts.size() == 1, "SwitchStmt did not correctly resolve an integral expression." );
    337                         CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() );
     329                        assert( initContext );
     330                        CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initContext->clone() );
    338331                        Expression * newExpr = findSingleExpression( castExpr, *this );
    339332                        castExpr = safe_dynamic_cast< CastExpr * >( newExpr );
     
    367360        }
    368361
    369         void Resolver::visit( ThrowStmt *throwStmt ) {
    370                 if ( throwStmt->get_expr() ) {
    371                         Expression * wrapped = new CastExpr( throwStmt->get_expr(), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    372                         Expression * newExpr = findSingleExpression( wrapped, *this );
    373                         throwStmt->set_expr( newExpr );
    374                 }
    375         }
    376 
    377362        template< typename T >
    378363        bool isCharType( T t ) {
     
    385370
    386371        void Resolver::visit( SingleInit *singleInit ) {
    387                 // resolve initialization using the possibilities as determined by the currentObject cursor
    388                 UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() );
    389                 Expression * newExpr = findSingleExpression( untyped, *this );
    390                 InitExpr * initExpr = safe_dynamic_cast< InitExpr * >( newExpr );
    391 
    392                 // move cursor to the object that is actually initialized
    393                 currentObject.setNext( initExpr->get_designation() );
    394 
    395                 // discard InitExpr wrapper and retain relevant pieces
    396                 newExpr = initExpr->get_expr();
    397                 newExpr->set_env( initExpr->get_env() );
    398                 initExpr->set_expr( nullptr );
    399                 initExpr->set_env( nullptr );
    400                 delete initExpr;
    401 
    402                 // get the actual object's type (may not exactly match what comes back from the resolver due to conversions)
    403                 Type * initContext = currentObject.getCurrentType();
    404 
    405                 // check if actual object's type is char[]
    406                 if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
    407                         if ( isCharType( at->get_base() ) ) {
    408                                 // check if the resolved type is char *
    409                                 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
    410                                         if ( isCharType( pt->get_base() ) ) {
    411                                                 // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
    412                                                 CastExpr *ce = safe_dynamic_cast< CastExpr * >( newExpr );
    413                                                 newExpr = ce->get_arg();
    414                                                 ce->set_arg( nullptr );
    415                                                 delete ce;
     372                if ( singleInit->get_value() ) {
     373                        // // find all the d's
     374                        // std::list<Expression *> &designators = singleInit->get_designators();
     375                        // std::list<Type *> types1{ initContext }, types2;
     376                        // for ( Expression * expr: designators ) {
     377                        //      cerr << expr << endl;
     378                        //      if ( NameExpr * nexpr = dynamic_cast<NameExpr *>( expr ) ) {
     379                        //              for ( Type * type: types1 ) {
     380                        //                      cerr << type << endl;
     381                        //                      ReferenceToType * fred = dynamic_cast<ReferenceToType *>(type);
     382                        //                      std::list<Declaration *> members;
     383                        //                      if ( fred ) {
     384                        //                              fred->lookup( nexpr->get_name(), members ); // concatenate identical field name
     385                        //                              for ( Declaration * mem: members ) {
     386                        //                                      if ( DeclarationWithType * dwt = dynamic_cast<DeclarationWithType *>(mem) ) {
     387                        //                                              types2.push_back( dwt->get_type() );
     388                        //                                      } // if
     389                        //                              } // for
     390                        //                      } // if
     391                        //              } // for
     392                        //              types1 = types2;
     393                        //              types2.clear();
     394                        //      } // if
     395                        // } // for
     396                        // // for ( Type * type: types1 ) {
     397                        // //   cerr << type << endl;
     398                        // // } // for
     399
     400                        // // O(N^2) checks of d-types with f-types
     401                        // // find the minimum cost
     402                        CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() );
     403                        Expression *newExpr = findSingleExpression( castExpr, *this );
     404                        delete castExpr;
     405                        singleInit->set_value( newExpr );
     406
     407                        // check if initializing type is char[]
     408                        if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
     409                                if ( isCharType( at->get_base() ) ) {
     410                                        // check if the resolved type is char *
     411                                        if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
     412                                                if ( isCharType( pt->get_base() ) ) {
     413                                                        // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
     414                                                        CastExpr *ce = dynamic_cast< CastExpr * >( newExpr );
     415                                                        singleInit->set_value( ce->get_arg() );
     416                                                        ce->set_arg( NULL );
     417                                                        delete ce;
     418                                                }
    416419                                        }
    417420                                }
    418421                        }
    419                 }
    420 
    421                 // set initializer expr to resolved express
    422                 singleInit->set_value( newExpr );
    423 
    424                 // move cursor to next object in preparation for next initializer
    425                 currentObject.increment();
     422                } // if
     423        }
     424
     425        template< typename AggrInst >
     426        TypeSubstitution makeGenericSubstitutuion( AggrInst * inst ) {
     427                assert( inst );
     428                assert( inst->get_baseParameters() );
     429                std::list< TypeDecl * > baseParams = *inst->get_baseParameters();
     430                std::list< Expression * > typeSubs = inst->get_parameters();
     431                TypeSubstitution subs( baseParams.begin(), baseParams.end(), typeSubs.begin() );
     432                return subs;
     433        }
     434
     435        ReferenceToType * isStructOrUnion( Type * type ) {
     436                if ( StructInstType * sit = dynamic_cast< StructInstType * >( type ) ) {
     437                        return sit;
     438                } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( type ) ) {
     439                        return uit;
     440                }
     441                return nullptr;
     442        }
     443
     444        void Resolver::resolveSingleAggrInit( Declaration * dcl, InitIterator & init, InitIterator & initEnd, TypeSubstitution sub ) {
     445                DeclarationWithType * dt = dynamic_cast< DeclarationWithType * >( dcl );
     446                assert( dt );
     447                // need to substitute for generic types, so that casts are to concrete types
     448                initContext = dt->get_type()->clone();
     449                sub.apply( initContext );
     450
     451                try {
     452                        if ( init == initEnd ) return; // stop when there are no more initializers
     453                        (*init)->accept( *this );
     454                        ++init; // made it past an initializer
     455                } catch( SemanticError & ) {
     456                        // need to delve deeper, if you can
     457                        if ( ReferenceToType * type = isStructOrUnion( initContext ) ) {
     458                                resolveAggrInit( type, init, initEnd );
     459                        } else {
     460                                // member is not an aggregate type, so can't go any deeper
     461
     462                                // might need to rethink what is being thrown
     463                                throw;
     464                        } // if
     465                }
     466        }
     467
     468        void Resolver::resolveAggrInit( ReferenceToType * inst, InitIterator & init, InitIterator & initEnd ) {
     469                if ( StructInstType * sit = dynamic_cast< StructInstType * >( inst ) ) {
     470                        TypeSubstitution sub = makeGenericSubstitutuion( sit );
     471                        StructDecl * st = sit->get_baseStruct();
     472                        if(st->get_members().empty()) return;
     473                        // want to resolve each initializer to the members of the struct,
     474                        // but if there are more initializers than members we should stop
     475                        list< Declaration * >::iterator it = st->get_members().begin();
     476                        for ( ; it != st->get_members().end(); ++it) {
     477                                resolveSingleAggrInit( *it, init, initEnd, sub );
     478                        }
     479                } else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( inst ) ) {
     480                        TypeSubstitution sub = makeGenericSubstitutuion( uit );
     481                        UnionDecl * un = uit->get_baseUnion();
     482                        if(un->get_members().empty()) return;
     483                        // only resolve to the first member of a union
     484                        resolveSingleAggrInit( *un->get_members().begin(), init, initEnd, sub );
     485                } // if
    426486        }
    427487
    428488        void Resolver::visit( ListInit * listInit ) {
    429                 // move cursor into brace-enclosed initializer-list
    430                 currentObject.enterListInit();
    431                 // xxx - fix this so that the list isn't copied, iterator should be used to change current element
    432                 std::list<Designation *> newDesignations;
    433                 for ( auto p : group_iterate(listInit->get_designations(), listInit->get_initializers()) ) {
    434                         // iterate designations and initializers in pairs, moving the cursor to the current designated object and resolving
    435                         // the initializer against that object.
    436                         Designation * des = std::get<0>(p);
    437                         Initializer * init = std::get<1>(p);
    438                         newDesignations.push_back( currentObject.findNext( des ) );
    439                         init->accept( *this );
    440                 }
    441                 // set the set of 'resolved' designations and leave the brace-enclosed initializer-list
    442                 listInit->get_designations() = newDesignations; // xxx - memory management
    443                 currentObject.exitListInit();
    444 
    445                 // xxx - this part has not be folded into CurrentObject yet
    446                 // } else if ( TypeInstType * tt = dynamic_cast< TypeInstType * >( initContext ) ) {
    447                 //      Type * base = tt->get_baseType()->get_base();
    448                 //      if ( base ) {
    449                 //              // know the implementation type, so try using that as the initContext
    450                 //              ObjectDecl tmpObj( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, base->clone(), nullptr );
    451                 //              currentObject = &tmpObj;
    452                 //              visit( listInit );
    453                 //      } else {
    454                 //              // missing implementation type -- might be an unknown type variable, so try proceeding with the current init context
    455                 //              Parent::visit( listInit );
    456                 //      }
    457                 // } else {
     489                InitIterator iter = listInit->begin();
     490                InitIterator end = listInit->end();
     491
     492                if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
     493                        // resolve each member to the base type of the array
     494                        for ( ; iter != end; ++iter ) {
     495                                initContext = at->get_base();
     496                                (*iter)->accept( *this );
     497                        } // for
     498                } else if ( TupleType * tt = dynamic_cast< TupleType * > ( initContext ) ) {
     499                        for ( Type * t : *tt ) {
     500                                if ( iter == end ) break;
     501                                initContext = t;
     502                                (*iter++)->accept( *this );
     503                        }
     504                } else if ( ReferenceToType * type = isStructOrUnion( initContext ) ) {
     505                        resolveAggrInit( type, iter, end );
     506                } else if ( TypeInstType * tt = dynamic_cast< TypeInstType * >( initContext ) ) {
     507                        Type * base = tt->get_baseType()->get_base();
     508                        if ( base ) {
     509                                // know the implementation type, so try using that as the initContext
     510                                initContext = base;
     511                                visit( listInit );
     512                        } else {
     513                                // missing implementation type -- might be an unknown type variable, so try proceeding with the current init context
     514                                Parent::visit( listInit );
     515                        }
     516                } else {
     517                        assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext )
     518                                || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) || dynamic_cast < EnumInstType * > ( initContext ) );
     519                        // basic types are handled here
     520                        Parent::visit( listInit );
     521                }
     522
     523#if 0
     524                if ( ArrayType *at = dynamic_cast<ArrayType*>(initContext) ) {
     525                        std::list<Initializer *>::iterator iter( listInit->begin_initializers() );
     526                        for ( ; iter != listInit->end_initializers(); ++iter ) {
     527                                initContext = at->get_base();
     528                                (*iter)->accept( *this );
     529                        } // for
     530                } else if ( StructInstType *st = dynamic_cast<StructInstType*>(initContext) ) {
     531                        StructDecl *baseStruct = st->get_baseStruct();
     532                        std::list<Declaration *>::iterator iter1( baseStruct->get_members().begin() );
     533                        std::list<Initializer *>::iterator iter2( listInit->begin_initializers() );
     534                        for ( ; iter1 != baseStruct->get_members().end() && iter2 != listInit->end_initializers(); ++iter2 ) {
     535                                if ( (*iter2)->get_designators().empty() ) {
     536                                        DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *iter1 );
     537                                        initContext = dt->get_type();
     538                                        (*iter2)->accept( *this );
     539                                        ++iter1;
     540                                } else {
     541                                        StructDecl *st = baseStruct;
     542                                        iter1 = st->get_members().begin();
     543                                        std::list<Expression *>::iterator iter3( (*iter2)->get_designators().begin() );
     544                                        for ( ; iter3 != (*iter2)->get_designators().end(); ++iter3 ) {
     545                                                NameExpr *key = dynamic_cast<NameExpr *>( *iter3 );
     546                                                assert( key );
     547                                                for ( ; iter1 != st->get_members().end(); ++iter1 ) {
     548                                                        if ( key->get_name() == (*iter1)->get_name() ) {
     549                                                                (*iter1)->print( cout );
     550                                                                cout << key->get_name() << endl;
     551                                                                ObjectDecl *fred = dynamic_cast<ObjectDecl *>( *iter1 );
     552                                                                assert( fred );
     553                                                                StructInstType *mary = dynamic_cast<StructInstType*>( fred->get_type() );
     554                                                                assert( mary );
     555                                                                st = mary->get_baseStruct();
     556                                                                iter1 = st->get_members().begin();
     557                                                                break;
     558                                                        } // if
     559                                                }  // for
     560                                        } // for
     561                                        ObjectDecl *fred = dynamic_cast<ObjectDecl *>( *iter1 );
     562                                        assert( fred );
     563                                        initContext = fred->get_type();
     564                                        (*listInit->begin_initializers())->accept( *this );
     565                                } // if
     566                        } // for
     567                } else if ( UnionInstType *st = dynamic_cast<UnionInstType*>(initContext) ) {
     568                        DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *st->get_baseUnion()->get_members().begin() );
     569                        initContext = dt->get_type();
     570                        (*listInit->begin_initializers())->accept( *this );
     571                } // if
     572#endif
    458573        }
    459574
  • src/ResolvExpr/Unify.cc

    rb826e6b rfea3faa  
    606606                        } else if ( tupleParam ) {
    607607                                // bundle other parameters into tuple to match
    608                                 std::list< Type * > binderTypes;
     608                                TupleType* binder = new TupleType{ paramTy->get_qualifiers() };
    609609
    610610                                do {
    611                                         binderTypes.push_back( otherParam->get_type()->clone() );
     611                                        binder->get_types().push_back( otherParam->get_type()->clone() );
    612612                                        ++jt;
    613613
     
    618618                                } while (true);
    619619
    620                                 otherParamTy = new TupleType{ paramTy->get_qualifiers(), binderTypes };
     620                                otherParamTy = binder;
    621621                                ++it;  // skip ttype parameter for break
    622622                        } else if ( otherTupleParam ) {
    623623                                // bundle parameters into tuple to match other
    624                                 std::list< Type * > binderTypes;
     624                                TupleType* binder = new TupleType{ otherParamTy->get_qualifiers() };
    625625
    626626                                do {
    627                                         binderTypes.push_back( param->get_type()->clone() );
     627                                        binder->get_types().push_back( param->get_type()->clone() );
    628628                                        ++it;
    629629
     
    634634                                } while (true);
    635635
    636                                 paramTy = new TupleType{ otherParamTy->get_qualifiers(), binderTypes };
     636                                paramTy = binder;
    637637                                ++jt;  // skip ttype parameter for break
    638638                        }
     
    756756                        return function->get_returnVals().front()->get_type()->clone();
    757757                } else {
    758                         std::list< Type * > types;
     758                        TupleType * tupleType = new TupleType( Type::Qualifiers() );
    759759                        for ( DeclarationWithType * decl : function->get_returnVals() ) {
    760                                 types.push_back( decl->get_type()->clone() );
     760                                tupleType->get_types().push_back( decl->get_type()->clone() );
    761761                        } // for
    762                         return new TupleType( Type::Qualifiers(), types );
     762                        return tupleType;
    763763                }
    764764        }
  • src/ResolvExpr/module.mk

    rb826e6b rfea3faa  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Richard C. Bilson
     
    3131       ResolvExpr/PolyCost.cc \
    3232       ResolvExpr/Occurs.cc \
    33        ResolvExpr/TypeEnvironment.cc \
    34        ResolvExpr/CurrentObject.cc
     33       ResolvExpr/TypeEnvironment.cc
  • src/SymTab/Autogen.cc

    rb826e6b rfea3faa  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 03 15:45:56 2016
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 16:41:00 2017
    13 // Update Count     : 62
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 09:41:08 2017
     13// Update Count     : 60
    1414//
    1515
     
    400400        /// generates struct constructors, destructor, and assignment functions
    401401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
    402                 // Builtins do not use autogeneration.
    403                 if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA ||
    404                          aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
    405                         return;
    406                 }
    407 
    408402                // Make function polymorphic in same parameters as generic struct, if applicable
    409403                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
  • src/SymTab/Autogen.h

    rb826e6b rfea3faa  
    2525
    2626namespace SymTab {
    27         /// Generates assignment operators, constructors, and destructor for aggregate types as required
    28         void autogenerateRoutines( std::list< Declaration * > &translationUnit );
     27    /// Generates assignment operators, constructors, and destructor for aggregate types as required
     28    void autogenerateRoutines( std::list< Declaration * > &translationUnit );
    2929
    30         /// returns true if obj's name is the empty string and it has a bitfield width
    31         bool isUnnamedBitfield( ObjectDecl * obj );
     30    /// returns true if obj's name is the empty string and it has a bitfield width
     31    bool isUnnamedBitfield( ObjectDecl * obj );
    3232
    33         /// size_t type - set when size_t typedef is seen. Useful in a few places,
    34         /// such as in determining array dimension type
    35         extern Type * SizeType;
     33    /// size_t type - set when size_t typedef is seen. Useful in a few places,
     34    /// such as in determining array dimension type
     35    extern Type * SizeType;
    3636
    37         /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
    38         template< typename OutputIterator >
     37    /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
     38    template< typename OutputIterator >
    3939        Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false, bool forward = true );
    4040
    41         /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types.
    42         /// optionally returns a statement which must be inserted prior to the containing loop, if there is one
    43         template< typename OutputIterator >
     41    /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types.
     42    /// optionally returns a statement which must be inserted prior to the containing loop, if there is one
     43    template< typename OutputIterator >
    4444        Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) {
    4545        // want to be able to generate assignment, ctor, and dtor generically,
     
    5050        dstParam = new AddressExpr( dstParam );
    5151        if ( addCast ) {
    52                 // cast to T* with qualifiers removed, so that qualified objects can be constructed
    53                 // and destructed with the same functions as non-qualified objects.
    54                 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument
    55                 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever
    56                 // remove lvalue as a qualifier, this can change to
    57                 //   type->get_qualifiers() = Type::Qualifiers();
    58                 assert( type );
    59                 Type * castType = type->clone();
    60                 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
    61                 castType->set_lvalue( true ); // xxx - might not need this
    62                 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) );
     52            // cast to T* with qualifiers removed, so that qualified objects can be constructed
     53            // and destructed with the same functions as non-qualified objects.
     54            // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument
     55            // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever
     56            // remove lvalue as a qualifier, this can change to
     57            //   type->get_qualifiers() = Type::Qualifiers();
     58            assert( type );
     59            Type * castType = type->clone();
     60//                      castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, false);
     61            castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
     62            castType->set_lvalue( true ); // xxx - might not need this
     63            dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) );
    6364        }
    6465        fExpr->get_args().push_back( dstParam );
     
    7475
    7576        return listInit;
     77    }
     78
     79    /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments.
     80    /// If forward is true, loop goes from 0 to N-1, else N-1 to 0
     81    template< typename OutputIterator >
     82        void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) {
     83        static UniqueName indexName( "_index" );
     84
     85        // for a flexible array member nothing is done -- user must define own assignment
     86        if ( ! array->get_dimension() ) return ;
     87
     88        Expression * begin, * end, * update, * cmp;
     89        if ( forward ) {
     90            // generate: for ( int i = 0; i < N; ++i )
     91            begin = new ConstantExpr( Constant::from_int( 0 ) );
     92            end = array->get_dimension()->clone();
     93            cmp = new NameExpr( "?<?" );
     94            update = new NameExpr( "++?" );
     95        } else {
     96            // generate: for ( int i = N-1; i >= 0; --i )
     97            begin = new UntypedExpr( new NameExpr( "?-?" ) );
     98            ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
     99            ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
     100            end = new ConstantExpr( Constant::from_int( 0 ) );
     101            cmp = new NameExpr( "?>=?" );
     102            update = new NameExpr( "--?" );
    76103        }
    77104
    78         /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments.
    79         /// If forward is true, loop goes from 0 to N-1, else N-1 to 0
    80         template< typename OutputIterator >
    81         void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) {
    82                 static UniqueName indexName( "_index" );
     105        ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) );
    83106
    84                 // for a flexible array member nothing is done -- user must define own assignment
    85                 if ( ! array->get_dimension() ) return ;
     107        UntypedExpr *cond = new UntypedExpr( cmp );
     108        cond->get_args().push_back( new VariableExpr( index ) );
     109        cond->get_args().push_back( end );
    86110
    87                 Expression * begin, * end, * update, * cmp;
    88                 if ( forward ) {
    89                         // generate: for ( int i = 0; i < N; ++i )
    90                         begin = new ConstantExpr( Constant::from_int( 0 ) );
    91                         end = array->get_dimension()->clone();
    92                         cmp = new NameExpr( "?<?" );
    93                         update = new NameExpr( "++?" );
    94                 } else {
    95                         // generate: for ( int i = N-1; i >= 0; --i )
    96                         begin = new UntypedExpr( new NameExpr( "?-?" ) );
    97                         ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
    98                         ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
    99                         end = new ConstantExpr( Constant::from_int( 0 ) );
    100                         cmp = new NameExpr( "?>=?" );
    101                         update = new NameExpr( "--?" );
    102                 }
     111        UntypedExpr *inc = new UntypedExpr( update );
     112        inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
    103113
    104                 ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin ) );
     114        UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
     115        dstIndex->get_args().push_back( dstParam );
     116        dstIndex->get_args().push_back( new VariableExpr( index ) );
     117        dstParam = dstIndex;
    105118
    106                 UntypedExpr *cond = new UntypedExpr( cmp );
    107                 cond->get_args().push_back( new VariableExpr( index ) );
    108                 cond->get_args().push_back( end );
     119        // srcParam must keep track of the array indices to build the
     120        // source parameter and/or array list initializer
     121        srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
    109122
    110                 UntypedExpr *inc = new UntypedExpr( update );
    111                 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
     123        // for stmt's body, eventually containing call
     124        CompoundStmt * body = new CompoundStmt( noLabels );
     125        Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
    112126
    113                 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
    114                 dstIndex->get_args().push_back( dstParam );
    115                 dstIndex->get_args().push_back( new VariableExpr( index ) );
    116                 dstParam = dstIndex;
     127        // block containing for stmt and index variable
     128        std::list<Statement *> initList;
     129        CompoundStmt * block = new CompoundStmt( noLabels );
     130        block->get_kids().push_back( new DeclStmt( noLabels, index ) );
     131        if ( listInit ) block->get_kids().push_back( listInit );
     132        block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
    117133
    118                 // srcParam must keep track of the array indices to build the
    119                 // source parameter and/or array list initializer
    120                 srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
     134        *out++ = block;
     135    }
    121136
    122                 // for stmt's body, eventually containing call
    123                 CompoundStmt * body = new CompoundStmt( noLabels );
    124                 Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
     137    template< typename OutputIterator >
     138        Statement * genCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
     139        if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     140            genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
     141            return 0;
     142        } else {
     143            return genScalarCall( srcParam, dstParam, fname, out, type, addCast );
     144        }
     145    }
    125146
    126                 // block containing for stmt and index variable
    127                 std::list<Statement *> initList;
    128                 CompoundStmt * block = new CompoundStmt( noLabels );
    129                 block->get_kids().push_back( new DeclStmt( noLabels, index ) );
    130                 if ( listInit ) block->get_kids().push_back( listInit );
    131                 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
     147    /// inserts into out a generated call expression to function fname with arguments dstParam
     148    /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the
     149    /// object being constructed. The function wraps constructor and destructor calls in an
     150    /// ImplicitCtorDtorStmt node.
     151    template< typename OutputIterator >
     152        void genImplicitCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
     153        ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
     154        assert( obj );
     155        // unnamed bit fields are not copied as they cannot be accessed
     156        if ( isUnnamedBitfield( obj ) ) return;
    132157
    133                 *out++ = block;
     158        bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) );
     159        std::list< Statement * > stmts;
     160        genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
     161
     162        // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
     163        assert( stmts.size() <= 1 );
     164        if ( stmts.size() == 1 ) {
     165            Statement * callStmt = stmts.front();
     166            if ( addCast ) {
     167                // implicitly generated ctor/dtor calls should be wrapped
     168                // so that later passes are aware they were generated.
     169                // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield,
     170                // because this causes the address to be taken at codegen, which is illegal in C.
     171                callStmt = new ImplicitCtorDtorStmt( callStmt );
     172            }
     173            *out++ = callStmt;
    134174        }
    135 
    136         template< typename OutputIterator >
    137         Statement * genCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
    138                 if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
    139                         genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
    140                         return 0;
    141                 } else {
    142                         return genScalarCall( srcParam, dstParam, fname, out, type, addCast );
    143                 }
    144         }
    145 
    146         /// inserts into out a generated call expression to function fname with arguments dstParam
    147         /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the
    148         /// object being constructed. The function wraps constructor and destructor calls in an
    149         /// ImplicitCtorDtorStmt node.
    150         template< typename OutputIterator >
    151         void genImplicitCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
    152                 ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
    153                 assert( obj );
    154                 // unnamed bit fields are not copied as they cannot be accessed
    155                 if ( isUnnamedBitfield( obj ) ) return;
    156 
    157                 bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) );
    158                 std::list< Statement * > stmts;
    159                 genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
    160 
    161                 // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
    162                 assert( stmts.size() <= 1 );
    163                 if ( stmts.size() == 1 ) {
    164                         Statement * callStmt = stmts.front();
    165                         if ( addCast ) {
    166                                 // implicitly generated ctor/dtor calls should be wrapped
    167                                 // so that later passes are aware they were generated.
    168                                 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield,
    169                                 // because this causes the address to be taken at codegen, which is illegal in C.
    170                                 callStmt = new ImplicitCtorDtorStmt( callStmt );
    171                         }
    172                         *out++ = callStmt;
    173                 }
    174         }
     175    }
    175176} // namespace SymTab
    176177#endif // AUTOGEN_H
  • src/SymTab/ImplementationType.cc

    rb826e6b rfea3faa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ImplementationType.cc --
     7// ImplementationType.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    9292
    9393        void ImplementationType::visit(TupleType *tupleType) {
    94                 std::list< Type * > types;
     94                TupleType *newType = new TupleType( Type::Qualifiers() );
    9595                for ( std::list< Type* >::iterator i = tupleType->get_types().begin(); i != tupleType->get_types().end(); ++i ) {
    9696                        Type *implType = implementationType( *i, indexer );
    9797                        implType->get_qualifiers() |= tupleType->get_qualifiers();
    98                         types.push_back( implType );
     98                        newType->get_types().push_back( implType );
    9999                } // for
    100                 result = new TupleType( Type::Qualifiers(), types );
     100                result = newType;
    101101        }
    102102
  • src/SymTab/Indexer.cc

    rb826e6b rfea3faa  
    652652                        for ( MangleTable::const_iterator decl = mangleTable.begin(); decl != mangleTable.end(); ++decl ) {
    653653                                // check for C decls with the same name, skipping those with a compatible type (by mangleName)
    654                                 if ( ! LinkageSpec::isMangled( decl->second->get_linkage() ) && decl->first != mangleName ) return true;
     654                                if ( decl->second->get_linkage() == LinkageSpec::C && decl->first != mangleName ) return true;
    655655                        }
    656656                }
     
    669669                                // check for C decls with the same name, skipping
    670670                                // those with an incompatible type (by mangleName)
    671                                 if ( ! LinkageSpec::isMangled( decl->second->get_linkage() ) && decl->first == mangleName ) return true;
     671                                if ( decl->second->get_linkage() == LinkageSpec::C && decl->first == mangleName ) return true;
    672672                        }
    673673                }
     
    724724                        // new definition shadows the autogenerated one, even at the same scope
    725725                        return false;
    726                 } else if ( LinkageSpec::isMangled( added->get_linkage() ) || ResolvExpr::typesCompatible( added->get_type(), existing->get_type(), Indexer() ) ) {
     726                } else if ( added->get_linkage() != LinkageSpec::C || ResolvExpr::typesCompatible( added->get_type(), existing->get_type(), Indexer() ) ) {
    727727                        // typesCompatible doesn't really do the right thing here. When checking compatibility of function types,
    728728                        // we should ignore outermost pointer qualifiers, except _Atomic?
     
    765765
    766766                // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage
    767                 if ( ! LinkageSpec::isMangled( decl->get_linkage() ) ) {
     767                if ( decl->get_linkage() == LinkageSpec::C ) {
    768768                        // NOTE this is broken in Richard's original code in such a way that it never triggers (it
    769769                        // doesn't check decls that have the same manglename, and all C-linkage decls are defined to
  • src/SymTab/Mangler.cc

    rb826e6b rfea3faa  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:31:00 2017
    13 // Update Count     : 21
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 09:40:01 2017
     13// Update Count     : 20
    1414//
    1515
     
    7272                        } else {
    7373                                // if we add another kind of overridable function, this has to change
    74                                 assert( false && "unknown overrideable linkage" );
     74                                assert( false );
    7575                        } // if
    7676                }
  • src/SymTab/Validate.cc

    rb826e6b rfea3faa  
    106106
    107107        /// Fix return types so that every function returns exactly one value
    108         struct ReturnTypeFixer {
     108        class ReturnTypeFixer {
     109          public:
    109110                static void fix( std::list< Declaration * > &translationUnit );
    110111
     
    114115
    115116        /// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers.
    116         struct EnumAndPointerDecay {
     117        class EnumAndPointerDecay {
     118        public:
    117119                void previsit( EnumDecl *aggregateDecl );
    118120                void previsit( FunctionType *func );
     
    157159        };
    158160
    159         struct ReturnChecker : public WithGuards {
     161        class ReturnChecker : public WithScopes {
     162          public:
    160163                /// Checks that return statements return nothing if their return type is void
    161164                /// and return something if the return type is non-void.
    162165                static void checkFunctionReturns( std::list< Declaration * > & translationUnit );
    163 
     166          private:
    164167                void previsit( FunctionDecl * functionDecl );
    165168                void previsit( ReturnStmt * returnStmt );
     
    202205        };
    203206
    204         struct VerifyCtorDtorAssign {
     207        class VerifyCtorDtorAssign {
     208        public:
    205209                /// ensure that constructors, destructors, and assignment have at least one
    206210                /// parameter, the first of which must be a pointer, and that ctor/dtors have no
     
    212216
    213217        /// ensure that generic types have the correct number of type arguments
    214         struct ValidateGenericParameters {
     218        class ValidateGenericParameters {
     219        public:
    215220                void previsit( StructInstType * inst );
    216221                void previsit( UnionInstType * inst );
    217222        };
    218223
    219         struct ArrayLength {
     224        class ArrayLength {
     225        public:
    220226                /// for array types without an explicit length, compute the length and store it so that it
    221227                /// is known to the rest of the phases. For example,
     
    230236        };
    231237
    232         struct CompoundLiteral final : public WithDeclsToAdd, public WithVisitorRef<CompoundLiteral> {
     238        class CompoundLiteral final : public GenPoly::DeclMutator {
    233239                Type::StorageClasses storageClasses;
    234240
    235                 void premutate( ObjectDecl *objectDecl );
    236                 Expression * postmutate( CompoundLiteralExpr *compLitExpr );
     241                using GenPoly::DeclMutator::mutate;
     242                DeclarationWithType * mutate( ObjectDecl *objectDecl ) final;
     243                Expression *mutate( CompoundLiteralExpr *compLitExpr ) final;
    237244        };
    238245
     
    241248                LinkReferenceToTypes lrt( doDebug, 0 );
    242249                ForallPointerDecay fpd( 0 );
    243                 PassVisitor<CompoundLiteral> compoundliteral;
     250                CompoundLiteral compoundliteral;
    244251                PassVisitor<ValidateGenericParameters> genericParams;
    245252
     
    256263                Concurrency::implementThreadStarter( translationUnit );
    257264                ReturnChecker::checkFunctionReturns( translationUnit );
    258                 mutateAll( translationUnit, compoundliteral );
     265                compoundliteral.mutateDeclarationList( translationUnit );
    259266                acceptAll( translationUnit, fpd );
    260267                ArrayLength::computeLength( translationUnit );
     
    876883        }
    877884
    878         void CompoundLiteral::premutate( ObjectDecl *objectDecl ) {
     885        DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
    879886                storageClasses = objectDecl->get_storageClasses();
    880         }
    881 
    882         Expression *CompoundLiteral::postmutate( CompoundLiteralExpr *compLitExpr ) {
     887                DeclarationWithType * temp = Mutator::mutate( objectDecl );
     888                return temp;
     889        }
     890
     891        Expression *CompoundLiteral::mutate( CompoundLiteralExpr *compLitExpr ) {
    883892                // transform [storage_class] ... (struct S){ 3, ... };
    884893                // into [storage_class] struct S temp =  { 3, ... };
    885894                static UniqueName indexName( "_compLit" );
    886895
    887                 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, nullptr, compLitExpr->get_result(), compLitExpr->get_initializer() );
    888                 compLitExpr->set_result( nullptr );
    889                 compLitExpr->set_initializer( nullptr );
     896                ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_result(), compLitExpr->get_initializer() );
     897                compLitExpr->set_result( 0 );
     898                compLitExpr->set_initializer( 0 );
    890899                delete compLitExpr;
    891                 declsToAddBefore.push_back( tempvar );                                  // add modified temporary to current block
    892                 return new VariableExpr( tempvar );
     900                DeclarationWithType * newtempvar = mutate( tempvar );
     901                addDeclaration( newtempvar );                                   // add modified temporary to current block
     902                return new VariableExpr( newtempvar );
    893903        }
    894904
  • src/SymTab/module.mk

    rb826e6b rfea3faa  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jul 12 13:06:00 2017
    14 ## Update Count     : 3
     12## Last Modified By : Rob Schluntz
     13## Last Modified On : Tue Jul 07 16:22:23 2015
     14## Update Count     : 2
    1515###############################################################################
    1616
     
    2121       SymTab/ImplementationType.cc \
    2222       SymTab/TypeEquality.cc \
    23        SymTab/Autogen.cc \
    24        SymTab/TreeStruct.cc
     23       SymTab/Autogen.cc
  • src/SynTree/AggregateDecl.cc

    rb826e6b rfea3faa  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:56:39 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:30:00 2017
    13 // Update Count     : 21
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 16 07:49:07 2017
     13// Update Count     : 20
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes, LinkageSpec::Spec linkage ) : Parent( name, Type::StorageClasses(), linkage ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Constant.cc

    rb826e6b rfea3faa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Constant.cc --
     7// Constant.cc -- 
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 14:50:00 2017
    13 // Update Count     : 29
     12// Last Modified On : Thr Jun 22 10:11:00 2017
     13// Update Count     : 28
    1414//
    1515
     
    4646}
    4747
    48 Constant Constant::null( Type * ptrtype ) {
    49         if ( nullptr == ptrtype ) {
    50                 ptrtype = new PointerType(
    51                         Type::Qualifiers(),
    52                         new VoidType( Type::Qualifiers() )
    53                         );
    54         }
    55 
    56         return Constant( ptrtype, "0", (unsigned long long int)0 );
    57 }
    58 
    59 unsigned long long Constant::get_ival() const {
    60         assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
    61         return val.ival;
    62 }
    63 
    64 double Constant::get_dval() const {
    65         assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
    66         return val.dval;
    67 }
    68 
    6948void Constant::print( std::ostream &os ) const {
    7049        os << "(" << rep << " " << val.ival;
  • src/SynTree/Constant.h

    rb826e6b rfea3faa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Constant.h --
     7// Constant.h -- 
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 13:33:00 2017
    13 // Update Count     : 16
     12// Last Modified On : Thr Jun 22 10:13:00 2017
     13// Update Count     : 15
    1414//
    1515
     
    3232        std::string & get_value() { return rep; }
    3333        void set_value( std::string newValue ) { rep = newValue; }
    34         unsigned long long get_ival() const;
    35         double get_dval() const;
    3634
    3735        /// generates a boolean constant of the given bool
     
    4341        /// generates a floating point constant of the given double
    4442        static Constant from_double( double d );
    45 
    46         /// generates a null pointer value for the given type. void * if omitted.
    47         static Constant null( Type * ptrtype = nullptr );
    4843
    4944        virtual void accept( Visitor & v ) { v.visit( this ); }
  • src/SynTree/Declaration.h

    rb826e6b rfea3faa  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 16:59:00 2017
    13 // Update Count     : 123
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar 17 16:05:08 2017
     13// Update Count     : 121
    1414//
    1515
     
    238238        typedef Declaration Parent;
    239239  public:
    240         AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );
     240        AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() );
    241241        AggregateDecl( const AggregateDecl &other );
    242242        virtual ~AggregateDecl();
     
    266266        typedef AggregateDecl Parent;
    267267  public:
    268         StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {}
    269         StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {}
     268        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ), kind( kind ) {}
    270269        StructDecl( const StructDecl &other ) : Parent( other ) {}
    271270
     
    274273        bool is_thread() { return kind == DeclarationNode::Thread; }
    275274
    276         // Tagged/Tree Structure Excetion
    277         bool get_tagged() { return tagged; }
    278         void set_tagged( bool newValue ) { tagged = newValue; }
    279         bool has_parent() { return parent_name != ""; }
    280         std::string get_parentName() { return parent_name; }
    281 
    282275        virtual StructDecl *clone() const { return new StructDecl( *this ); }
    283276        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    286279        DeclarationNode::Aggregate kind;
    287280        virtual std::string typeString() const;
    288 
    289         bool tagged;
    290         std::string parent_name;
    291281};
    292282
     
    294284        typedef AggregateDecl Parent;
    295285  public:
    296         UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
     286        UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    297287        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    298288
     
    307297        typedef AggregateDecl Parent;
    308298  public:
    309         EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
     299        EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
    310300        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    311301
  • src/SynTree/Expression.cc

    rb826e6b rfea3faa  
    2121#include <iterator>
    2222
     23#include "Type.h"
     24#include "Initializer.h"
     25#include "Expression.h"
    2326#include "Declaration.h"
    24 #include "Expression.h"
    25 #include "Initializer.h"
    2627#include "Statement.h"
    27 #include "Type.h"
    2828#include "TypeSubstitution.h"
    29 #include "VarExprReplacer.h"
    30 
    3129#include "Common/utility.h"
    32 #include "Common/PassVisitor.h"
    33 
    3430#include "InitTweak/InitTweak.h"
    3531
     
    9692
    9793        Declaration *decl = get_var();
     94        // if ( decl != 0) decl->print(os, indent + 2);
    9895        if ( decl != 0) decl->printShort(os, indent + 2);
    9996        os << std::endl;
     
    660657}
    661658
    662 InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {}
    663 InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {}
    664 InitAlternative::~InitAlternative() {
    665         delete type;
    666         delete designation;
    667 }
    668 
    669 UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {}
    670 UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {}
    671 UntypedInitExpr::~UntypedInitExpr() {
    672         delete expr;
    673 }
    674 
    675 void UntypedInitExpr::print( std::ostream & os, int indent ) const {
    676         os << "Untyped Init Expression" << std::endl << std::string( indent+2, ' ' );
    677         expr->print( os, indent+2 );
    678         if ( ! initAlts.empty() ) {
    679                 for ( const InitAlternative & alt : initAlts ) {
    680                         os << std::string( indent+2, ' ' ) <<  "InitAlternative: ";
    681                         alt.type->print( os, indent+2 );
    682                         alt.designation->print( os, indent+2 );
    683                 }
    684         }
    685 }
    686 
    687 InitExpr::InitExpr( Expression * expr, Designation * designation ) : expr( expr ), designation( designation ) {
    688         set_result( expr->get_result()->clone() );
    689 }
    690 InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {}
    691 InitExpr::~InitExpr() {
    692         delete expr;
    693         delete designation;
    694 }
    695 
    696 void InitExpr::print( std::ostream & os, int indent ) const {
    697         os << "Init Expression" << std::endl << std::string( indent+2, ' ' );
    698         expr->print( os, indent+2 );
    699         os << std::string( indent+2, ' ' ) << "with designation: ";
    700         designation->print( os, indent+2 );
    701 }
    702 
    703 
    704659std::ostream & operator<<( std::ostream & out, const Expression * expr ) {
    705660        if ( expr ) {
  • src/SynTree/Expression.h

    rb826e6b rfea3faa  
    744744};
    745745
    746 struct InitAlternative {
    747 public:
    748         Type * type = nullptr;
    749         Designation * designation = nullptr;
    750         InitAlternative( Type * type, Designation * designation );
    751         InitAlternative( const InitAlternative & other );
    752         InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it
    753         ~InitAlternative();
    754 };
    755 
    756 class UntypedInitExpr : public Expression {
    757 public:
    758         UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );
    759         UntypedInitExpr( const UntypedInitExpr & other );
    760         ~UntypedInitExpr();
    761 
    762         Expression * get_expr() const { return expr; }
    763         UntypedInitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
    764 
    765         std::list<InitAlternative> & get_initAlts() { return initAlts; }
    766 
    767         virtual UntypedInitExpr * clone() const { return new UntypedInitExpr( * this ); }
    768         virtual void accept( Visitor & v ) { v.visit( this ); }
    769         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    770         virtual void print( std::ostream & os, int indent = 0 ) const;
    771 private:
    772         Expression * expr;
    773         std::list<InitAlternative> initAlts;
    774 };
    775 
    776 class InitExpr : public Expression {
    777 public:
    778         InitExpr( Expression * expr, Designation * designation );
    779         InitExpr( const InitExpr & other );
    780         ~InitExpr();
    781 
    782         Expression * get_expr() const { return expr; }
    783         InitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
    784 
    785         Designation * get_designation() const { return designation; }
    786         InitExpr * set_designation( Designation * newValue ) { designation = newValue; return this; }
    787 
    788         virtual InitExpr * clone() const { return new InitExpr( * this ); }
    789         virtual void accept( Visitor & v ) { v.visit( this ); }
    790         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    791         virtual void print( std::ostream & os, int indent = 0 ) const;
    792 private:
    793         Expression * expr;
    794         Designation * designation;
    795 };
    796 
    797 
    798746std::ostream & operator<<( std::ostream & out, const Expression * expr );
    799747
  • src/SynTree/Initializer.cc

    rb826e6b rfea3faa  
    1919#include "Common/utility.h"
    2020
    21 Designation::Designation( const std::list< Expression * > & designators ) : designators( designators ) {}
    22 Designation::Designation( const Designation & other ) : BaseSyntaxNode( other ) {
    23         // std::cerr << "cloning designation" << std::endl;
    24         cloneAll( other.designators, designators );
    25         // std::cerr << "finished cloning designation" << std::endl;
    26 }
    27 
    28 Designation::~Designation() {
    29         // std::cerr << "destroying designation" << std::endl;
    30         deleteAll( designators );
    31         // std::cerr << "finished destroying designation" << std::endl;
    32 }
    33 
    34 void Designation::print( std::ostream &os, int indent ) const {
    35         if ( ! designators.empty() ) {
    36                 os << std::string(indent + 2, ' ' ) << "designated by: " << std::endl;
    37                 for ( std::list < Expression * >::const_iterator i = designators.begin(); i != designators.end(); i++ ) {
    38                         os << std::string(indent + 4, ' ' );
    39                         ( *i )->print(os, indent + 4 );
    40                 }
    41                 os << std::endl;
    42         } // if
    43 }
    44 
    4521Initializer::Initializer( bool maybeConstructed ) : maybeConstructed( maybeConstructed ) {}
    4622Initializer::Initializer( const Initializer & other ) : BaseSyntaxNode( other ), maybeConstructed( other.maybeConstructed ) {
    4723}
     24
     25
    4826Initializer::~Initializer() {}
    4927
    50 SingleInit::SingleInit( Expression *v, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ) {
     28std::string Initializer::designator_name( Expression *des ) {
     29        if ( NameExpr *n = dynamic_cast<NameExpr *>(des) )
     30                return n->get_name();
     31        else
     32                throw 0;
     33}
     34
     35// void Initializer::print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent ) {}
     36
     37SingleInit::SingleInit( Expression *v, const std::list< Expression *> &_designators, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ), designators( _designators ) {
    5138}
    5239
    5340SingleInit::SingleInit( const SingleInit &other ) : Initializer(other), value ( maybeClone( other.value ) ) {
     41        cloneAll(other.designators, designators );
    5442}
    5543
    5644SingleInit::~SingleInit() {
    5745        delete value;
     46        deleteAll(designators);
    5847}
    5948
    60 void SingleInit::print( std::ostream &os, int indent ) const {
    61         os << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;
     49void SingleInit::print( std::ostream &os, int indent ) {
     50        os << std::endl << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;
    6251        os << std::string(indent+4, ' ' );
    6352        value->print( os, indent+4 );
     53
     54        if ( ! designators.empty() ) {
     55                os << std::endl << std::string(indent + 2, ' ' ) << "designated by: " << std::endl;
     56                for ( std::list < Expression * >::iterator i = designators.begin(); i != designators.end(); i++ ) {
     57                        os << std::string(indent + 4, ' ' );
     58                        ( *i )->print(os, indent + 4 );
     59                }
     60        } // if
    6461}
    6562
    66 
    67 ListInit::ListInit( const std::list<Initializer*> &inits, const std::list<Designation *> &des, bool maybeConstructed )
    68         : Initializer( maybeConstructed ), initializers( inits ), designations( des ) {
    69                 // handle the common case where a ListInit is created without designations by making a list of empty designations with the same length as the initializer
    70                 if ( designations.empty() ) {
    71                         for ( auto & i : initializers ) {
    72                                 (void)i;
    73                                 designations.push_back( new Designation( {} ) );
    74                         }
    75                 }
    76                 assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%d) and designations (%d)", initializers.size(), designations.size() );
     63ListInit::ListInit( const std::list<Initializer*> &_initializers, const std::list<Expression *> &_designators, bool maybeConstructed )
     64        : Initializer( maybeConstructed ), initializers( _initializers ), designators( _designators ) {
    7765}
    7866
    7967ListInit::ListInit( const ListInit & other ) : Initializer( other ) {
    8068        cloneAll( other.initializers, initializers );
    81         cloneAll( other.designations, designations );
     69        cloneAll( other.designators, designators );
    8270}
     71
    8372
    8473ListInit::~ListInit() {
    8574        deleteAll( initializers );
    86         deleteAll( designations );
     75        deleteAll( designators );
    8776}
    8877
    89 void ListInit::print( std::ostream &os, int indent ) const {
    90         os << std::string(indent, ' ') << "Compound initializer:  " << std::endl;
    91         for ( Designation * d : designations ) {
    92                 d->print( os, indent + 2 );
    93         }
     78void ListInit::print( std::ostream &os, int indent ) {
     79        os << std::endl << std::string(indent, ' ') << "Compound initializer:  ";
     80        if ( ! designators.empty() ) {
     81                os << std::string(indent + 2, ' ' ) << "designated by: [";
     82                for ( std::list < Expression * >::iterator i = designators.begin();
     83                          i != designators.end(); i++ ) {
     84                        ( *i )->print(os, indent + 4 );
     85                } // for
    9486
    95         for ( const Initializer * init : initializers ) {
    96                 init->print( os, indent + 2 );
    97                 os << std::endl;
    98         }
     87                os << std::string(indent + 2, ' ' ) << "]";
     88        } // if
     89
     90        for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ )
     91                (*i)->print( os, indent + 2 );
    9992}
    10093
     
    110103}
    111104
    112 void ConstructorInit::print( std::ostream &os, int indent ) const {
     105void ConstructorInit::print( std::ostream &os, int indent ) {
    113106        os << std::endl << std::string(indent, ' ') << "Constructor initializer: " << std::endl;
    114107        if ( ctor ) {
     
    131124}
    132125
    133 std::ostream & operator<<( std::ostream & out, const Initializer * init ) {
    134         if ( init ) {
    135                 init->print( out );
    136         } else {
    137                 out << "nullptr";
    138         }
    139         return out;
    140 }
    141 
    142 std::ostream & operator<<( std::ostream & out, const Designation * des ) {
    143         if ( des ) {
    144                 des->print( out );
    145         } else {
    146                 out << "nullptr";
    147         }
     126std::ostream & operator<<( std::ostream & out, Initializer * init ) {
     127        init->print( out );
    148128        return out;
    149129}
  • src/SynTree/Initializer.h

    rb826e6b rfea3faa  
    2525#include "Visitor.h"
    2626
    27 // Designation: list of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an object being initialized.
    28 class Designation : public BaseSyntaxNode {
    29 public:
    30         Designation( const std::list< Expression * > & designators );
    31         Designation( const Designation & other );
    32         virtual ~Designation();
    33 
    34         std::list< Expression * > & get_designators() { return designators; }
    35 
    36         virtual Designation * clone() const { return new Designation( *this ); };
    37         virtual void accept( Visitor &v ) { v.visit( this ); }
    38         virtual Designation * acceptMutator( Mutator &m ) { return m.mutate( this ); }
    39         virtual void print( std::ostream &os, int indent = 0 ) const;
    40 private:
    41         std::list< Expression * > designators;
    42 };
    43 
    44 const std::list<Designation *> noDesignators;
     27const std::list<Expression*> noDesignators;
    4528
    4629// Initializer: base class for object initializers (provide default values)
    4730class Initializer : public BaseSyntaxNode {
    4831  public:
     32        //      Initializer( std::string _name = std::string(""), int _pos = 0 );
    4933        Initializer( bool maybeConstructed );
    5034        Initializer( const Initializer & other );
    5135        virtual ~Initializer();
     36
     37        static std::string designator_name( Expression *designator );
     38
     39        //      void set_name( std::string newValue ) { name = newValue; }
     40        //      std::string get_name() const { return name; }
     41
     42        //      void set_pos( int newValue ) { pos = newValue; }
     43        //      int get_pos() const { return pos; }
     44        virtual void set_designators( std::list<Expression *> & ) { assert(false); }
     45        virtual std::list<Expression *> &get_designators() {
     46                assert(false);
     47                std::list<Expression *> *ret = 0; return *ret;  // never reached
     48        }
    5249
    5350        bool get_maybeConstructed() { return maybeConstructed; }
     
    5653        virtual void accept( Visitor &v ) = 0;
    5754        virtual Initializer *acceptMutator( Mutator &m ) = 0;
    58         virtual void print( std::ostream &os, int indent = 0 ) const = 0;
     55        virtual void print( std::ostream &os, int indent = 0 ) = 0;
    5956  private:
     57        //      std::string name;
     58        //      int pos;
    6059        bool maybeConstructed;
    6160};
     
    6463class SingleInit : public Initializer {
    6564  public:
    66         SingleInit( Expression *value, bool maybeConstructed = false );
     65        SingleInit( Expression *value, const std::list< Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false );
    6766        SingleInit( const SingleInit &other );
    6867        virtual ~SingleInit();
     
    7170        void set_value( Expression *newValue ) { value = newValue; }
    7271
     72        std::list<Expression *> &get_designators() { return designators; }
     73        void set_designators( std::list<Expression *> &newValue ) { designators = newValue; }
     74
    7375        virtual SingleInit *clone() const { return new SingleInit( *this); }
    7476        virtual void accept( Visitor &v ) { v.visit( this ); }
    7577        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    76         virtual void print( std::ostream &os, int indent = 0 ) const;
     78        virtual void print( std::ostream &os, int indent = 0 );
    7779  private:
    7880        //Constant *value;
    7981        Expression *value;      // has to be a compile-time constant
     82        std::list< Expression * > designators;
    8083};
    8184
     
    8588  public:
    8689        ListInit( const std::list<Initializer*> &initializers,
    87                           const std::list<Designation *> &designators = {}, bool maybeConstructed = false );
     90                          const std::list<Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false );
    8891        ListInit( const ListInit & other );
    8992        virtual ~ListInit();
    9093
    91         std::list<Designation *> & get_designations() { return designations; }
    92         std::list<Initializer *> & get_initializers() { return initializers; }
     94        void set_designators( std::list<Expression *> &newValue ) { designators = newValue; }
     95        std::list<Expression *> &get_designators() { return designators; }
     96        void set_initializers( std::list<Initializer*> &newValue ) { initializers = newValue; }
     97        std::list<Initializer*> &get_initializers() { return initializers; }
    9398
    9499        typedef std::list<Initializer*>::iterator iterator;
    95         typedef std::list<Initializer*>::const_iterator const_iterator;
    96100        iterator begin() { return initializers.begin(); }
    97101        iterator end() { return initializers.end(); }
    98         const_iterator begin() const { return initializers.begin(); }
    99         const_iterator end() const { return initializers.end(); }
    100102
    101103        virtual ListInit *clone() const { return new ListInit( *this ); }
    102104        virtual void accept( Visitor &v ) { v.visit( this ); }
    103105        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    104         virtual void print( std::ostream &os, int indent = 0 ) const;
     106        virtual void print( std::ostream &os, int indent = 0 );
    105107  private:
    106         std::list<Initializer *> initializers;  // order *is* important
    107         std::list<Designation *> designations;  // order/length is consistent with initializers
     108        std::list<Initializer*> initializers;  // order *is* important
     109        std::list<Expression *> designators;
    108110};
    109111
     
    128130        virtual void accept( Visitor &v ) { v.visit( this ); }
    129131        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    130         virtual void print( std::ostream &os, int indent = 0 ) const;
     132        virtual void print( std::ostream &os, int indent = 0 );
    131133
    132134  private:
     
    138140};
    139141
    140 std::ostream & operator<<( std::ostream & out, const Initializer * init );
    141 std::ostream & operator<<( std::ostream & out, const Designation * des );
     142std::ostream & operator<<( std::ostream & out, Initializer * init );
    142143
    143144#endif // INITIALIZER_H
  • src/SynTree/Mutator.cc

    rb826e6b rfea3faa  
    433433}
    434434
    435 Expression *Mutator::mutate( UntypedInitExpr * initExpr ) {
    436         initExpr->set_env( maybeMutate( initExpr->get_env(), *this ) );
    437         initExpr->set_result( maybeMutate( initExpr->get_result(), *this ) );
    438         initExpr->set_expr( maybeMutate( initExpr->get_expr(), *this ) );
    439         // not currently mutating initAlts, but this doesn't matter since this node is only used in the resolver.
    440         return initExpr;
    441 }
    442 
    443 Expression *Mutator::mutate( InitExpr * initExpr ) {
    444         initExpr->set_env( maybeMutate( initExpr->get_env(), *this ) );
    445         initExpr->set_result( maybeMutate( initExpr->get_result(), *this ) );
    446         initExpr->set_expr( maybeMutate( initExpr->get_expr(), *this ) );
    447         initExpr->set_designation( maybeMutate( initExpr->get_designation(), *this ) );
    448         return initExpr;
    449 }
    450 
    451435
    452436Type *Mutator::mutate( VoidType *voidType ) {
     
    515499        mutateAll( tupleType->get_forall(), *this );
    516500        mutateAll( tupleType->get_types(), *this );
    517         mutateAll( tupleType->get_members(), *this );
    518501        return tupleType;
    519502}
     
    552535
    553536
    554 Designation *Mutator::mutate( Designation * designation ) {
    555         mutateAll( designation->get_designators(), *this );
    556         return designation;
    557 }
    558 
    559537Initializer *Mutator::mutate( SingleInit *singleInit ) {
    560538        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
     
    563541
    564542Initializer *Mutator::mutate( ListInit *listInit ) {
    565         mutateAll( listInit->get_designations(), *this );
     543        mutateAll( listInit->get_designators(), *this );
    566544        mutateAll( listInit->get_initializers(), *this );
    567545        return listInit;
  • src/SynTree/Mutator.h

    rb826e6b rfea3faa  
    8585        virtual Expression* mutate( StmtExpr * stmtExpr );
    8686        virtual Expression* mutate( UniqueExpr * uniqueExpr );
    87         virtual Expression* mutate( UntypedInitExpr * initExpr );
    88         virtual Expression* mutate( InitExpr * initExpr );
    8987
    9088        virtual Type* mutate( VoidType *basicType );
     
    105103        virtual Type* mutate( OneType *oneType );
    106104
    107         virtual Designation* mutate( Designation *designation );
    108105        virtual Initializer* mutate( SingleInit *singleInit );
    109106        virtual Initializer* mutate( ListInit *listInit );
  • src/SynTree/SynTree.h

    rb826e6b rfea3faa  
    9393class StmtExpr;
    9494class UniqueExpr;
    95 class UntypedInitExpr;
    96 class InitExpr;
    9795
    9896class Type;
     
    115113class OneType;
    116114
    117 class Designation;
    118115class Initializer;
    119116class SingleInit;
  • src/SynTree/TupleType.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include "Declaration.h"
    17 #include "Initializer.h"
    1816#include "Type.h"
    1917#include "Common/utility.h"
    20 #include "Parser/LinkageSpec.h"
    2118
    2219TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
    23         for ( Type * t : *this ) {
    24                 // xxx - this is very awkward. TupleTypes should contain objects so that members can be named, but if they don't have an initializer node then
    25                 // they end up getting constructors, which end up being inserted causing problems. This happens because the object decls have to be visited so that
    26                 // their types are kept in sync with the types list here. Ultimately, the types list here should be eliminated and perhaps replaced with a list-view
    27                 // of the object types list, but I digress. The temporary solution here is to make a ListInit with maybeConstructed = false, that way even when the
    28                 // object is visited, it is never constructed. Ultimately, a better solution might be either:
    29                 // a) to separate TupleType from its declarations, into TupleDecl and Tuple{Inst?}Type, ala StructDecl and StructInstType
    30                 // b) separate initializer nodes better, e.g. add a MaybeConstructed node that is replaced by genInit, rather than what currently exists in a bool
    31                 members.push_back( new ObjectDecl( "" , Type::StorageClasses(), LinkageSpec::Cforall, nullptr, t->clone(), new ListInit( {}, {}, false ) ) );
    32         }
    3320}
    3421
    3522TupleType::TupleType( const TupleType& other ) : Type( other ) {
    3623        cloneAll( other.types, types );
    37         cloneAll( other.members, members );
    3824}
    3925
    4026TupleType::~TupleType() {
    4127        deleteAll( types );
    42         deleteAll( members );
    4328}
    4429
  • src/SynTree/Type.h

    rb826e6b rfea3faa  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 18 10:06:00 2017
    13 // Update Count     : 150
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Mar 23 16:16:36 2017
     13// Update Count     : 149
    1414//
    1515
     
    172172};
    173173
    174 extern Type::Qualifiers noQualifiers;                           // no qualifiers on constants
     174extern Type::Qualifiers emptyQualifiers;                                // no qualifiers on constants
    175175
    176176class VoidType : public Type {
     
    481481class TupleType : public Type {
    482482  public:
    483         TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     483        TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    484484        TupleType( const TupleType& );
    485485        virtual ~TupleType();
     
    488488        typedef value_type::iterator iterator;
    489489
    490         std::list<Type *> & get_types() { return types; }
     490        std::list<Type*>& get_types() { return types; }
    491491        virtual unsigned size() const { return types.size(); };
    492 
    493         // For now, this is entirely synthetic -- tuple types always have unnamed members.
    494         // Eventually, we may allow named tuples, in which case members should subsume types
    495         std::list<Declaration *> & get_members() { return members; }
    496492
    497493        iterator begin() { return types.begin(); }
     
    510506        virtual void print( std::ostream & os, int indent = 0 ) const;
    511507  private:
    512         std::list<Type *> types;
    513         std::list<Declaration *> members;
     508        std::list<Type*> types;
    514509};
    515510
  • src/SynTree/VarExprReplacer.cc

    rb826e6b rfea3faa  
    1414//
    1515
    16 #include "Declaration.h"
    1716#include "Expression.h"
    1817#include "VarExprReplacer.h"
    1918
    20 VarExprReplacer::VarExprReplacer( const DeclMap & declMap, bool debug ) : declMap( declMap ), debug( debug ) {}
     19VarExprReplacer::VarExprReplacer( const DeclMap & declMap ) : declMap( declMap ) {}
    2120
    2221// replace variable with new node from decl map
    2322void VarExprReplacer::visit( VariableExpr * varExpr ) {
    24         // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)
    25         if ( declMap.count( varExpr->get_var() ) ) {
    26                 if ( debug ) {
    27                         std::cerr << "replacing variable reference: " << (void*)varExpr->get_var() << " " << varExpr->get_var() << " with " << (void*)declMap.at( varExpr->get_var() ) << " " << declMap.at( varExpr->get_var() ) << std::endl;
    28                 }
    29                 varExpr->set_var( declMap.at( varExpr->get_var() ) );
    30         }
     23  // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)
     24  if ( declMap.count( varExpr->get_var() ) ) {
     25    varExpr->set_var( declMap.at( varExpr->get_var() ) );
     26  }
    3127}
  • src/SynTree/VarExprReplacer.h

    rb826e6b rfea3faa  
    2727private:
    2828        const DeclMap & declMap;
    29   bool debug;
    3029public:
    31         VarExprReplacer( const DeclMap & declMap, bool debug = false );
     30        VarExprReplacer( const DeclMap & declMap );
    3231
    3332        // replace variable with new node from decl map
  • src/SynTree/Visitor.cc

    rb826e6b rfea3faa  
    340340}
    341341
    342 void Visitor::visit( UntypedInitExpr * initExpr ) {
    343         maybeAccept( initExpr->get_result(), *this );
    344         maybeAccept( initExpr->get_expr(), *this );
    345         // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
    346 }
    347 
    348 void Visitor::visit( InitExpr * initExpr ) {
    349         maybeAccept( initExpr->get_result(), *this );
    350         maybeAccept( initExpr->get_expr(), *this );
    351         maybeAccept( initExpr->get_designation(), *this );
    352 }
    353 
    354342
    355343void Visitor::visit( VoidType *voidType ) {
     
    407395        acceptAll( tupleType->get_forall(), *this );
    408396        acceptAll( tupleType->get_types(), *this );
    409         acceptAll( tupleType->get_members(), *this );
    410397}
    411398
     
    437424}
    438425
    439 void Visitor::visit( Designation * designation ) {
    440         acceptAll( designation->get_designators(), *this );
    441 }
    442426
    443427void Visitor::visit( SingleInit *singleInit ) {
     
    446430
    447431void Visitor::visit( ListInit *listInit ) {
    448         acceptAll( listInit->get_designations(), *this );
     432        acceptAll( listInit->get_designators(), *this );
    449433        acceptAll( listInit->get_initializers(), *this );
    450434}
  • src/SynTree/Visitor.h

    rb826e6b rfea3faa  
    8888        virtual void visit( StmtExpr * stmtExpr );
    8989        virtual void visit( UniqueExpr * uniqueExpr );
    90         virtual void visit( UntypedInitExpr * initExpr );
    91         virtual void visit( InitExpr * initExpr );
    9290
    9391        virtual void visit( VoidType *basicType );
     
    108106        virtual void visit( OneType *oneType );
    109107
    110         virtual void visit( Designation *designation );
    111108        virtual void visit( SingleInit *singleInit );
    112109        virtual void visit( ListInit *listInit );
  • src/Tuples/TupleExpansion.cc

    rb826e6b rfea3faa  
    192192                        }
    193193                        ObjectDecl * finished = new ObjectDecl( toString( "_unq", id, "_finished_" ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ),
    194                                                                                                         new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) );
     194                                                                                                        new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ), noDesignators ) );
    195195                        addDeclaration( finished );
    196196                        // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N))
     
    310310        Type * makeTupleType( const std::list< Expression * > & exprs ) {
    311311                // produce the TupleType which aggregates the types of the exprs
    312                 std::list< Type * > types;
    313                 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex );
     312                TupleType *tupleType = new TupleType( Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex ) );
     313                Type::Qualifiers &qualifiers = tupleType->get_qualifiers();
    314314                for ( Expression * expr : exprs ) {
    315315                        assert( expr->get_result() );
    316316                        if ( expr->get_result()->isVoid() ) {
    317317                                // if the type of any expr is void, the type of the entire tuple is void
     318                                delete tupleType;
    318319                                return new VoidType( Type::Qualifiers() );
    319320                        }
    320321                        Type * type = expr->get_result()->clone();
    321                         types.push_back( type );
     322                        tupleType->get_types().push_back( type );
    322323                        // the qualifiers on the tuple type are the qualifiers that exist on all component types
    323324                        qualifiers &= type->get_qualifiers();
    324325                } // for
    325326                if ( exprs.empty() ) qualifiers = Type::Qualifiers();
    326                 return new TupleType( qualifiers, types );
     327                return tupleType;
    327328        }
    328329
  • src/benchmark/CorCtxSwitch.c

    rb826e6b rfea3faa  
    3131
    3232        StartTime = Time();
     33        // for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
     34        //      resume( this_coroutine() );
     35        //      // resume( &s );       
     36        // }
    3337        resumer( &s, NoOfTimes );
    3438        EndTime = Time();
  • src/benchmark/Makefile.am

    rb826e6b rfea3faa  
    2020CC = @CFA_BINDIR@/@CFA_NAME@
    2121
    22 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
     22noinst_PROGRAMS = bench ctxswitch-coroutine ctxswitch-thread
    2323
    24 bench$(EXEEXT) :
     24bench :
    2525        @for ccflags in "-debug" "-nodebug"; do \
    2626                echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\
     
    3030        rm -f ./a.out ;
    3131
    32 ctxswitch-coroutine$(EXEEXT):
     32ctxswitch-coroutine:
    3333        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c
    3434        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    3737        @rm -f ./a.out
    3838
    39 ctxswitch-thread$(EXEEXT):
     39ctxswitch-thread:
    4040        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c
    4141        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    4444        @rm -f ./a.out
    4545
    46 sched-int$(EXEEXT):
     46sched-int:
    4747        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
    4848        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    5151        @rm -f ./a.out
    5252
    53 monitor$(EXEEXT):
     53monitor:
    5454        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
    5555        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    5858        @rm -f ./a.out
    5959
    60 csv-data$(EXEEXT):
     60csv-data:
    6161        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
    6262        @./a.out
  • src/benchmark/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1920
    2021VPATH = @srcdir@
    21 am__is_gnu_make = { \
    22   if test -z '$(MAKELEVEL)'; then \
    23     false; \
    24   elif test -n '$(MAKE_HOST)'; then \
    25     true; \
    26   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    27     true; \
    28   else \
    29     false; \
    30   fi; \
    31 }
    32 am__make_running_with_option = \
    33   case $${target_option-} in \
    34       ?) ;; \
    35       *) echo "am__make_running_with_option: internal error: invalid" \
    36               "target option '$${target_option-}' specified" >&2; \
    37          exit 1;; \
    38   esac; \
    39   has_opt=no; \
    40   sane_makeflags=$$MAKEFLAGS; \
    41   if $(am__is_gnu_make); then \
    42     sane_makeflags=$$MFLAGS; \
    43   else \
    44     case $$MAKEFLAGS in \
    45       *\\[\ \   ]*) \
    46         bs=\\; \
    47         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    48           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    49     esac; \
    50   fi; \
    51   skip_next=no; \
    52   strip_trailopt () \
    53   { \
    54     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    55   }; \
    56   for flg in $$sane_makeflags; do \
    57     test $$skip_next = yes && { skip_next=no; continue; }; \
    58     case $$flg in \
    59       *=*|--*) continue;; \
    60         -*I) strip_trailopt 'I'; skip_next=yes;; \
    61       -*I?*) strip_trailopt 'I';; \
    62         -*O) strip_trailopt 'O'; skip_next=yes;; \
    63       -*O?*) strip_trailopt 'O';; \
    64         -*l) strip_trailopt 'l'; skip_next=yes;; \
    65       -*l?*) strip_trailopt 'l';; \
    66       -[dEDm]) skip_next=yes;; \
    67       -[JT]) skip_next=yes;; \
    68     esac; \
    69     case $$flg in \
    70       *$$target_option*) has_opt=yes; break;; \
    71     esac; \
    72   done; \
    73   test $$has_opt = yes
    74 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    75 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7622pkgdatadir = $(datadir)/@PACKAGE@
    7723pkgincludedir = $(includedir)/@PACKAGE@
     
    9238build_triplet = @build@
    9339host_triplet = @host@
     40noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) \
     41        ctxswitch-thread$(EXEEXT)
    9442subdir = src/benchmark
     43DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    9544ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    9645am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    9746am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9847        $(ACLOCAL_M4)
    99 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    10048mkinstalldirs = $(install_sh) -d
    10149CONFIG_HEADER = $(top_builddir)/config.h
     
    10654bench_OBJECTS = bench.$(OBJEXT)
    10755bench_LDADD = $(LDADD)
    108 csv_data_SOURCES = csv-data.c
    109 csv_data_OBJECTS = csv-data.$(OBJEXT)
    110 csv_data_LDADD = $(LDADD)
    11156ctxswitch_coroutine_SOURCES = ctxswitch-coroutine.c
    11257ctxswitch_coroutine_OBJECTS = ctxswitch-coroutine.$(OBJEXT)
     
    11560ctxswitch_thread_OBJECTS = ctxswitch-thread.$(OBJEXT)
    11661ctxswitch_thread_LDADD = $(LDADD)
    117 monitor_SOURCES = monitor.c
    118 monitor_OBJECTS = monitor.$(OBJEXT)
    119 monitor_LDADD = $(LDADD)
    120 sched_int_SOURCES = sched-int.c
    121 sched_int_OBJECTS = sched-int.$(OBJEXT)
    122 sched_int_LDADD = $(LDADD)
    123 AM_V_P = $(am__v_P_@AM_V@)
    124 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    125 am__v_P_0 = false
    126 am__v_P_1 = :
    127 AM_V_GEN = $(am__v_GEN_@AM_V@)
    128 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    129 am__v_GEN_0 = @echo "  GEN     " $@;
    130 am__v_GEN_1 =
    131 AM_V_at = $(am__v_at_@AM_V@)
    132 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    133 am__v_at_0 = @
    134 am__v_at_1 =
    13562DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    13663depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    14168AM_V_CC = $(am__v_CC_@AM_V@)
    14269am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    143 am__v_CC_0 = @echo "  CC      " $@;
    144 am__v_CC_1 =
     70am__v_CC_0 = @echo "  CC    " $@;
     71AM_V_at = $(am__v_at_@AM_V@)
     72am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     73am__v_at_0 = @
    14574CCLD = $(CC)
    14675LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    14776AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    14877am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    149 am__v_CCLD_0 = @echo "  CCLD    " $@;
    150 am__v_CCLD_1 =
    151 SOURCES = bench.c csv-data.c ctxswitch-coroutine.c ctxswitch-thread.c \
    152         monitor.c sched-int.c
    153 DIST_SOURCES = bench.c csv-data.c ctxswitch-coroutine.c \
    154         ctxswitch-thread.c monitor.c sched-int.c
    155 am__can_run_installinfo = \
    156   case $$AM_UPDATE_INFO_DIR in \
    157     n|no|NO) false;; \
    158     *) (install-info --version) >/dev/null 2>&1;; \
    159   esac
    160 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    161 # Read a list of newline-separated strings from the standard input,
    162 # and print each of them once, without duplicates.  Input order is
    163 # *not* preserved.
    164 am__uniquify_input = $(AWK) '\
    165   BEGIN { nonempty = 0; } \
    166   { items[$$0] = 1; nonempty = 1; } \
    167   END { if (nonempty) { for (i in items) print i; }; } \
    168 '
    169 # Make sure the list of sources is unique.  This is necessary because,
    170 # e.g., the same source file might be shared among _SOURCES variables
    171 # for different programs/libraries.
    172 am__define_uniq_tagged_files = \
    173   list='$(am__tagged_files)'; \
    174   unique=`for i in $$list; do \
    175     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    176   done | $(am__uniquify_input)`
     78am__v_CCLD_0 = @echo "  CCLD  " $@;
     79AM_V_GEN = $(am__v_GEN_@AM_V@)
     80am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     81am__v_GEN_0 = @echo "  GEN   " $@;
     82SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c
     83DIST_SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c
    17784ETAGS = etags
    17885CTAGS = ctags
    179 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    18086DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    18187ACLOCAL = @ACLOCAL@
     
    292198program_transform_name = @program_transform_name@
    293199psdir = @psdir@
    294 runstatedir = @runstatedir@
    295200sbindir = @sbindir@
    296201sharedstatedir = @sharedstatedir@
     
    302207top_srcdir = @top_srcdir@
    303208AM_CFLAGS = -g -Wall -Wno-unused-function -O2
    304 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
    305209all: all-am
    306210
     
    319223        $(am__cd) $(top_srcdir) && \
    320224          $(AUTOMAKE) --foreign src/benchmark/Makefile
     225.PRECIOUS: Makefile
    321226Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    322227        @case '$?' in \
     
    347252
    348253@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bench.Po@am__quote@
    349 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csv-data.Po@am__quote@
    350254@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-coroutine.Po@am__quote@
    351255@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-thread.Po@am__quote@
    352 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
    353 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched-int.Po@am__quote@
    354256
    355257.c.o:
    356 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    357 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    358 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     258@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
     259@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    359260@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    360261@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    361 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
     262@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
    362263
    363264.c.obj:
    364 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
    365 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
    366 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     265@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
     266@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    367267@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    368268@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    369 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    370 
    371 ID: $(am__tagged_files)
    372         $(am__define_uniq_tagged_files); mkid -fID $$unique
    373 tags: tags-am
    374 TAGS: tags
    375 
    376 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     269@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
     270
     271ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     272        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     273        unique=`for i in $$list; do \
     274            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     275          done | \
     276          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     277              END { if (nonempty) { for (i in files) print i; }; }'`; \
     278        mkid -fID $$unique
     279tags: TAGS
     280
     281TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     282                $(TAGS_FILES) $(LISP)
    377283        set x; \
    378284        here=`pwd`; \
    379         $(am__define_uniq_tagged_files); \
     285        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     286        unique=`for i in $$list; do \
     287            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     288          done | \
     289          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     290              END { if (nonempty) { for (i in files) print i; }; }'`; \
    380291        shift; \
    381292        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    389300          fi; \
    390301        fi
    391 ctags: ctags-am
    392 
    393 CTAGS: ctags
    394 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    395         $(am__define_uniq_tagged_files); \
     302ctags: CTAGS
     303CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     304                $(TAGS_FILES) $(LISP)
     305        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     306        unique=`for i in $$list; do \
     307            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     308          done | \
     309          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     310              END { if (nonempty) { for (i in files) print i; }; }'`; \
    396311        test -z "$(CTAGS_ARGS)$$unique" \
    397312          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    402317          && $(am__cd) $(top_srcdir) \
    403318          && gtags -i $(GTAGS_ARGS) "$$here"
    404 cscopelist: cscopelist-am
    405 
    406 cscopelist-am: $(am__tagged_files)
    407         list='$(am__tagged_files)'; \
    408         case "$(srcdir)" in \
    409           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    410           *) sdir=$(subdir)/$(srcdir) ;; \
    411         esac; \
    412         for i in $$list; do \
    413           if test -f "$$i"; then \
    414             echo "$(subdir)/$$i"; \
    415           else \
    416             echo "$$sdir/$$i"; \
    417           fi; \
    418         done >> $(top_builddir)/cscope.files
    419319
    420320distclean-tags:
     
    556456.MAKE: install-am install-strip
    557457
    558 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
    559         clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
    560         distclean-compile distclean-generic distclean-tags distdir dvi \
    561         dvi-am html html-am info info-am install install-am \
    562         install-data install-data-am install-dvi install-dvi-am \
    563         install-exec install-exec-am install-html install-html-am \
    564         install-info install-info-am install-man install-pdf \
    565         install-pdf-am install-ps install-ps-am install-strip \
    566         installcheck installcheck-am installdirs maintainer-clean \
     458.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
     459        clean-noinstPROGRAMS ctags distclean distclean-compile \
     460        distclean-generic distclean-tags distdir dvi dvi-am html \
     461        html-am info info-am install install-am install-data \
     462        install-data-am install-dvi install-dvi-am install-exec \
     463        install-exec-am install-html install-html-am install-info \
     464        install-info-am install-man install-pdf install-pdf-am \
     465        install-ps install-ps-am install-strip installcheck \
     466        installcheck-am installdirs maintainer-clean \
    567467        maintainer-clean-generic mostlyclean mostlyclean-compile \
    568         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
     468        mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
    569469        uninstall-am
    570470
    571 .PRECIOUS: Makefile
    572 
    573 
    574 bench$(EXEEXT) :
     471
     472bench :
    575473        @for ccflags in "-debug" "-nodebug"; do \
    576474                echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\
     
    580478        rm -f ./a.out ;
    581479
    582 ctxswitch-coroutine$(EXEEXT):
     480ctxswitch-coroutine:
    583481        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c
    584482        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    587485        @rm -f ./a.out
    588486
    589 ctxswitch-thread$(EXEEXT):
     487ctxswitch-thread:
    590488        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c
    591489        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    594492        @rm -f ./a.out
    595493
    596 sched-int$(EXEEXT):
     494sched-int:
    597495        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
    598496        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    601499        @rm -f ./a.out
    602500
    603 monitor$(EXEEXT):
     501monitor:
    604502        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
    605503        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    608506        @rm -f ./a.out
    609507
    610 csv-data$(EXEEXT):
     508csv-data:
    611509        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
    612510        @./a.out
  • src/benchmark/bench.h

    rb826e6b rfea3faa  
    2626#define N 10000000
    2727#endif
    28 
    29 unsigned int default_preemption() {
    30         return 0;
    31 }
  • src/benchmark/create_pthrd.c

    rb826e6b rfea3faa  
    1414                n = atoi(argv[1]);
    1515        }
    16         printf("create %lu pthreads ... ", n);
     16        printf("%lu\n", n);
    1717
    1818        for (size_t i = 0; i < n; i++) {
    19                 pthread_t thread;
    20                 if (pthread_create(&thread, NULL, foo, NULL) < 0) {
    21                         perror( "failure" );
     19                pthread_attr_t attr;
     20                if (pthread_attr_init(&attr) < 0) {
    2221                        return 1;
    2322                }
    24 
    25                 if (pthread_join( thread, NULL) < 0) {
    26                         perror( "failure" );
     23                if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) < 0) {
     24                        return 1;
     25                }
     26                pthread_t thread;
     27                if (pthread_create(&thread, &attr, foo, NULL) < 0) {
    2728                        return 1;
    2829                }
    2930        }
    30         printf("finish\n");
     31        pthread_exit(NULL);
     32        return 0;
    3133}
  • src/benchmark/csv-data.c

    rb826e6b rfea3faa  
    2525}
    2626
     27#ifndef N
     28#define N 100000000
     29#endif
     30
    2731//-----------------------------------------------------------------------------
    2832// coroutine context switch
     
    3438
    3539        StartTime = Time();
     40        // for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
     41        //      resume( this_coroutine() );
     42        //      // resume( &s );
     43        // }
    3644        resumer( &s, NoOfTimes );
    3745        EndTime = Time();
     
    96104mon_t mon1;
    97105
    98 condition cond1a;
     106condition cond1a; 
    99107condition cond1b;
    100108
     
    144152mon_t mon2;
    145153
    146 condition cond2a;
     154condition cond2a; 
    147155condition cond2b;
    148156
  • src/driver/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1920
    2021VPATH = @srcdir@
    21 am__is_gnu_make = { \
    22   if test -z '$(MAKELEVEL)'; then \
    23     false; \
    24   elif test -n '$(MAKE_HOST)'; then \
    25     true; \
    26   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    27     true; \
    28   else \
    29     false; \
    30   fi; \
    31 }
    32 am__make_running_with_option = \
    33   case $${target_option-} in \
    34       ?) ;; \
    35       *) echo "am__make_running_with_option: internal error: invalid" \
    36               "target option '$${target_option-}' specified" >&2; \
    37          exit 1;; \
    38   esac; \
    39   has_opt=no; \
    40   sane_makeflags=$$MAKEFLAGS; \
    41   if $(am__is_gnu_make); then \
    42     sane_makeflags=$$MFLAGS; \
    43   else \
    44     case $$MAKEFLAGS in \
    45       *\\[\ \   ]*) \
    46         bs=\\; \
    47         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    48           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    49     esac; \
    50   fi; \
    51   skip_next=no; \
    52   strip_trailopt () \
    53   { \
    54     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    55   }; \
    56   for flg in $$sane_makeflags; do \
    57     test $$skip_next = yes && { skip_next=no; continue; }; \
    58     case $$flg in \
    59       *=*|--*) continue;; \
    60         -*I) strip_trailopt 'I'; skip_next=yes;; \
    61       -*I?*) strip_trailopt 'I';; \
    62         -*O) strip_trailopt 'O'; skip_next=yes;; \
    63       -*O?*) strip_trailopt 'O';; \
    64         -*l) strip_trailopt 'l'; skip_next=yes;; \
    65       -*l?*) strip_trailopt 'l';; \
    66       -[dEDm]) skip_next=yes;; \
    67       -[JT]) skip_next=yes;; \
    68     esac; \
    69     case $$flg in \
    70       *$$target_option*) has_opt=yes; break;; \
    71     esac; \
    72   done; \
    73   test $$has_opt = yes
    74 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    75 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7622pkgdatadir = $(datadir)/@PACKAGE@
    7723pkgincludedir = $(includedir)/@PACKAGE@
     
    9844cc1lib_PROGRAMS = cc1$(EXEEXT)
    9945subdir = src/driver
     46DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    10047ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    10148am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    10249am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    10350        $(ACLOCAL_M4)
    104 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    10551mkinstalldirs = $(install_sh) -d
    10652CONFIG_HEADER = $(top_builddir)/config.h
     
    11561cfa_OBJECTS = $(am_cfa_OBJECTS)
    11662cfa_LDADD = $(LDADD)
    117 AM_V_P = $(am__v_P_@AM_V@)
    118 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    119 am__v_P_0 = false
    120 am__v_P_1 = :
    121 AM_V_GEN = $(am__v_GEN_@AM_V@)
    122 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    123 am__v_GEN_0 = @echo "  GEN     " $@;
    124 am__v_GEN_1 =
    125 AM_V_at = $(am__v_at_@AM_V@)
    126 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    127 am__v_at_0 = @
    128 am__v_at_1 =
    12963DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    13064depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    13569AM_V_CXX = $(am__v_CXX_@AM_V@)
    13670am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
    137 am__v_CXX_0 = @echo "  CXX     " $@;
    138 am__v_CXX_1 =
     71am__v_CXX_0 = @echo "  CXX   " $@;
     72AM_V_at = $(am__v_at_@AM_V@)
     73am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     74am__v_at_0 = @
    13975CXXLD = $(CXX)
    14076CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
     
    14278AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
    14379am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
    144 am__v_CXXLD_0 = @echo "  CXXLD   " $@;
    145 am__v_CXXLD_1 =
     80am__v_CXXLD_0 = @echo "  CXXLD " $@;
     81AM_V_GEN = $(am__v_GEN_@AM_V@)
     82am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     83am__v_GEN_0 = @echo "  GEN   " $@;
    14684SOURCES = $(cc1_SOURCES) $(cfa_SOURCES)
    14785DIST_SOURCES = $(cc1_SOURCES) $(cfa_SOURCES)
    148 am__can_run_installinfo = \
    149   case $$AM_UPDATE_INFO_DIR in \
    150     n|no|NO) false;; \
    151     *) (install-info --version) >/dev/null 2>&1;; \
    152   esac
    153 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    154 # Read a list of newline-separated strings from the standard input,
    155 # and print each of them once, without duplicates.  Input order is
    156 # *not* preserved.
    157 am__uniquify_input = $(AWK) '\
    158   BEGIN { nonempty = 0; } \
    159   { items[$$0] = 1; nonempty = 1; } \
    160   END { if (nonempty) { for (i in items) print i; }; } \
    161 '
    162 # Make sure the list of sources is unique.  This is necessary because,
    163 # e.g., the same source file might be shared among _SOURCES variables
    164 # for different programs/libraries.
    165 am__define_uniq_tagged_files = \
    166   list='$(am__tagged_files)'; \
    167   unique=`for i in $$list; do \
    168     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    169   done | $(am__uniquify_input)`
    17086ETAGS = etags
    17187CTAGS = ctags
    172 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    17388DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    17489ACLOCAL = @ACLOCAL@
     
    283198program_transform_name = @program_transform_name@
    284199psdir = @psdir@
    285 runstatedir = @runstatedir@
    286200sbindir = @sbindir@
    287201sharedstatedir = @sharedstatedir@
     
    318232        $(am__cd) $(top_srcdir) && \
    319233          $(AUTOMAKE) --foreign src/driver/Makefile
     234.PRECIOUS: Makefile
    320235Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    321236        @case '$?' in \
     
    337252install-cc1libPROGRAMS: $(cc1lib_PROGRAMS)
    338253        @$(NORMAL_INSTALL)
     254        test -z "$(cc1libdir)" || $(MKDIR_P) "$(DESTDIR)$(cc1libdir)"
    339255        @list='$(cc1lib_PROGRAMS)'; test -n "$(cc1libdir)" || list=; \
    340         if test -n "$$list"; then \
    341           echo " $(MKDIR_P) '$(DESTDIR)$(cc1libdir)'"; \
    342           $(MKDIR_P) "$(DESTDIR)$(cc1libdir)" || exit 1; \
    343         fi; \
    344256        for p in $$list; do echo "$$p $$p"; done | \
    345257        sed 's/$(EXEEXT)$$//' | \
    346         while read p p1; do if test -f $$p \
    347           ; then echo "$$p"; echo "$$p"; else :; fi; \
     258        while read p p1; do if test -f $$p; \
     259          then echo "$$p"; echo "$$p"; else :; fi; \
    348260        done | \
    349         sed -e 'p;s,.*/,,;n;h' \
    350             -e 's|.*|.|' \
     261        sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
    351262            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
    352263        sed 'N;N;N;s,\n, ,g' | \
     
    369280        files=`for p in $$list; do echo "$$p"; done | \
    370281          sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
    371               -e 's/$$/$(EXEEXT)/' \
    372         `; \
     282              -e 's/$$/$(EXEEXT)/' `; \
    373283        test -n "$$list" || exit 0; \
    374284        echo " ( cd '$(DESTDIR)$(cc1libdir)' && rm -f" $$files ")"; \
     
    380290clean-noinstPROGRAMS:
    381291        -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
    382 
    383292cc1$(EXEEXT): $(cc1_OBJECTS) $(cc1_DEPENDENCIES) $(EXTRA_cc1_DEPENDENCIES)
    384293        @rm -f cc1$(EXEEXT)
    385294        $(AM_V_CXXLD)$(CXXLINK) $(cc1_OBJECTS) $(cc1_LDADD) $(LIBS)
    386 
    387295cfa$(EXEEXT): $(cfa_OBJECTS) $(cfa_DEPENDENCIES) $(EXTRA_cfa_DEPENDENCIES)
    388296        @rm -f cfa$(EXEEXT)
     
    399307
    400308.cc.o:
    401 @am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    402 @am__fastdepCXX_TRUE@   $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    403 @am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
     309@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
     310@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    404311@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    405312@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     
    407314
    408315.cc.obj:
    409 @am__fastdepCXX_TRUE@   $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
    410 @am__fastdepCXX_TRUE@   $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
    411 @am__fastdepCXX_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
     316@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
     317@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    412318@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    413319@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    414320@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    415321
    416 ID: $(am__tagged_files)
    417         $(am__define_uniq_tagged_files); mkid -fID $$unique
    418 tags: tags-am
    419 TAGS: tags
    420 
    421 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     322ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     323        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     324        unique=`for i in $$list; do \
     325            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     326          done | \
     327          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     328              END { if (nonempty) { for (i in files) print i; }; }'`; \
     329        mkid -fID $$unique
     330tags: TAGS
     331
     332TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     333                $(TAGS_FILES) $(LISP)
    422334        set x; \
    423335        here=`pwd`; \
    424         $(am__define_uniq_tagged_files); \
     336        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     337        unique=`for i in $$list; do \
     338            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     339          done | \
     340          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     341              END { if (nonempty) { for (i in files) print i; }; }'`; \
    425342        shift; \
    426343        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    434351          fi; \
    435352        fi
    436 ctags: ctags-am
    437 
    438 CTAGS: ctags
    439 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    440         $(am__define_uniq_tagged_files); \
     353ctags: CTAGS
     354CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     355                $(TAGS_FILES) $(LISP)
     356        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     357        unique=`for i in $$list; do \
     358            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     359          done | \
     360          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     361              END { if (nonempty) { for (i in files) print i; }; }'`; \
    441362        test -z "$(CTAGS_ARGS)$$unique" \
    442363          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    447368          && $(am__cd) $(top_srcdir) \
    448369          && gtags -i $(GTAGS_ARGS) "$$here"
    449 cscopelist: cscopelist-am
    450 
    451 cscopelist-am: $(am__tagged_files)
    452         list='$(am__tagged_files)'; \
    453         case "$(srcdir)" in \
    454           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    455           *) sdir=$(subdir)/$(srcdir) ;; \
    456         esac; \
    457         for i in $$list; do \
    458           if test -f "$$i"; then \
    459             echo "$(subdir)/$$i"; \
    460           else \
    461             echo "$$sdir/$$i"; \
    462           fi; \
    463         done >> $(top_builddir)/cscope.files
    464370
    465371distclean-tags:
     
    608514.MAKE: install-am install-exec-am install-strip uninstall-am
    609515
    610 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
    611         clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS \
    612         cscopelist-am ctags ctags-am distclean distclean-compile \
    613         distclean-generic distclean-tags distdir dvi dvi-am html \
    614         html-am info info-am install install-am install-cc1libPROGRAMS \
    615         install-data install-data-am install-dvi install-dvi-am \
    616         install-exec install-exec-am install-exec-hook install-html \
    617         install-html-am install-info install-info-am install-man \
    618         install-pdf install-pdf-am install-ps install-ps-am \
    619         install-strip installcheck installcheck-am installdirs \
    620         maintainer-clean maintainer-clean-generic mostlyclean \
    621         mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
    622         tags tags-am uninstall uninstall-am uninstall-cc1libPROGRAMS \
    623         uninstall-hook
    624 
    625 .PRECIOUS: Makefile
     516.PHONY: CTAGS GTAGS all all-am check check-am clean \
     517        clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS ctags \
     518        distclean distclean-compile distclean-generic distclean-tags \
     519        distdir dvi dvi-am html html-am info info-am install \
     520        install-am install-cc1libPROGRAMS install-data install-data-am \
     521        install-dvi install-dvi-am install-exec install-exec-am \
     522        install-exec-hook install-html install-html-am install-info \
     523        install-info-am install-man install-pdf install-pdf-am \
     524        install-ps install-ps-am install-strip installcheck \
     525        installcheck-am installdirs maintainer-clean \
     526        maintainer-clean-generic mostlyclean mostlyclean-compile \
     527        mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
     528        uninstall-am uninstall-cc1libPROGRAMS uninstall-hook
    626529
    627530
  • src/examples/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1920
    2021VPATH = @srcdir@
    21 am__is_gnu_make = { \
    22   if test -z '$(MAKELEVEL)'; then \
    23     false; \
    24   elif test -n '$(MAKE_HOST)'; then \
    25     true; \
    26   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    27     true; \
    28   else \
    29     false; \
    30   fi; \
    31 }
    32 am__make_running_with_option = \
    33   case $${target_option-} in \
    34       ?) ;; \
    35       *) echo "am__make_running_with_option: internal error: invalid" \
    36               "target option '$${target_option-}' specified" >&2; \
    37          exit 1;; \
    38   esac; \
    39   has_opt=no; \
    40   sane_makeflags=$$MAKEFLAGS; \
    41   if $(am__is_gnu_make); then \
    42     sane_makeflags=$$MFLAGS; \
    43   else \
    44     case $$MAKEFLAGS in \
    45       *\\[\ \   ]*) \
    46         bs=\\; \
    47         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    48           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    49     esac; \
    50   fi; \
    51   skip_next=no; \
    52   strip_trailopt () \
    53   { \
    54     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    55   }; \
    56   for flg in $$sane_makeflags; do \
    57     test $$skip_next = yes && { skip_next=no; continue; }; \
    58     case $$flg in \
    59       *=*|--*) continue;; \
    60         -*I) strip_trailopt 'I'; skip_next=yes;; \
    61       -*I?*) strip_trailopt 'I';; \
    62         -*O) strip_trailopt 'O'; skip_next=yes;; \
    63       -*O?*) strip_trailopt 'O';; \
    64         -*l) strip_trailopt 'l'; skip_next=yes;; \
    65       -*l?*) strip_trailopt 'l';; \
    66       -[dEDm]) skip_next=yes;; \
    67       -[JT]) skip_next=yes;; \
    68     esac; \
    69     case $$flg in \
    70       *$$target_option*) has_opt=yes; break;; \
    71     esac; \
    72   done; \
    73   test $$has_opt = yes
    74 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    75 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7622pkgdatadir = $(datadir)/@PACKAGE@
    7723pkgincludedir = $(includedir)/@PACKAGE@
     
    9541        avl_test$(EXEEXT) Bench$(EXEEXT)
    9642subdir = src/examples
     43DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    9744ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    9845am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    9946am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    10047        $(ACLOCAL_M4)
    101 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    10248mkinstalldirs = $(install_sh) -d
    10349CONFIG_HEADER = $(top_builddir)/config.h
     
    10854Bench_OBJECTS = Bench.$(OBJEXT)
    10955Bench_LDADD = $(LDADD)
    110 am__dirstamp = $(am__leading_dot)dirstamp
    111 am_avl_test_OBJECTS = avltree/avl_test.$(OBJEXT) \
    112         avltree/avl0.$(OBJEXT) avltree/avl1.$(OBJEXT) \
    113         avltree/avl2.$(OBJEXT) avltree/avl3.$(OBJEXT) \
    114         avltree/avl4.$(OBJEXT) avltree/avl-private.$(OBJEXT)
     56am_avl_test_OBJECTS = avl_test.$(OBJEXT) avl0.$(OBJEXT) avl1.$(OBJEXT) \
     57        avl2.$(OBJEXT) avl3.$(OBJEXT) avl4.$(OBJEXT) \
     58        avl-private.$(OBJEXT)
    11559avl_test_OBJECTS = $(am_avl_test_OBJECTS)
    11660avl_test_LDADD = $(LDADD)
     
    12266vector_test_OBJECTS = $(am_vector_test_OBJECTS)
    12367vector_test_LDADD = $(LDADD)
    124 AM_V_P = $(am__v_P_@AM_V@)
    125 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    126 am__v_P_0 = false
    127 am__v_P_1 = :
    128 AM_V_GEN = $(am__v_GEN_@AM_V@)
    129 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    130 am__v_GEN_0 = @echo "  GEN     " $@;
    131 am__v_GEN_1 =
    132 AM_V_at = $(am__v_at_@AM_V@)
    133 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    134 am__v_at_0 = @
    135 am__v_at_1 =
    13668DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    13769depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
    13870am__depfiles_maybe = depfiles
    13971am__mv = mv -f
     72AM_V_lt = $(am__v_lt_@AM_V@)
     73am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
     74am__v_lt_0 = --silent
    14075COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    14176        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    14277AM_V_CC = $(am__v_CC_@AM_V@)
    14378am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    144 am__v_CC_0 = @echo "  CC      " $@;
    145 am__v_CC_1 =
     79am__v_CC_0 = @echo "  CC    " $@;
     80AM_V_at = $(am__v_at_@AM_V@)
     81am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     82am__v_at_0 = @
    14683CCLD = $(CC)
    14784LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    14885AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    14986am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    150 am__v_CCLD_0 = @echo "  CCLD    " $@;
    151 am__v_CCLD_1 =
     87am__v_CCLD_0 = @echo "  CCLD  " $@;
     88AM_V_GEN = $(am__v_GEN_@AM_V@)
     89am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     90am__v_GEN_0 = @echo "  GEN   " $@;
    15291SOURCES = Bench.c $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    15392        $(vector_test_SOURCES)
    15493DIST_SOURCES = Bench.c $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    15594        $(vector_test_SOURCES)
    156 am__can_run_installinfo = \
    157   case $$AM_UPDATE_INFO_DIR in \
    158     n|no|NO) false;; \
    159     *) (install-info --version) >/dev/null 2>&1;; \
    160   esac
    161 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    162 # Read a list of newline-separated strings from the standard input,
    163 # and print each of them once, without duplicates.  Input order is
    164 # *not* preserved.
    165 am__uniquify_input = $(AWK) '\
    166   BEGIN { nonempty = 0; } \
    167   { items[$$0] = 1; nonempty = 1; } \
    168   END { if (nonempty) { for (i in items) print i; }; } \
    169 '
    170 # Make sure the list of sources is unique.  This is necessary because,
    171 # e.g., the same source file might be shared among _SOURCES variables
    172 # for different programs/libraries.
    173 am__define_uniq_tagged_files = \
    174   list='$(am__tagged_files)'; \
    175   unique=`for i in $$list; do \
    176     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    177   done | $(am__uniquify_input)`
    17895ETAGS = etags
    17996CTAGS = ctags
    180 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    18197DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    18298ACLOCAL = @ACLOCAL@
     
    293209program_transform_name = @program_transform_name@
    294210psdir = @psdir@
    295 runstatedir = @runstatedir@
    296211sbindir = @sbindir@
    297212sharedstatedir = @sharedstatedir@
     
    322237        $(am__cd) $(top_srcdir) && \
    323238          $(AUTOMAKE) --foreign src/examples/Makefile
     239.PRECIOUS: Makefile
    324240Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    325241        @case '$?' in \
     
    342258clean-noinstPROGRAMS:
    343259        -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
    344 avltree/$(am__dirstamp):
    345         @$(MKDIR_P) avltree
    346         @: > avltree/$(am__dirstamp)
    347 avltree/$(DEPDIR)/$(am__dirstamp):
    348         @$(MKDIR_P) avltree/$(DEPDIR)
    349         @: > avltree/$(DEPDIR)/$(am__dirstamp)
    350 avltree/avl_test.$(OBJEXT): avltree/$(am__dirstamp) \
    351         avltree/$(DEPDIR)/$(am__dirstamp)
    352 avltree/avl0.$(OBJEXT): avltree/$(am__dirstamp) \
    353         avltree/$(DEPDIR)/$(am__dirstamp)
    354 avltree/avl1.$(OBJEXT): avltree/$(am__dirstamp) \
    355         avltree/$(DEPDIR)/$(am__dirstamp)
    356 avltree/avl2.$(OBJEXT): avltree/$(am__dirstamp) \
    357         avltree/$(DEPDIR)/$(am__dirstamp)
    358 avltree/avl3.$(OBJEXT): avltree/$(am__dirstamp) \
    359         avltree/$(DEPDIR)/$(am__dirstamp)
    360 avltree/avl4.$(OBJEXT): avltree/$(am__dirstamp) \
    361         avltree/$(DEPDIR)/$(am__dirstamp)
    362 avltree/avl-private.$(OBJEXT): avltree/$(am__dirstamp) \
    363         avltree/$(DEPDIR)/$(am__dirstamp)
    364 
    365260avl_test$(EXEEXT): $(avl_test_OBJECTS) $(avl_test_DEPENDENCIES) $(EXTRA_avl_test_DEPENDENCIES)
    366261        @rm -f avl_test$(EXEEXT)
    367262        $(AM_V_CCLD)$(LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS)
    368 
    369263fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES)
    370264        @rm -f fstream_test$(EXEEXT)
    371265        $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)
    372 
    373266vector_test$(EXEEXT): $(vector_test_OBJECTS) $(vector_test_DEPENDENCIES) $(EXTRA_vector_test_DEPENDENCIES)
    374267        @rm -f vector_test$(EXEEXT)
     
    377270mostlyclean-compile:
    378271        -rm -f *.$(OBJEXT)
    379         -rm -f avltree/*.$(OBJEXT)
    380272
    381273distclean-compile:
     
    384276@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bench.Po@am__quote@
    385277@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
     278@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl-private.Po@am__quote@
     279@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl0.Po@am__quote@
     280@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl1.Po@am__quote@
     281@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl2.Po@am__quote@
     282@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl3.Po@am__quote@
     283@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl4.Po@am__quote@
     284@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_test.Po@am__quote@
    386285@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@
    387286@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@
    388287@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_test.Po@am__quote@
    389 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl-private.Po@am__quote@
    390 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl0.Po@am__quote@
    391 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl1.Po@am__quote@
    392 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl2.Po@am__quote@
    393 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl3.Po@am__quote@
    394 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl4.Po@am__quote@
    395 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test.Po@am__quote@
    396288
    397289.c.o:
    398 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    399 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    400 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     290@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
     291@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    401292@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    402293@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    403 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
     294@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
    404295
    405296.c.obj:
    406 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
    407 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
    408 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     297@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
     298@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    409299@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    410300@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    411 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    412 
    413 ID: $(am__tagged_files)
    414         $(am__define_uniq_tagged_files); mkid -fID $$unique
    415 tags: tags-am
    416 TAGS: tags
    417 
    418 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     301@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
     302
     303avl_test.o: avltree/avl_test.c
     304@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.o -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
     305@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
     306@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.o' libtool=no @AMDEPBACKSLASH@
     307@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     308@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
     309
     310avl_test.obj: avltree/avl_test.c
     311@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.obj -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
     312@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
     313@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.obj' libtool=no @AMDEPBACKSLASH@
     314@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     315@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
     316
     317avl0.o: avltree/avl0.c
     318@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.o -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
     319@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
     320@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.o' libtool=no @AMDEPBACKSLASH@
     321@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     322@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
     323
     324avl0.obj: avltree/avl0.c
     325@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.obj -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
     326@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
     327@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.obj' libtool=no @AMDEPBACKSLASH@
     328@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     329@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
     330
     331avl1.o: avltree/avl1.c
     332@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.o -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
     333@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
     334@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.o' libtool=no @AMDEPBACKSLASH@
     335@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     336@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
     337
     338avl1.obj: avltree/avl1.c
     339@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.obj -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
     340@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
     341@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.obj' libtool=no @AMDEPBACKSLASH@
     342@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     343@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
     344
     345avl2.o: avltree/avl2.c
     346@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.o -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
     347@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
     348@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.o' libtool=no @AMDEPBACKSLASH@
     349@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     350@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
     351
     352avl2.obj: avltree/avl2.c
     353@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.obj -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
     354@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
     355@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.obj' libtool=no @AMDEPBACKSLASH@
     356@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     357@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
     358
     359avl3.o: avltree/avl3.c
     360@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.o -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
     361@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
     362@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.o' libtool=no @AMDEPBACKSLASH@
     363@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     364@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
     365
     366avl3.obj: avltree/avl3.c
     367@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.obj -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
     368@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
     369@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.obj' libtool=no @AMDEPBACKSLASH@
     370@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     371@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
     372
     373avl4.o: avltree/avl4.c
     374@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.o -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
     375@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
     376@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.o' libtool=no @AMDEPBACKSLASH@
     377@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     378@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
     379
     380avl4.obj: avltree/avl4.c
     381@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.obj -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
     382@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
     383@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.obj' libtool=no @AMDEPBACKSLASH@
     384@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     385@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
     386
     387avl-private.o: avltree/avl-private.c
     388@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.o -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
     389@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
     390@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.o' libtool=no @AMDEPBACKSLASH@
     391@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     392@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
     393
     394avl-private.obj: avltree/avl-private.c
     395@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.obj -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
     396@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
     397@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.obj' libtool=no @AMDEPBACKSLASH@
     398@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     399@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
     400
     401ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     402        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     403        unique=`for i in $$list; do \
     404            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     405          done | \
     406          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     407              END { if (nonempty) { for (i in files) print i; }; }'`; \
     408        mkid -fID $$unique
     409tags: TAGS
     410
     411TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     412                $(TAGS_FILES) $(LISP)
    419413        set x; \
    420414        here=`pwd`; \
    421         $(am__define_uniq_tagged_files); \
     415        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     416        unique=`for i in $$list; do \
     417            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     418          done | \
     419          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     420              END { if (nonempty) { for (i in files) print i; }; }'`; \
    422421        shift; \
    423422        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    431430          fi; \
    432431        fi
    433 ctags: ctags-am
    434 
    435 CTAGS: ctags
    436 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    437         $(am__define_uniq_tagged_files); \
     432ctags: CTAGS
     433CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     434                $(TAGS_FILES) $(LISP)
     435        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     436        unique=`for i in $$list; do \
     437            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     438          done | \
     439          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     440              END { if (nonempty) { for (i in files) print i; }; }'`; \
    438441        test -z "$(CTAGS_ARGS)$$unique" \
    439442          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    444447          && $(am__cd) $(top_srcdir) \
    445448          && gtags -i $(GTAGS_ARGS) "$$here"
    446 cscopelist: cscopelist-am
    447 
    448 cscopelist-am: $(am__tagged_files)
    449         list='$(am__tagged_files)'; \
    450         case "$(srcdir)" in \
    451           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    452           *) sdir=$(subdir)/$(srcdir) ;; \
    453         esac; \
    454         for i in $$list; do \
    455           if test -f "$$i"; then \
    456             echo "$(subdir)/$$i"; \
    457           else \
    458             echo "$$sdir/$$i"; \
    459           fi; \
    460         done >> $(top_builddir)/cscope.files
    461449
    462450distclean-tags:
     
    523511        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    524512        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
    525         -rm -f avltree/$(DEPDIR)/$(am__dirstamp)
    526         -rm -f avltree/$(am__dirstamp)
    527513
    528514maintainer-clean-generic:
     
    534520
    535521distclean: distclean-am
    536         -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)
     522        -rm -rf ./$(DEPDIR)
    537523        -rm -f Makefile
    538524distclean-am: clean-am distclean-compile distclean-generic \
     
    580566
    581567maintainer-clean: maintainer-clean-am
    582         -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)
     568        -rm -rf ./$(DEPDIR)
    583569        -rm -f Makefile
    584570maintainer-clean-am: distclean-am maintainer-clean-generic
     
    600586.MAKE: install-am install-strip
    601587
    602 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
    603         clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
    604         distclean-compile distclean-generic distclean-tags distdir dvi \
    605         dvi-am html html-am info info-am install install-am \
    606         install-data install-data-am install-dvi install-dvi-am \
    607         install-exec install-exec-am install-html install-html-am \
    608         install-info install-info-am install-man install-pdf \
    609         install-pdf-am install-ps install-ps-am install-strip \
    610         installcheck installcheck-am installdirs maintainer-clean \
     588.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
     589        clean-noinstPROGRAMS ctags distclean distclean-compile \
     590        distclean-generic distclean-tags distdir dvi dvi-am html \
     591        html-am info info-am install install-am install-data \
     592        install-data-am install-dvi install-dvi-am install-exec \
     593        install-exec-am install-html install-html-am install-info \
     594        install-info-am install-man install-pdf install-pdf-am \
     595        install-ps install-ps-am install-strip installcheck \
     596        installcheck-am installdirs maintainer-clean \
    611597        maintainer-clean-generic mostlyclean mostlyclean-compile \
    612         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
     598        mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
    613599        uninstall-am
    614 
    615 .PRECIOUS: Makefile
    616600
    617601
  • src/include/assert.h

    rb826e6b rfea3faa  
    1515
    1616#pragma once
    17 // Pragmas for header cleanup tool
    18 // IWYU pragma: private, include <cassert>
    1917
    2018#include_next <assert.h>
  • src/libcfa/Makefile.am

    rb826e6b rfea3faa  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:54:01 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Fri Jun 14 17:00:00 2017
    14 ## Update Count     : 216
     12## Last Modified By : Peter A. Buhr
     13## Last Modified On : Sun May 14 21:04:21 2017
     14## Update Count     : 214
    1515###############################################################################
    1616
    1717# create object files in directory with source files
    1818AUTOMAKE_OPTIONS = subdir-objects
    19 ARFLAGS = cr
    2019
    2120libdir = ${CFA_LIBDIR}
     
    5150
    5251libobjs = ${headers:=.o}
    53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
    54         exception.c typeobject.c
     52libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c}
    5553
    5654# not all platforms support concurrency, add option do disable it
     
    6664        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6765
    68 libcfa_a-exception.o : exception.c
    69         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    70 
    71 libcfa_a-typeobject.o : typeobject.c
    72         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    73 
    7466concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    75         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    76 
    77 libcfa_d_a-exception.o : exception.c
    78         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    79 
    80 libcfa_d_a-typeobject.o : typeobject.c
    8167        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    8268
  • src/libcfa/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    2021
    2122VPATH = @srcdir@
    22 am__is_gnu_make = { \
    23   if test -z '$(MAKELEVEL)'; then \
    24     false; \
    25   elif test -n '$(MAKE_HOST)'; then \
    26     true; \
    27   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    28     true; \
    29   else \
    30     false; \
    31   fi; \
    32 }
    33 am__make_running_with_option = \
    34   case $${target_option-} in \
    35       ?) ;; \
    36       *) echo "am__make_running_with_option: internal error: invalid" \
    37               "target option '$${target_option-}' specified" >&2; \
    38          exit 1;; \
    39   esac; \
    40   has_opt=no; \
    41   sane_makeflags=$$MAKEFLAGS; \
    42   if $(am__is_gnu_make); then \
    43     sane_makeflags=$$MFLAGS; \
    44   else \
    45     case $$MAKEFLAGS in \
    46       *\\[\ \   ]*) \
    47         bs=\\; \
    48         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    49           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    50     esac; \
    51   fi; \
    52   skip_next=no; \
    53   strip_trailopt () \
    54   { \
    55     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    56   }; \
    57   for flg in $$sane_makeflags; do \
    58     test $$skip_next = yes && { skip_next=no; continue; }; \
    59     case $$flg in \
    60       *=*|--*) continue;; \
    61         -*I) strip_trailopt 'I'; skip_next=yes;; \
    62       -*I?*) strip_trailopt 'I';; \
    63         -*O) strip_trailopt 'O'; skip_next=yes;; \
    64       -*O?*) strip_trailopt 'O';; \
    65         -*l) strip_trailopt 'l'; skip_next=yes;; \
    66       -*l?*) strip_trailopt 'l';; \
    67       -[dEDm]) skip_next=yes;; \
    68       -[JT]) skip_next=yes;; \
    69     esac; \
    70     case $$flg in \
    71       *$$target_option*) has_opt=yes; break;; \
    72     esac; \
    73   done; \
    74   test $$has_opt = yes
    75 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    76 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7723pkgdatadir = $(datadir)/@PACKAGE@
    7824pkgincludedir = $(includedir)/@PACKAGE@
     
    10248@BUILD_CONCURRENCY_TRUE@am__append_4 = concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c concurrency/invoke.c concurrency/preemption.c
    10349subdir = src/libcfa
     50DIST_COMMON = $(am__nobase_cfa_include_HEADERS_DIST) \
     51        $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    10452ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    10553am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    10654am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    10755        $(ACLOCAL_M4)
    108 DIST_COMMON = $(srcdir)/Makefile.am \
    109         $(am__nobase_cfa_include_HEADERS_DIST) $(am__DIST_COMMON)
    11056mkinstalldirs = $(install_sh) -d
    11157CONFIG_HEADER = $(top_builddir)/config.h
     
    14288LIBRARIES = $(lib_LIBRARIES)
    14389AR = ar
     90ARFLAGS = cru
    14491AM_V_AR = $(am__v_AR_@AM_V@)
    14592am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
    146 am__v_AR_0 = @echo "  AR      " $@;
    147 am__v_AR_1 =
     93am__v_AR_0 = @echo "  AR    " $@;
     94AM_V_at = $(am__v_at_@AM_V@)
     95am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     96am__v_at_0 = @
    14897libcfa_d_a_AR = $(AR) $(ARFLAGS)
    14998libcfa_d_a_LIBADD =
     
    153102        containers/pair.c containers/result.c containers/vector.c \
    154103        concurrency/coroutine.c concurrency/thread.c \
    155         concurrency/kernel.c concurrency/monitor.c exception.c \
    156         typeobject.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
    157         concurrency/alarm.c concurrency/invoke.c \
    158         concurrency/preemption.c
     104        concurrency/kernel.c concurrency/monitor.c \
     105        concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \
     106        concurrency/invoke.c concurrency/preemption.c
    159107am__dirstamp = $(am__leading_dot)dirstamp
    160108@BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
     
    178126        libcfa_d_a-interpose.$(OBJEXT) \
    179127        libhdr/libcfa_d_a-libdebug.$(OBJEXT) $(am__objects_2) \
    180         libcfa_d_a-exception.$(OBJEXT) libcfa_d_a-typeobject.$(OBJEXT) \
    181128        $(am__objects_3)
    182129am_libcfa_d_a_OBJECTS = $(am__objects_4)
     
    189136        containers/pair.c containers/result.c containers/vector.c \
    190137        concurrency/coroutine.c concurrency/thread.c \
    191         concurrency/kernel.c concurrency/monitor.c exception.c \
    192         typeobject.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
    193         concurrency/alarm.c concurrency/invoke.c \
    194         concurrency/preemption.c
     138        concurrency/kernel.c concurrency/monitor.c \
     139        concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \
     140        concurrency/invoke.c concurrency/preemption.c
    195141@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    196142@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
     
    212158        libcfa_a-interpose.$(OBJEXT) \
    213159        libhdr/libcfa_a-libdebug.$(OBJEXT) $(am__objects_6) \
    214         libcfa_a-exception.$(OBJEXT) libcfa_a-typeobject.$(OBJEXT) \
    215160        $(am__objects_7)
    216161am_libcfa_a_OBJECTS = $(am__objects_8)
    217162libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
    218 AM_V_P = $(am__v_P_@AM_V@)
    219 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    220 am__v_P_0 = false
    221 am__v_P_1 = :
    222 AM_V_GEN = $(am__v_GEN_@AM_V@)
    223 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    224 am__v_GEN_0 = @echo "  GEN     " $@;
    225 am__v_GEN_1 =
    226 AM_V_at = $(am__v_at_@AM_V@)
    227 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    228 am__v_at_0 = @
    229 am__v_at_1 =
    230163DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    231164depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    236169AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
    237170am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
    238 am__v_CPPAS_0 = @echo "  CPPAS   " $@;
    239 am__v_CPPAS_1 =
     171am__v_CPPAS_0 = @echo "  CPPAS " $@;
    240172AM_V_lt = $(am__v_lt_@AM_V@)
    241173am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    242174am__v_lt_0 = --silent
    243 am__v_lt_1 =
    244175COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    245176        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    246177AM_V_CC = $(am__v_CC_@AM_V@)
    247178am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    248 am__v_CC_0 = @echo "  CC      " $@;
    249 am__v_CC_1 =
     179am__v_CC_0 = @echo "  CC    " $@;
    250180CCLD = $(CC)
    251181LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    252182AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    253183am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    254 am__v_CCLD_0 = @echo "  CCLD    " $@;
    255 am__v_CCLD_1 =
     184am__v_CCLD_0 = @echo "  CCLD  " $@;
     185AM_V_GEN = $(am__v_GEN_@AM_V@)
     186am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     187am__v_GEN_0 = @echo "  GEN   " $@;
    256188SOURCES = $(libcfa_d_a_SOURCES) $(libcfa_a_SOURCES)
    257189DIST_SOURCES = $(am__libcfa_d_a_SOURCES_DIST) \
    258190        $(am__libcfa_a_SOURCES_DIST)
    259 am__can_run_installinfo = \
    260   case $$AM_UPDATE_INFO_DIR in \
    261     n|no|NO) false;; \
    262     *) (install-info --version) >/dev/null 2>&1;; \
    263   esac
    264191am__nobase_cfa_include_HEADERS_DIST = assert fstream iostream iterator \
    265192        limits math rational stdlib containers/maybe containers/pair \
     
    268195        ${shell echo stdhdr/*} gmp concurrency/invoke.h
    269196HEADERS = $(nobase_cfa_include_HEADERS)
    270 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    271 # Read a list of newline-separated strings from the standard input,
    272 # and print each of them once, without duplicates.  Input order is
    273 # *not* preserved.
    274 am__uniquify_input = $(AWK) '\
    275   BEGIN { nonempty = 0; } \
    276   { items[$$0] = 1; nonempty = 1; } \
    277   END { if (nonempty) { for (i in items) print i; }; } \
    278 '
    279 # Make sure the list of sources is unique.  This is necessary because,
    280 # e.g., the same source file might be shared among _SOURCES variables
    281 # for different programs/libraries.
    282 am__define_uniq_tagged_files = \
    283   list='$(am__tagged_files)'; \
    284   unique=`for i in $$list; do \
    285     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    286   done | $(am__uniquify_input)`
    287197ETAGS = etags
    288198CTAGS = ctags
    289 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    290199DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    291200ACLOCAL = @ACLOCAL@
     
    400309program_transform_name = @program_transform_name@
    401310psdir = @psdir@
    402 runstatedir = @runstatedir@
    403311sbindir = @sbindir@
    404312sharedstatedir = @sharedstatedir@
     
    412320# create object files in directory with source files
    413321AUTOMAKE_OPTIONS = subdir-objects
    414 ARFLAGS = cr
    415322lib_LIBRARIES = $(am__append_1) $(am__append_2)
    416323EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@
     
    421328libobjs = ${headers:=.o}
    422329libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
    423         exception.c typeobject.c $(am__append_4)
     330        $(am__append_4)
    424331libcfa_a_SOURCES = ${libsrc}
    425332libcfa_a_CFLAGS = -nodebug -O2
     
    446353        $(am__cd) $(top_srcdir) && \
    447354          $(AUTOMAKE) --foreign src/libcfa/Makefile
     355.PRECIOUS: Makefile
    448356Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    449357        @case '$?' in \
     
    465373install-libLIBRARIES: $(lib_LIBRARIES)
    466374        @$(NORMAL_INSTALL)
     375        test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
    467376        @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
    468377        list2=; for p in $$list; do \
     
    472381        done; \
    473382        test -z "$$list2" || { \
    474           echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
    475           $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
    476383          echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
    477384          $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
     
    541448        concurrency/$(am__dirstamp) \
    542449        concurrency/$(DEPDIR)/$(am__dirstamp)
    543 
    544450libcfa-d.a: $(libcfa_d_a_OBJECTS) $(libcfa_d_a_DEPENDENCIES) $(EXTRA_libcfa_d_a_DEPENDENCIES)
    545451        $(AM_V_at)-rm -f libcfa-d.a
     
    571477        concurrency/$(am__dirstamp) \
    572478        concurrency/$(DEPDIR)/$(am__dirstamp)
    573 
    574479libcfa.a: $(libcfa_a_OBJECTS) $(libcfa_a_DEPENDENCIES) $(EXTRA_libcfa_a_DEPENDENCIES)
    575480        $(AM_V_at)-rm -f libcfa.a
     
    579484mostlyclean-compile:
    580485        -rm -f *.$(OBJEXT)
    581         -rm -f concurrency/*.$(OBJEXT)
    582         -rm -f containers/*.$(OBJEXT)
    583         -rm -f libhdr/*.$(OBJEXT)
     486        -rm -f concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT)
     487        -rm -f concurrency/libcfa_a-alarm.$(OBJEXT)
     488        -rm -f concurrency/libcfa_a-coroutine.$(OBJEXT)
     489        -rm -f concurrency/libcfa_a-invoke.$(OBJEXT)
     490        -rm -f concurrency/libcfa_a-kernel.$(OBJEXT)
     491        -rm -f concurrency/libcfa_a-monitor.$(OBJEXT)
     492        -rm -f concurrency/libcfa_a-preemption.$(OBJEXT)
     493        -rm -f concurrency/libcfa_a-thread.$(OBJEXT)
     494        -rm -f concurrency/libcfa_d_a-alarm.$(OBJEXT)
     495        -rm -f concurrency/libcfa_d_a-coroutine.$(OBJEXT)
     496        -rm -f concurrency/libcfa_d_a-invoke.$(OBJEXT)
     497        -rm -f concurrency/libcfa_d_a-kernel.$(OBJEXT)
     498        -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT)
     499        -rm -f concurrency/libcfa_d_a-preemption.$(OBJEXT)
     500        -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT)
     501        -rm -f containers/libcfa_a-maybe.$(OBJEXT)
     502        -rm -f containers/libcfa_a-pair.$(OBJEXT)
     503        -rm -f containers/libcfa_a-result.$(OBJEXT)
     504        -rm -f containers/libcfa_a-vector.$(OBJEXT)
     505        -rm -f containers/libcfa_d_a-maybe.$(OBJEXT)
     506        -rm -f containers/libcfa_d_a-pair.$(OBJEXT)
     507        -rm -f containers/libcfa_d_a-result.$(OBJEXT)
     508        -rm -f containers/libcfa_d_a-vector.$(OBJEXT)
     509        -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT)
     510        -rm -f libhdr/libcfa_d_a-libdebug.$(OBJEXT)
    584511
    585512distclean-compile:
     
    587514
    588515@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-assert.Po@am__quote@
    589 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-exception.Po@am__quote@
    590516@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-fstream.Po@am__quote@
    591517@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-interpose.Po@am__quote@
     
    597523@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@
    598524@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-stdlib.Po@am__quote@
    599 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-typeobject.Po@am__quote@
    600525@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@
    601 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-exception.Po@am__quote@
    602526@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-fstream.Po@am__quote@
    603527@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-interpose.Po@am__quote@
     
    609533@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@
    610534@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
    611 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-typeobject.Po@am__quote@
    612535@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@
    613536@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@
     
    927850@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-monitor.obj `if test -f 'concurrency/monitor.c'; then $(CYGPATH_W) 'concurrency/monitor.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/monitor.c'; fi`
    928851
    929 libcfa_d_a-exception.obj: exception.c
    930 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-exception.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-exception.Tpo -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
    931 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-exception.Tpo $(DEPDIR)/libcfa_d_a-exception.Po
    932 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='exception.c' object='libcfa_d_a-exception.obj' libtool=no @AMDEPBACKSLASH@
    933 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    934 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
    935 
    936 libcfa_d_a-typeobject.obj: typeobject.c
    937 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-typeobject.Tpo -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
    938 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-typeobject.Tpo $(DEPDIR)/libcfa_d_a-typeobject.Po
    939 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='typeobject.c' object='libcfa_d_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@
    940 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    941 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
    942 
    943852concurrency/libcfa_d_a-alarm.o: concurrency/alarm.c
    944853@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-alarm.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo -c -o concurrency/libcfa_d_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c
     
    12351144@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-monitor.obj `if test -f 'concurrency/monitor.c'; then $(CYGPATH_W) 'concurrency/monitor.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/monitor.c'; fi`
    12361145
    1237 libcfa_a-exception.obj: exception.c
    1238 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-exception.obj -MD -MP -MF $(DEPDIR)/libcfa_a-exception.Tpo -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
    1239 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-exception.Tpo $(DEPDIR)/libcfa_a-exception.Po
    1240 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='exception.c' object='libcfa_a-exception.obj' libtool=no @AMDEPBACKSLASH@
    1241 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1242 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
    1243 
    1244 libcfa_a-typeobject.obj: typeobject.c
    1245 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_a-typeobject.Tpo -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
    1246 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-typeobject.Tpo $(DEPDIR)/libcfa_a-typeobject.Po
    1247 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='typeobject.c' object='libcfa_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@
    1248 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1249 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
    1250 
    12511146concurrency/libcfa_a-alarm.o: concurrency/alarm.c
    12521147@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-alarm.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-alarm.Tpo -c -o concurrency/libcfa_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c
     
    12851180install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS)
    12861181        @$(NORMAL_INSTALL)
     1182        test -z "$(cfa_includedir)" || $(MKDIR_P) "$(DESTDIR)$(cfa_includedir)"
    12871183        @list='$(nobase_cfa_include_HEADERS)'; test -n "$(cfa_includedir)" || list=; \
    1288         if test -n "$$list"; then \
    1289           echo " $(MKDIR_P) '$(DESTDIR)$(cfa_includedir)'"; \
    1290           $(MKDIR_P) "$(DESTDIR)$(cfa_includedir)" || exit 1; \
    1291         fi; \
    12921184        $(am__nobase_list) | while read dir files; do \
    12931185          xfiles=; for file in $$files; do \
     
    12961188          test -z "$$xfiles" || { \
    12971189            test "x$$dir" = x. || { \
    1298               echo " $(MKDIR_P) '$(DESTDIR)$(cfa_includedir)/$$dir'"; \
     1190              echo "$(MKDIR_P) '$(DESTDIR)$(cfa_includedir)/$$dir'"; \
    12991191              $(MKDIR_P) "$(DESTDIR)$(cfa_includedir)/$$dir"; }; \
    13001192            echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(cfa_includedir)/$$dir'"; \
     
    13081200        dir='$(DESTDIR)$(cfa_includedir)'; $(am__uninstall_files_from_dir)
    13091201
    1310 ID: $(am__tagged_files)
    1311         $(am__define_uniq_tagged_files); mkid -fID $$unique
    1312 tags: tags-am
    1313 TAGS: tags
    1314 
    1315 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     1202ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     1203        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     1204        unique=`for i in $$list; do \
     1205            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     1206          done | \
     1207          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     1208              END { if (nonempty) { for (i in files) print i; }; }'`; \
     1209        mkid -fID $$unique
     1210tags: TAGS
     1211
     1212TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     1213                $(TAGS_FILES) $(LISP)
    13161214        set x; \
    13171215        here=`pwd`; \
    1318         $(am__define_uniq_tagged_files); \
     1216        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     1217        unique=`for i in $$list; do \
     1218            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     1219          done | \
     1220          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     1221              END { if (nonempty) { for (i in files) print i; }; }'`; \
    13191222        shift; \
    13201223        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    13281231          fi; \
    13291232        fi
    1330 ctags: ctags-am
    1331 
    1332 CTAGS: ctags
    1333 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    1334         $(am__define_uniq_tagged_files); \
     1233ctags: CTAGS
     1234CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     1235                $(TAGS_FILES) $(LISP)
     1236        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     1237        unique=`for i in $$list; do \
     1238            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     1239          done | \
     1240          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     1241              END { if (nonempty) { for (i in files) print i; }; }'`; \
    13351242        test -z "$(CTAGS_ARGS)$$unique" \
    13361243          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    13411248          && $(am__cd) $(top_srcdir) \
    13421249          && gtags -i $(GTAGS_ARGS) "$$here"
    1343 cscopelist: cscopelist-am
    1344 
    1345 cscopelist-am: $(am__tagged_files)
    1346         list='$(am__tagged_files)'; \
    1347         case "$(srcdir)" in \
    1348           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    1349           *) sdir=$(subdir)/$(srcdir) ;; \
    1350         esac; \
    1351         for i in $$list; do \
    1352           if test -f "$$i"; then \
    1353             echo "$(subdir)/$$i"; \
    1354           else \
    1355             echo "$$sdir/$$i"; \
    1356           fi; \
    1357         done >> $(top_builddir)/cscope.files
    13581250
    13591251distclean-tags:
     
    15071399.MAKE: install-am install-strip
    15081400
    1509 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
    1510         clean-libLIBRARIES cscopelist-am ctags ctags-am distclean \
    1511         distclean-compile distclean-generic distclean-tags distdir dvi \
    1512         dvi-am html html-am info info-am install install-am \
    1513         install-data install-data-am install-dvi install-dvi-am \
    1514         install-exec install-exec-am install-html install-html-am \
    1515         install-info install-info-am install-libLIBRARIES install-man \
     1401.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
     1402        clean-libLIBRARIES ctags distclean distclean-compile \
     1403        distclean-generic distclean-tags distdir dvi dvi-am html \
     1404        html-am info info-am install install-am install-data \
     1405        install-data-am install-dvi install-dvi-am install-exec \
     1406        install-exec-am install-html install-html-am install-info \
     1407        install-info-am install-libLIBRARIES install-man \
    15161408        install-nobase_cfa_includeHEADERS install-pdf install-pdf-am \
    15171409        install-ps install-ps-am install-strip installcheck \
     
    15191411        maintainer-clean-generic maintainer-clean-local mostlyclean \
    15201412        mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
    1521         tags tags-am uninstall uninstall-am uninstall-libLIBRARIES \
     1413        tags uninstall uninstall-am uninstall-libLIBRARIES \
    15221414        uninstall-nobase_cfa_includeHEADERS
    1523 
    1524 .PRECIOUS: Makefile
    15251415
    15261416
     
    15381428        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    15391429
    1540 libcfa_a-exception.o : exception.c
    1541         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    1542 
    1543 libcfa_a-typeobject.o : typeobject.c
    1544         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    1545 
    15461430concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    1547         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    1548 
    1549 libcfa_d_a-exception.o : exception.c
    1550         ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    1551 
    1552 libcfa_d_a-typeobject.o : typeobject.c
    15531431        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    15541432
  • src/libcfa/concurrency/CtxSwitch-i386.S

    rb826e6b rfea3faa  
    9898        ret
    9999
     100.text
     101        .align 2
     102.globl  CtxGet
     103CtxGet:
     104        movl %esp,SP_OFFSET(%eax)
     105        movl %ebp,FP_OFFSET(%eax)
     106
     107        ret
     108
    100109// Local Variables: //
    101110// compile-command: "make install" //
  • src/libcfa/concurrency/CtxSwitch-x86_64.S

    rb826e6b rfea3faa  
    1 //                               -*- Mode: Asm -*-
     1//                               -*- Mode: Asm -*- 
    22//
    33// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    1818// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
    1919// option) any later version.
    20 //
     20// 
    2121// This library is distributed in the  hope that it will be useful, but WITHOUT
    2222// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
    2323// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    2424// for more details.
    25 //
     25// 
    2626// You should  have received a  copy of the  GNU Lesser General  Public License
    2727// along  with this library.
    28 //
     28// 
    2929
    3030// This context switch routine depends on the fact that the stack of a new
     
    9393.globl  CtxInvokeStub
    9494CtxInvokeStub:
    95         movq %rbx, %rdi
     95        movq %rbx, %rdi 
    9696        jmp *%r12
     97
     98.text
     99        .align 2
     100.globl  CtxGet
     101CtxGet:
     102        movq %rsp,SP_OFFSET(%rdi)
     103        movq %rbp,FP_OFFSET(%rdi)
     104
     105        ret
    97106
    98107// Local Variables: //
  • src/libcfa/concurrency/alarm.c

    rb826e6b rfea3faa  
    1616
    1717extern "C" {
    18 #include <errno.h>
    19 #include <stdio.h>
    20 #include <string.h>
    2118#include <time.h>
    22 #include <unistd.h>
    2319#include <sys/time.h>
    2420}
    25 
    26 #include "libhdr.h"
    2721
    2822#include "alarm.h"
    2923#include "kernel_private.h"
    3024#include "preemption.h"
    31 
    32 //=============================================================================================
    33 // time type
    34 //=============================================================================================
    35 
    36 #define one_second         1_000_000_000ul
    37 #define one_milisecond         1_000_000ul
    38 #define one_microsecond            1_000ul
    39 #define one_nanosecond                 1ul
    40 
    41 __cfa_time_t zero_time = { 0 };
    42 
    43 void ?{}( __cfa_time_t * this ) { this->val = 0; }
    44 void ?{}( __cfa_time_t * this, zero_t zero ) { this->val = 0; }
    45 
    46 void ?{}( itimerval * this, __cfa_time_t * alarm ) {
    47         this->it_value.tv_sec = alarm->val / one_second;                        // seconds
    48         this->it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds
    49         this->it_interval.tv_sec = 0;
    50         this->it_interval.tv_usec = 0;
    51 }
    52 
    53 
    54 void ?{}( __cfa_time_t * this, timespec * curr ) {
    55         uint64_t secs  = curr->tv_sec;
    56         uint64_t nsecs = curr->tv_nsec;
    57         this->val = (secs * one_second) + nsecs;
    58 }
    59 
    60 __cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs ) {
    61         this->val = 0;
    62         return *this;
    63 }
    64 
    65 __cfa_time_t from_s ( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1_000_000_000ul; return ret; }
    66 __cfa_time_t from_ms( uint64_t val ) { __cfa_time_t ret; ret.val = val *     1_000_000ul; return ret; }
    67 __cfa_time_t from_us( uint64_t val ) { __cfa_time_t ret; ret.val = val *         1_000ul; return ret; }
    68 __cfa_time_t from_ns( uint64_t val ) { __cfa_time_t ret; ret.val = val *             1ul; return ret; }
    6925
    7026//=============================================================================================
     
    7531        timespec curr;
    7632        clock_gettime( CLOCK_REALTIME, &curr );
    77         return (__cfa_time_t){ &curr };
     33        return ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec;
    7834}
    7935
    8036void __kernel_set_timer( __cfa_time_t alarm ) {
    81         itimerval val = { &alarm };
     37        itimerval val;
     38        val.it_value.tv_sec = alarm / TIMEGRAN;                 // seconds
     39        val.it_value.tv_usec = (alarm % TIMEGRAN) / ( TIMEGRAN / 1_000_000L ); // microseconds
     40        val.it_interval.tv_sec = 0;
     41        val.it_interval.tv_usec = 0;
    8242        setitimer( ITIMER_REAL, &val, NULL );
    8343}
     
    8747//=============================================================================================
    8848
    89 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
     49void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
    9050        this->thrd = thrd;
    9151        this->alarm = alarm;
     
    9656}
    9757
    98 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {
     58void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) {
    9959        this->proc = proc;
    10060        this->alarm = alarm;
     
    11171}
    11272
    113 LIB_DEBUG_DO( bool validate( alarm_list_t * this ) {
    114         alarm_node_t ** it = &this->head;
    115         while( (*it) ) {
    116                 it = &(*it)->next;
    117         }
    118 
    119         return it == this->tail;
    120 })
    121 
    12273static inline void insert_at( alarm_list_t * this, alarm_node_t * n, __alarm_it_t p ) {
    123         verify( !n->next );
     74        assert( !n->next );
    12475        if( p == this->tail ) {
    12576                this->tail = &n->next;
     
    12980        }
    13081        *p = n;
    131 
    132         verify( validate( this ) );
    13382}
    13483
     
    14089
    14190        insert_at( this, n, it );
    142 
    143         verify( validate( this ) );
    14491}
    14592
     
    153100                head->next = NULL;
    154101        }
    155         verify( validate( this ) );
    156102        return head;
    157103}
     
    159105static inline void remove_at( alarm_list_t * this, alarm_node_t * n, __alarm_it_t it ) {
    160106        verify( it );
    161         verify( (*it) == n );
     107        verify( (*it)->next == n );
    162108
    163         (*it) = n->next;
     109        (*it)->next = n->next;
    164110        if( !n-> next ) {
    165111                this->tail = it;
    166112        }
    167113        n->next = NULL;
    168 
    169         verify( validate( this ) );
    170114}
    171115
    172116static inline void remove( alarm_list_t * this, alarm_node_t * n ) {
    173117        alarm_node_t ** it = &this->head;
    174         while( (*it) && (*it) != n ) {
     118        while( (*it) && (*it)->next != n ) {
    175119                it = &(*it)->next;
    176120        }
    177121
    178         verify( validate( this ) );
    179 
    180122        if( *it ) { remove_at( this, n, it ); }
    181 
    182         verify( validate( this ) );
    183123}
    184124
    185125void register_self( alarm_node_t * this ) {
    186         alarm_list_t * alarms = &event_kernel->alarms;
    187 
    188126        disable_interrupts();
    189         lock( &event_kernel->lock DEBUG_CTX2 );
     127        assert( !systemProcessor->pending_alarm );
     128        lock( &systemProcessor->alarm_lock );
    190129        {
    191                 verify( validate( alarms ) );
    192                 bool first = !alarms->head;
    193 
    194                 insert( alarms, this );
    195                 if( first ) {
    196                         __kernel_set_timer( alarms->head->alarm - __kernel_get_time() );
     130                insert( &systemProcessor->alarms, this );
     131                if( systemProcessor->pending_alarm ) {
     132                        tick_preemption();
    197133                }
    198134        }
    199         unlock( &event_kernel->lock );
     135        unlock( &systemProcessor->alarm_lock );
    200136        this->set = true;
    201         enable_interrupts( DEBUG_CTX );
     137        enable_interrupts();
    202138}
    203139
    204140void unregister_self( alarm_node_t * this ) {
    205141        disable_interrupts();
    206         lock( &event_kernel->lock DEBUG_CTX2 );
    207         {
    208                 verify( validate( &event_kernel->alarms ) );
    209                 remove( &event_kernel->alarms, this );
    210         }
    211         unlock( &event_kernel->lock );
    212         enable_interrupts( DEBUG_CTX );
     142        lock( &systemProcessor->alarm_lock );
     143        remove( &systemProcessor->alarms, this );
     144        unlock( &systemProcessor->alarm_lock );
     145        disable_interrupts();
    213146        this->set = false;
    214147}
  • src/libcfa/concurrency/alarm.h

    rb826e6b rfea3faa  
    1919
    2020#include <stdbool.h>
    21 #include <stdint.h>
    2221
    2322#include "assert"
     23
     24typedef unsigned long int __cfa_time_t;
    2425
    2526struct thread_desc;
    2627struct processor;
    2728
    28 struct timespec;
    29 struct itimerval;
    30 
    31 //=============================================================================================
    32 // time type
    33 //=============================================================================================
    34 
    35 struct __cfa_time_t {
    36         uint64_t val;
    37 };
    38 
    39 // ctors
    40 void ?{}( __cfa_time_t * this );
    41 void ?{}( __cfa_time_t * this, zero_t zero );
    42 void ?{}( __cfa_time_t * this, timespec * curr );
    43 void ?{}( itimerval * this, __cfa_time_t * alarm );
    44 
    45 __cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs );
    46 
    47 // logical ops
    48 static inline bool ?==?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val == rhs.val; }
    49 static inline bool ?!=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val != rhs.val; }
    50 static inline bool ?>? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >  rhs.val; }
    51 static inline bool ?<? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <  rhs.val; }
    52 static inline bool ?>=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >= rhs.val; }
    53 static inline bool ?<=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <= rhs.val; }
    54 
    55 static inline bool ?==?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val == rhs; }
    56 static inline bool ?!=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val != rhs; }
    57 static inline bool ?>? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >  rhs; }
    58 static inline bool ?<? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <  rhs; }
    59 static inline bool ?>=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >= rhs; }
    60 static inline bool ?<=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <= rhs; }
    61 
    62 // addition/substract
    63 static inline __cfa_time_t ?+?( __cfa_time_t lhs, __cfa_time_t rhs ) {
    64         __cfa_time_t ret;
    65         ret.val = lhs.val + rhs.val;
    66         return ret;
    67 }
    68 
    69 static inline __cfa_time_t ?-?( __cfa_time_t lhs, __cfa_time_t rhs ) {
    70         __cfa_time_t ret;
    71         ret.val = lhs.val - rhs.val;
    72         return ret;
    73 }
    74 
    75 __cfa_time_t from_s ( uint64_t );
    76 __cfa_time_t from_ms( uint64_t );
    77 __cfa_time_t from_us( uint64_t );
    78 __cfa_time_t from_ns( uint64_t );
    79 
    80 extern __cfa_time_t zero_time;
    81 
    8229//=============================================================================================
    8330// Clock logic
    8431//=============================================================================================
     32
     33#define TIMEGRAN 1_000_000_000L                         // nanosecond granularity, except for timeval
    8534
    8635__cfa_time_t __kernel_get_time();
     
    10756typedef alarm_node_t ** __alarm_it_t;
    10857
    109 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
    110 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
     58void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
     59void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
    11160void ^?{}( alarm_node_t * this );
    11261
  • src/libcfa/concurrency/coroutine

    rb826e6b rfea3faa  
    6363
    6464// Get current coroutine
    65 extern volatile thread_local coroutine_desc * this_coroutine;
     65coroutine_desc * this_coroutine(void);
    6666
    6767// Private wrappers for context switch and stack creation
     
    7171// Suspend implementation inlined for performance
    7272static inline void suspend() {
    73         coroutine_desc * src = this_coroutine;          // optimization
     73        coroutine_desc * src = this_coroutine();                // optimization
    7474
    7575        assertf( src->last != 0,
     
    8888forall(dtype T | is_coroutine(T))
    8989static inline void resume(T * cor) {
    90         coroutine_desc * src = this_coroutine;          // optimization
     90        coroutine_desc * src = this_coroutine();                // optimization
    9191        coroutine_desc * dst = get_coroutine(cor);
    9292
     
    112112
    113113static inline void resume(coroutine_desc * dst) {
    114         coroutine_desc * src = this_coroutine;          // optimization
     114        coroutine_desc * src = this_coroutine();                // optimization
    115115
    116116        // not resuming self ?
  • src/libcfa/concurrency/coroutine.c

    rb826e6b rfea3faa  
    3232#include "invoke.h"
    3333
    34 extern volatile thread_local processor * this_processor;
     34extern thread_local processor * this_processor;
    3535
    3636//-----------------------------------------------------------------------------
     
    4444// Coroutine ctors and dtors
    4545void ?{}(coStack_t* this) {
    46         this->size              = 65000;        // size of stack
     46        this->size              = 10240;        // size of stack
    4747        this->storage   = NULL; // pointer to stack
    4848        this->limit             = NULL; // stack grows towards stack limit
     
    5050        this->context   = NULL; // address of cfa_context_t
    5151        this->top               = NULL; // address of top of storage
    52         this->userStack = false;
     52        this->userStack = false;       
    5353}
    5454
     
    106106
    107107        // set state of current coroutine to inactive
    108         src->state = src->state == Halted ? Halted : Inactive;
     108        src->state = Inactive;
    109109
    110110        // set new coroutine that task is executing
    111         this_coroutine = dst;
     111        this_processor->current_coroutine = dst;
    112112
    113113        // context switch to specified coroutine
    114         assert( src->stack.context );
    115114        CtxSwitch( src->stack.context, dst->stack.context );
    116         // when CtxSwitch returns we are back in the src coroutine
     115        // when CtxSwitch returns we are back in the src coroutine             
    117116
    118117        // set state of new coroutine to active
     
    132131                this->size = libCeiling( storageSize, 16 );
    133132                // use malloc/memalign because "new" raises an exception for out-of-memory
    134 
     133               
    135134                // assume malloc has 8 byte alignment so add 8 to allow rounding up to 16 byte alignment
    136135                LIB_DEBUG_DO( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) );
  • src/libcfa/concurrency/invoke.c

    rb826e6b rfea3faa  
    2929
    3030extern void __suspend_internal(void);
    31 extern void __leave_thread_monitor( struct thread_desc * this );
    32 extern void disable_interrupts();
    33 extern void enable_interrupts( DEBUG_CTX_PARAM );
     31extern void __leave_monitor_desc( struct monitor_desc * this );
    3432
    3533void CtxInvokeCoroutine(
    36       void (*main)(void *),
    37       struct coroutine_desc *(*get_coroutine)(void *),
     34      void (*main)(void *), 
     35      struct coroutine_desc *(*get_coroutine)(void *), 
    3836      void *this
    3937) {
     
    5856
    5957void CtxInvokeThread(
    60       void (*dtor)(void *),
    61       void (*main)(void *),
    62       struct thread_desc *(*get_thread)(void *),
     58      void (*dtor)(void *), 
     59      void (*main)(void *), 
     60      struct thread_desc *(*get_thread)(void *), 
    6361      void *this
    6462) {
    65       // First suspend, once the thread arrives here,
    66       // the function pointer to main can be invalidated without risk
    6763      __suspend_internal();
    6864
    69       // Fetch the thread handle from the user defined thread structure
    7065      struct thread_desc* thrd = get_thread( this );
     66      struct coroutine_desc* cor = &thrd->cor;
     67      struct monitor_desc* mon = &thrd->mon;
     68      cor->state = Active;
    7169
    72       // Officially start the thread by enabling preemption
    73       enable_interrupts( DEBUG_CTX );
    74 
    75       // Call the main of the thread
     70      // LIB_DEBUG_PRINTF("Invoke Thread : invoking main %p (args %p)\n", main, this);
    7671      main( this );
    7772
    78       // To exit a thread we must :
    79       // 1 - Mark it as halted
    80       // 2 - Leave its monitor
    81       // 3 - Disable the interupts
    82       // 4 - Final suspend
    83       // The order of these 4 operations is very important
     73      __leave_monitor_desc( mon );
     74
    8475      //Final suspend, should never return
    85       __leave_thread_monitor( thrd );
     76      __suspend_internal();
    8677      abortf("Resumed dead thread");
    8778}
     
    8980
    9081void CtxStart(
    91       void (*main)(void *),
    92       struct coroutine_desc *(*get_coroutine)(void *),
    93       void *this,
     82      void (*main)(void *), 
     83      struct coroutine_desc *(*get_coroutine)(void *), 
     84      void *this, 
    9485      void (*invoke)(void *)
    9586) {
     
    117108        ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = invoke;
    118109      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520
    119       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7
     110      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7 
    120111
    121112#elif defined( __x86_64__ )
     
    137128      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[1] = invoke;
    138129      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520
    139       ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7
     130      ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7 
    140131#else
    141132      #error Only __i386__ and __x86_64__ is supported for threads in cfa
  • src/libcfa/concurrency/invoke.h

    rb826e6b rfea3faa  
    3131      struct spinlock {
    3232            volatile int lock;
    33             #ifdef __CFA_DEBUG__
    34                   const char * prev_name;
    35                   void* prev_thrd;
    36             #endif
    3733      };
    3834
     
    8783            struct __thread_queue_t entry_queue;      // queue of threads that are blocked waiting for the monitor
    8884            struct __condition_stack_t signal_stack;  // stack of conditions to run next once we exit the monitor
     85            struct monitor_desc * stack_owner;        // if bulk acquiring was used we need to synchronize signals with an other monitor
    8986            unsigned int recursion;                   // monitor routines can be called recursively, we need to keep track of that
    9087      };
     
    10299#ifndef _INVOKE_PRIVATE_H_
    103100#define _INVOKE_PRIVATE_H_
    104 
     101     
    105102      struct machine_context_t {
    106103            void *SP;
     
    112109      extern void CtxInvokeStub( void );
    113110      void CtxSwitch( void * from, void * to ) asm ("CtxSwitch");
    114 
    115       #if   defined( __x86_64__ )
    116       #define CtxGet( ctx ) __asm__ ( \
    117                   "movq %%rsp,%0\n"   \
    118                   "movq %%rbp,%1\n"   \
    119             : "=rm" (ctx.SP), "=rm" (ctx.FP) )
    120       #elif defined( __i386__ )
    121       #define CtxGet( ctx ) __asm__ ( \
    122                   "movl %%esp,%0\n"   \
    123                   "movl %%ebp,%1\n"   \
    124             : "=rm" (ctx.SP), "=rm" (ctx.FP) )
    125       #endif
     111      void CtxGet( void * this ) asm ("CtxGet");
    126112
    127113#endif //_INVOKE_PRIVATE_H_
  • src/libcfa/concurrency/kernel

    rb826e6b rfea3faa  
    2828//-----------------------------------------------------------------------------
    2929// Locks
    30 void lock      ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, spin if already acquired
    31 void lock_yield( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, yield repeatedly if already acquired
    32 bool try_lock  ( spinlock * DEBUG_CTX_PARAM2 );       // Lock the spinlock, return false if already acquired
    33 void unlock    ( spinlock * );                        // Unlock the spinlock
     30bool try_lock( spinlock * );
     31void lock( spinlock * );
     32void unlock( spinlock * );
    3433
    35 struct semaphore {
    36         spinlock lock;
    37         int count;
    38         __thread_queue_t waiting;
     34struct signal_once {
     35        volatile bool cond;
     36        struct spinlock lock;
     37        struct __thread_queue_t blocked;
    3938};
    4039
    41 void  ?{}(semaphore * this, int count = 1);
    42 void ^?{}(semaphore * this);
    43 void P(semaphore * this);
    44 void V(semaphore * this);
     40void ?{}(signal_once * this);
     41void ^?{}(signal_once * this);
    4542
     43void wait( signal_once * );
     44void signal( signal_once * );
    4645
    4746//-----------------------------------------------------------------------------
    4847// Cluster
    4948struct cluster {
    50         spinlock ready_queue_lock;                      // Ready queue locks
    51         __thread_queue_t ready_queue;                   // Ready queue for threads
    52         unsigned long long int preemption;              // Preemption rate on this cluster
     49        __thread_queue_t ready_queue;
     50        spinlock lock;
    5351};
    5452
     
    7068        unsigned short thrd_count;
    7169};
    72 static inline void ?{}(FinishAction * this) {
     70static inline void ?{}(FinishAction * this) { 
    7371        this->action_code = No_Action;
    7472        this->thrd = NULL;
     
    7775static inline void ^?{}(FinishAction * this) {}
    7876
    79 // Processor
    80 // Wrapper around kernel threads
    8177struct processor {
    82         // Main state
    83         struct processorCtx_t * runner;                 // Coroutine ctx who does keeps the state of the processor
    84         cluster * cltr;                                 // Cluster from which to get threads
    85         pthread_t kernel_thread;                        // Handle to pthreads
     78        struct processorCtx_t * runner;
     79        cluster * cltr;
     80        coroutine_desc * current_coroutine;
     81        thread_desc * current_thread;
     82        pthread_t kernel_thread;
     83       
     84        signal_once terminated;
     85        volatile bool is_terminated;
    8686
    87         // Termination
    88         volatile bool do_terminate;                     // Set to true to notify the processor should terminate
    89         semaphore terminated;                           // Termination synchronisation
     87        struct FinishAction finish;
    9088
    91         // RunThread data
    92         struct FinishAction finish;                     // Action to do after a thread is ran
     89        struct alarm_node_t * preemption_alarm;
     90        unsigned int preemption;
    9391
    94         // Preemption data
    95         struct alarm_node_t * preemption_alarm;         // Node which is added in the discrete event simulaiton
    96         bool pending_preemption;                        // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
     92        unsigned short disable_preempt_count;
    9793
    98 #ifdef __CFA_DEBUG__
    99         char * last_enable;                             // Last function to enable preemption on this processor
    100 #endif
     94        bool pending_preemption;
    10195};
    10296
  • src/libcfa/concurrency/kernel.c

    rb826e6b rfea3faa  
    1515//
    1616
    17 #include "libhdr.h"
     17#include "startup.h"
     18
     19//Start and stop routine for the kernel, declared first to make sure they run first
     20void kernel_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
     21void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
     22
     23//Header
     24#include "kernel_private.h"
    1825
    1926//C Includes
     
    2835
    2936//CFA Includes
    30 #include "kernel_private.h"
     37#include "libhdr.h"
    3138#include "preemption.h"
    32 #include "startup.h"
    3339
    3440//Private includes
     
    3642#include "invoke.h"
    3743
    38 //Start and stop routine for the kernel, declared first to make sure they run first
    39 void kernel_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
    40 void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
    41 
    4244//-----------------------------------------------------------------------------
    4345// Kernel storage
    44 KERNEL_STORAGE(cluster,           mainCluster);
    45 KERNEL_STORAGE(processor,         mainProcessor);
    46 KERNEL_STORAGE(processorCtx_t,    mainProcessorCtx);
    47 KERNEL_STORAGE(thread_desc,       mainThread);
    48 KERNEL_STORAGE(machine_context_t, mainThreadCtx);
    49 
    50 cluster *     mainCluster;
    51 processor *   mainProcessor;
     46#define KERNEL_STORAGE(T,X) static char X##_storage[sizeof(T)]
     47
     48KERNEL_STORAGE(processorCtx_t, systemProcessorCtx);
     49KERNEL_STORAGE(cluster, systemCluster);
     50KERNEL_STORAGE(system_proc_t, systemProcessor);
     51KERNEL_STORAGE(thread_desc, mainThread);
     52KERNEL_STORAGE(machine_context_t, mainThread_context);
     53
     54cluster * systemCluster;
     55system_proc_t * systemProcessor;
    5256thread_desc * mainThread;
    5357
     
    5559// Global state
    5660
    57 volatile thread_local coroutine_desc * this_coroutine;
    58 volatile thread_local thread_desc * this_thread;
    59 volatile thread_local processor * this_processor;
    60 
    61 volatile thread_local bool preemption_in_progress = 0;
    62 volatile thread_local unsigned short disable_preempt_count = 1;
     61thread_local processor * this_processor;
     62
     63coroutine_desc * this_coroutine(void) {
     64        return this_processor->current_coroutine;
     65}
     66
     67thread_desc * this_thread(void) {
     68        return this_processor->current_thread;
     69}
    6370
    6471//-----------------------------------------------------------------------------
    6572// Main thread construction
    6673struct current_stack_info_t {
    67         machine_context_t ctx;
     74        machine_context_t ctx; 
    6875        unsigned int size;              // size of stack
    6976        void *base;                             // base of stack
     
    7582
    7683void ?{}( current_stack_info_t * this ) {
    77         CtxGet( this->ctx );
     84        CtxGet( &this->ctx );
    7885        this->base = this->ctx.FP;
    7986        this->storage = this->ctx.SP;
     
    8491
    8592        this->limit = (void *)(((intptr_t)this->base) - this->size);
    86         this->context = &storage_mainThreadCtx;
     93        this->context = &mainThread_context_storage;
    8794        this->top = this->base;
    8895}
     
    99106
    100107void ?{}( coroutine_desc * this, current_stack_info_t * info) {
    101         (&this->stack){ info };
     108        (&this->stack){ info }; 
    102109        this->name = "Main Thread";
    103110        this->errno_ = 0;
     
    124131
    125132void ?{}(processor * this) {
    126         this{ mainCluster };
     133        this{ systemCluster };
    127134}
    128135
    129136void ?{}(processor * this, cluster * cltr) {
    130137        this->cltr = cltr;
    131         (&this->terminated){ 0 };
    132         this->do_terminate = false;
     138        this->current_coroutine = NULL;
     139        this->current_thread = NULL;
     140        (&this->terminated){};
     141        this->is_terminated = false;
    133142        this->preemption_alarm = NULL;
     143        this->preemption = default_preemption();
     144        this->disable_preempt_count = 1;                //Start with interrupts disabled
    134145        this->pending_preemption = false;
    135146
     
    139150void ?{}(processor * this, cluster * cltr, processorCtx_t * runner) {
    140151        this->cltr = cltr;
    141         (&this->terminated){ 0 };
    142         this->do_terminate = false;
    143         this->preemption_alarm = NULL;
     152        this->current_coroutine = NULL;
     153        this->current_thread = NULL;
     154        (&this->terminated){};
     155        this->is_terminated = false;
     156        this->disable_preempt_count = 0;
    144157        this->pending_preemption = false;
    145         this->kernel_thread = pthread_self();
    146158
    147159        this->runner = runner;
    148         LIB_DEBUG_PRINT_SAFE("Kernel : constructing main processor context %p\n", runner);
     160        LIB_DEBUG_PRINT_SAFE("Kernel : constructing processor context %p\n", runner);
    149161        runner{ this };
    150162}
    151163
     164void ?{}(system_proc_t * this, cluster * cltr, processorCtx_t * runner) {
     165        (&this->alarms){};
     166        (&this->alarm_lock){};
     167        this->pending_alarm = false;
     168
     169        (&this->proc){ cltr, runner };
     170}
     171
    152172void ^?{}(processor * this) {
    153         if( ! this->do_terminate ) {
     173        if( ! this->is_terminated ) {
    154174                LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", this);
    155                 this->do_terminate = true;
    156                 P( &this->terminated );
    157                 pthread_join( this->kernel_thread, NULL );
     175                this->is_terminated = true;
     176                wait( &this->terminated );
    158177        }
    159178}
     
    161180void ?{}(cluster * this) {
    162181        ( &this->ready_queue ){};
    163         ( &this->ready_queue_lock ){};
    164 
    165         this->preemption = default_preemption();
     182        ( &this->lock ){};
    166183}
    167184
    168185void ^?{}(cluster * this) {
    169 
     186       
    170187}
    171188
     
    186203
    187204                thread_desc * readyThread = NULL;
    188                 for( unsigned int spin_count = 0; ! this->do_terminate; spin_count++ )
     205                for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ )
    189206                {
    190207                        readyThread = nextThread( this->cltr );
     
    192209                        if(readyThread)
    193210                        {
    194                                 verify( disable_preempt_count > 0 );
    195 
    196211                                runThread(this, readyThread);
    197 
    198                                 verify( disable_preempt_count > 0 );
    199212
    200213                                //Some actions need to be taken from the kernel
     
    212225        }
    213226
    214         V( &this->terminated );
    215 
     227        signal( &this->terminated );
    216228        LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this);
    217229}
    218230
    219 // runThread runs a thread by context switching
    220 // from the processor coroutine to the target thread
     231// runThread runs a thread by context switching 
     232// from the processor coroutine to the target thread 
    221233void runThread(processor * this, thread_desc * dst) {
    222234        coroutine_desc * proc_cor = get_coroutine(this->runner);
    223235        coroutine_desc * thrd_cor = get_coroutine(dst);
    224 
     236       
    225237        //Reset the terminating actions here
    226238        this->finish.action_code = No_Action;
    227239
    228240        //Update global state
    229         this_thread = dst;
     241        this->current_thread = dst;
    230242
    231243        // Context Switch to the thread
     
    234246}
    235247
    236 // Once a thread has finished running, some of
     248// Once a thread has finished running, some of 
    237249// its final actions must be executed from the kernel
    238250void finishRunning(processor * this) {
     
    244256        }
    245257        else if( this->finish.action_code == Release_Schedule ) {
    246                 unlock( this->finish.lock );
     258                unlock( this->finish.lock );           
    247259                ScheduleThread( this->finish.thrd );
    248260        }
     
    277289        processor * proc = (processor *) arg;
    278290        this_processor = proc;
    279         this_coroutine = NULL;
    280         this_thread = NULL;
    281         disable_preempt_count = 1;
    282291        // SKULLDUGGERY: We want to create a context for the processor coroutine
    283292        // which is needed for the 2-step context switch. However, there is no reason
    284         // to waste the perfectly valid stack create by pthread.
     293        // to waste the perfectly valid stack create by pthread. 
    285294        current_stack_info_t info;
    286295        machine_context_t ctx;
     
    291300
    292301        //Set global state
    293         this_coroutine = &proc->runner->__cor;
    294         this_thread = NULL;
     302        proc->current_coroutine = &proc->runner->__cor;
     303        proc->current_thread = NULL;
    295304
    296305        //We now have a proper context from which to schedule threads
    297306        LIB_DEBUG_PRINT_SAFE("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);
    298307
    299         // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't
    300         // resume it to start it like it normally would, it will just context switch
    301         // back to here. Instead directly call the main since we already are on the
     308        // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't 
     309        // resume it to start it like it normally would, it will just context switch 
     310        // back to here. Instead directly call the main since we already are on the 
    302311        // appropriate stack.
    303312        proc_cor_storage.__cor.state = Active;
     
    306315
    307316        // Main routine of the core returned, the core is now fully terminated
    308         LIB_DEBUG_PRINT_SAFE("Kernel : core %p main ended (%p)\n", proc, proc->runner);
     317        LIB_DEBUG_PRINT_SAFE("Kernel : core %p main ended (%p)\n", proc, proc->runner); 
    309318
    310319        return NULL;
     
    313322void start(processor * this) {
    314323        LIB_DEBUG_PRINT_SAFE("Kernel : Starting core %p\n", this);
    315 
     324       
    316325        pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this );
    317326
    318         LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this);
     327        LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this);       
    319328}
    320329
     
    322331// Scheduler routines
    323332void ScheduleThread( thread_desc * thrd ) {
    324         // if( !thrd ) return;
    325         assert( thrd );
    326         assert( thrd->cor.state != Halted );
    327 
    328         verify( disable_preempt_count > 0 );
     333        if( !thrd ) return;
    329334
    330335        verifyf( thrd->next == NULL, "Expected null got %p", thrd->next );
    331 
    332         lock(   &this_processor->cltr->ready_queue_lock DEBUG_CTX2 );
    333         append( &this_processor->cltr->ready_queue, thrd );
    334         unlock( &this_processor->cltr->ready_queue_lock );
    335 
    336         verify( disable_preempt_count > 0 );
     336       
     337        lock( &systemProcessor->proc.cltr->lock );
     338        append( &systemProcessor->proc.cltr->ready_queue, thrd );
     339        unlock( &systemProcessor->proc.cltr->lock );
    337340}
    338341
    339342thread_desc * nextThread(cluster * this) {
    340         verify( disable_preempt_count > 0 );
    341         lock( &this->ready_queue_lock DEBUG_CTX2 );
     343        lock( &this->lock );
    342344        thread_desc * head = pop_head( &this->ready_queue );
    343         unlock( &this->ready_queue_lock );
    344         verify( disable_preempt_count > 0 );
     345        unlock( &this->lock );
    345346        return head;
    346347}
    347348
    348 void BlockInternal() {
    349         disable_interrupts();
    350         verify( disable_preempt_count > 0 );
     349void ScheduleInternal() {
    351350        suspend();
    352         verify( disable_preempt_count > 0 );
    353         enable_interrupts( DEBUG_CTX );
    354 }
    355 
    356 void BlockInternal( spinlock * lock ) {
    357         disable_interrupts();
     351}
     352
     353void ScheduleInternal( spinlock * lock ) {
    358354        this_processor->finish.action_code = Release;
    359355        this_processor->finish.lock = lock;
    360 
    361         verify( disable_preempt_count > 0 );
    362356        suspend();
    363         verify( disable_preempt_count > 0 );
    364 
    365         enable_interrupts( DEBUG_CTX );
    366 }
    367 
    368 void BlockInternal( thread_desc * thrd ) {
    369         disable_interrupts();
    370         assert( thrd->cor.state != Halted );
     357}
     358
     359void ScheduleInternal( thread_desc * thrd ) {
    371360        this_processor->finish.action_code = Schedule;
    372361        this_processor->finish.thrd = thrd;
    373 
    374         verify( disable_preempt_count > 0 );
    375362        suspend();
    376         verify( disable_preempt_count > 0 );
    377 
    378         enable_interrupts( DEBUG_CTX );
    379 }
    380 
    381 void BlockInternal( spinlock * lock, thread_desc * thrd ) {
    382         disable_interrupts();
     363}
     364
     365void ScheduleInternal( spinlock * lock, thread_desc * thrd ) {
    383366        this_processor->finish.action_code = Release_Schedule;
    384367        this_processor->finish.lock = lock;
    385368        this_processor->finish.thrd = thrd;
    386 
    387         verify( disable_preempt_count > 0 );
    388369        suspend();
    389         verify( disable_preempt_count > 0 );
    390 
    391         enable_interrupts( DEBUG_CTX );
    392 }
    393 
    394 void BlockInternal(spinlock ** locks, unsigned short count) {
    395         disable_interrupts();
     370}
     371
     372void ScheduleInternal(spinlock ** locks, unsigned short count) {
    396373        this_processor->finish.action_code = Release_Multi;
    397374        this_processor->finish.locks = locks;
    398375        this_processor->finish.lock_count = count;
    399 
    400         verify( disable_preempt_count > 0 );
    401376        suspend();
    402         verify( disable_preempt_count > 0 );
    403 
    404         enable_interrupts( DEBUG_CTX );
    405 }
    406 
    407 void BlockInternal(spinlock ** locks, unsigned short lock_count, thread_desc ** thrds, unsigned short thrd_count) {
    408         disable_interrupts();
     377}
     378
     379void ScheduleInternal(spinlock ** locks, unsigned short lock_count, thread_desc ** thrds, unsigned short thrd_count) {
    409380        this_processor->finish.action_code = Release_Multi_Schedule;
    410381        this_processor->finish.locks = locks;
     
    412383        this_processor->finish.thrds = thrds;
    413384        this_processor->finish.thrd_count = thrd_count;
    414 
    415         verify( disable_preempt_count > 0 );
    416         suspend();
    417         verify( disable_preempt_count > 0 );
    418 
    419         enable_interrupts( DEBUG_CTX );
    420 }
    421 
    422 void LeaveThread(spinlock * lock, thread_desc * thrd) {
    423         verify( disable_preempt_count > 0 );
    424         this_processor->finish.action_code = thrd ? Release_Schedule : Release;
    425         this_processor->finish.lock = lock;
    426         this_processor->finish.thrd = thrd;
    427 
    428385        suspend();
    429386}
     
    435392// Kernel boot procedures
    436393void kernel_startup(void) {
    437         LIB_DEBUG_PRINT_SAFE("Kernel : Starting\n");
     394        LIB_DEBUG_PRINT_SAFE("Kernel : Starting\n");   
    438395
    439396        // Start by initializing the main thread
    440         // SKULLDUGGERY: the mainThread steals the process main thread
    441         // which will then be scheduled by the mainProcessor normally
    442         mainThread = (thread_desc *)&storage_mainThread;
     397        // SKULLDUGGERY: the mainThread steals the process main thread 
     398        // which will then be scheduled by the systemProcessor normally
     399        mainThread = (thread_desc *)&mainThread_storage;
    443400        current_stack_info_t info;
    444401        mainThread{ &info };
     
    446403        LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n");
    447404
    448         // Initialize the main cluster
    449         mainCluster = (cluster *)&storage_mainCluster;
    450         mainCluster{};
    451 
    452         LIB_DEBUG_PRINT_SAFE("Kernel : main cluster ready\n");
    453 
    454         // Initialize the main processor and the main processor ctx
    455         // (the coroutine that contains the processing control flow)
    456         mainProcessor = (processor *)&storage_mainProcessor;
    457         mainProcessor{ mainCluster, (processorCtx_t *)&storage_mainProcessorCtx };
    458 
    459         //initialize the global state variables
    460         this_processor = mainProcessor;
    461         this_thread = mainThread;
    462         this_coroutine = &mainThread->cor;
    463 
    464405        // Enable preemption
    465406        kernel_start_preemption();
    466407
    467         // Add the main thread to the ready queue
    468         // once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread
     408        // Initialize the system cluster
     409        systemCluster = (cluster *)&systemCluster_storage;
     410        systemCluster{};
     411
     412        LIB_DEBUG_PRINT_SAFE("Kernel : System cluster ready\n");
     413
     414        // Initialize the system processor and the system processor ctx
     415        // (the coroutine that contains the processing control flow)
     416        systemProcessor = (system_proc_t *)&systemProcessor_storage;
     417        systemProcessor{ systemCluster, (processorCtx_t *)&systemProcessorCtx_storage };
     418
     419        // Add the main thread to the ready queue
     420        // once resume is called on systemProcessor->runner the mainThread needs to be scheduled like any normal thread
    469421        ScheduleThread(mainThread);
    470422
    471         // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX
     423        //initialize the global state variables
     424        this_processor = &systemProcessor->proc;
     425        this_processor->current_thread = mainThread;
     426        this_processor->current_coroutine = &mainThread->cor;
     427
     428        // SKULLDUGGERY: Force a context switch to the system processor to set the main thread's context to the current UNIX
    472429        // context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that
    473         // mainThread is on the ready queue when this call is made.
    474         resume( mainProcessor->runner );
     430        // mainThread is on the ready queue when this call is made. 
     431        resume( systemProcessor->proc.runner );
    475432
    476433
     
    478435        // THE SYSTEM IS NOW COMPLETELY RUNNING
    479436        LIB_DEBUG_PRINT_SAFE("Kernel : Started\n--------------------------------------------------\n\n");
    480 
    481         enable_interrupts( DEBUG_CTX );
    482437}
    483438
     
    485440        LIB_DEBUG_PRINT_SAFE("\n--------------------------------------------------\nKernel : Shutting down\n");
    486441
    487         disable_interrupts();
    488 
    489         // SKULLDUGGERY: Notify the mainProcessor it needs to terminates.
     442        // SKULLDUGGERY: Notify the systemProcessor it needs to terminates.
    490443        // When its coroutine terminates, it return control to the mainThread
    491444        // which is currently here
    492         mainProcessor->do_terminate = true;
     445        systemProcessor->proc.is_terminated = true;
    493446        suspend();
    494447
    495448        // THE SYSTEM IS NOW COMPLETELY STOPPED
    496449
    497         // Disable preemption
    498         kernel_stop_preemption();
    499 
    500         // Destroy the main processor and its context in reverse order of construction
     450        // Destroy the system processor and its context in reverse order of construction
    501451        // These were manually constructed so we need manually destroy them
    502         ^(mainProcessor->runner){};
    503         ^(mainProcessor){};
     452        ^(systemProcessor->proc.runner){};
     453        ^(systemProcessor){};
    504454
    505455        // Final step, destroy the main thread since it is no longer needed
     
    507457        ^(mainThread){};
    508458
    509         LIB_DEBUG_PRINT_SAFE("Kernel : Shutdown complete\n");
     459        LIB_DEBUG_PRINT_SAFE("Kernel : Shutdown complete\n");   
    510460}
    511461
     
    517467        // abort cannot be recursively entered by the same or different processors because all signal handlers return when
    518468        // the globalAbort flag is true.
    519         lock( &kernel_abort_lock DEBUG_CTX2 );
     469        lock( &kernel_abort_lock );
    520470
    521471        // first task to abort ?
     
    523473                kernel_abort_called = true;
    524474                unlock( &kernel_abort_lock );
    525         }
     475        } 
    526476        else {
    527477                unlock( &kernel_abort_lock );
    528 
     478               
    529479                sigset_t mask;
    530480                sigemptyset( &mask );
     
    532482                sigaddset( &mask, SIGUSR1 );                    // block SIGUSR1 signals
    533483                sigsuspend( &mask );                            // block the processor to prevent further damage during abort
    534                 _exit( EXIT_FAILURE );                          // if processor unblocks before it is killed, terminate it
    535         }
    536 
    537         return this_thread;
     484                _exit( EXIT_FAILURE );                          // if processor unblocks before it is killed, terminate it             
     485        }
     486
     487        return this_thread();
    538488}
    539489
     
    544494        __lib_debug_write( STDERR_FILENO, abort_text, len );
    545495
    546         if ( thrd != this_coroutine ) {
    547                 len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine->name, this_coroutine );
     496        if ( thrd != this_coroutine() ) {
     497                len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine()->name, this_coroutine() );
    548498                __lib_debug_write( STDERR_FILENO, abort_text, len );
    549         }
     499        } 
    550500        else {
    551501                __lib_debug_write( STDERR_FILENO, ".\n", 2 );
     
    555505extern "C" {
    556506        void __lib_debug_acquire() {
    557                 lock( &kernel_debug_lock DEBUG_CTX2 );
     507                lock(&kernel_debug_lock);
    558508        }
    559509
    560510        void __lib_debug_release() {
    561                 unlock( &kernel_debug_lock );
     511                unlock(&kernel_debug_lock);
    562512        }
    563513}
     
    575525}
    576526
    577 bool try_lock( spinlock * this DEBUG_CTX_PARAM2 ) {
     527bool try_lock( spinlock * this ) {
    578528        return this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0;
    579529}
    580530
    581 void lock( spinlock * this DEBUG_CTX_PARAM2 ) {
     531void lock( spinlock * this ) {
    582532        for ( unsigned int i = 1;; i += 1 ) {
    583                 if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) { break; }
    584         }
    585         LIB_DEBUG_DO(
    586                 this->prev_name = caller;
    587                 this->prev_thrd = this_thread;
    588         )
    589 }
    590 
    591 void lock_yield( spinlock * this DEBUG_CTX_PARAM2 ) {
    592         for ( unsigned int i = 1;; i += 1 ) {
    593                 if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) { break; }
    594                 yield();
    595         }
    596         LIB_DEBUG_DO(
    597                 this->prev_name = caller;
    598                 this->prev_thrd = this_thread;
    599         )
    600 }
    601 
     533                if ( this->lock == 0 && __sync_lock_test_and_set_4( &this->lock, 1 ) == 0 ) break;
     534        }
     535}
    602536
    603537void unlock( spinlock * this ) {
     
    605539}
    606540
    607 void  ?{}( semaphore * this, int count = 1 ) {
    608         (&this->lock){};
    609         this->count = count;
    610         (&this->waiting){};
    611 }
    612 void ^?{}(semaphore * this) {}
    613 
    614 void P(semaphore * this) {
    615         lock( &this->lock DEBUG_CTX2 );
    616         this->count -= 1;
    617         if ( this->count < 0 ) {
    618                 // queue current task
    619                 append( &this->waiting, (thread_desc *)this_thread );
    620 
    621                 // atomically release spin lock and block
    622                 BlockInternal( &this->lock );
    623         }
    624         else {
    625             unlock( &this->lock );
    626         }
    627 }
    628 
    629 void V(semaphore * this) {
    630         thread_desc * thrd = NULL;
    631         lock( &this->lock DEBUG_CTX2 );
    632         this->count += 1;
    633         if ( this->count <= 0 ) {
    634                 // remove task at head of waiting list
    635                 thrd = pop_head( &this->waiting );
    636         }
    637 
     541void ?{}( signal_once * this ) {
     542        this->cond = false;
     543}
     544void ^?{}( signal_once * this ) {
     545
     546}
     547
     548void wait( signal_once * this ) {
     549        lock( &this->lock );
     550        if( !this->cond ) {
     551                append( &this->blocked, this_thread() );
     552                ScheduleInternal( &this->lock );
     553                lock( &this->lock );
     554        }
    638555        unlock( &this->lock );
    639 
    640         // make new owner
    641         WakeThread( thrd );
     556}
     557
     558void signal( signal_once * this ) {
     559        lock( &this->lock );
     560        {
     561                this->cond = true;
     562
     563                thread_desc * it;
     564                while( it = pop_head( &this->blocked) ) {
     565                        ScheduleThread( it );
     566                }
     567        }
     568        unlock( &this->lock );
    642569}
    643570
     
    663590                }
    664591                head->next = NULL;
    665         }
     592        }       
    666593        return head;
    667594}
     
    682609                this->top = top->next;
    683610                top->next = NULL;
    684         }
     611        }       
    685612        return top;
    686613}
  • src/libcfa/concurrency/kernel_private.h

    rb826e6b rfea3faa  
    1818#define KERNEL_PRIVATE_H
    1919
    20 #include "libhdr.h"
    21 
    2220#include "kernel"
    2321#include "thread"
     
    2523#include "alarm.h"
    2624
     25#include "libhdr.h"
    2726
    2827//-----------------------------------------------------------------------------
    2928// Scheduler
    30 
    31 extern "C" {
    32         void disable_interrupts();
    33         void enable_interrupts_noPoll();
    34         void enable_interrupts( DEBUG_CTX_PARAM );
    35 }
    36 
    3729void ScheduleThread( thread_desc * );
    38 static inline void WakeThread( thread_desc * thrd ) {
    39         if( !thrd ) return;
    40 
    41         disable_interrupts();
    42         ScheduleThread( thrd );
    43         enable_interrupts( DEBUG_CTX );
    44 }
    4530thread_desc * nextThread(cluster * this);
    4631
    47 //Block current thread and release/wake-up the following resources
    48 void BlockInternal(void);
    49 void BlockInternal(spinlock * lock);
    50 void BlockInternal(thread_desc * thrd);
    51 void BlockInternal(spinlock * lock, thread_desc * thrd);
    52 void BlockInternal(spinlock ** locks, unsigned short count);
    53 void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
    54 void LeaveThread(spinlock * lock, thread_desc * thrd);
     32void ScheduleInternal(void);
     33void ScheduleInternal(spinlock * lock);
     34void ScheduleInternal(thread_desc * thrd);
     35void ScheduleInternal(spinlock * lock, thread_desc * thrd);
     36void ScheduleInternal(spinlock ** locks, unsigned short count);
     37void ScheduleInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
    5538
    5639//-----------------------------------------------------------------------------
     
    6649void spin(processor * this, unsigned int * spin_count);
    6750
    68 struct event_kernel_t {
     51struct system_proc_t {
     52        processor proc;
     53
    6954        alarm_list_t alarms;
    70         spinlock lock;
     55        spinlock alarm_lock;
     56
     57        bool pending_alarm;
    7158};
    7259
    73 extern event_kernel_t * event_kernel;
     60extern cluster * systemCluster;
     61extern system_proc_t * systemProcessor;
     62extern thread_local processor * this_processor;
    7463
    75 extern volatile thread_local processor * this_processor;
    76 extern volatile thread_local coroutine_desc * this_coroutine;
    77 extern volatile thread_local thread_desc * this_thread;
    78 extern volatile thread_local bool preemption_in_progress;
    79 extern volatile thread_local unsigned short disable_preempt_count;
     64static inline void disable_interrupts() {
     65        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, 1, __ATOMIC_SEQ_CST );
     66        assert( prev != (unsigned short) -1 );
     67}
     68
     69static inline void enable_interrupts_noRF() {
     70        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     71        verify( prev != (unsigned short) 0 );
     72}
     73
     74static inline void enable_interrupts() {
     75        __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &this_processor->disable_preempt_count, -1, __ATOMIC_SEQ_CST );
     76        verify( prev != (unsigned short) 0 );
     77        if( prev == 1 && this_processor->pending_preemption ) {
     78                ScheduleInternal( this_processor->current_thread );
     79                this_processor->pending_preemption = false;
     80        }
     81}
    8082
    8183//-----------------------------------------------------------------------------
     
    8890extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
    8991
    90 //-----------------------------------------------------------------------------
    91 // Utils
    92 #define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
    93 
    9492#endif //KERNEL_PRIVATE_H
    9593
  • src/libcfa/concurrency/monitor

    rb826e6b rfea3faa  
    2626static inline void ?{}(monitor_desc * this) {
    2727        this->owner = NULL;
     28        this->stack_owner = NULL;
    2829        this->recursion = 0;
    2930}
  • src/libcfa/concurrency/monitor.c

    rb826e6b rfea3faa  
    1919#include <stdlib>
    2020
     21#include "kernel_private.h"
    2122#include "libhdr.h"
    22 #include "kernel_private.h"
    2323
    2424//-----------------------------------------------------------------------------
     
    4444
    4545extern "C" {
    46         void __enter_monitor_desc( monitor_desc * this ) {
    47                 lock_yield( &this->lock DEBUG_CTX2 );
    48                 thread_desc * thrd = this_thread;
    49 
    50                 // LIB_DEBUG_PRINT_SAFE("%p Entering %p (o: %p, r: %i)\n", thrd, this, this->owner, this->recursion);
     46        void __enter_monitor_desc(monitor_desc * this) {
     47                lock( &this->lock );
     48                thread_desc * thrd = this_thread();
     49
     50                LIB_DEBUG_PRINT_SAFE("%p Entering %p (o: %p, r: %i)\n", thrd, this, this->owner, this->recursion);
    5151
    5252                if( !this->owner ) {
     
    6262                        //Some one else has the monitor, wait in line for it
    6363                        append( &this->entry_queue, thrd );
    64                         // LIB_DEBUG_PRINT_SAFE("%p Blocking on entry\n", thrd);
    65                         BlockInternal( &this->lock );
    66 
    67                         //BlockInternal will unlock spinlock, no need to unlock ourselves
    68                         return;
     64                        LIB_DEBUG_PRINT_SAFE("%p Blocking on entry\n", thrd);
     65                        ScheduleInternal( &this->lock );
     66
     67                        //ScheduleInternal will unlock spinlock, no need to unlock ourselves
     68                        return; 
    6969                }
    7070
     
    7575        // leave pseudo code :
    7676        //      TODO
    77         void __leave_monitor_desc( monitor_desc * this ) {
    78                 lock_yield( &this->lock DEBUG_CTX2 );
    79 
    80                 // LIB_DEBUG_PRINT_SAFE("%p Leaving %p (o: %p, r: %i). ", this_thread, this, this->owner, this->recursion);
    81                 verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i)", this_thread, this->owner, this->recursion );
     77        void __leave_monitor_desc(monitor_desc * this) {
     78                lock( &this->lock );
     79
     80                LIB_DEBUG_PRINT_SAFE("%p Leaving %p (o: %p, r: %i)\n", thrd, this, this->owner, this->recursion);
     81                verifyf( this_thread() == this->owner, "Expected owner to be %p, got %p (r: %i)", this_thread(), this->owner, this->recursion );
    8282
    8383                //Leaving a recursion level, decrement the counter
     
    9696                unlock( &this->lock );
    9797
    98                 // LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner);
     98                LIB_DEBUG_PRINT_SAFE("Next owner is %p\n", new_owner);
    9999
    100100                //We need to wake-up the thread
    101                 WakeThread( new_owner );
    102         }
    103 
    104         void __leave_thread_monitor( thread_desc * thrd ) {
    105                 monitor_desc * this = &thrd->mon;
    106                 lock_yield( &this->lock DEBUG_CTX2 );
    107 
    108                 disable_interrupts();
    109 
    110                 thrd->cor.state = Halted;
    111 
    112                 verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i)", thrd, this->owner, this->recursion );
    113 
    114                 //Leaving a recursion level, decrement the counter
    115                 this->recursion -= 1;
    116 
    117                 //If we haven't left the last level of recursion
    118                 //it means we don't need to do anything
    119                 if( this->recursion != 0) {
    120                         unlock( &this->lock );
    121                         return;
    122                 }
    123 
    124                 thread_desc * new_owner = next_thread( this );
    125 
    126                 LeaveThread( &this->lock, new_owner );
     101                ScheduleThread( new_owner );
    127102        }
    128103}
     
    146121        enter( this->m, this->count );
    147122
    148         this->prev_mntrs = this_thread->current_monitors;
    149         this->prev_count = this_thread->current_monitor_count;
    150 
    151         this_thread->current_monitors      = m;
    152         this_thread->current_monitor_count = count;
     123        this->prev_mntrs = this_thread()->current_monitors;
     124        this->prev_count = this_thread()->current_monitor_count;
     125
     126        this_thread()->current_monitors      = m;
     127        this_thread()->current_monitor_count = count;
    153128}
    154129
     
    156131        leave( this->m, this->count );
    157132
    158         this_thread->current_monitors      = this->prev_mntrs;
    159         this_thread->current_monitor_count = this->prev_count;
     133        this_thread()->current_monitors      = this->prev_mntrs;
     134        this_thread()->current_monitor_count = this->prev_count;
    160135}
    161136
     
    184159// Internal scheduling
    185160void wait( condition * this, uintptr_t user_info = 0 ) {
    186         // LIB_DEBUG_PRINT_SAFE("Waiting\n");
     161        LIB_DEBUG_PRINT_SAFE("Waiting\n");
    187162
    188163        brand_condition( this );
     
    195170        unsigned short count = this->monitor_count;
    196171        unsigned int recursions[ count ];               //Save the current recursion levels to restore them later
    197         spinlock *   locks     [ count ];               //We need to pass-in an array of locks to BlockInternal
    198 
    199         // LIB_DEBUG_PRINT_SAFE("count %i\n", count);
    200 
    201         __condition_node_t waiter = { (thread_desc*)this_thread, count, user_info };
     172        spinlock *   locks     [ count ];               //We need to pass-in an array of locks to ScheduleInternal
     173
     174        LIB_DEBUG_PRINT_SAFE("count %i\n", count);
     175
     176        __condition_node_t waiter = { this_thread(), count, user_info };
    202177
    203178        __condition_criterion_t criteria[count];
    204179        for(int i = 0; i < count; i++) {
    205180                (&criteria[i]){ this->monitors[i], &waiter };
    206                 // LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
     181                LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
    207182        }
    208183
     
    226201        }
    227202
    228         // LIB_DEBUG_PRINT_SAFE("Will unblock: ");
     203        LIB_DEBUG_PRINT_SAFE("Will unblock: ");
    229204        for(int i = 0; i < thread_count; i++) {
    230                 // LIB_DEBUG_PRINT_SAFE("%p ", threads[i]);
    231         }
    232         // LIB_DEBUG_PRINT_SAFE("\n");
     205                LIB_DEBUG_PRINT_SAFE("%p ", threads[i]);
     206        }
     207        LIB_DEBUG_PRINT_SAFE("\n");
    233208
    234209        // Everything is ready to go to sleep
    235         BlockInternal( locks, count, threads, thread_count );
     210        ScheduleInternal( locks, count, threads, thread_count );
    236211
    237212
     
    247222bool signal( condition * this ) {
    248223        if( is_empty( this ) ) {
    249                 // LIB_DEBUG_PRINT_SAFE("Nothing to signal\n");
     224                LIB_DEBUG_PRINT_SAFE("Nothing to signal\n");
    250225                return false;
    251226        }
     
    256231
    257232        unsigned short count = this->monitor_count;
    258 
     233       
    259234        //Some more checking in debug
    260235        LIB_DEBUG_DO(
    261                 thread_desc * this_thrd = this_thread;
     236                thread_desc * this_thrd = this_thread();
    262237                if ( this->monitor_count != this_thrd->current_monitor_count ) {
    263238                        abortf( "Signal on condition %p made with different number of monitor(s), expected %i got %i", this, this->monitor_count, this_thrd->current_monitor_count );
     
    273248        //Lock all the monitors
    274249        lock_all( this->monitors, NULL, count );
    275         // LIB_DEBUG_PRINT_SAFE("Signalling");
     250        LIB_DEBUG_PRINT_SAFE("Signalling");
    276251
    277252        //Pop the head of the waiting queue
     
    281256        for(int i = 0; i < count; i++) {
    282257                __condition_criterion_t * crit = &node->criteria[i];
    283                 // LIB_DEBUG_PRINT_SAFE(" %p", crit->target);
     258                LIB_DEBUG_PRINT_SAFE(" %p", crit->target);
    284259                assert( !crit->ready );
    285260                push( &crit->target->signal_stack, crit );
    286261        }
    287262
    288         // LIB_DEBUG_PRINT_SAFE("\n");
     263        LIB_DEBUG_PRINT_SAFE("\n");
    289264
    290265        //Release
     
    306281        unsigned short count = this->monitor_count;
    307282        unsigned int recursions[ count ];               //Save the current recursion levels to restore them later
    308         spinlock *   locks     [ count ];               //We need to pass-in an array of locks to BlockInternal
     283        spinlock *   locks     [ count ];               //We need to pass-in an array of locks to ScheduleInternal
    309284
    310285        lock_all( this->monitors, locks, count );
    311286
    312287        //create creteria
    313         __condition_node_t waiter = { (thread_desc*)this_thread, count, 0 };
     288        __condition_node_t waiter = { this_thread(), count, 0 };
    314289
    315290        __condition_criterion_t criteria[count];
    316291        for(int i = 0; i < count; i++) {
    317292                (&criteria[i]){ this->monitors[i], &waiter };
    318                 // LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
     293                LIB_DEBUG_PRINT_SAFE( "Criterion %p\n", &criteria[i] );
    319294                push( &criteria[i].target->signal_stack, &criteria[i] );
    320295        }
     
    334309
    335310        //Everything is ready to go to sleep
    336         BlockInternal( locks, count, &signallee, 1 );
     311        ScheduleInternal( locks, count, &signallee, 1 );
    337312
    338313
     
    350325
    351326uintptr_t front( condition * this ) {
    352         verifyf( !is_empty(this),
     327        verifyf( !is_empty(this), 
    353328                "Attempt to access user data on an empty condition.\n"
    354329                "Possible cause is not checking if the condition is empty before reading stored data."
     
    360335// Internal scheduling
    361336void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) ) {
    362         // thread_desc * this = this_thread;
     337        // thread_desc * this = this_thread();
    363338
    364339        // unsigned short count = this->current_monitor_count;
    365340        // unsigned int recursions[ count ];            //Save the current recursion levels to restore them later
    366         // spinlock *   locks     [ count ];            //We need to pass-in an array of locks to BlockInternal
     341        // spinlock *   locks     [ count ];            //We need to pass-in an array of locks to ScheduleInternal
    367342
    368343        // lock_all( this->current_monitors, locks, count );
     
    373348
    374349        // // // Everything is ready to go to sleep
    375         // // BlockInternal( locks, count, threads, thread_count );
     350        // // ScheduleInternal( locks, count, threads, thread_count );
    376351
    377352
     
    418393static inline void lock_all( spinlock ** locks, unsigned short count ) {
    419394        for( int i = 0; i < count; i++ ) {
    420                 lock_yield( locks[i] DEBUG_CTX2 );
     395                lock( locks[i] );
    421396        }
    422397}
     
    425400        for( int i = 0; i < count; i++ ) {
    426401                spinlock * l = &source[i]->lock;
    427                 lock_yield( l DEBUG_CTX2 );
     402                lock( l );
    428403                if(locks) locks[i] = l;
    429404        }
     
    468443        for(    int i = 0; i < count; i++ ) {
    469444
    470                 // LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target );
     445                LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target );
    471446                if( &criteria[i] == target ) {
    472447                        criteria[i].ready = true;
    473                         // LIB_DEBUG_PRINT_SAFE( "True\n" );
     448                        LIB_DEBUG_PRINT_SAFE( "True\n" );
    474449                }
    475450
     
    477452        }
    478453
    479         // LIB_DEBUG_PRINT_SAFE( "Runing %i\n", ready2run );
     454        LIB_DEBUG_PRINT_SAFE( "Runing %i\n", ready2run );
    480455        return ready2run ? node->waiting_thread : NULL;
    481456}
    482457
    483458static inline void brand_condition( condition * this ) {
    484         thread_desc * thrd = this_thread;
     459        thread_desc * thrd = this_thread();
    485460        if( !this->monitors ) {
    486                 // LIB_DEBUG_PRINT_SAFE("Branding\n");
     461                LIB_DEBUG_PRINT_SAFE("Branding\n");
    487462                assertf( thrd->current_monitors != NULL, "No current monitor to brand condition", thrd->current_monitors );
    488463                this->monitor_count = thrd->current_monitor_count;
  • src/libcfa/concurrency/preemption.c

    rb826e6b rfea3faa  
    1515//
    1616
    17 #include "libhdr.h"
    1817#include "preemption.h"
    1918
    2019extern "C" {
    21 #include <errno.h>
    22 #include <execinfo.h>
    23 #define __USE_GNU
    2420#include <signal.h>
    25 #undef __USE_GNU
    26 #include <stdio.h>
    27 #include <string.h>
    28 #include <unistd.h>
    2921}
    3022
     23#define __CFA_DEFAULT_PREEMPTION__ 10
    3124
    32 #ifdef __USE_STREAM__
    33 #include "fstream"
    34 #endif
    35 
    36 //TODO move to defaults
    37 #define __CFA_DEFAULT_PREEMPTION__ 10000
    38 
    39 //TODO move to defaults
    4025__attribute__((weak)) unsigned int default_preemption() {
    4126        return __CFA_DEFAULT_PREEMPTION__;
    4227}
    4328
    44 // Short hands for signal context information
    45 #define __CFA_SIGCXT__ ucontext_t *
    46 #define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
    47 
    48 // FwdDeclarations : timeout handlers
    4929static void preempt( processor   * this );
    5030static void timeout( thread_desc * this );
    51 
    52 // FwdDeclarations : Signal handlers
    53 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );
    54 void sigHandler_segv     ( __CFA_SIGPARMS__ );
    55 void sigHandler_abort    ( __CFA_SIGPARMS__ );
    56 
    57 // FwdDeclarations : sigaction wrapper
    58 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags );
    59 
    60 // FwdDeclarations : alarm thread main
    61 void * alarm_loop( __attribute__((unused)) void * args );
    62 
    63 // Machine specific register name
    64 #ifdef __x86_64__
    65 #define CFA_REG_IP REG_RIP
    66 #else
    67 #define CFA_REG_IP REG_EIP
    68 #endif
    69 
    70 KERNEL_STORAGE(event_kernel_t, event_kernel);         // private storage for event kernel
    71 event_kernel_t * event_kernel;                        // kernel public handle to even kernel
    72 static pthread_t alarm_thread;                        // pthread handle to alarm thread
    73 
    74 void ?{}(event_kernel_t * this) {
    75         (&this->alarms){};
    76         (&this->lock){};
    77 }
    7831
    7932//=============================================================================================
     
    8134//=============================================================================================
    8235
    83 // Get next expired node
    84 static inline alarm_node_t * get_expired( alarm_list_t * alarms, __cfa_time_t currtime ) {
    85         if( !alarms->head ) return NULL;                          // If no alarms return null
    86         if( alarms->head->alarm >= currtime ) return NULL;        // If alarms head not expired return null
    87         return pop(alarms);                                       // Otherwise just pop head
     36void kernel_start_preemption() {
     37
    8838}
    8939
    90 // Tick one frame of the Discrete Event Simulation for alarms
    9140void tick_preemption() {
    92         alarm_node_t * node = NULL;                     // Used in the while loop but cannot be declared in the while condition
    93         alarm_list_t * alarms = &event_kernel->alarms;  // Local copy for ease of reading
    94         __cfa_time_t currtime = __kernel_get_time();    // Check current time once so we everything "happens at once"
    95 
    96         //Loop throught every thing expired
    97         while( node = get_expired( alarms, currtime ) ) {
    98 
    99                 // Check if this is a kernel
     41        alarm_list_t * alarms = &systemProcessor->alarms;
     42        __cfa_time_t currtime = __kernel_get_time();
     43        while( alarms->head && alarms->head->alarm < currtime ) {
     44                alarm_node_t * node = pop(alarms);
    10045                if( node->kernel_alarm ) {
    10146                        preempt( node->proc );
     
    10550                }
    10651
    107                 // Check if this is a periodic alarm
    108                 __cfa_time_t period = node->period;
    109                 if( period > 0 ) {
    110                         node->alarm = currtime + period;    // Alarm is periodic, add currtime to it (used cached current time)
    111                         insert( alarms, node );             // Reinsert the node for the next time it triggers
     52                if( node->period > 0 ) {
     53                        node->alarm += node->period;
     54                        insert( alarms, node );
    11255                }
    11356                else {
    114                         node->set = false;                  // Node is one-shot, just mark it as not pending
     57                        node->set = false;
    11558                }
    11659        }
    11760
    118         // If there are still alarms pending, reset the timer
    119         if( alarms->head ) { __kernel_set_timer( alarms->head->alarm - currtime ); }
     61        if( alarms->head ) {
     62                __kernel_set_timer( alarms->head->alarm - currtime );
     63        }
    12064}
    12165
    122 // Update the preemption of a processor and notify interested parties
    12366void update_preemption( processor * this, __cfa_time_t duration ) {
     67        //     assert( THREAD_GETMEM( disableInt ) && THREAD_GETMEM( disableIntCnt ) == 1 );
    12468        alarm_node_t * alarm = this->preemption_alarm;
    12569
     
    14589}
    14690
     91void ?{}( preemption_scope * this, processor * proc ) {
     92        (&this->alarm){ proc };
     93        this->proc = proc;
     94        this->proc->preemption_alarm = &this->alarm;
     95        update_preemption( this->proc, this->proc->preemption );
     96}
     97
     98void ^?{}( preemption_scope * this ) {
     99        update_preemption( this->proc, 0 );
     100}
     101
    147102//=============================================================================================
    148 // Kernel Signal Tools
     103// Kernel Signal logic
    149104//=============================================================================================
    150105
    151 LIB_DEBUG_DO( static thread_local void * last_interrupt = 0; )
     106static inline bool preemption_ready() {
     107        return this_processor->disable_preempt_count == 0;
     108}
    152109
    153 extern "C" {
    154         // Disable interrupts by incrementing the counter
    155         void disable_interrupts() {
    156                 __attribute__((unused)) unsigned short new_val = __atomic_add_fetch_2( &disable_preempt_count, 1, __ATOMIC_SEQ_CST );
    157                 verify( new_val < 65_000u );              // If this triggers someone is disabling interrupts without enabling them
     110static inline void defer_ctxSwitch() {
     111        this_processor->pending_preemption = true;
     112}
     113
     114static inline void defer_alarm() {
     115        systemProcessor->pending_alarm = true;
     116}
     117
     118void sigHandler_ctxSwitch( __attribute__((unused)) int sig ) {
     119        if( preemption_ready() ) {
     120                ScheduleInternal( this_processor->current_thread );
    158121        }
    159 
    160         // Enable interrupts by decrementing the counter
    161         // If counter reaches 0, execute any pending CtxSwitch
    162         void enable_interrupts( DEBUG_CTX_PARAM ) {
    163                 processor * proc   = this_processor;      // Cache the processor now since interrupts can start happening after the atomic add
    164                 thread_desc * thrd = this_thread;         // Cache the thread now since interrupts can start happening after the atomic add
    165 
    166                 unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    167                 verify( prev != 0u );                     // If this triggers someone is enabled already enabled interruptsverify( prev != 0u );
    168 
    169                 // Check if we need to prempt the thread because an interrupt was missed
    170                 if( prev == 1 && proc->pending_preemption ) {
    171                         proc->pending_preemption = false;
    172                         BlockInternal( thrd );
    173                 }
    174 
    175                 // For debugging purposes : keep track of the last person to enable the interrupts
    176                 LIB_DEBUG_DO( proc->last_enable = caller; )
    177         }
    178 
    179         // Disable interrupts by incrementint the counter
    180         // Don't execute any pending CtxSwitch even if counter reaches 0
    181         void enable_interrupts_noPoll() {
    182                 __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
    183                 verify( prev != 0u );                     // If this triggers someone is enabled already enabled interrupts
     122        else {
     123                defer_ctxSwitch();
    184124        }
    185125}
    186126
    187 // sigprocmask wrapper : unblock a single signal
    188 static inline void signal_unblock( int sig ) {
    189         sigset_t mask;
    190         sigemptyset( &mask );
    191         sigaddset( &mask, sig );
    192 
    193         if ( pthread_sigmask( SIG_UNBLOCK, &mask, NULL ) == -1 ) {
    194             abortf( "internal error, pthread_sigmask" );
     127void sigHandler_alarm( __attribute__((unused)) int sig ) {
     128        if( try_lock( &systemProcessor->alarm_lock ) ) {
     129                tick_preemption();
     130                unlock( &systemProcessor->alarm_lock );
     131        }
     132        else {
     133                defer_alarm();
    195134        }
    196135}
    197136
    198 // sigprocmask wrapper : block a single signal
    199 static inline void signal_block( int sig ) {
    200         sigset_t mask;
    201         sigemptyset( &mask );
    202         sigaddset( &mask, sig );
    203 
    204         if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) {
    205             abortf( "internal error, pthread_sigmask" );
    206         }
    207 }
    208 
    209 // kill wrapper : signal a processor
    210137static void preempt( processor * this ) {
    211138        pthread_kill( this->kernel_thread, SIGUSR1 );
    212139}
    213140
    214 // reserved for future use
    215141static void timeout( thread_desc * this ) {
    216142        //TODO : implement waking threads
    217143}
    218 
    219 
    220 // Check if a CtxSwitch signal handler shoud defer
    221 // If true  : preemption is safe
    222 // If false : preemption is unsafe and marked as pending
    223 static inline bool preemption_ready() {
    224         bool ready = disable_preempt_count == 0 && !preemption_in_progress; // Check if preemption is safe
    225         this_processor->pending_preemption = !ready;                        // Adjust the pending flag accordingly
    226         return ready;
    227 }
    228 
    229 //=============================================================================================
    230 // Kernel Signal Startup/Shutdown logic
    231 //=============================================================================================
    232 
    233 // Startup routine to activate preemption
    234 // Called from kernel_startup
    235 void kernel_start_preemption() {
    236         LIB_DEBUG_PRINT_SAFE("Kernel : Starting preemption\n");
    237 
    238         // Start with preemption disabled until ready
    239         disable_preempt_count = 1;
    240 
    241         // Initialize the event kernel
    242         event_kernel = (event_kernel_t *)&storage_event_kernel;
    243         event_kernel{};
    244 
    245         // Setup proper signal handlers
    246         __kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO );         // CtxSwitch handler
    247         // __kernel_sigaction( SIGSEGV, sigHandler_segv     , SA_SIGINFO );      // Failure handler
    248         // __kernel_sigaction( SIGBUS , sigHandler_segv     , SA_SIGINFO );      // Failure handler
    249 
    250         signal_block( SIGALRM );
    251 
    252         pthread_create( &alarm_thread, NULL, alarm_loop, NULL );
    253 }
    254 
    255 // Shutdown routine to deactivate preemption
    256 // Called from kernel_shutdown
    257 void kernel_stop_preemption() {
    258         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopping\n");
    259 
    260         // Block all signals since we are already shutting down
    261         sigset_t mask;
    262         sigfillset( &mask );
    263         sigprocmask( SIG_BLOCK, &mask, NULL );
    264 
    265         // Notify the alarm thread of the shutdown
    266         sigval val = { 1 };
    267         pthread_sigqueue( alarm_thread, SIGALRM, val );
    268 
    269         // Wait for the preemption thread to finish
    270         pthread_join( alarm_thread, NULL );
    271 
    272         // Preemption is now fully stopped
    273 
    274         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopped\n");
    275 }
    276 
    277 // Raii ctor/dtor for the preemption_scope
    278 // Used by thread to control when they want to receive preemption signals
    279 void ?{}( preemption_scope * this, processor * proc ) {
    280         (&this->alarm){ proc, zero_time, zero_time };
    281         this->proc = proc;
    282         this->proc->preemption_alarm = &this->alarm;
    283 
    284         update_preemption( this->proc, from_us(this->proc->cltr->preemption) );
    285 }
    286 
    287 void ^?{}( preemption_scope * this ) {
    288         disable_interrupts();
    289 
    290         update_preemption( this->proc, zero_time );
    291 }
    292 
    293 //=============================================================================================
    294 // Kernel Signal Handlers
    295 //=============================================================================================
    296 
    297 // Context switch signal handler
    298 // Receives SIGUSR1 signal and causes the current thread to yield
    299 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
    300         LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )
    301 
    302         // Check if it is safe to preempt here
    303         if( !preemption_ready() ) { return; }
    304 
    305         preemption_in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
    306         signal_unblock( SIGUSR1 );                          // We are about to CtxSwitch out of the signal handler, let other handlers in
    307         preemption_in_progress = false;                     // Clear the in progress flag
    308 
    309         // Preemption can occur here
    310 
    311         BlockInternal( (thread_desc*)this_thread );         // Do the actual CtxSwitch
    312 }
    313 
    314 // Main of the alarm thread
    315 // Waits on SIGALRM and send SIGUSR1 to whom ever needs it
    316 void * alarm_loop( __attribute__((unused)) void * args ) {
    317         // Block sigalrms to control when they arrive
    318         sigset_t mask;
    319         sigemptyset( &mask );
    320         sigaddset( &mask, SIGALRM );
    321 
    322         if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) {
    323             abortf( "internal error, pthread_sigmask" );
    324         }
    325 
    326         // Main loop
    327         while( true ) {
    328                 // Wait for a sigalrm
    329                 siginfo_t info;
    330                 int sig = sigwaitinfo( &mask, &info );
    331 
    332                 // If another signal arrived something went wrong
    333                 assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int);
    334 
    335                 LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );
    336                 // Switch on the code (a.k.a. the sender) to
    337                 switch( info.si_code )
    338                 {
    339                 // Timers can apparently be marked as sent for the kernel
    340                 // In either case, tick preemption
    341                 case SI_TIMER:
    342                 case SI_KERNEL:
    343                         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n");
    344                         lock( &event_kernel->lock DEBUG_CTX2 );
    345                         tick_preemption();
    346                         unlock( &event_kernel->lock );
    347                         break;
    348                 // Signal was not sent by the kernel but by an other thread
    349                 case SI_QUEUE:
    350                         // For now, other thread only signal the alarm thread to shut it down
    351                         // If this needs to change use info.si_value and handle the case here
    352                         goto EXIT;
    353                 }
    354         }
    355 
    356 EXIT:
    357         LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n");
    358         return NULL;
    359 }
    360 
    361 // Sigaction wrapper : register an signal handler
    362 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
    363         struct sigaction act;
    364 
    365         act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
    366         act.sa_flags = flags;
    367 
    368         if ( sigaction( sig, &act, NULL ) == -1 ) {
    369                 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO,
    370                         " __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
    371                         sig, handler, flags, errno, strerror( errno )
    372                 );
    373                 _exit( EXIT_FAILURE );
    374         }
    375 }
    376 
    377 // Sigaction wrapper : restore default handler
    378 static void __kernel_sigdefault( int sig ) {
    379         struct sigaction act;
    380 
    381         act.sa_handler = SIG_DFL;
    382         act.sa_flags = 0;
    383         sigemptyset( &act.sa_mask );
    384 
    385         if ( sigaction( sig, &act, NULL ) == -1 ) {
    386                 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO,
    387                         " __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
    388                         sig, errno, strerror( errno )
    389                 );
    390                 _exit( EXIT_FAILURE );
    391         }
    392 }
    393 
    394 //=============================================================================================
    395 // Terminating Signals logic
    396 //=============================================================================================
    397 
    398 LIB_DEBUG_DO(
    399         static void __kernel_backtrace( int start ) {
    400                 // skip first N stack frames
    401 
    402                 enum { Frames = 50 };
    403                 void * array[Frames];
    404                 int size = backtrace( array, Frames );
    405                 char ** messages = backtrace_symbols( array, size );
    406 
    407                 // find executable name
    408                 *index( messages[0], '(' ) = '\0';
    409                 #ifdef __USE_STREAM__
    410                 serr | "Stack back trace for:" | messages[0] | endl;
    411                 #else
    412                 fprintf( stderr, "Stack back trace for: %s\n", messages[0]);
    413                 #endif
    414 
    415                 // skip last 2 stack frames after main
    416                 for ( int i = start; i < size && messages != NULL; i += 1 ) {
    417                         char * name = NULL;
    418                         char * offset_begin = NULL;
    419                         char * offset_end = NULL;
    420 
    421                         for ( char *p = messages[i]; *p; ++p ) {
    422                                 // find parantheses and +offset
    423                                 if ( *p == '(' ) {
    424                                         name = p;
    425                                 }
    426                                 else if ( *p == '+' ) {
    427                                         offset_begin = p;
    428                                 }
    429                                 else if ( *p == ')' ) {
    430                                         offset_end = p;
    431                                         break;
    432                                 }
    433                         }
    434 
    435                         // if line contains symbol print it
    436                         int frameNo = i - start;
    437                         if ( name && offset_begin && offset_end && name < offset_begin ) {
    438                                 // delimit strings
    439                                 *name++ = '\0';
    440                                 *offset_begin++ = '\0';
    441                                 *offset_end++ = '\0';
    442 
    443                                 #ifdef __USE_STREAM__
    444                                 serr    | "("  | frameNo | ")" | messages[i] | ":"
    445                                         | name | "+" | offset_begin | offset_end | endl;
    446                                 #else
    447                                 fprintf( stderr, "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
    448                                 #endif
    449                         }
    450                         // otherwise, print the whole line
    451                         else {
    452                                 #ifdef __USE_STREAM__
    453                                 serr | "(" | frameNo | ")" | messages[i] | endl;
    454                                 #else
    455                                 fprintf( stderr, "(%i) %s\n", frameNo, messages[i] );
    456                                 #endif
    457                         }
    458                 }
    459 
    460                 free( messages );
    461         }
    462 )
    463 
    464 // void sigHandler_segv( __CFA_SIGPARMS__ ) {
    465 //      LIB_DEBUG_DO(
    466 //              #ifdef __USE_STREAM__
    467 //              serr    | "*CFA runtime error* program cfa-cpp terminated with"
    468 //                      | (sig == SIGSEGV ? "segment fault." : "bus error.")
    469 //                      | endl;
    470 //              #else
    471 //              fprintf( stderr, "*CFA runtime error* program cfa-cpp terminated with %s\n", sig == SIGSEGV ? "segment fault." : "bus error." );
    472 //              #endif
    473 
    474 //              // skip first 2 stack frames
    475 //              __kernel_backtrace( 1 );
    476 //      )
    477 //      exit( EXIT_FAILURE );
    478 // }
    479 
    480 // void sigHandler_abort( __CFA_SIGPARMS__ ) {
    481 //      // skip first 6 stack frames
    482 //      LIB_DEBUG_DO( __kernel_backtrace( 6 ); )
    483 
    484 //      // reset default signal handler
    485 //      __kernel_sigdefault( SIGABRT );
    486 
    487 //      raise( SIGABRT );
    488 // }
  • src/libcfa/concurrency/thread

    rb826e6b rfea3faa  
    5454}
    5555
    56 extern volatile thread_local thread_desc * this_thread;
     56thread_desc * this_thread(void);
    5757
    5858forall( dtype T | is_thread(T) )
  • src/libcfa/concurrency/thread.c

    rb826e6b rfea3faa  
    2828}
    2929
    30 extern volatile thread_local processor * this_processor;
     30extern thread_local processor * this_processor;
    3131
    3232//-----------------------------------------------------------------------------
     
    7171        coroutine_desc* thrd_c = get_coroutine(this);
    7272        thread_desc*  thrd_h = get_thread   (this);
    73         thrd_c->last = this_coroutine;
     73        thrd_c->last = this_coroutine();
     74        this_processor->current_coroutine = thrd_c;
    7475
    75         // LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
     76        LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
    7677
    77         disable_interrupts();
    7878        create_stack(&thrd_c->stack, thrd_c->stack.size);
    79         this_coroutine = thrd_c;
    8079        CtxStart(this, CtxInvokeThread);
    81         assert( thrd_c->last->stack.context );
    8280        CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
    8381
    8482        ScheduleThread(thrd_h);
    85         enable_interrupts( DEBUG_CTX );
    8683}
    8784
    8885void yield( void ) {
    89         BlockInternal( (thread_desc *)this_thread );
     86        ScheduleInternal( this_processor->current_thread );
    9087}
    9188
     
    9895void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    9996        // set state of current coroutine to inactive
    100         src->state = src->state == Halted ? Halted : Inactive;
     97        src->state = Inactive;
    10198        dst->state = Active;
    10299
     
    106103        // set new coroutine that the processor is executing
    107104        // and context switch to it
    108         this_coroutine = dst;
    109         assert( src->stack.context );
     105        this_processor->current_coroutine = dst;
    110106        CtxSwitch( src->stack.context, dst->stack.context );
    111         this_coroutine = src;
     107        this_processor->current_coroutine = src;
    112108
    113109        // set state of new coroutine to active
    114         dst->state = dst->state == Halted ? Halted : Inactive;
     110        dst->state = Inactive;
    115111        src->state = Active;
    116112}
  • src/libcfa/fstream

    rb826e6b rfea3faa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 08:32:38 2017
    13 // Update Count     : 117
     12// Last Modified On : Mon May 15 18:11:09 2017
     13// Update Count     : 104
    1414//
    1515
    16 #pragma once
     16#ifndef __FSTREAM_H__
     17#define __FSTREAM_H__
    1718
    1819#include "iostream"
    1920
    20 enum { sepSize = 16 };
     21enum { separateSize = 16 };
    2122struct ofstream {
    2223        void * file;
    2324        _Bool sepDefault;
    2425        _Bool sepOnOff;
    25         _Bool sawNL;
    2626        const char * sepCur;
    27         char separator[sepSize];
    28         char tupleSeparator[sepSize];
     27        char separator[separateSize];
     28        char tupleSeparator[separateSize];
    2929}; // ofstream
    3030
     
    3535const char * sepGetCur( ofstream * );
    3636void sepSetCur( ofstream *, const char * );
    37 _Bool getNL( ofstream * );
    38 void setNL( ofstream *, _Bool );
    3937
    4038// public
     
    7573extern ifstream * sin;
    7674
     75#endif // __FSTREAM_H__
     76
    7777// Local Variables: //
    7878// mode: c //
  • src/libcfa/fstream.c

    rb826e6b rfea3faa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul  6 18:38:25 2017
    13 // Update Count     : 251
     12// Last Modified On : Mon May 15 18:11:11 2017
     13// Update Count     : 234
    1414//
    1515
     
    3939
    4040// private
    41 _Bool sepPrt( ofstream * os ) { setNL( os, false ); return os->sepOnOff; }
     41_Bool sepPrt( ofstream * os ) { return os->sepOnOff; }
    4242void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
    4343void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
    4444const char * sepGetCur( ofstream * os ) { return os->sepCur; }
    4545void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; }
    46 _Bool getNL( ofstream * os ) { return os->sawNL; }
    47 void setNL( ofstream * os, _Bool state ) { os->sawNL = state; }
    4846
    4947// public
    50 void sepOn( ofstream * os ) { os->sepOnOff = ! getNL( os ); }
    51 void sepOff( ofstream * os ) { os->sepOnOff = false; }
     48void sepOn( ofstream * os ) { os->sepOnOff = 1; }
     49void sepOff( ofstream * os ) { os->sepOnOff = 0; }
    5250
    5351_Bool sepDisable( ofstream *os ) {
     
    6866void sepSet( ofstream * os, const char * s ) {
    6967        assert( s );
    70         strncpy( os->separator, s, sepSize - 1 );
    71         os->separator[sepSize - 1] = '\0';
     68        strncpy( os->separator, s, separateSize - 1 );
     69        os->separator[separateSize - 1] = '\0';
    7270} // sepSet
    7371
     
    7573void sepSetTuple( ofstream * os, const char * s ) {
    7674        assert( s );
    77         strncpy( os->tupleSeparator, s, sepSize - 1 );
    78         os->tupleSeparator[sepSize - 1] = '\0';
     75        strncpy( os->tupleSeparator, s, separateSize - 1 );
     76        os->tupleSeparator[separateSize - 1] = '\0';
    7977} // sepSet
    8078
     
    9492                exit( EXIT_FAILURE );
    9593        } // if
    96         ?{}( os, file, true, false, " ", ", " );
     94        ?{}( os, file, 1, 0, " ", ", " );
    9795} // open
    9896
     
    134132} // fmt
    135133
    136 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };
     134static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " };
    137135ofstream *sout = &soutFile;
    138 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };
     136static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " };
    139137ofstream *serr = &serrFile;
    140138
     
    152150
    153151void open( ifstream * is, const char * name, const char * mode ) {
    154         FILE *file = fopen( name, mode );
    155         if ( file == 0 ) {                                                                      // do not change unless successful
     152        FILE *t = fopen( name, mode );
     153        if ( t == 0 ) {                                                                         // do not change unless successful
    156154                fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
    157155                perror( 0 );
    158156                exit( EXIT_FAILURE );
    159157        } // if
    160         is->file = file;
     158        is->file = t;
    161159} // open
    162160
  • src/libcfa/gmp

    rb826e6b rfea3faa  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 09:33:20 2017
    13 // Update Count     : 15
     12// Last Modified On : Sat May 27 09:55:51 2017
     13// Update Count     : 14
    1414//
    1515
    1616// https://gmplib.org/gmp-man-6.1.1.pdf
    17 
    18 #pragma once
    1917
    2018#include <gmp.h>                                                                                // GNU multi-precise integers
  • src/libcfa/iostream

    rb826e6b rfea3faa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 08:35:59 2017
    13 // Update Count     : 118
     12// Last Modified On : Mon May 15 18:08:44 2017
     13// Update Count     : 105
    1414//
    1515
    16 #pragma once
     16#ifndef __IOSTREAM_H__
     17#define __IOSTREAM_H__
    1718
    1819#include "iterator"
     
    2526        const char * sepGetCur( ostype * );                                     // get current separator string
    2627        void sepSetCur( ostype *, const char * );                       // set current separator string
    27         _Bool getNL( ostype * );                                                        // check newline
    28         void setNL( ostype *, _Bool );                                          // saw newline
    2928        // public
    3029        void sepOn( ostype * );                                                         // turn separator state on
     
    4443        ostype * write( ostype *, const char *, unsigned long int );
    4544        int fmt( ostype *, const char fmt[], ... );
    46 }; // ostream
     45};
    4746
    4847trait writeable( otype T ) {
    4948        forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, T );
    50 }; // writeable
     49};
    5150
    5251// implement writable for intrinsic types
     
    8281forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, ostype * (*)( ostype * ) );
    8382forall( dtype ostype | ostream( ostype ) ) ostype * endl( ostype * );
    84 forall( dtype ostype | ostream( ostype ) ) ostype * sep( ostype * );
    85 forall( dtype ostype | ostream( ostype ) ) ostype * sepTuple( ostype * );
    8683forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
    8784forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * );
     
    106103        istype * ungetc( istype *, char );
    107104        int fmt( istype *, const char fmt[], ... );
    108 }; // istream
     105};
    109106
    110107trait readable( otype T ) {
    111108        forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, T );
    112 }; // readable
     109};
    113110
    114111forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, char * );
     
    139136forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrC );
    140137
     138#endif // __IOSTREAM_H
     139
    141140// Local Variables: //
    142141// mode: c //
  • src/libcfa/iostream.c

    rb826e6b rfea3faa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 16 21:12:03 2017
    13 // Update Count     : 398
     12// Last Modified On : Mon May  8 18:24:23 2017
     13// Update Count     : 369
    1414//
    1515
     
    1818extern "C" {
    1919#include <stdio.h>
    20 #include <stdbool.h>                                                                    // true/false
    2120#include <string.h>                                                                             // strlen
    2221#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
     
    2524
    2625forall( dtype ostype | ostream( ostype ) )
    27 ostype * ?|?( ostype * os, char ch ) {
    28         fmt( os, "%c", ch );
    29         if ( ch == '\n' ) setNL( os, true );
     26ostype * ?|?( ostype * os, char c ) {
     27        fmt( os, "%c", c );
    3028        sepOff( os );
    3129        return os;
     
    125123forall( dtype ostype | ostream( ostype ) )
    126124ostype * ?|?( ostype * os, float _Complex fc ) {
    127         if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    128         fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) );
     125        os | crealf( fc );
     126        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     127        if ( cimagf( fc ) >= 0 ) os | '+';                                      // negative value prints '-'
     128        os | cimagf( fc ) | 'i';
     129        sepReset( os, temp );                                                           // reset separator
    129130        return os;
    130131} // ?|?
     
    132133forall( dtype ostype | ostream( ostype ) )
    133134ostype * ?|?( ostype * os, double _Complex dc ) {
    134         if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    135         fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) );
     135        os | creal( dc );
     136        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     137        if ( cimag( dc ) >= 0 ) os | '+';                                       // negative value prints '-'
     138        os | cimag( dc ) | 'i';
     139        sepReset( os, temp );                                                           // reset separator
    136140        return os;
    137141} // ?|?
     
    139143forall( dtype ostype | ostream( ostype ) )
    140144ostype * ?|?( ostype * os, long double _Complex ldc ) {
    141         if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    142         fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
     145        os | creall( ldc );
     146        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     147        if ( cimagl( ldc ) >= 0 ) os | '+';                                     // negative value prints '-'
     148        os | cimagl( ldc ) | 'i';
     149        sepReset( os, temp );                                                           // reset separator
    143150        return os;
    144151} // ?|?
     
    173180
    174181        // last character IS spacing or opening punctuation => turn off separator for next item
    175         size_t len = strlen( cp );
    176         ch = cp[len - 1];                                                                       // must make unsigned
     182        unsigned int len = strlen( cp ), posn = len - 1;
     183        ch = cp[posn];                                                                          // must make unsigned
    177184        if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
    178185                sepOn( os );
     
    180187                sepOff( os );
    181188        } // if
    182         if ( ch == '\n' ) setNL( os, true );                            // check *AFTER* sepPrt call above as it resets NL flag
    183189        return write( os, cp, len );
    184190} // ?|?
     
    195201forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
    196202ostype * ?|?( ostype * os, T arg, Params rest ) {
     203        sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    197204        os | arg;                                                                                       // print first argument
    198         sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    199205        os | rest;                                                                                      // print remaining arguments
    200206        sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
     
    210216
    211217forall( dtype ostype | ostream( ostype ) )
    212 ostype * sep( ostype * os ) {
    213         os | sepGet( os );
    214         return os;
    215 } // sep
    216 
    217 forall( dtype ostype | ostream( ostype ) )
    218 ostype * sepTuple( ostype * os ) {
    219         os | sepGetTuple( os );
    220         return os;
    221 } // sepTuple
    222 
    223 forall( dtype ostype | ostream( ostype ) )
    224218ostype * endl( ostype * os ) {
    225219        os | '\n';
    226         setNL( os, true );
    227220        flush( os );
    228221        sepOff( os );                                                                           // prepare for next line
  • src/libcfa/iterator

    rb826e6b rfea3faa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 08:37:25 2017
    13 // Update Count     : 10
     12// Last Modified On : Wed Mar  2 18:06:05 2016
     13// Update Count     : 9
    1414//
    1515
    16 #pragma once
     16#ifndef ITERATOR_H
     17#define ITERATOR_H
    1718
    1819// An iterator can be used to traverse a data structure.
     
    3839
    3940forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    40 void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
     41void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
    4142
    4243forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    43 void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
     44void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
     45
     46#endif // ITERATOR_H
    4447
    4548// Local Variables: //
  • src/libcfa/iterator.c

    rb826e6b rfea3faa  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 08:38:23 2017
    13 // Update Count     : 28
     12// Last Modified On : Wed Mar  2 18:08:11 2016
     13// Update Count     : 27
    1414//
    1515
     
    1717
    1818forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    19 void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) {
     19void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) ) {
    2020        for ( iterator_type i = begin; i != end; ++i ) {
    2121                func( *i );
    22         } // for
    23 } // for_each
     22        }
     23}
    2424
    2525forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
    26 void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) {
     26void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) ) {
    2727        for ( iterator_type i = end; i != begin; ) {
    2828                --i;
    2929                func( *i );
    30         } // for
    31 } // for_each_reverse
     30        }
     31}
    3232
    3333// Local Variables: //
  • src/libcfa/libhdr/libalign.h

    rb826e6b rfea3faa  
    1 //                              -*- Mode: C++ -*-
     1//                              -*- Mode: C++ -*- 
    22//
    33// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    1818// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
    1919// option) any later version.
    20 //
     20// 
    2121// This library is distributed in the  hope that it will be useful, but WITHOUT
    2222// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
    2323// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    2424// for more details.
    25 //
     25// 
    2626// You should  have received a  copy of the  GNU Lesser General  Public License
    2727// along  with this library.
    28 //
     28// 
    2929
    3030
     
    3333
    3434#include "assert"
    35 #include <stdbool.h>
    3635
    37 // Minimum size used to align memory boundaries for memory allocations.
     36// Minimum size used to align memory boundaries for memory allocations. 
    3837#define libAlign() (sizeof(double))
    3938
  • src/libcfa/libhdr/libdebug.h

    rb826e6b rfea3faa  
    1818
    1919#ifdef __CFA_DEBUG__
    20         #define LIB_DEBUG_DO(...) __VA_ARGS__
    21         #define LIB_NO_DEBUG_DO(...)
    22         #define DEBUG_CTX __PRETTY_FUNCTION__
    23         #define DEBUG_CTX2 , __PRETTY_FUNCTION__
    24         #define DEBUG_CTX_PARAM const char * caller
    25         #define DEBUG_CTX_PARAM2 , const char * caller
     20        #define LIB_DEBUG_DO(x) x
     21        #define LIB_NO_DEBUG_DO(x) ((void)0)
    2622#else
    27         #define LIB_DEBUG_DO(...)
    28         #define LIB_NO_DEBUG_DO(...) __VA_ARGS__
    29         #define DEBUG_CTX
    30         #define DEBUG_CTX2
    31         #define DEBUG_CTX_PARAM
    32         #define DEBUG_CTX_PARAM2
     23        #define LIB_DEBUG_DO(x) ((void)0)
     24        #define LIB_NO_DEBUG_DO(x) x     
    3325#endif
    3426
     
    5951
    6052#ifdef __CFA_DEBUG_PRINT__
    61         #define LIB_DEBUG_WRITE( fd, buffer, len )     __lib_debug_write( fd, buffer, len )
    62         #define LIB_DEBUG_ACQUIRE()                    __lib_debug_acquire()
    63         #define LIB_DEBUG_RELEASE()                    __lib_debug_release()
    64         #define LIB_DEBUG_PRINT_SAFE(...)              __lib_debug_print_safe   (__VA_ARGS__)
    65         #define LIB_DEBUG_PRINT_NOLOCK(...)            __lib_debug_print_nolock (__VA_ARGS__)
    66         #define LIB_DEBUG_PRINT_BUFFER(...)            __lib_debug_print_buffer (__VA_ARGS__)
    67         #define LIB_DEBUG_PRINT_BUFFER_DECL(fd, ...)   char text[256]; int len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
    68         #define LIB_DEBUG_PRINT_BUFFER_LOCAL(fd, ...)  len = snprintf( text, 256, __VA_ARGS__ ); __lib_debug_write( fd, text, len );
     53      #define LIB_DEBUG_WRITE( fd, buffer, len )  __lib_debug_write( fd, buffer, len )
     54      #define LIB_DEBUG_ACQUIRE()                 __lib_debug_acquire()
     55      #define LIB_DEBUG_RELEASE()                 __lib_debug_release()
     56      #define LIB_DEBUG_PRINT_SAFE(...)           __lib_debug_print_safe   (__VA_ARGS__)
     57      #define LIB_DEBUG_PRINT_NOLOCK(...)         __lib_debug_print_nolock (__VA_ARGS__)
     58      #define LIB_DEBUG_PRINT_BUFFER(...)         __lib_debug_print_buffer (__VA_ARGS__)
    6959#else
    70         #define LIB_DEBUG_WRITE(...)               ((void)0)
    71         #define LIB_DEBUG_ACQUIRE()                ((void)0)
    72         #define LIB_DEBUG_RELEASE()                ((void)0)
    73         #define LIB_DEBUG_PRINT_SAFE(...)          ((void)0)
    74         #define LIB_DEBUG_PRINT_NOLOCK(...)        ((void)0)
    75         #define LIB_DEBUG_PRINT_BUFFER(...)        ((void)0)
    76         #define LIB_DEBUG_PRINT_BUFFER_DECL(...)   ((void)0)
    77         #define LIB_DEBUG_PRINT_BUFFER_LOCAL(...)  ((void)0)
     60      #define LIB_DEBUG_WRITE(...)          ((void)0)
     61      #define LIB_DEBUG_ACQUIRE()           ((void)0)
     62      #define LIB_DEBUG_RELEASE()           ((void)0)
     63      #define LIB_DEBUG_PRINT_SAFE(...)     ((void)0)
     64      #define LIB_DEBUG_PRINT_NOLOCK(...)   ((void)0)
     65      #define LIB_DEBUG_PRINT_BUFFER(...)   ((void)0)
    7866#endif
    7967
  • src/libcfa/limits

    rb826e6b rfea3faa  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 09:33:57 2017
    13 // Update Count     : 7
     12// Last Modified On : Wed Apr  6 21:08:16 2016
     13// Update Count     : 6
    1414//
    1515
    16 #pragma once
     16#ifndef LIMITS_H
     17#define LIMITS_H
    1718
    1819// Integral Constants
     
    109110extern const long _Complex _1_SQRT_2;                                   // 1 / sqrt(2)
    110111
     112#endif // LIMITS_H
     113
    111114// Local Variables: //
    112115// mode: c //
  • src/libcfa/math

    rb826e6b rfea3faa  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 09:34:15 2017
    13 // Update Count     : 61
    14 //
    15 
    16 #pragma once
     12// Last Modified On : Wed May 24 17:40:39 2017
     13// Update Count     : 60
     14//
     15
     16#ifndef MATH_H
     17#define MATH_H
    1718
    1819extern "C" {
     
    344345long double scalbln( long double, long int );
    345346
     347#endif // MATH_H
     348
    346349// Local Variables: //
    347350// mode: c //
  • src/libcfa/rational

    rb826e6b rfea3faa  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Fri Jul  7 09:34:33 2017
    15 // Update Count     : 93
     14// Last Modified On : Mon May 15 21:30:12 2017
     15// Update Count     : 90
    1616//
    1717
    18 #pragma once
     18#ifndef RATIONAL_H
     19#define RATIONAL_H
    1920
    2021#include "iostream"
     
    4647// implementation
    4748
    48 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     49forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    4950struct Rational {
    5051        RationalImpl numerator, denominator;                            // invariant: denominator > 0
     
    5354// constructors
    5455
    55 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     56forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    5657void ?{}( Rational(RationalImpl) * r );
    5758
    58 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     59forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    5960void ?{}( Rational(RationalImpl) * r, RationalImpl n );
    6061
    61 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     62forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    6263void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d );
    6364
    64 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     65forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    6566void ?{}( Rational(RationalImpl) * r, zero_t );
    6667
    67 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     68forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    6869void ?{}( Rational(RationalImpl) * r, one_t );
    6970
    70 // numerator/denominator getter
     71// getter for numerator/denominator
    7172
    72 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     73forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    7374RationalImpl numerator( Rational(RationalImpl) r );
    7475
    75 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     76forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    7677RationalImpl denominator( Rational(RationalImpl) r );
    77 
    78 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     78forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    7979[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src );
    8080
    81 // numerator/denominator setter
     81// setter for numerator/denominator
    8282
    83 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     83forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    8484RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n );
    8585
    86 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     86forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    8787RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d );
    8888
    8989// comparison
    9090
    91 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     91forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    9292int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9393
    94 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     94forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    9595int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9696
    97 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     97forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    9898int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    9999
    100 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     100forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    101101int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    102102
    103 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     103forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    104104int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    105105
    106 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     106forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    107107int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    108108
    109109// arithmetic
    110110
    111 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     111forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    112112Rational(RationalImpl) +?( Rational(RationalImpl) r );
    113113
    114 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     114forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    115115Rational(RationalImpl) -?( Rational(RationalImpl) r );
    116116
    117 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     117forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    118118Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    119119
    120 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     120forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    121121Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    122122
    123 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     123forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    124124Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    125125
    126 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     126forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    127127Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r );
    128128
    129129// conversion
    130 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
     130forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
    131131double widen( Rational(RationalImpl) r );
    132 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
     132forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
    133133Rational(RationalImpl) narrow( double f, RationalImpl md );
    134134
    135135// I/O
    136 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     136forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    137137forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
    138138istype * ?|?( istype *, Rational(RationalImpl) * );
    139139
    140 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     140forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    141141forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
    142142ostype * ?|?( ostype *, Rational(RationalImpl ) );
     143
     144#endif // RATIONAL_H
    143145
    144146// Local Variables: //
  • src/libcfa/rational.c

    rb826e6b rfea3faa  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 16 18:35:36 2017
    13 // Update Count     : 150
     12// Last Modified On : Mon May 15 21:29:23 2017
     13// Update Count     : 149
    1414//
    1515
     
    2222// Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals.
    2323// alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm
    24 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     24forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    2525static RationalImpl gcd( RationalImpl a, RationalImpl b ) {
    2626        for ( ;; ) {                                                                            // Euclid's algorithm
     
    3333} // gcd
    3434
    35 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     35forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    3636static RationalImpl simplify( RationalImpl * n, RationalImpl * d ) {
    3737        if ( *d == (RationalImpl){0} ) {
     
    4646// constructors
    4747
    48 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     48forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    4949void ?{}( Rational(RationalImpl) * r ) {
    5050        r{ (RationalImpl){0}, (RationalImpl){1} };
    5151} // rational
    5252
    53 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     53forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    5454void ?{}( Rational(RationalImpl) * r, RationalImpl n ) {
    5555        r{ n, (RationalImpl){1} };
    5656} // rational
    5757
    58 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     58forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    5959void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ) {
    6060        RationalImpl t = simplify( &n, &d );                            // simplify
     
    6666// getter for numerator/denominator
    6767
    68 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     68forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    6969RationalImpl numerator( Rational(RationalImpl) r ) {
    7070        return r.numerator;
    7171} // numerator
    7272
    73 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     73forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    7474RationalImpl denominator( Rational(RationalImpl) r ) {
    7575        return r.denominator;
    7676} // denominator
    7777
    78 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     78forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    7979[ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ) {
    8080        return *dest = src.[ numerator, denominator ];
     
    8383// setter for numerator/denominator
    8484
    85 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     85forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    8686RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ) {
    8787        RationalImpl prev = r.numerator;
     
    9292} // numerator
    9393
    94 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     94forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    9595RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ) {
    9696        RationalImpl prev = r.denominator;
     
    104104// comparison
    105105
    106 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     106forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    107107int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    108108        return l.numerator * r.denominator == l.denominator * r.numerator;
    109109} // ?==?
    110110
    111 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     111forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    112112int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    113113        return ! ( l == r );
    114114} // ?!=?
    115115
    116 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     116forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    117117int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    118118        return l.numerator * r.denominator < l.denominator * r.numerator;
    119119} // ?<?
    120120
    121 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     121forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    122122int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    123123        return l.numerator * r.denominator <= l.denominator * r.numerator;
    124124} // ?<=?
    125125
    126 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     126forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    127127int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    128128        return ! ( l <= r );
    129129} // ?>?
    130130
    131 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     131forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    132132int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    133133        return ! ( l < r );
     
    137137// arithmetic
    138138
    139 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     139forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    140140Rational(RationalImpl) +?( Rational(RationalImpl) r ) {
    141141        Rational(RationalImpl) t = { r.numerator, r.denominator };
     
    143143} // +?
    144144
    145 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     145forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    146146Rational(RationalImpl) -?( Rational(RationalImpl) r ) {
    147147        Rational(RationalImpl) t = { -r.numerator, r.denominator };
     
    149149} // -?
    150150
    151 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     151forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    152152Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    153153        if ( l.denominator == r.denominator ) {                         // special case
     
    160160} // ?+?
    161161
    162 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     162forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    163163Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    164164        if ( l.denominator == r.denominator ) {                         // special case
     
    171171} // ?-?
    172172
    173 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     173forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    174174Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    175175        Rational(RationalImpl) t = { l.numerator * r.numerator, l.denominator * r.denominator };
     
    177177} // ?*?
    178178
    179 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     179forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    180180Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ) {
    181181        if ( r.numerator < (RationalImpl){0} ) {
     
    190190// conversion
    191191
    192 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
     192forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
    193193double widen( Rational(RationalImpl) r ) {
    194194        return convert( r.numerator ) / convert( r.denominator );
     
    196196
    197197// http://www.ics.uci.edu/~eppstein/numth/frap.c
    198 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); RationalImpl convert( double ); } )
     198forall ( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); RationalImpl convert( double ); } )
    199199Rational(RationalImpl) narrow( double f, RationalImpl md ) {
    200200        if ( md <= (RationalImpl){1} ) {                                        // maximum fractional digits too small?
     
    227227// I/O
    228228
    229 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     229forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    230230forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } )
    231231istype * ?|?( istype * is, Rational(RationalImpl) * r ) {
     
    238238} // ?|?
    239239
    240 forall( otype RationalImpl | arithmetic( RationalImpl ) )
     240forall ( otype RationalImpl | arithmetic( RationalImpl ) )
    241241forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } )
    242242ostype * ?|?( ostype * os, Rational(RationalImpl ) r ) {
  • src/libcfa/stdlib

    rb826e6b rfea3faa  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul  7 09:34:49 2017
    13 // Update Count     : 219
    14 //
    15 
    16 #pragma once
     12// Last Modified On : Fri Jun  2 15:51:03 2017
     13// Update Count     : 218
     14//
     15
     16#ifndef STDLIB_H
     17#define STDLIB_H
    1718
    1819//---------------------------------------
     
    231232void swap( T * t1, T * t2 );
    232233
     234#endif // STDLIB_H
     235
    233236// Local Variables: //
    234237// mode: c //
  • src/main.cc

    rb826e6b rfea3faa  
    1111// Created On       : Fri May 15 23:12:02 2015
    1212// Last Modified By : Andrew Beach
    13 // Last Modified On : Fri Jul  7 11:13:00 2017
    14 // Update Count     : 442
     13// Last Modified On : Wed May 10 14:45:00 2017
     14// Update Count     : 437
    1515//
    1616
    17 #include <cassert>                          // for assertf
    18 #include <cxxabi.h>                         // for __cxa_demangle
    19 #include <execinfo.h>                       // for backtrace, backtrace_symbols
    20 #include <getopt.h>                         // for no_argument, optind, geto...
    21 #include <signal.h>                         // for signal, SIGABRT, SIGSEGV
    22 #include <cstdio>                           // for fopen, FILE, fclose, stdin
    23 #include <cstdlib>                          // for exit, free, abort, EXIT_F...
    24 #include <cstring>                          // for index
    25 #include <fstream>                          // for ofstream
    26 #include <iostream>                         // for operator<<, basic_ostream
    27 #include <iterator>                         // for back_inserter
    28 #include <list>                             // for list
    29 #include <string>                           // for operator<<, allocator
    30 
    31 #include "../config.h"                      // for CFA_LIBDIR
    32 #include "CodeGen/FixMain.h"                // for FixMain
    33 #include "CodeGen/FixNames.h"               // for fixNames
    34 #include "CodeGen/Generate.h"               // for generate
    35 #include "CodeTools/DeclStats.h"            // for printDeclStats
    36 #include "CodeTools/TrackLoc.h"             // for fillLocations
    37 #include "Common/CompilerError.h"           // for CompilerError
    38 #include "Common/SemanticError.h"           // for SemanticError
    39 #include "Common/UnimplementedError.h"      // for UnimplementedError
    40 #include "Common/utility.h"                 // for deleteAll, filter, printAll
    41 #include "ControlStruct/ExceptTranslate.h"  // for translateEHM
    42 #include "ControlStruct/Mutate.h"           // for mutate
    43 #include "GenPoly/Box.h"                    // for box
    44 #include "GenPoly/CopyParams.h"             // for copyParams
    45 #include "GenPoly/InstantiateGeneric.h"     // for instantiateGeneric
    46 #include "GenPoly/Lvalue.h"                 // for convertLvalue
    47 #include "GenPoly/Specialize.h"             // for convertSpecializations
    48 #include "InitTweak/FixInit.h"              // for fix
    49 #include "InitTweak/GenInit.h"              // for genInit
    50 #include "MakeLibCfa.h"                     // for makeLibCfa
    51 #include "Parser/LinkageSpec.h"             // for Spec, Cforall, Intrinsic
    52 #include "Parser/ParseNode.h"               // for DeclarationNode, buildList
    53 #include "Parser/TypedefTable.h"            // for TypedefTable
    54 #include "ResolvExpr/AlternativePrinter.h"  // for AlternativePrinter
    55 #include "ResolvExpr/Resolver.h"            // for resolve
    56 #include "SymTab/Validate.h"                // for validate
    57 #include "SynTree/Declaration.h"            // for Declaration
    58 #include "SynTree/Visitor.h"                // for acceptAll
    59 #include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
     17#include <iostream>
     18#include <fstream>
     19#include <signal.h>                                                                             // signal
     20#include <getopt.h>                                                                             // getopt
     21#include <execinfo.h>                                                                   // backtrace, backtrace_symbols
     22#include <cxxabi.h>                                                                             // __cxa_demangle
     23#include <cstring>                                                                              // index
     24
     25using namespace std;
     26
     27#include "Parser/lex.h"
     28#include "Parser/parser.h"
     29#include "Parser/TypedefTable.h"
     30#include "GenPoly/Lvalue.h"
     31#include "GenPoly/Specialize.h"
     32#include "GenPoly/Box.h"
     33#include "GenPoly/CopyParams.h"
     34#include "GenPoly/InstantiateGeneric.h"
     35#include "Concurrency/Keywords.h"
     36#include "CodeGen/Generate.h"
     37#include "CodeGen/FixNames.h"
     38#include "CodeGen/FixMain.h"
     39#include "CodeTools/DeclStats.h"
     40#include "CodeTools/TrackLoc.h"
     41#include "ControlStruct/Mutate.h"
     42#include "SymTab/Validate.h"
     43#include "ResolvExpr/AlternativePrinter.h"
     44#include "ResolvExpr/Resolver.h"
     45#include "MakeLibCfa.h"
     46#include "InitTweak/GenInit.h"
     47#include "InitTweak/FixInit.h"
     48#include "Common/UnimplementedError.h"
     49#include "../config.h"
     50#include "Tuples/Tuples.h"
    6051
    6152using namespace std;
     
    195186                if ( ! nopreludep ) {                                                   // include gcc builtins
    196187                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
     188                        // Read to cfa builtins, if not generating the cfa library
     189                        FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     190                        assertf( builtins, "cannot open builtins.cf\n" );
     191                        parse( builtins, LinkageSpec::Compiler );
    197192
    198193                        // Read to gcc builtins, if not generating the cfa library
     
    211206                                assertf( prelude, "cannot open prelude.cf\n" );
    212207                                parse( prelude, LinkageSpec::Intrinsic );
    213 
    214                                 // Read to cfa builtins, if not generating the cfa library
    215                                 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
    216                                 assertf( builtins, "cannot open builtins.cf\n" );
    217                                 parse( builtins, LinkageSpec::BuiltinCFA );
    218208                        } // if
    219209                } // if
     
    299289                OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    300290                Tuples::expandUniqueExpr( translationUnit );
    301 
    302                 OPTPRINT( "translateEHM" );
    303                 ControlStruct::translateEHM( translationUnit );
    304291
    305292                OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
     
    494481                        break;
    495482                  case '?':
    496                         if ( optopt ) {                                                         // short option ?
    497                                 assertf( false, "Unknown option: -%c\n", (char)optopt );
    498                         } else {
    499                                 assertf( false, "Unknown option: %s\n", argv[optind - 1] );
    500                         } // if
     483                        assertf( false, "Unknown option: '%c'\n", (char)optopt );
    501484                  default:
    502485                        abort();
  • src/prelude/Makefile.am

    rb826e6b rfea3faa  
    2323noinst_DATA = ../libcfa/libcfa-prelude.c
    2424
    25 CC = ${abs_top_srcdir}/src/driver/cfa
    26 
    27 $(DEPDIR) :
    28         mkdir $(DEPDIR)
    29 
    30 $(DEPDIR)/builtins.Po : $(DEPDIR)
    31         touch ${@}
    32 
    3325# create extra forward types/declarations to reduce inclusion of library files
    3426extras.cf : extras.regx extras.c
     
    4739
    4840# create forward declarations for cfa builtins
    49 builtins.cf : builtins.c ${CC}
    50         ${AM_V_GEN}${CC} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
    51         ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
    52 
    53 include $(DEPDIR)/builtins.Po
     41builtins.cf : builtins.c
     42        ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@}
    5443
    5544../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     
    5948        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    6049
    61 maintainer-clean-local :
    62         rm -rf $(DEPDIR)
    63 
    6450MAINTAINERCLEANFILES = gcc-builtins.c gcc-builtins.cf builtins.cf extras.cf bootloader.c ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • src/prelude/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1920
    2021VPATH = @srcdir@
    21 am__is_gnu_make = { \
    22   if test -z '$(MAKELEVEL)'; then \
    23     false; \
    24   elif test -n '$(MAKE_HOST)'; then \
    25     true; \
    26   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    27     true; \
    28   else \
    29     false; \
    30   fi; \
    31 }
    32 am__make_running_with_option = \
    33   case $${target_option-} in \
    34       ?) ;; \
    35       *) echo "am__make_running_with_option: internal error: invalid" \
    36               "target option '$${target_option-}' specified" >&2; \
    37          exit 1;; \
    38   esac; \
    39   has_opt=no; \
    40   sane_makeflags=$$MAKEFLAGS; \
    41   if $(am__is_gnu_make); then \
    42     sane_makeflags=$$MFLAGS; \
    43   else \
    44     case $$MAKEFLAGS in \
    45       *\\[\ \   ]*) \
    46         bs=\\; \
    47         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    48           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    49     esac; \
    50   fi; \
    51   skip_next=no; \
    52   strip_trailopt () \
    53   { \
    54     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    55   }; \
    56   for flg in $$sane_makeflags; do \
    57     test $$skip_next = yes && { skip_next=no; continue; }; \
    58     case $$flg in \
    59       *=*|--*) continue;; \
    60         -*I) strip_trailopt 'I'; skip_next=yes;; \
    61       -*I?*) strip_trailopt 'I';; \
    62         -*O) strip_trailopt 'O'; skip_next=yes;; \
    63       -*O?*) strip_trailopt 'O';; \
    64         -*l) strip_trailopt 'l'; skip_next=yes;; \
    65       -*l?*) strip_trailopt 'l';; \
    66       -[dEDm]) skip_next=yes;; \
    67       -[JT]) skip_next=yes;; \
    68     esac; \
    69     case $$flg in \
    70       *$$target_option*) has_opt=yes; break;; \
    71     esac; \
    72   done; \
    73   test $$has_opt = yes
    74 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    75 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7622pkgdatadir = $(datadir)/@PACKAGE@
    7723pkgincludedir = $(includedir)/@PACKAGE@
     
    9339host_triplet = @host@
    9440subdir = src/prelude
     41DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    9542ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    9643am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    9744am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9845        $(ACLOCAL_M4)
    99 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    10046mkinstalldirs = $(install_sh) -d
    10147CONFIG_HEADER = $(top_builddir)/config.h
    10248CONFIG_CLEAN_FILES =
    10349CONFIG_CLEAN_VPATH_FILES =
    104 AM_V_P = $(am__v_P_@AM_V@)
    105 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    106 am__v_P_0 = false
    107 am__v_P_1 = :
    10850AM_V_GEN = $(am__v_GEN_@AM_V@)
    10951am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    110 am__v_GEN_0 = @echo "  GEN     " $@;
    111 am__v_GEN_1 =
     52am__v_GEN_0 = @echo "  GEN   " $@;
    11253AM_V_at = $(am__v_at_@AM_V@)
    11354am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    11455am__v_at_0 = @
    115 am__v_at_1 =
    11656SOURCES =
    11757DIST_SOURCES =
    118 am__can_run_installinfo = \
    119   case $$AM_UPDATE_INFO_DIR in \
    120     n|no|NO) false;; \
    121     *) (install-info --version) >/dev/null 2>&1;; \
    122   esac
    12358am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
    12459am__vpath_adj = case $$p in \
     
    15085am__installdirs = "$(DESTDIR)$(cfalibdir)"
    15186DATA = $(cfalib_DATA) $(noinst_DATA)
    152 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    153 am__DIST_COMMON = $(srcdir)/Makefile.in
    15487DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    15588ACLOCAL = @ACLOCAL@
     
    16295AWK = @AWK@
    16396BACKEND_CC = @BACKEND_CC@
    164 CC = ${abs_top_srcdir}/src/driver/cfa
     97CC = @CC@
    16598CCAS = @CCAS@
    16699CCASDEPMODE = @CCASDEPMODE@
     
    264197program_transform_name = @program_transform_name@
    265198psdir = @psdir@
    266 runstatedir = @runstatedir@
    267199sbindir = @sbindir@
    268200sharedstatedir = @sharedstatedir@
     
    297229        $(am__cd) $(top_srcdir) && \
    298230          $(AUTOMAKE) --foreign src/prelude/Makefile
     231.PRECIOUS: Makefile
    299232Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    300233        @case '$?' in \
     
    316249install-cfalibDATA: $(cfalib_DATA)
    317250        @$(NORMAL_INSTALL)
     251        test -z "$(cfalibdir)" || $(MKDIR_P) "$(DESTDIR)$(cfalibdir)"
    318252        @list='$(cfalib_DATA)'; test -n "$(cfalibdir)" || list=; \
    319         if test -n "$$list"; then \
    320           echo " $(MKDIR_P) '$(DESTDIR)$(cfalibdir)'"; \
    321           $(MKDIR_P) "$(DESTDIR)$(cfalibdir)" || exit 1; \
    322         fi; \
    323253        for p in $$list; do \
    324254          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
     
    335265        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
    336266        dir='$(DESTDIR)$(cfalibdir)'; $(am__uninstall_files_from_dir)
    337 tags TAGS:
    338 
    339 ctags CTAGS:
    340 
    341 cscope cscopelist:
     267tags: TAGS
     268TAGS:
     269
     270ctags: CTAGS
     271CTAGS:
    342272
    343273
     
    460390maintainer-clean: maintainer-clean-am
    461391        -rm -f Makefile
    462 maintainer-clean-am: distclean-am maintainer-clean-generic \
    463         maintainer-clean-local
     392maintainer-clean-am: distclean-am maintainer-clean-generic
    464393
    465394mostlyclean: mostlyclean-am
     
    479408.MAKE: install-am install-strip
    480409
    481 .PHONY: all all-am check check-am clean clean-generic cscopelist-am \
    482         ctags-am distclean distclean-generic distdir dvi dvi-am html \
    483         html-am info info-am install install-am install-cfalibDATA \
    484         install-data install-data-am install-dvi install-dvi-am \
    485         install-exec install-exec-am install-html install-html-am \
    486         install-info install-info-am install-man install-pdf \
    487         install-pdf-am install-ps install-ps-am install-strip \
    488         installcheck installcheck-am installdirs maintainer-clean \
    489         maintainer-clean-generic maintainer-clean-local mostlyclean \
    490         mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \
    491         uninstall-am uninstall-cfalibDATA
    492 
    493 .PRECIOUS: Makefile
    494 
    495 
    496 $(DEPDIR) :
    497         mkdir $(DEPDIR)
    498 
    499 $(DEPDIR)/builtins.Po : $(DEPDIR)
    500         touch ${@}
     410.PHONY: all all-am check check-am clean clean-generic distclean \
     411        distclean-generic distdir dvi dvi-am html html-am info info-am \
     412        install install-am install-cfalibDATA install-data \
     413        install-data-am install-dvi install-dvi-am install-exec \
     414        install-exec-am install-html install-html-am install-info \
     415        install-info-am install-man install-pdf install-pdf-am \
     416        install-ps install-ps-am install-strip installcheck \
     417        installcheck-am installdirs maintainer-clean \
     418        maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
     419        pdf-am ps ps-am uninstall uninstall-am uninstall-cfalibDATA
     420
    501421
    502422# create extra forward types/declarations to reduce inclusion of library files
     
    516436
    517437# create forward declarations for cfa builtins
    518 builtins.cf : builtins.c ${CC}
    519         ${AM_V_GEN}${CC} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po
    520         ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
    521 
    522 include $(DEPDIR)/builtins.Po
     438builtins.cf : builtins.c
     439        ${AM_V_GEN}@BACKEND_CC@ -E -P ${<} -o ${@}
    523440
    524441../libcfa/libcfa-prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
     
    527444bootloader.c : bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf ${abs_top_srcdir}/src/driver/cfa-cpp
    528445        ${AM_V_GEN}${abs_top_srcdir}/src/driver/cfa-cpp -tpmL bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    529 
    530 maintainer-clean-local :
    531         rm -rf $(DEPDIR)
    532446
    533447# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/prelude/builtins.c

    rb826e6b rfea3faa  
    11typedef unsigned long long __cfaabi_exception_type_t;
    2 
    3 #include "../libcfa/exception.h"
  • src/tests/.expect/32/math.txt

    rb826e6b rfea3faa  
    2222cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
    2323tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
    24 asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
     24asin:1.5708 1.5707963267949 1.57079632679489662 0.66624+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
    2525acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
    2626atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
  • src/tests/.expect/concurrent/sched-int-disjoint.txt

    rb826e6b rfea3faa  
    999000
    101010000
     1111000
     1212000
     1313000
     1414000
     1515000
     1616000
     1717000
     1818000
     1919000
     2020000
     2121000
     2222000
     2323000
     2424000
     2525000
     2626000
     2727000
     2828000
     2929000
     3030000
     3131000
     3232000
     3333000
     3434000
     3535000
     3636000
     3737000
     3838000
     3939000
     4040000
     4141000
     4242000
     4343000
     4444000
     4545000
     4646000
     4747000
     4848000
     4949000
     5050000
     5151000
     5252000
     5353000
     5454000
     5555000
     5656000
     5757000
     5858000
     5959000
     6060000
     6161000
     6262000
     6363000
     6464000
     6565000
     6666000
     6767000
     6868000
     6969000
     7070000
     7171000
     7272000
     7373000
     7474000
     7575000
     7676000
     7777000
     7878000
     7979000
     8080000
     8181000
     8282000
     8383000
     8484000
     8585000
     8686000
     8787000
     8888000
     8989000
     9090000
     9191000
     9292000
     9393000
     9494000
     9595000
     9696000
     9797000
     9898000
     9999000
     100100000
    11101All waiter done
  • src/tests/.expect/io.txt

    rb826e6b rfea3faa  
    44123
    55
    6 opening delimiters
    76x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10
    8 
    9 closing delimiters
    1071, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x
    11 
    12 opening/closing delimiters
    138x`1`x'2'x"3"x:4:x 5 x   6       x
    1497
     
    201510
    2116x
    22 
    23 override opening/closing delimiters
    2417x ( 1 ) x 2 , x 3 :x: 4
    25 
    26 input bacis types
    27 
    28 output basic types
    2918A
    30191 2 3 4 5 6 7 8
     
    32211.1+2.3i 1.1-2.3i 1.1-2.3i
    3322
    34 tuples
    35 1, 2, 3 4, 5, 6
    36 
    37 toggle separator
    38231.11.21.3
    39241.1+2.3i1.1-2.3i1.1-2.3i
    40 1.1+2.3i 1.1-2.3i1.1-2.3i
    41 1.1+2.3i 1.1-2.3i 1.1-2.3i
    42 1.1+2.3i1.1-2.3i 1.1-2.3i
    43 abcxyz
     25 abcxyz
    4426abcxyz
    4527
    46 change separator
    47 from " " to ", $"
    48281.1, $1.2, $1.3
    49291.1+2.3i, $1.1-2.3i, $1.1-2.3i
    5030abc, $xyz
    51 1, 2, 3, $4, 5, 6
    5231
    53 from ", $" to " "
    54 1.1 1.2 1.3
    55 1.1+2.3i 1.1-2.3i 1.1-2.3i
    56 abc xyz
    57 1, 2, 3 4, 5, 6
    58 
    59 check sepOn/sepOff
    60 1 2 3
     321, 2, 3, 4
     331, $2, $3 ", $"
     341 2 3 " "
     35 1 2 3
    613612 3
    62 1 2 3
    63 1 2 3
    64 
    65 1 2 3
    66 
    67 check enable/disable
    6837123
    69381 23
    70391 2 3
    71 123
    72 1 2 3
    73 123
    74 1 2 3
    75 
    76 1 2 3 4 5 6 " "
    77 1, 2, 3 4, 5, 6 " "
    78 1, 2, 3 4, 5, 6
    79 
     401 2 3 4 " "
     411, 2, 3, 4 ", "
     421, 2, 3, 4
    80433, 4, a, 7.2
    81443, 4, a, 7.2
    82453 4 a 7.2
    83 3 4 a 7.234a7.23 4 a 7.2
    84 3-4-a-7.2^3^4^3-4-a-7.2
     46 3 4 a 7.234a7.23 4 a 7.2
     473-4-a-7.2^3^4-3-4-a-7.2
  • src/tests/Makefile.am

    rb826e6b rfea3faa  
    2929
    3030# applies to both programs
    31 DEBUG_FLAGS =
    32 
    33 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@
    34 if !BUILD_DEBUG
    35 BUILD_FLAGS += -nodebug
    36 else
    37 if !BUILD_RELEASE
    38 BUILD_FLAGS += -debug
    39 else
    40 BUILD_FLAGS += ${DEBUG_FLAGS}
    41 endif
    42 endif
    43 
     31EXTRA_FLAGS =
     32BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS}
    4433TEST_FLAGS = $(if $(test), 2> .err/${@}.log, )
    45 AM_CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
     34CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
    4635CC = @CFA_BINDIR@/@CFA_NAME@
    4736
     
    5039
    5140fstream_test_SOURCES = fstream_test.c
    52 fstream_test_CFLAGS = $(if $(test), 2>> .err/fstream_test.log, ) ${BUILD_FLAGS}
    53 
    5441vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
    55 vector_test_CFLAGS = $(if $(test), 2>> .err/vector_test.log, ) ${BUILD_FLAGS}
    56 
    5742avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
    58 avl_test_CFLAGS = $(if $(test), 2>> .err/avl_test.log, ) ${BUILD_FLAGS}
    5943
    6044all-local :
     
    7862
    7963% : %.c @CFA_BINDIR@/@CFA_NAME@
    80         ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
     64        ${CC} ${CFLAGS} ${<} -o ${@}
    8165
    8266dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    83         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     67        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    8468
    8569dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    86         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR2 ${<} -o ${@}
     70        ${CC} ${CFLAGS} -DERR2 ${<} -o ${@}
    8771
    8872declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    89         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     73        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    9074
    9175gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    92         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     76        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    9377
    9478extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    95         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     79        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    9680
    9781attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    98         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     82        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    9983
    10084KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    101         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     85        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    10286
    10387gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
    104         ${CC} ${AM_CFLAGS} ${CFLAGS} -lgmp ${<} -o ${@}
     88        ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
    10589
    10690memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@
    107         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     91        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    10892
    10993completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    110         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     94        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
  • src/tests/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1819###############################################################################
    1920VPATH = @srcdir@
    20 am__is_gnu_make = { \
    21   if test -z '$(MAKELEVEL)'; then \
    22     false; \
    23   elif test -n '$(MAKE_HOST)'; then \
    24     true; \
    25   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    26     true; \
    27   else \
    28     false; \
    29   fi; \
    30 }
    31 am__make_running_with_option = \
    32   case $${target_option-} in \
    33       ?) ;; \
    34       *) echo "am__make_running_with_option: internal error: invalid" \
    35               "target option '$${target_option-}' specified" >&2; \
    36          exit 1;; \
    37   esac; \
    38   has_opt=no; \
    39   sane_makeflags=$$MAKEFLAGS; \
    40   if $(am__is_gnu_make); then \
    41     sane_makeflags=$$MFLAGS; \
    42   else \
    43     case $$MAKEFLAGS in \
    44       *\\[\ \   ]*) \
    45         bs=\\; \
    46         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    47           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    48     esac; \
    49   fi; \
    50   skip_next=no; \
    51   strip_trailopt () \
    52   { \
    53     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    54   }; \
    55   for flg in $$sane_makeflags; do \
    56     test $$skip_next = yes && { skip_next=no; continue; }; \
    57     case $$flg in \
    58       *=*|--*) continue;; \
    59         -*I) strip_trailopt 'I'; skip_next=yes;; \
    60       -*I?*) strip_trailopt 'I';; \
    61         -*O) strip_trailopt 'O'; skip_next=yes;; \
    62       -*O?*) strip_trailopt 'O';; \
    63         -*l) strip_trailopt 'l'; skip_next=yes;; \
    64       -*l?*) strip_trailopt 'l';; \
    65       -[dEDm]) skip_next=yes;; \
    66       -[JT]) skip_next=yes;; \
    67     esac; \
    68     case $$flg in \
    69       *$$target_option*) has_opt=yes; break;; \
    70     esac; \
    71   done; \
    72   test $$has_opt = yes
    73 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    74 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7521pkgdatadir = $(datadir)/@PACKAGE@
    7622pkgincludedir = $(includedir)/@PACKAGE@
     
    9238host_triplet = @host@
    9339@BUILD_CONCURRENCY_TRUE@am__append_1 = coroutine thread monitor
    94 @BUILD_DEBUG_FALSE@am__append_2 = -nodebug
    95 @BUILD_DEBUG_TRUE@@BUILD_RELEASE_FALSE@am__append_3 = -debug
    96 @BUILD_DEBUG_TRUE@@BUILD_RELEASE_TRUE@am__append_4 = ${DEBUG_FLAGS}
    9740EXTRA_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \
    9841        avl_test$(EXEEXT)
    9942subdir = src/tests
     43DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    10044ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    10145am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    10246am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    10347        $(ACLOCAL_M4)
    104 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    10548mkinstalldirs = $(install_sh) -d
    10649CONFIG_HEADER = $(top_builddir)/config.h
    10750CONFIG_CLEAN_FILES =
    10851CONFIG_CLEAN_VPATH_FILES =
    109 am__dirstamp = $(am__leading_dot)dirstamp
    110 am_avl_test_OBJECTS = avltree/avl_test-avl_test.$(OBJEXT) \
    111         avltree/avl_test-avl0.$(OBJEXT) \
    112         avltree/avl_test-avl1.$(OBJEXT) \
    113         avltree/avl_test-avl2.$(OBJEXT) \
    114         avltree/avl_test-avl3.$(OBJEXT) \
    115         avltree/avl_test-avl4.$(OBJEXT) \
    116         avltree/avl_test-avl-private.$(OBJEXT)
     52am_avl_test_OBJECTS = avl_test.$(OBJEXT) avl0.$(OBJEXT) avl1.$(OBJEXT) \
     53        avl2.$(OBJEXT) avl3.$(OBJEXT) avl4.$(OBJEXT) \
     54        avl-private.$(OBJEXT)
    11755avl_test_OBJECTS = $(am_avl_test_OBJECTS)
    11856avl_test_LDADD = $(LDADD)
    119 avl_test_LINK = $(CCLD) $(avl_test_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
    120         $(LDFLAGS) -o $@
    121 am_fstream_test_OBJECTS = fstream_test-fstream_test.$(OBJEXT)
     57am_fstream_test_OBJECTS = fstream_test.$(OBJEXT)
    12258fstream_test_OBJECTS = $(am_fstream_test_OBJECTS)
    12359fstream_test_LDADD = $(LDADD)
    124 fstream_test_LINK = $(CCLD) $(fstream_test_CFLAGS) $(CFLAGS) \
    125         $(AM_LDFLAGS) $(LDFLAGS) -o $@
    126 am_vector_test_OBJECTS = vector/vector_test-vector_int.$(OBJEXT) \
    127         vector/vector_test-array.$(OBJEXT) \
    128         vector/vector_test-vector_test.$(OBJEXT)
     60am_vector_test_OBJECTS = vector_int.$(OBJEXT) array.$(OBJEXT) \
     61        vector_test.$(OBJEXT)
    12962vector_test_OBJECTS = $(am_vector_test_OBJECTS)
    13063vector_test_LDADD = $(LDADD)
    131 vector_test_LINK = $(CCLD) $(vector_test_CFLAGS) $(CFLAGS) \
    132         $(AM_LDFLAGS) $(LDFLAGS) -o $@
    133 AM_V_P = $(am__v_P_@AM_V@)
    134 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    135 am__v_P_0 = false
    136 am__v_P_1 = :
    137 AM_V_GEN = $(am__v_GEN_@AM_V@)
    138 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    139 am__v_GEN_0 = @echo "  GEN     " $@;
    140 am__v_GEN_1 =
    141 AM_V_at = $(am__v_at_@AM_V@)
    142 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    143 am__v_at_0 = @
    144 am__v_at_1 =
    14564DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
    14665depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
     
    15069am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    15170am__v_lt_0 = --silent
    152 am__v_lt_1 =
    15371COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    15472        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
    15573AM_V_CC = $(am__v_CC_@AM_V@)
    15674am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
    157 am__v_CC_0 = @echo "  CC      " $@;
    158 am__v_CC_1 =
     75am__v_CC_0 = @echo "  CC    " $@;
     76AM_V_at = $(am__v_at_@AM_V@)
     77am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
     78am__v_at_0 = @
    15979CCLD = $(CC)
    16080LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    16181AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    16282am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    163 am__v_CCLD_0 = @echo "  CCLD    " $@;
    164 am__v_CCLD_1 =
     83am__v_CCLD_0 = @echo "  CCLD  " $@;
     84AM_V_GEN = $(am__v_GEN_@AM_V@)
     85am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
     86am__v_GEN_0 = @echo "  GEN   " $@;
    16587SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    16688        $(vector_test_SOURCES)
    16789DIST_SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    16890        $(vector_test_SOURCES)
    169 am__can_run_installinfo = \
    170   case $$AM_UPDATE_INFO_DIR in \
    171     n|no|NO) false;; \
    172     *) (install-info --version) >/dev/null 2>&1;; \
    173   esac
    174 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    175 # Read a list of newline-separated strings from the standard input,
    176 # and print each of them once, without duplicates.  Input order is
    177 # *not* preserved.
    178 am__uniquify_input = $(AWK) '\
    179   BEGIN { nonempty = 0; } \
    180   { items[$$0] = 1; nonempty = 1; } \
    181   END { if (nonempty) { for (i in items) print i; }; } \
    182 '
    183 # Make sure the list of sources is unique.  This is necessary because,
    184 # e.g., the same source file might be shared among _SOURCES variables
    185 # for different programs/libraries.
    186 am__define_uniq_tagged_files = \
    187   list='$(am__tagged_files)'; \
    188   unique=`for i in $$list; do \
    189     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
    190   done | $(am__uniquify_input)`
    19191ETAGS = etags
    19292CTAGS = ctags
    193 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp
    19493DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    19594ACLOCAL = @ACLOCAL@
     
    214113CFA_NAME = @CFA_NAME@
    215114CFA_PREFIX = @CFA_PREFIX@
    216 CFLAGS = @CFLAGS@
     115CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
    217116CPP = @CPP@
    218117CPPFLAGS = @CPPFLAGS@
     
    304203program_transform_name = @program_transform_name@
    305204psdir = @psdir@
    306 runstatedir = @runstatedir@
    307205sbindir = @sbindir@
    308206sharedstatedir = @sharedstatedir@
     
    323221
    324222# applies to both programs
    325 DEBUG_FLAGS =
    326 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ \
    327         $(am__append_2) $(am__append_3) $(am__append_4)
     223EXTRA_FLAGS =
     224BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS}
    328225TEST_FLAGS = $(if $(test), 2> .err/${@}.log, )
    329 AM_CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS}
    330226fstream_test_SOURCES = fstream_test.c
    331 fstream_test_CFLAGS = $(if $(test), 2>> .err/fstream_test.log, ) ${BUILD_FLAGS}
    332227vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
    333 vector_test_CFLAGS = $(if $(test), 2>> .err/vector_test.log, ) ${BUILD_FLAGS}
    334228avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
    335 avl_test_CFLAGS = $(if $(test), 2>> .err/avl_test.log, ) ${BUILD_FLAGS}
    336229all: all-am
    337230
     
    350243        $(am__cd) $(top_srcdir) && \
    351244          $(AUTOMAKE) --foreign src/tests/Makefile
     245.PRECIOUS: Makefile
    352246Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    353247        @case '$?' in \
     
    367261        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    368262$(am__aclocal_m4_deps):
    369 avltree/$(am__dirstamp):
    370         @$(MKDIR_P) avltree
    371         @: > avltree/$(am__dirstamp)
    372 avltree/$(DEPDIR)/$(am__dirstamp):
    373         @$(MKDIR_P) avltree/$(DEPDIR)
    374         @: > avltree/$(DEPDIR)/$(am__dirstamp)
    375 avltree/avl_test-avl_test.$(OBJEXT): avltree/$(am__dirstamp) \
    376         avltree/$(DEPDIR)/$(am__dirstamp)
    377 avltree/avl_test-avl0.$(OBJEXT): avltree/$(am__dirstamp) \
    378         avltree/$(DEPDIR)/$(am__dirstamp)
    379 avltree/avl_test-avl1.$(OBJEXT): avltree/$(am__dirstamp) \
    380         avltree/$(DEPDIR)/$(am__dirstamp)
    381 avltree/avl_test-avl2.$(OBJEXT): avltree/$(am__dirstamp) \
    382         avltree/$(DEPDIR)/$(am__dirstamp)
    383 avltree/avl_test-avl3.$(OBJEXT): avltree/$(am__dirstamp) \
    384         avltree/$(DEPDIR)/$(am__dirstamp)
    385 avltree/avl_test-avl4.$(OBJEXT): avltree/$(am__dirstamp) \
    386         avltree/$(DEPDIR)/$(am__dirstamp)
    387 avltree/avl_test-avl-private.$(OBJEXT): avltree/$(am__dirstamp) \
    388         avltree/$(DEPDIR)/$(am__dirstamp)
    389 
    390263avl_test$(EXEEXT): $(avl_test_OBJECTS) $(avl_test_DEPENDENCIES) $(EXTRA_avl_test_DEPENDENCIES)
    391264        @rm -f avl_test$(EXEEXT)
    392         $(AM_V_CCLD)$(avl_test_LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS)
    393 
     265        $(AM_V_CCLD)$(LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS)
    394266fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES)
    395267        @rm -f fstream_test$(EXEEXT)
    396         $(AM_V_CCLD)$(fstream_test_LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)
    397 vector/$(am__dirstamp):
    398         @$(MKDIR_P) vector
    399         @: > vector/$(am__dirstamp)
    400 vector/$(DEPDIR)/$(am__dirstamp):
    401         @$(MKDIR_P) vector/$(DEPDIR)
    402         @: > vector/$(DEPDIR)/$(am__dirstamp)
    403 vector/vector_test-vector_int.$(OBJEXT): vector/$(am__dirstamp) \
    404         vector/$(DEPDIR)/$(am__dirstamp)
    405 vector/vector_test-array.$(OBJEXT): vector/$(am__dirstamp) \
    406         vector/$(DEPDIR)/$(am__dirstamp)
    407 vector/vector_test-vector_test.$(OBJEXT): vector/$(am__dirstamp) \
    408         vector/$(DEPDIR)/$(am__dirstamp)
    409 
     268        $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)
    410269vector_test$(EXEEXT): $(vector_test_OBJECTS) $(vector_test_DEPENDENCIES) $(EXTRA_vector_test_DEPENDENCIES)
    411270        @rm -f vector_test$(EXEEXT)
    412         $(AM_V_CCLD)$(vector_test_LINK) $(vector_test_OBJECTS) $(vector_test_LDADD) $(LIBS)
     271        $(AM_V_CCLD)$(LINK) $(vector_test_OBJECTS) $(vector_test_LDADD) $(LIBS)
    413272
    414273mostlyclean-compile:
    415274        -rm -f *.$(OBJEXT)
    416         -rm -f avltree/*.$(OBJEXT)
    417         -rm -f vector/*.$(OBJEXT)
    418275
    419276distclean-compile:
    420277        -rm -f *.tab.c
    421278
    422 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test-fstream_test.Po@am__quote@
    423 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl-private.Po@am__quote@
    424 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl0.Po@am__quote@
    425 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl1.Po@am__quote@
    426 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl2.Po@am__quote@
    427 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl3.Po@am__quote@
    428 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl4.Po@am__quote@
    429 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test-avl_test.Po@am__quote@
    430 @AMDEP_TRUE@@am__include@ @am__quote@vector/$(DEPDIR)/vector_test-array.Po@am__quote@
    431 @AMDEP_TRUE@@am__include@ @am__quote@vector/$(DEPDIR)/vector_test-vector_int.Po@am__quote@
    432 @AMDEP_TRUE@@am__include@ @am__quote@vector/$(DEPDIR)/vector_test-vector_test.Po@am__quote@
     279@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
     280@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl-private.Po@am__quote@
     281@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl0.Po@am__quote@
     282@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl1.Po@am__quote@
     283@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl2.Po@am__quote@
     284@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl3.Po@am__quote@
     285@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl4.Po@am__quote@
     286@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl_test.Po@am__quote@
     287@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@
     288@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@
     289@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_test.Po@am__quote@
    433290
    434291.c.o:
    435 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    436 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    437 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     292@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
     293@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    438294@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    439295@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    440 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
     296@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
    441297
    442298.c.obj:
    443 @am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
    444 @am__fastdepCC_TRUE@    $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
    445 @am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Po
     299@am__fastdepCC_TRUE@    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
     300@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
    446301@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
    447302@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    448 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    449 
    450 avltree/avl_test-avl_test.o: avltree/avl_test.c
    451 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl_test.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl_test.Tpo -c -o avltree/avl_test-avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
    452 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl_test.Tpo avltree/$(DEPDIR)/avl_test-avl_test.Po
    453 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avltree/avl_test-avl_test.o' libtool=no @AMDEPBACKSLASH@
    454 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    455 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
    456 
    457 avltree/avl_test-avl_test.obj: avltree/avl_test.c
    458 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl_test.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl_test.Tpo -c -o avltree/avl_test-avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
    459 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl_test.Tpo avltree/$(DEPDIR)/avl_test-avl_test.Po
    460 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avltree/avl_test-avl_test.obj' libtool=no @AMDEPBACKSLASH@
    461 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    462 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
    463 
    464 avltree/avl_test-avl0.o: avltree/avl0.c
    465 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl0.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl0.Tpo -c -o avltree/avl_test-avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
    466 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl0.Tpo avltree/$(DEPDIR)/avl_test-avl0.Po
    467 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avltree/avl_test-avl0.o' libtool=no @AMDEPBACKSLASH@
    468 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    469 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
    470 
    471 avltree/avl_test-avl0.obj: avltree/avl0.c
    472 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl0.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl0.Tpo -c -o avltree/avl_test-avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
    473 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl0.Tpo avltree/$(DEPDIR)/avl_test-avl0.Po
    474 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avltree/avl_test-avl0.obj' libtool=no @AMDEPBACKSLASH@
    475 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    476 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
    477 
    478 avltree/avl_test-avl1.o: avltree/avl1.c
    479 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl1.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl1.Tpo -c -o avltree/avl_test-avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
    480 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl1.Tpo avltree/$(DEPDIR)/avl_test-avl1.Po
    481 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avltree/avl_test-avl1.o' libtool=no @AMDEPBACKSLASH@
    482 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    483 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
    484 
    485 avltree/avl_test-avl1.obj: avltree/avl1.c
    486 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl1.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl1.Tpo -c -o avltree/avl_test-avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
    487 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl1.Tpo avltree/$(DEPDIR)/avl_test-avl1.Po
    488 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avltree/avl_test-avl1.obj' libtool=no @AMDEPBACKSLASH@
    489 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    490 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
    491 
    492 avltree/avl_test-avl2.o: avltree/avl2.c
    493 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl2.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl2.Tpo -c -o avltree/avl_test-avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
    494 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl2.Tpo avltree/$(DEPDIR)/avl_test-avl2.Po
    495 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avltree/avl_test-avl2.o' libtool=no @AMDEPBACKSLASH@
    496 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    497 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
    498 
    499 avltree/avl_test-avl2.obj: avltree/avl2.c
    500 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl2.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl2.Tpo -c -o avltree/avl_test-avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
    501 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl2.Tpo avltree/$(DEPDIR)/avl_test-avl2.Po
    502 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avltree/avl_test-avl2.obj' libtool=no @AMDEPBACKSLASH@
    503 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    504 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
    505 
    506 avltree/avl_test-avl3.o: avltree/avl3.c
    507 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl3.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl3.Tpo -c -o avltree/avl_test-avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
    508 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl3.Tpo avltree/$(DEPDIR)/avl_test-avl3.Po
    509 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avltree/avl_test-avl3.o' libtool=no @AMDEPBACKSLASH@
    510 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    511 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
    512 
    513 avltree/avl_test-avl3.obj: avltree/avl3.c
    514 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl3.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl3.Tpo -c -o avltree/avl_test-avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
    515 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl3.Tpo avltree/$(DEPDIR)/avl_test-avl3.Po
    516 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avltree/avl_test-avl3.obj' libtool=no @AMDEPBACKSLASH@
    517 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    518 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
    519 
    520 avltree/avl_test-avl4.o: avltree/avl4.c
    521 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl4.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl4.Tpo -c -o avltree/avl_test-avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
    522 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl4.Tpo avltree/$(DEPDIR)/avl_test-avl4.Po
    523 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avltree/avl_test-avl4.o' libtool=no @AMDEPBACKSLASH@
    524 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    525 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
    526 
    527 avltree/avl_test-avl4.obj: avltree/avl4.c
    528 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl4.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl4.Tpo -c -o avltree/avl_test-avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
    529 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl4.Tpo avltree/$(DEPDIR)/avl_test-avl4.Po
    530 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avltree/avl_test-avl4.obj' libtool=no @AMDEPBACKSLASH@
    531 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    532 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
    533 
    534 avltree/avl_test-avl-private.o: avltree/avl-private.c
    535 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl-private.o -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl-private.Tpo -c -o avltree/avl_test-avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
    536 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl-private.Tpo avltree/$(DEPDIR)/avl_test-avl-private.Po
    537 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avltree/avl_test-avl-private.o' libtool=no @AMDEPBACKSLASH@
    538 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    539 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
    540 
    541 avltree/avl_test-avl-private.obj: avltree/avl-private.c
    542 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -MT avltree/avl_test-avl-private.obj -MD -MP -MF avltree/$(DEPDIR)/avl_test-avl-private.Tpo -c -o avltree/avl_test-avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
    543 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) avltree/$(DEPDIR)/avl_test-avl-private.Tpo avltree/$(DEPDIR)/avl_test-avl-private.Po
    544 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avltree/avl_test-avl-private.obj' libtool=no @AMDEPBACKSLASH@
    545 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    546 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(avl_test_CFLAGS) $(CFLAGS) -c -o avltree/avl_test-avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
    547 
    548 fstream_test-fstream_test.o: fstream_test.c
    549 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -MT fstream_test-fstream_test.o -MD -MP -MF $(DEPDIR)/fstream_test-fstream_test.Tpo -c -o fstream_test-fstream_test.o `test -f 'fstream_test.c' || echo '$(srcdir)/'`fstream_test.c
    550 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fstream_test-fstream_test.Tpo $(DEPDIR)/fstream_test-fstream_test.Po
    551 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='fstream_test.c' object='fstream_test-fstream_test.o' libtool=no @AMDEPBACKSLASH@
    552 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    553 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -c -o fstream_test-fstream_test.o `test -f 'fstream_test.c' || echo '$(srcdir)/'`fstream_test.c
    554 
    555 fstream_test-fstream_test.obj: fstream_test.c
    556 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -MT fstream_test-fstream_test.obj -MD -MP -MF $(DEPDIR)/fstream_test-fstream_test.Tpo -c -o fstream_test-fstream_test.obj `if test -f 'fstream_test.c'; then $(CYGPATH_W) 'fstream_test.c'; else $(CYGPATH_W) '$(srcdir)/fstream_test.c'; fi`
    557 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/fstream_test-fstream_test.Tpo $(DEPDIR)/fstream_test-fstream_test.Po
    558 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='fstream_test.c' object='fstream_test-fstream_test.obj' libtool=no @AMDEPBACKSLASH@
    559 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    560 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fstream_test_CFLAGS) $(CFLAGS) -c -o fstream_test-fstream_test.obj `if test -f 'fstream_test.c'; then $(CYGPATH_W) 'fstream_test.c'; else $(CYGPATH_W) '$(srcdir)/fstream_test.c'; fi`
    561 
    562 vector/vector_test-vector_int.o: vector/vector_int.c
    563 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_int.o -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_int.Tpo -c -o vector/vector_test-vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
    564 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_int.Tpo vector/$(DEPDIR)/vector_test-vector_int.Po
    565 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector/vector_test-vector_int.o' libtool=no @AMDEPBACKSLASH@
    566 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    567 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
    568 
    569 vector/vector_test-vector_int.obj: vector/vector_int.c
    570 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_int.obj -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_int.Tpo -c -o vector/vector_test-vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
    571 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_int.Tpo vector/$(DEPDIR)/vector_test-vector_int.Po
    572 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector/vector_test-vector_int.obj' libtool=no @AMDEPBACKSLASH@
    573 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    574 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
    575 
    576 vector/vector_test-array.o: vector/array.c
    577 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-array.o -MD -MP -MF vector/$(DEPDIR)/vector_test-array.Tpo -c -o vector/vector_test-array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
    578 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-array.Tpo vector/$(DEPDIR)/vector_test-array.Po
    579 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='vector/vector_test-array.o' libtool=no @AMDEPBACKSLASH@
    580 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    581 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
    582 
    583 vector/vector_test-array.obj: vector/array.c
    584 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-array.obj -MD -MP -MF vector/$(DEPDIR)/vector_test-array.Tpo -c -o vector/vector_test-array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
    585 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-array.Tpo vector/$(DEPDIR)/vector_test-array.Po
    586 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='vector/vector_test-array.obj' libtool=no @AMDEPBACKSLASH@
    587 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    588 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
    589 
    590 vector/vector_test-vector_test.o: vector/vector_test.c
    591 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_test.o -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_test.Tpo -c -o vector/vector_test-vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
    592 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_test.Tpo vector/$(DEPDIR)/vector_test-vector_test.Po
    593 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector/vector_test-vector_test.o' libtool=no @AMDEPBACKSLASH@
    594 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    595 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
    596 
    597 vector/vector_test-vector_test.obj: vector/vector_test.c
    598 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -MT vector/vector_test-vector_test.obj -MD -MP -MF vector/$(DEPDIR)/vector_test-vector_test.Tpo -c -o vector/vector_test-vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
    599 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) vector/$(DEPDIR)/vector_test-vector_test.Tpo vector/$(DEPDIR)/vector_test-vector_test.Po
    600 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector/vector_test-vector_test.obj' libtool=no @AMDEPBACKSLASH@
    601 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    602 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vector_test_CFLAGS) $(CFLAGS) -c -o vector/vector_test-vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
    603 
    604 ID: $(am__tagged_files)
    605         $(am__define_uniq_tagged_files); mkid -fID $$unique
    606 tags: tags-am
    607 TAGS: tags
    608 
    609 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
     303@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
     304
     305avl_test.o: avltree/avl_test.c
     306@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.o -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
     307@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
     308@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.o' libtool=no @AMDEPBACKSLASH@
     309@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     310@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.o `test -f 'avltree/avl_test.c' || echo '$(srcdir)/'`avltree/avl_test.c
     311
     312avl_test.obj: avltree/avl_test.c
     313@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl_test.obj -MD -MP -MF $(DEPDIR)/avl_test.Tpo -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
     314@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl_test.Tpo $(DEPDIR)/avl_test.Po
     315@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl_test.c' object='avl_test.obj' libtool=no @AMDEPBACKSLASH@
     316@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     317@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl_test.obj `if test -f 'avltree/avl_test.c'; then $(CYGPATH_W) 'avltree/avl_test.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl_test.c'; fi`
     318
     319avl0.o: avltree/avl0.c
     320@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.o -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
     321@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
     322@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.o' libtool=no @AMDEPBACKSLASH@
     323@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     324@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.o `test -f 'avltree/avl0.c' || echo '$(srcdir)/'`avltree/avl0.c
     325
     326avl0.obj: avltree/avl0.c
     327@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl0.obj -MD -MP -MF $(DEPDIR)/avl0.Tpo -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
     328@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl0.Tpo $(DEPDIR)/avl0.Po
     329@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl0.c' object='avl0.obj' libtool=no @AMDEPBACKSLASH@
     330@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     331@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl0.obj `if test -f 'avltree/avl0.c'; then $(CYGPATH_W) 'avltree/avl0.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl0.c'; fi`
     332
     333avl1.o: avltree/avl1.c
     334@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.o -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
     335@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
     336@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.o' libtool=no @AMDEPBACKSLASH@
     337@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     338@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.o `test -f 'avltree/avl1.c' || echo '$(srcdir)/'`avltree/avl1.c
     339
     340avl1.obj: avltree/avl1.c
     341@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl1.obj -MD -MP -MF $(DEPDIR)/avl1.Tpo -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
     342@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl1.Tpo $(DEPDIR)/avl1.Po
     343@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl1.c' object='avl1.obj' libtool=no @AMDEPBACKSLASH@
     344@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     345@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl1.obj `if test -f 'avltree/avl1.c'; then $(CYGPATH_W) 'avltree/avl1.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl1.c'; fi`
     346
     347avl2.o: avltree/avl2.c
     348@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.o -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
     349@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
     350@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.o' libtool=no @AMDEPBACKSLASH@
     351@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     352@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.o `test -f 'avltree/avl2.c' || echo '$(srcdir)/'`avltree/avl2.c
     353
     354avl2.obj: avltree/avl2.c
     355@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl2.obj -MD -MP -MF $(DEPDIR)/avl2.Tpo -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
     356@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl2.Tpo $(DEPDIR)/avl2.Po
     357@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl2.c' object='avl2.obj' libtool=no @AMDEPBACKSLASH@
     358@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     359@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl2.obj `if test -f 'avltree/avl2.c'; then $(CYGPATH_W) 'avltree/avl2.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl2.c'; fi`
     360
     361avl3.o: avltree/avl3.c
     362@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.o -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
     363@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
     364@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.o' libtool=no @AMDEPBACKSLASH@
     365@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     366@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.o `test -f 'avltree/avl3.c' || echo '$(srcdir)/'`avltree/avl3.c
     367
     368avl3.obj: avltree/avl3.c
     369@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl3.obj -MD -MP -MF $(DEPDIR)/avl3.Tpo -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
     370@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl3.Tpo $(DEPDIR)/avl3.Po
     371@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl3.c' object='avl3.obj' libtool=no @AMDEPBACKSLASH@
     372@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     373@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl3.obj `if test -f 'avltree/avl3.c'; then $(CYGPATH_W) 'avltree/avl3.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl3.c'; fi`
     374
     375avl4.o: avltree/avl4.c
     376@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.o -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
     377@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
     378@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.o' libtool=no @AMDEPBACKSLASH@
     379@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     380@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.o `test -f 'avltree/avl4.c' || echo '$(srcdir)/'`avltree/avl4.c
     381
     382avl4.obj: avltree/avl4.c
     383@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl4.obj -MD -MP -MF $(DEPDIR)/avl4.Tpo -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
     384@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl4.Tpo $(DEPDIR)/avl4.Po
     385@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl4.c' object='avl4.obj' libtool=no @AMDEPBACKSLASH@
     386@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     387@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl4.obj `if test -f 'avltree/avl4.c'; then $(CYGPATH_W) 'avltree/avl4.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl4.c'; fi`
     388
     389avl-private.o: avltree/avl-private.c
     390@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.o -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
     391@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
     392@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.o' libtool=no @AMDEPBACKSLASH@
     393@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     394@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.o `test -f 'avltree/avl-private.c' || echo '$(srcdir)/'`avltree/avl-private.c
     395
     396avl-private.obj: avltree/avl-private.c
     397@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT avl-private.obj -MD -MP -MF $(DEPDIR)/avl-private.Tpo -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
     398@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/avl-private.Tpo $(DEPDIR)/avl-private.Po
     399@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='avltree/avl-private.c' object='avl-private.obj' libtool=no @AMDEPBACKSLASH@
     400@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     401@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o avl-private.obj `if test -f 'avltree/avl-private.c'; then $(CYGPATH_W) 'avltree/avl-private.c'; else $(CYGPATH_W) '$(srcdir)/avltree/avl-private.c'; fi`
     402
     403vector_int.o: vector/vector_int.c
     404@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_int.o -MD -MP -MF $(DEPDIR)/vector_int.Tpo -c -o vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
     405@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_int.Tpo $(DEPDIR)/vector_int.Po
     406@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector_int.o' libtool=no @AMDEPBACKSLASH@
     407@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     408@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_int.o `test -f 'vector/vector_int.c' || echo '$(srcdir)/'`vector/vector_int.c
     409
     410vector_int.obj: vector/vector_int.c
     411@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_int.obj -MD -MP -MF $(DEPDIR)/vector_int.Tpo -c -o vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
     412@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_int.Tpo $(DEPDIR)/vector_int.Po
     413@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_int.c' object='vector_int.obj' libtool=no @AMDEPBACKSLASH@
     414@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     415@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_int.obj `if test -f 'vector/vector_int.c'; then $(CYGPATH_W) 'vector/vector_int.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_int.c'; fi`
     416
     417array.o: vector/array.c
     418@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT array.o -MD -MP -MF $(DEPDIR)/array.Tpo -c -o array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
     419@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/array.Tpo $(DEPDIR)/array.Po
     420@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='array.o' libtool=no @AMDEPBACKSLASH@
     421@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     422@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o array.o `test -f 'vector/array.c' || echo '$(srcdir)/'`vector/array.c
     423
     424array.obj: vector/array.c
     425@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT array.obj -MD -MP -MF $(DEPDIR)/array.Tpo -c -o array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
     426@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/array.Tpo $(DEPDIR)/array.Po
     427@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/array.c' object='array.obj' libtool=no @AMDEPBACKSLASH@
     428@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     429@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o array.obj `if test -f 'vector/array.c'; then $(CYGPATH_W) 'vector/array.c'; else $(CYGPATH_W) '$(srcdir)/vector/array.c'; fi`
     430
     431vector_test.o: vector/vector_test.c
     432@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_test.o -MD -MP -MF $(DEPDIR)/vector_test.Tpo -c -o vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
     433@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_test.Tpo $(DEPDIR)/vector_test.Po
     434@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector_test.o' libtool=no @AMDEPBACKSLASH@
     435@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     436@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_test.o `test -f 'vector/vector_test.c' || echo '$(srcdir)/'`vector/vector_test.c
     437
     438vector_test.obj: vector/vector_test.c
     439@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vector_test.obj -MD -MP -MF $(DEPDIR)/vector_test.Tpo -c -o vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
     440@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/vector_test.Tpo $(DEPDIR)/vector_test.Po
     441@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='vector/vector_test.c' object='vector_test.obj' libtool=no @AMDEPBACKSLASH@
     442@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     443@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vector_test.obj `if test -f 'vector/vector_test.c'; then $(CYGPATH_W) 'vector/vector_test.c'; else $(CYGPATH_W) '$(srcdir)/vector/vector_test.c'; fi`
     444
     445ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
     446        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
     447        unique=`for i in $$list; do \
     448            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     449          done | \
     450          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     451              END { if (nonempty) { for (i in files) print i; }; }'`; \
     452        mkid -fID $$unique
     453tags: TAGS
     454
     455TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     456                $(TAGS_FILES) $(LISP)
    610457        set x; \
    611458        here=`pwd`; \
    612         $(am__define_uniq_tagged_files); \
     459        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     460        unique=`for i in $$list; do \
     461            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     462          done | \
     463          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     464              END { if (nonempty) { for (i in files) print i; }; }'`; \
    613465        shift; \
    614466        if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
     
    622474          fi; \
    623475        fi
    624 ctags: ctags-am
    625 
    626 CTAGS: ctags
    627 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    628         $(am__define_uniq_tagged_files); \
     476ctags: CTAGS
     477CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     478                $(TAGS_FILES) $(LISP)
     479        list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
     480        unique=`for i in $$list; do \
     481            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
     482          done | \
     483          $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
     484              END { if (nonempty) { for (i in files) print i; }; }'`; \
    629485        test -z "$(CTAGS_ARGS)$$unique" \
    630486          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
     
    635491          && $(am__cd) $(top_srcdir) \
    636492          && gtags -i $(GTAGS_ARGS) "$$here"
    637 cscopelist: cscopelist-am
    638 
    639 cscopelist-am: $(am__tagged_files)
    640         list='$(am__tagged_files)'; \
    641         case "$(srcdir)" in \
    642           [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
    643           *) sdir=$(subdir)/$(srcdir) ;; \
    644         esac; \
    645         for i in $$list; do \
    646           if test -f "$$i"; then \
    647             echo "$(subdir)/$$i"; \
    648           else \
    649             echo "$$sdir/$$i"; \
    650           fi; \
    651         done >> $(top_builddir)/cscope.files
    652493
    653494distclean-tags:
     
    714555        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    715556        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
    716         -rm -f avltree/$(DEPDIR)/$(am__dirstamp)
    717         -rm -f avltree/$(am__dirstamp)
    718         -rm -f vector/$(DEPDIR)/$(am__dirstamp)
    719         -rm -f vector/$(am__dirstamp)
    720557
    721558maintainer-clean-generic:
     
    727564
    728565distclean: distclean-am
    729         -rm -rf ./$(DEPDIR) avltree/$(DEPDIR) vector/$(DEPDIR)
     566        -rm -rf ./$(DEPDIR)
    730567        -rm -f Makefile
    731568distclean-am: clean-am distclean-compile distclean-generic \
     
    773610
    774611maintainer-clean: maintainer-clean-am
    775         -rm -rf ./$(DEPDIR) avltree/$(DEPDIR) vector/$(DEPDIR)
     612        -rm -rf ./$(DEPDIR)
    776613        -rm -f Makefile
    777614maintainer-clean-am: distclean-am maintainer-clean-generic
     
    793630.MAKE: install-am install-strip
    794631
    795 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
    796         clean-generic clean-local cscopelist-am ctags ctags-am \
    797         distclean distclean-compile distclean-generic distclean-tags \
    798         distdir dvi dvi-am html html-am info info-am install \
    799         install-am install-data install-data-am install-dvi \
    800         install-dvi-am install-exec install-exec-am install-html \
    801         install-html-am install-info install-info-am install-man \
    802         install-pdf install-pdf-am install-ps install-ps-am \
    803         install-strip installcheck installcheck-am installdirs \
    804         maintainer-clean maintainer-clean-generic mostlyclean \
    805         mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
    806         tags tags-am uninstall uninstall-am
    807 
    808 .PRECIOUS: Makefile
     632.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
     633        clean-generic clean-local ctags distclean distclean-compile \
     634        distclean-generic distclean-tags distdir dvi dvi-am html \
     635        html-am info info-am install install-am install-data \
     636        install-data-am install-dvi install-dvi-am install-exec \
     637        install-exec-am install-html install-html-am install-info \
     638        install-info-am install-man install-pdf install-pdf-am \
     639        install-ps install-ps-am install-strip installcheck \
     640        installcheck-am installdirs maintainer-clean \
     641        maintainer-clean-generic mostlyclean mostlyclean-compile \
     642        mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
     643        uninstall-am
    809644
    810645
     
    830665
    831666% : %.c @CFA_BINDIR@/@CFA_NAME@
    832         ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
     667        ${CC} ${CFLAGS} ${<} -o ${@}
    833668
    834669dtor-early-exit-ERR1: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    835         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     670        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    836671
    837672dtor-early-exit-ERR2: dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
    838         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR2 ${<} -o ${@}
     673        ${CC} ${CFLAGS} -DERR2 ${<} -o ${@}
    839674
    840675declarationSpecifier: declarationSpecifier.c @CFA_BINDIR@/@CFA_NAME@
    841         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     676        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    842677
    843678gccExtensions : gccExtensions.c @CFA_BINDIR@/@CFA_NAME@
    844         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     679        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    845680
    846681extension : extension.c @CFA_BINDIR@/@CFA_NAME@
    847         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     682        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    848683
    849684attributes : attributes.c @CFA_BINDIR@/@CFA_NAME@
    850         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     685        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    851686
    852687KRfunctions : KRfunctions.c @CFA_BINDIR@/@CFA_NAME@
    853         ${CC} ${AM_CFLAGS} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
     688        ${CC} ${CFLAGS} -CFA -XCFA -p -XCFA -L ${<} -o ${@}
    854689
    855690gmp : gmp.c @CFA_BINDIR@/@CFA_NAME@
    856         ${CC} ${AM_CFLAGS} ${CFLAGS} -lgmp ${<} -o ${@}
     691        ${CC} ${CFLAGS} -lgmp ${<} -o ${@}
    857692
    858693memberCtors-ERR1: memberCtors.c @CFA_BINDIR@/@CFA_NAME@
    859         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     694        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    860695
    861696completeTypeError : completeTypeError.c @CFA_BINDIR@/@CFA_NAME@
    862         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
     697        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    863698
    864699# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/gmp.c

    rb826e6b rfea3faa  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 13 16:35:01 2017
    13 // Update Count     : 541
     12// Last Modified On : Wed May 24 22:05:38 2017
     13// Update Count     : 540
    1414//
    1515
     
    9595// Local Variables: //
    9696// tab-width: 4 //
    97 // compile-command: "cfa gmp.c -lgmp" //
     97// compile-command: "cfa gmp.c -l gmp" //
    9898// End: //
  • src/tests/io.c

    rb826e6b rfea3faa  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul  6 23:26:12 2017
    13 // Update Count     : 78
     12// Last Modified On : Thu Jun  8 09:52:10 2017
     13// Update Count     : 51
    1414//
    1515
     
    4242        sout | endl;
    4343
    44         sout | "opening delimiters" | endl;
    4544        sout
     45                // opening delimiters
    4646                | "x (" | 1
    4747                | "x [" | 2
     
    5454                | "x ¿" | 9
    5555                | "x «" | 10
    56                 | endl | endl;
    57 
    58         sout | "closing delimiters" | endl;
     56                | endl;
    5957        sout
     58                // closing delimiters
    6059                | 1 | ", x"
    6160                | 2 | ". x"
     
    6968                | 10 | "] x"
    7069                | 11 | "} x"
    71                 | endl | endl;
    72 
    73         sout | "opening/closing delimiters" | endl;
     70                | endl;
    7471        sout
     72                // opening-closing delimiters
    7573                | "x`" | 1 | "`x'" | 2
    7674                | "'x\"" | 3 | "\"x:" | 4
     
    7876                | "\tx\f" | 7 | "\fx\v" | 8
    7977                | "\vx\n" | 9 | "\nx\r" | 10
    80                 | "\rx"
    81                 | endl | endl;
    82 
    83         sout | "override opening/closing delimiters" | endl;
     78                | "\rx" |
     79                endl;
    8480        sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl;
    85         sout | endl;
    8681
    8782        ifstream in;                                                                            // create / open file
    8883        open( &in, "io.data", "r" );
    8984
    90         sout | "input bacis types" | endl;
    9185        &in | &c                                                                                        // character
    9286                | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli     // integral
     
    9488                | &fc | &dc | &ldc                                                              // floating-point complex
    9589                | cstr( s1 ) | cstr( s2, size );                                // C string, length unchecked and checked
    96         sout | endl;
    9790
    98         sout | "output basic types" | endl;
    9991        sout | c | ' ' | endl                                                           // character
    10092                | si | usi | i | ui | li | uli | lli | ulli | endl // integral
     
    10294                | fc | dc | ldc | endl;                                                 // complex
    10395        sout | endl;
    104 
    105         sout | "tuples" | endl;
    106         [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
    107         sout | t1 | t2 | endl;                                                          // print tuple
     96        sout | f | "" | d | "" | ld | endl                                      // floating point without separator
     97                | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator
     98                | sepOn | s1 | sepOff | s2 | endl                               // local separator removal
     99                | s1 | "" | s2 | endl;                                                  // C string without separator
    108100        sout | endl;
    109101
    110         sout | "toggle separator" | endl;
    111         sout | f | "" | d | "" | ld | endl                                      // floating point without separator
    112                 | sepDisable | fc | dc | ldc | endl                             // complex without separator
    113                 | fc | sepOn | dc | ldc | endl                                  // local separator add
    114                 | sepEnable | fc | dc | ldc | endl                              // complex with separator
    115                 | fc | sepOff | dc | ldc | endl                                 // local separator removal
    116                 | s1 | sepOff | s2 | endl                                               // local separator removal
    117                 | s1 | "" | s2 | endl;                                                  // local separator removal
     102        sepSet( sout, ", $" );                                                          // change separator, maximum of 15 characters
     103        sout | f | d | ld | endl
     104                | fc | dc | ldc | endl
     105                | s1 | s2 | endl;
    118106        sout | endl;
    119107
    120         sout | "change separator" | endl;
    121         sout | "from \"" | sep | "\"";
    122         sepSet( sout, ", $" );                                                          // change separator, maximum of 15 characters
    123         sout | " to \"" | sep | "\"" | endl;
    124         sout | f | d | ld | endl
    125                 | fc | dc | ldc | endl
    126                 | s1 | s2 | endl
    127                 | t1 | t2 | endl;                                                               // print tuple
    128         sout | endl;
    129         sout | "from \"" | sep | "\" ";
    130         sepSet( sout, " " );                                                            // restore separator
    131         sout | "to \"" | sep | "\"" | endl;
    132         sout | f | d | ld | endl
    133                 | fc | dc | ldc | endl
    134                 | s1 | s2 | endl
    135                 | t1 | t2 | endl;                                                               // print tuple
    136         sout | endl;
     108        [int, int] t1 = [1, 2], t2 = [3, 4];
     109        sout | t1 | t2 | endl;                                                          // print tuple
    137110
    138         sout | "check sepOn/sepOff" | endl;
    139         sout | sepOn | 1 | 2 | 3 | sepOn | endl;                        // no separator at start/end of line
     111        sepSet( sout, " " );
     112        sepSet( sout, ", $" );                                                          // set separator from " " to ", $"
     113        sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
     114        sepSet( sout, " " );                                                            // reset separator to " "
     115        sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
     116
     117        sout | sepOn | 1 | 2 | 3 | sepOn | endl;                        // separator at start of line
    140118        sout | 1 | sepOff | 2 | 3 | endl;                                       // locally turn off implicit separator
    141         sout | sepOn | sepOn | 1 | 2 | 3 | sepOn | sepOff | sepOn | '\n'; // no separator at start/end of line
    142         sout | 1 | 2 | 3 | "\n\n" | sepOn;                                      // no separator at start of next line
    143         sout | 1 | 2 | 3 | endl;
    144         sout | endl;
    145119
    146         sout | "check enable/disable" | endl;
    147120        sout | sepDisable | 1 | 2 | 3 | endl;                           // globally turn off implicit separation
    148121        sout | 1 | sepOn | 2 | 3 | endl;                                        // locally turn on implicit separator
    149         sout | sepEnable | 1 | 2 | 3 | endl | sepDisable;       // globally turn on/off implicit separation
    150         sout | 1 | 2 | 3 | endl | sepEnable;                            // globally turn on implicit separation
    151         sout | 1 | 2 | 3 | sepOn | sepDisable | endl;           // ignore seperate at end of line
    152         sout | 1 | 2 | 3 | sepOn | sepEnable | endl;            // separator at end of line
    153         sout | 1 | 2 | 3 | endl;
    154         sout | endl;
    155 
    156 //      sout | fmt( d, "%8.3f" ) || endl;
    157 //      sout | endl;
     122        sout | sepEnable | 1 | 2 | 3 | endl;                            // globally turn on implicit separation
    158123
    159124        sepSetTuple( sout, " " );                                                       // set tuple separator from ", " to " "
    160         sout | t1 | t2 | " \"" | sep | "\"" | endl;
     125        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
    161126        sepSetTuple( sout, ", " );                                                      // reset tuple separator to ", "
    162         sout | t1 | t2 | " \"" | sep | "\"" | endl;
     127        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
     128
    163129        sout | t1 | t2 | endl;                                                          // print tuple
    164         sout | endl;
    165130
    166131        [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
  • src/tests/preempt_longrun/Makefile.am

    rb826e6b rfea3faa  
    1010## Author           : Thierry Delisle
    1111## Created On       : Fri Jun 16 10:57:34 2017
    12 ## Last Modified By :
    13 ## Last Modified On :
     12## Last Modified By : 
     13## Last Modified On : 
    1414## Update Count     : 0
    1515###############################################################################
    1616
    1717repeats=10
    18 max_time=600
    19 preempt=1_000ul
     18max_time=10
     19N=10ul
     20preempt=10_000ul
    2021
    2122REPEAT = ${abs_top_srcdir}/tools/repeat -s
    2223
    23 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
     24BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
    2425CFLAGS = ${BUILD_FLAGS}
    2526CC = @CFA_BINDIR@/@CFA_NAME@
    2627
    27 TESTS = barge block create disjoint enter enter3 processor stack wait yield
     28TESTS = barge block create disjoint processor stack wait yield
    2829
    2930.INTERMEDIATE: ${TESTS}
    3031
    3132all-local: ${TESTS:=.run}
    32 
    33 clean-local:
    34         rm -f ${TESTS}
    3533
    3634% : %.c ${CC}
  • src/tests/preempt_longrun/Makefile.in

    rb826e6b rfea3faa  
    1 # Makefile.in generated by automake 1.15 from Makefile.am.
     1# Makefile.in generated by automake 1.11.3 from Makefile.am.
    22# @configure_input@
    33
    4 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
    5 
     4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
     5# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
     6# Foundation, Inc.
    67# This Makefile.in is free software; the Free Software Foundation
    78# gives unlimited permission to copy and/or distribute it,
     
    1819###############################################################################
    1920VPATH = @srcdir@
    20 am__is_gnu_make = { \
    21   if test -z '$(MAKELEVEL)'; then \
    22     false; \
    23   elif test -n '$(MAKE_HOST)'; then \
    24     true; \
    25   elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    26     true; \
    27   else \
    28     false; \
    29   fi; \
    30 }
    31 am__make_running_with_option = \
    32   case $${target_option-} in \
    33       ?) ;; \
    34       *) echo "am__make_running_with_option: internal error: invalid" \
    35               "target option '$${target_option-}' specified" >&2; \
    36          exit 1;; \
    37   esac; \
    38   has_opt=no; \
    39   sane_makeflags=$$MAKEFLAGS; \
    40   if $(am__is_gnu_make); then \
    41     sane_makeflags=$$MFLAGS; \
    42   else \
    43     case $$MAKEFLAGS in \
    44       *\\[\ \   ]*) \
    45         bs=\\; \
    46         sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
    47           | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    48     esac; \
    49   fi; \
    50   skip_next=no; \
    51   strip_trailopt () \
    52   { \
    53     flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
    54   }; \
    55   for flg in $$sane_makeflags; do \
    56     test $$skip_next = yes && { skip_next=no; continue; }; \
    57     case $$flg in \
    58       *=*|--*) continue;; \
    59         -*I) strip_trailopt 'I'; skip_next=yes;; \
    60       -*I?*) strip_trailopt 'I';; \
    61         -*O) strip_trailopt 'O'; skip_next=yes;; \
    62       -*O?*) strip_trailopt 'O';; \
    63         -*l) strip_trailopt 'l'; skip_next=yes;; \
    64       -*l?*) strip_trailopt 'l';; \
    65       -[dEDm]) skip_next=yes;; \
    66       -[JT]) skip_next=yes;; \
    67     esac; \
    68     case $$flg in \
    69       *$$target_option*) has_opt=yes; break;; \
    70     esac; \
    71   done; \
    72   test $$has_opt = yes
    73 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
    74 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
    7521pkgdatadir = $(datadir)/@PACKAGE@
    7622pkgincludedir = $(includedir)/@PACKAGE@
     
    9238host_triplet = @host@
    9339subdir = src/tests/preempt_longrun
     40DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
    9441ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    9542am__aclocal_m4_deps = $(top_srcdir)/configure.ac
    9643am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    9744        $(ACLOCAL_M4)
    98 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
    9945mkinstalldirs = $(install_sh) -d
    10046CONFIG_HEADER = $(top_builddir)/config.h
    10147CONFIG_CLEAN_FILES =
    10248CONFIG_CLEAN_VPATH_FILES =
    103 AM_V_P = $(am__v_P_@AM_V@)
    104 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
    105 am__v_P_0 = false
    106 am__v_P_1 = :
    10749AM_V_GEN = $(am__v_GEN_@AM_V@)
    10850am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    109 am__v_GEN_0 = @echo "  GEN     " $@;
    110 am__v_GEN_1 =
     51am__v_GEN_0 = @echo "  GEN   " $@;
    11152AM_V_at = $(am__v_at_@AM_V@)
    11253am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
    11354am__v_at_0 = @
    114 am__v_at_1 =
    11555SOURCES =
    11656DIST_SOURCES =
    117 am__can_run_installinfo = \
    118   case $$AM_UPDATE_INFO_DIR in \
    119     n|no|NO) false;; \
    120     *) (install-info --version) >/dev/null 2>&1;; \
    121   esac
    122 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    123 am__tty_colors_dummy = \
    124   mgn= red= grn= lgn= blu= brg= std=; \
    125   am__color_tests=no
    126 am__tty_colors = { \
    127   $(am__tty_colors_dummy); \
    128   if test "X$(AM_COLOR_TESTS)" = Xno; then \
    129     am__color_tests=no; \
    130   elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
    131     am__color_tests=yes; \
    132   elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
    133     am__color_tests=yes; \
    134   fi; \
    135   if test $$am__color_tests = yes; then \
    136     red='[0;31m'; \
    137     grn='[0;32m'; \
    138     lgn='[1;32m'; \
    139     blu='[1;34m'; \
    140     mgn='[0;35m'; \
    141     brg='[1m'; \
    142     std='[m'; \
    143   fi; \
    144 }
    145 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
    146 am__vpath_adj = case $$p in \
    147     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    148     *) f=$$p;; \
    149   esac;
    150 am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
    151 am__install_max = 40
    152 am__nobase_strip_setup = \
    153   srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
    154 am__nobase_strip = \
    155   for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
    156 am__nobase_list = $(am__nobase_strip_setup); \
    157   for p in $$list; do echo "$$p $$p"; done | \
    158   sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
    159   $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
    160     if (++n[$$2] == $(am__install_max)) \
    161       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
    162     END { for (dir in files) print dir, files[dir] }'
    163 am__base_list = \
    164   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
    165   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
    166 am__uninstall_files_from_dir = { \
    167   test -z "$$files" \
    168     || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
    169     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
    170          $(am__cd) "$$dir" && rm -f $$files; }; \
    171   }
    172 am__recheck_rx = ^[     ]*:recheck:[    ]*
    173 am__global_test_result_rx = ^[  ]*:global-test-result:[         ]*
    174 am__copy_in_global_log_rx = ^[  ]*:copy-in-global-log:[         ]*
    175 # A command that, given a newline-separated list of test names on the
    176 # standard input, print the name of the tests that are to be re-run
    177 # upon "make recheck".
    178 am__list_recheck_tests = $(AWK) '{ \
    179   recheck = 1; \
    180   while ((rc = (getline line < ($$0 ".trs"))) != 0) \
    181     { \
    182       if (rc < 0) \
    183         { \
    184           if ((getline line2 < ($$0 ".log")) < 0) \
    185             recheck = 0; \
    186           break; \
    187         } \
    188       else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
    189         { \
    190           recheck = 0; \
    191           break; \
    192         } \
    193       else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
    194         { \
    195           break; \
    196         } \
    197     }; \
    198   if (recheck) \
    199     print $$0; \
    200   close ($$0 ".trs"); \
    201   close ($$0 ".log"); \
    202 }'
    203 # A command that, given a newline-separated list of test names on the
    204 # standard input, create the global log from their .trs and .log files.
    205 am__create_global_log = $(AWK) ' \
    206 function fatal(msg) \
    207 { \
    208   print "fatal: making $@: " msg | "cat >&2"; \
    209   exit 1; \
    210 } \
    211 function rst_section(header) \
    212 { \
    213   print header; \
    214   len = length(header); \
    215   for (i = 1; i <= len; i = i + 1) \
    216     printf "="; \
    217   printf "\n\n"; \
    218 } \
    219 { \
    220   copy_in_global_log = 1; \
    221   global_test_result = "RUN"; \
    222   while ((rc = (getline line < ($$0 ".trs"))) != 0) \
    223     { \
    224       if (rc < 0) \
    225          fatal("failed to read from " $$0 ".trs"); \
    226       if (line ~ /$(am__global_test_result_rx)/) \
    227         { \
    228           sub("$(am__global_test_result_rx)", "", line); \
    229           sub("[        ]*$$", "", line); \
    230           global_test_result = line; \
    231         } \
    232       else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
    233         copy_in_global_log = 0; \
    234     }; \
    235   if (copy_in_global_log) \
    236     { \
    237       rst_section(global_test_result ": " $$0); \
    238       while ((rc = (getline line < ($$0 ".log"))) != 0) \
    239       { \
    240         if (rc < 0) \
    241           fatal("failed to read from " $$0 ".log"); \
    242         print line; \
    243       }; \
    244       printf "\n"; \
    245     }; \
    246   close ($$0 ".trs"); \
    247   close ($$0 ".log"); \
    248 }'
    249 # Restructured Text title.
    250 am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
    251 # Solaris 10 'make', and several other traditional 'make' implementations,
    252 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
    253 # by disabling -e (using the XSI extension "set +e") if it's set.
    254 am__sh_e_setup = case $$- in *e*) set +e;; esac
    255 # Default flags passed to test drivers.
    256 am__common_driver_flags = \
    257   --color-tests "$$am__color_tests" \
    258   --enable-hard-errors "$$am__enable_hard_errors" \
    259   --expect-failure "$$am__expect_failure"
    260 # To be inserted before the command running the test.  Creates the
    261 # directory for the log if needed.  Stores in $dir the directory
    262 # containing $f, in $tst the test, in $log the log.  Executes the
    263 # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
    264 # passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
    265 # will run the test scripts (or their associated LOG_COMPILER, if
    266 # thy have one).
    267 am__check_pre = \
    268 $(am__sh_e_setup);                                      \
    269 $(am__vpath_adj_setup) $(am__vpath_adj)                 \
    270 $(am__tty_colors);                                      \
    271 srcdir=$(srcdir); export srcdir;                        \
    272 case "$@" in                                            \
    273   */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;    \
    274     *) am__odir=.;;                                     \
    275 esac;                                                   \
    276 test "x$$am__odir" = x"." || test -d "$$am__odir"       \
    277   || $(MKDIR_P) "$$am__odir" || exit $$?;               \
    278 if test -f "./$$f"; then dir=./;                        \
    279 elif test -f "$$f"; then dir=;                          \
    280 else dir="$(srcdir)/"; fi;                              \
    281 tst=$$dir$$f; log='$@';                                 \
    282 if test -n '$(DISABLE_HARD_ERRORS)'; then               \
    283   am__enable_hard_errors=no;                            \
    284 else                                                    \
    285   am__enable_hard_errors=yes;                           \
    286 fi;                                                     \
    287 case " $(XFAIL_TESTS) " in                              \
    288   *[\ \ ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
    289     am__expect_failure=yes;;                            \
    290   *)                                                    \
    291     am__expect_failure=no;;                             \
    292 esac;                                                   \
    293 $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
    294 # A shell command to get the names of the tests scripts with any registered
    295 # extension removed (i.e., equivalently, the names of the test logs, with
    296 # the '.log' extension removed).  The result is saved in the shell variable
    297 # '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
    298 # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
    299 # since that might cause problem with VPATH rewrites for suffix-less tests.
    300 # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
    301 am__set_TESTS_bases = \
    302   bases='$(TEST_LOGS)'; \
    303   bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
    304   bases=`echo $$bases`
    305 RECHECK_LOGS = $(TEST_LOGS)
    306 AM_RECURSIVE_TARGETS = check recheck
    307 TEST_SUITE_LOG = test-suite.log
    308 TEST_EXTENSIONS = @EXEEXT@ .test
    309 LOG_DRIVER = $(SHELL) $(top_srcdir)/automake/test-driver
    310 LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
    311 am__set_b = \
    312   case '$@' in \
    313     */*) \
    314       case '$*' in \
    315         */*) b='$*';; \
    316           *) b=`echo '$@' | sed 's/\.log$$//'`; \
    317        esac;; \
    318     *) \
    319       b='$*';; \
    320   esac
    321 am__test_logs1 = $(TESTS:=.log)
    322 am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
    323 TEST_LOGS = $(am__test_logs2:.test.log=.log)
    324 TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/automake/test-driver
    325 TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
    326         $(TEST_LOG_FLAGS)
    327 am__DIST_COMMON = $(srcdir)/Makefile.in \
    328         $(top_srcdir)/automake/test-driver
     57am__tty_colors = \
     58red=; grn=; lgn=; blu=; std=
    32959DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    33060ACLOCAL = @ACLOCAL@
     
    439169program_transform_name = @program_transform_name@
    440170psdir = @psdir@
    441 runstatedir = @runstatedir@
    442171sbindir = @sbindir@
    443172sharedstatedir = @sharedstatedir@
     
    449178top_srcdir = @top_srcdir@
    450179repeats = 10
    451 max_time = 600
    452 preempt = 1_000ul
     180max_time = 10
     181N = 10ul
     182preempt = 10_000ul
    453183REPEAT = ${abs_top_srcdir}/tools/repeat -s
    454 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt}
    455 TESTS = barge block create disjoint enter enter3 processor stack wait yield
     184BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DN=${N} -DPREEMPTION_RATE=${preempt}
     185TESTS = barge block create disjoint processor stack wait yield
    456186all: all-am
    457187
    458188.SUFFIXES:
    459 .SUFFIXES: .log .test .test$(EXEEXT) .trs
    460189$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
    461190        @for dep in $?; do \
     
    470199        $(am__cd) $(top_srcdir) && \
    471200          $(AUTOMAKE) --foreign src/tests/preempt_longrun/Makefile
     201.PRECIOUS: Makefile
    472202Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    473203        @case '$?' in \
     
    487217        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    488218$(am__aclocal_m4_deps):
    489 tags TAGS:
    490 
    491 ctags CTAGS:
    492 
    493 cscope cscopelist:
    494 
    495 
    496 # Recover from deleted '.trs' file; this should ensure that
    497 # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
    498 # both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
    499 # to avoid problems with "make -n".
    500 .log.trs:
    501         rm -f $< $@
    502         $(MAKE) $(AM_MAKEFLAGS) $<
    503 
    504 # Leading 'am--fnord' is there to ensure the list of targets does not
    505 # expand to empty, as could happen e.g. with make check TESTS=''.
    506 am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
    507 am--force-recheck:
    508         @:
    509 
    510 $(TEST_SUITE_LOG): $(TEST_LOGS)
    511         @$(am__set_TESTS_bases); \
    512         am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
    513         redo_bases=`for i in $$bases; do \
    514                       am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
    515                     done`; \
    516         if test -n "$$redo_bases"; then \
    517           redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
    518           redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
    519           if $(am__make_dryrun); then :; else \
    520             rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
    521           fi; \
    522         fi; \
    523         if test -n "$$am__remaking_logs"; then \
    524           echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
    525                "recursion detected" >&2; \
    526         elif test -n "$$redo_logs"; then \
    527           am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
    528         fi; \
    529         if $(am__make_dryrun); then :; else \
    530           st=0;  \
    531           errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
    532           for i in $$redo_bases; do \
    533             test -f $$i.trs && test -r $$i.trs \
    534               || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
    535             test -f $$i.log && test -r $$i.log \
    536               || { echo "$$errmsg $$i.log" >&2; st=1; }; \
     219tags: TAGS
     220TAGS:
     221
     222ctags: CTAGS
     223CTAGS:
     224
     225
     226check-TESTS: $(TESTS)
     227        @failed=0; all=0; xfail=0; xpass=0; skip=0; \
     228        srcdir=$(srcdir); export srcdir; \
     229        list=' $(TESTS) '; \
     230        $(am__tty_colors); \
     231        if test -n "$$list"; then \
     232          for tst in $$list; do \
     233            if test -f ./$$tst; then dir=./; \
     234            elif test -f $$tst; then dir=; \
     235            else dir="$(srcdir)/"; fi; \
     236            if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
     237              all=`expr $$all + 1`; \
     238              case " $(XFAIL_TESTS) " in \
     239              *[\ \     ]$$tst[\ \      ]*) \
     240                xpass=`expr $$xpass + 1`; \
     241                failed=`expr $$failed + 1`; \
     242                col=$$red; res=XPASS; \
     243              ;; \
     244              *) \
     245                col=$$grn; res=PASS; \
     246              ;; \
     247              esac; \
     248            elif test $$? -ne 77; then \
     249              all=`expr $$all + 1`; \
     250              case " $(XFAIL_TESTS) " in \
     251              *[\ \     ]$$tst[\ \      ]*) \
     252                xfail=`expr $$xfail + 1`; \
     253                col=$$lgn; res=XFAIL; \
     254              ;; \
     255              *) \
     256                failed=`expr $$failed + 1`; \
     257                col=$$red; res=FAIL; \
     258              ;; \
     259              esac; \
     260            else \
     261              skip=`expr $$skip + 1`; \
     262              col=$$blu; res=SKIP; \
     263            fi; \
     264            echo "$${col}$$res$${std}: $$tst"; \
    537265          done; \
    538           test $$st -eq 0 || exit 1; \
    539         fi
    540         @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
    541         ws='[   ]'; \
    542         results=`for b in $$bases; do echo $$b.trs; done`; \
    543         test -n "$$results" || results=/dev/null; \
    544         all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
    545         pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
    546         fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
    547         skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
    548         xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
    549         xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
    550         error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
    551         if test `expr $$fail + $$xpass + $$error` -eq 0; then \
    552           success=true; \
    553         else \
    554           success=false; \
    555         fi; \
    556         br='==================='; br=$$br$$br$$br$$br; \
    557         result_count () \
    558         { \
    559             if test x"$$1" = x"--maybe-color"; then \
    560               maybe_colorize=yes; \
    561             elif test x"$$1" = x"--no-color"; then \
    562               maybe_colorize=no; \
     266          if test "$$all" -eq 1; then \
     267            tests="test"; \
     268            All=""; \
     269          else \
     270            tests="tests"; \
     271            All="All "; \
     272          fi; \
     273          if test "$$failed" -eq 0; then \
     274            if test "$$xfail" -eq 0; then \
     275              banner="$$All$$all $$tests passed"; \
    563276            else \
    564               echo "$@: invalid 'result_count' usage" >&2; exit 4; \
    565             fi; \
    566             shift; \
    567             desc=$$1 count=$$2; \
    568             if test $$maybe_colorize = yes && test $$count -gt 0; then \
    569               color_start=$$3 color_end=$$std; \
     277              if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
     278              banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
     279            fi; \
     280          else \
     281            if test "$$xpass" -eq 0; then \
     282              banner="$$failed of $$all $$tests failed"; \
    570283            else \
    571               color_start= color_end=; \
    572             fi; \
    573             echo "$${color_start}# $$desc $$count$${color_end}"; \
    574         }; \
    575         create_testsuite_report () \
    576         { \
    577           result_count $$1 "TOTAL:" $$all   "$$brg"; \
    578           result_count $$1 "PASS: " $$pass  "$$grn"; \
    579           result_count $$1 "SKIP: " $$skip  "$$blu"; \
    580           result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
    581           result_count $$1 "FAIL: " $$fail  "$$red"; \
    582           result_count $$1 "XPASS:" $$xpass "$$red"; \
    583           result_count $$1 "ERROR:" $$error "$$mgn"; \
    584         }; \
    585         {                                                               \
    586           echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
    587             $(am__rst_title);                                           \
    588           create_testsuite_report --no-color;                           \
    589           echo;                                                         \
    590           echo ".. contents:: :depth: 2";                               \
    591           echo;                                                         \
    592           for b in $$bases; do echo $$b; done                           \
    593             | $(am__create_global_log);                                 \
    594         } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
    595         mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
    596         if $$success; then                                              \
    597           col="$$grn";                                                  \
    598          else                                                           \
    599           col="$$red";                                                  \
    600           test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
    601         fi;                                                             \
    602         echo "$${col}$$br$${std}";                                      \
    603         echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
    604         echo "$${col}$$br$${std}";                                      \
    605         create_testsuite_report --maybe-color;                          \
    606         echo "$$col$$br$$std";                                          \
    607         if $$success; then :; else                                      \
    608           echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
    609           if test -n "$(PACKAGE_BUGREPORT)"; then                       \
    610             echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
    611           fi;                                                           \
    612           echo "$$col$$br$$std";                                        \
    613         fi;                                                             \
    614         $$success || exit 1
    615 
    616 check-TESTS:
    617         @list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
    618         @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
    619         @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
    620         @set +e; $(am__set_TESTS_bases); \
    621         log_list=`for i in $$bases; do echo $$i.log; done`; \
    622         trs_list=`for i in $$bases; do echo $$i.trs; done`; \
    623         log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
    624         $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
    625         exit $$?;
    626 recheck: all
    627         @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
    628         @set +e; $(am__set_TESTS_bases); \
    629         bases=`for i in $$bases; do echo $$i; done \
    630                  | $(am__list_recheck_tests)` || exit 1; \
    631         log_list=`for i in $$bases; do echo $$i.log; done`; \
    632         log_list=`echo $$log_list`; \
    633         $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
    634                 am__force_recheck=am--force-recheck \
    635                 TEST_LOGS="$$log_list"; \
    636         exit $$?
    637 barge.log: barge
    638         @p='barge'; \
    639         b='barge'; \
    640         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    641         --log-file $$b.log --trs-file $$b.trs \
    642         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    643         "$$tst" $(AM_TESTS_FD_REDIRECT)
    644 block.log: block
    645         @p='block'; \
    646         b='block'; \
    647         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    648         --log-file $$b.log --trs-file $$b.trs \
    649         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    650         "$$tst" $(AM_TESTS_FD_REDIRECT)
    651 create.log: create
    652         @p='create'; \
    653         b='create'; \
    654         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    655         --log-file $$b.log --trs-file $$b.trs \
    656         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    657         "$$tst" $(AM_TESTS_FD_REDIRECT)
    658 disjoint.log: disjoint
    659         @p='disjoint'; \
    660         b='disjoint'; \
    661         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    662         --log-file $$b.log --trs-file $$b.trs \
    663         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    664         "$$tst" $(AM_TESTS_FD_REDIRECT)
    665 enter.log: enter
    666         @p='enter'; \
    667         b='enter'; \
    668         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    669         --log-file $$b.log --trs-file $$b.trs \
    670         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    671         "$$tst" $(AM_TESTS_FD_REDIRECT)
    672 enter3.log: enter3
    673         @p='enter3'; \
    674         b='enter3'; \
    675         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    676         --log-file $$b.log --trs-file $$b.trs \
    677         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    678         "$$tst" $(AM_TESTS_FD_REDIRECT)
    679 processor.log: processor
    680         @p='processor'; \
    681         b='processor'; \
    682         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    683         --log-file $$b.log --trs-file $$b.trs \
    684         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    685         "$$tst" $(AM_TESTS_FD_REDIRECT)
    686 stack.log: stack
    687         @p='stack'; \
    688         b='stack'; \
    689         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    690         --log-file $$b.log --trs-file $$b.trs \
    691         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    692         "$$tst" $(AM_TESTS_FD_REDIRECT)
    693 wait.log: wait
    694         @p='wait'; \
    695         b='wait'; \
    696         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    697         --log-file $$b.log --trs-file $$b.trs \
    698         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    699         "$$tst" $(AM_TESTS_FD_REDIRECT)
    700 yield.log: yield
    701         @p='yield'; \
    702         b='yield'; \
    703         $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
    704         --log-file $$b.log --trs-file $$b.trs \
    705         $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
    706         "$$tst" $(AM_TESTS_FD_REDIRECT)
    707 .test.log:
    708         @p='$<'; \
    709         $(am__set_b); \
    710         $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
    711         --log-file $$b.log --trs-file $$b.trs \
    712         $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
    713         "$$tst" $(AM_TESTS_FD_REDIRECT)
    714 @am__EXEEXT_TRUE@.test$(EXEEXT).log:
    715 @am__EXEEXT_TRUE@       @p='$<'; \
    716 @am__EXEEXT_TRUE@       $(am__set_b); \
    717 @am__EXEEXT_TRUE@       $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
    718 @am__EXEEXT_TRUE@       --log-file $$b.log --trs-file $$b.trs \
    719 @am__EXEEXT_TRUE@       $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
    720 @am__EXEEXT_TRUE@       "$$tst" $(AM_TESTS_FD_REDIRECT)
     284              if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
     285              banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
     286            fi; \
     287          fi; \
     288          dashes="$$banner"; \
     289          skipped=""; \
     290          if test "$$skip" -ne 0; then \
     291            if test "$$skip" -eq 1; then \
     292              skipped="($$skip test was not run)"; \
     293            else \
     294              skipped="($$skip tests were not run)"; \
     295            fi; \
     296            test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
     297              dashes="$$skipped"; \
     298          fi; \
     299          report=""; \
     300          if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
     301            report="Please report to $(PACKAGE_BUGREPORT)"; \
     302            test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
     303              dashes="$$report"; \
     304          fi; \
     305          dashes=`echo "$$dashes" | sed s/./=/g`; \
     306          if test "$$failed" -eq 0; then \
     307            col="$$grn"; \
     308          else \
     309            col="$$red"; \
     310          fi; \
     311          echo "$${col}$$dashes$${std}"; \
     312          echo "$${col}$$banner$${std}"; \
     313          test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
     314          test -z "$$report" || echo "$${col}$$report$${std}"; \
     315          echo "$${col}$$dashes$${std}"; \
     316          test "$$failed" -eq 0; \
     317        else :; fi
    721318
    722319distdir: $(DISTFILES)
     
    775372        fi
    776373mostlyclean-generic:
    777         -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
    778         -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
    779         -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
    780374
    781375clean-generic:
     
    790384clean: clean-am
    791385
    792 clean-am: clean-generic clean-local mostlyclean-am
     386clean-am: clean-generic mostlyclean-am
    793387
    794388distclean: distclean-am
     
    857451
    858452.PHONY: all all-am all-local check check-TESTS check-am clean \
    859         clean-generic clean-local cscopelist-am ctags-am distclean \
    860         distclean-generic distdir dvi dvi-am html html-am info info-am \
    861         install install-am install-data install-data-am install-dvi \
    862         install-dvi-am install-exec install-exec-am install-html \
    863         install-html-am install-info install-info-am install-man \
    864         install-pdf install-pdf-am install-ps install-ps-am \
    865         install-strip installcheck installcheck-am installdirs \
    866         maintainer-clean maintainer-clean-generic mostlyclean \
    867         mostlyclean-generic pdf pdf-am ps ps-am recheck tags-am \
    868         uninstall uninstall-am
    869 
    870 .PRECIOUS: Makefile
     453        clean-generic distclean distclean-generic distdir dvi dvi-am \
     454        html html-am info info-am install install-am install-data \
     455        install-data-am install-dvi install-dvi-am install-exec \
     456        install-exec-am install-html install-html-am install-info \
     457        install-info-am install-man install-pdf install-pdf-am \
     458        install-ps install-ps-am install-strip installcheck \
     459        installcheck-am installdirs maintainer-clean \
     460        maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
     461        pdf-am ps ps-am uninstall uninstall-am
    871462
    872463
     
    874465
    875466all-local: ${TESTS:=.run}
    876 
    877 clean-local:
    878         rm -f ${TESTS}
    879467
    880468% : %.c ${CC}
  • src/tests/preempt_longrun/create.c

    rb826e6b rfea3faa  
    1010}
    1111
    12 thread worker_t {};
     12thread Worker {};
    1313
    14 void main(worker_t * this) {}
     14void main(Worker * this) {}
    1515
    1616int main(int argc, char* argv[]) {
    17         processor p;
    18         for(int i = 0; i < 10_000ul; i++) {
    19                 worker_t w[7];
     17        for(int i = 0; i < 100_000ul; i++) {
     18                Worker w;
    2019        }
    2120}
  • src/tests/preempt_longrun/processor.c

    rb826e6b rfea3faa  
    1010}
    1111
    12 thread worker_t {};
     12thread Worker {};
    1313
    14 void main(worker_t * this) {}
     14void main(Worker * this) {}
    1515
    1616int main(int argc, char* argv[]) {
    17         for(int i = 0; i < 10_000ul; i++) {
     17        for(int i = 0; i < 100_000ul; i++) {
    1818                processor p;
    1919        }
  • src/tests/preempt_longrun/stack.c

    rb826e6b rfea3faa  
    1212}
    1313
    14 thread worker_t {};
     14thread Worker {};
    1515
    16 void main(worker_t * this) {
     16void main(Worker * this) {
    1717        volatile long p = 5_021_609ul;
    1818        volatile long a = 326_417ul;
    1919        volatile long n = 1l;
    20         for (volatile long i = 0; i < p; i++) {
    21                 n *= a;
    22                 n %= p;
     20        for (volatile long i = 0; i < p; i++) { 
     21                n *= a; 
     22                n %= p; 
    2323        }
    24 
     24               
    2525        if( n != a ) {
    2626                abort();
     
    2828}
    2929
    30 extern "C" {
    31 static worker_t * workers;
    32 }
    33 
    3430int main(int argc, char* argv[]) {
    3531        processor p;
    3632        {
    37                 worker_t w[7];
    38                 workers = w;
     33                Worker w[7];
    3934        }
    4035}
  • src/tests/preempt_longrun/yield.c

    rb826e6b rfea3faa  
    1010}
    1111
    12 thread worker_t {};
     12thread Worker {};
    1313
    14 void main(worker_t * this) {
    15         for(int i = 0; i < 325_000ul; i++) {
     14void main(Worker * this) {
     15        for(int i = 0; i < 100_000ul; i++) {
    1616                yield();
    1717        }
    18 }
    19 
    20 extern "C" {
    21 static worker_t * workers;
    2218}
    2319
     
    2521        processor p;
    2622        {
    27                 worker_t w[7];
    28                 workers = w;
     23                Worker w[7];
    2924        }
    3025}
  • src/tests/sched-int-barge.c

    rb826e6b rfea3faa  
    44#include <stdlib>
    55#include <thread>
    6 
    7 #ifndef N
    8 #define N 100_000
    9 #endif
    106
    117enum state_t { WAIT, SIGNAL, BARGE };
     
    7773        }
    7874
    79         if( c->counter >= N ) c->done = true;
     75        if( c->counter >= 100_000 ) c->done = true;
    8076        return !c->done;
    8177}
  • src/tests/sched-int-block.c

    rb826e6b rfea3faa  
    66
    77#ifndef N
    8 #define N 10_000
     8#define N 100_000
    99#endif
    1010
     
    3131//------------------------------------------------------------------------------
    3232void wait_op( global_data_t * mutex a, global_data_t * mutex b, unsigned i ) {
    33         wait( &cond, (uintptr_t)this_thread );
     33        wait( &cond, (uintptr_t)this_thread() );
    3434
    3535        yield( ((unsigned)rand48()) % 10 );
     
    4040        }
    4141
    42         a->last_thread = b->last_thread = this_thread;
     42        a->last_thread = b->last_thread = this_thread();
    4343
    4444        yield( ((unsigned)rand48()) % 10 );
     
    5656        yield( ((unsigned)rand48()) % 10 );
    5757
    58         a->last_thread = b->last_thread = a->last_signaller = b->last_signaller = this_thread;
     58        a->last_thread = b->last_thread = a->last_signaller = b->last_signaller = this_thread();
    5959
    6060        if( !is_empty( &cond ) ) {
     
    8686//------------------------------------------------------------------------------
    8787void barge_op( global_data_t * mutex a ) {
    88         a->last_thread = this_thread;
     88        a->last_thread = this_thread();
    8989}
    9090
  • src/tests/sched-int-disjoint.c

    rb826e6b rfea3faa  
    55
    66#ifndef N
    7 #define N 10_000
     7#define N 100_000
    88#endif
    99
     
    4242
    4343void main( Barger * this ) {
    44         while( !all_done ) {
     44        while( !all_done ) { 
    4545                barge( &data );
    46                 yield();
     46                yield(); 
    4747        }
    4848}
     
    5353        wait( &cond );
    5454        if( d->state != SIGNAL ) {
    55                 sout | "ERROR barging!" | endl;
     55                sout | "ERROR barging!" | endl; 
    5656        }
    5757
     
    8585        bool running = data.counter < N && data.counter > 0;
    8686        if( data.state != SIGNAL && running ) {
    87                 sout | "ERROR Eager signal" | data.state | endl;
     87                sout | "ERROR Eager signal" | data.state | endl; 
    8888        }
    8989}
     
    9292
    9393void main( Signaller * this ) {
    94         while( !all_done ) {
     94        while( !all_done ) { 
    9595                logic( &mut );
    96                 yield();
     96                yield(); 
    9797        }
    9898}
     
    111111                sout | "All waiter done" | endl;
    112112                all_done = true;
    113         }
     113        }       
    114114}
  • src/tests/sched-int-wait.c

    rb826e6b rfea3faa  
    5050                unsigned action = (unsigned)rand48() % 4;
    5151                switch( action ) {
    52                         case 0:
     52                        case 0: 
    5353                                signal( &condABC, &globalA, &globalB, &globalC );
    5454                                break;
    55                         case 1:
     55                        case 1: 
    5656                                signal( &condAB , &globalA, &globalB );
    5757                                break;
    58                         case 2:
     58                        case 2: 
    5959                                signal( &condBC , &globalB, &globalC );
    6060                                break;
    61                         case 3:
     61                        case 3: 
    6262                                signal( &condAC , &globalA, &globalC );
    6363                                break;
     
    6767                }
    6868                yield();
    69         }
     69        }       
    7070}
    7171
  • src/tests/test.py

    rb826e6b rfea3faa  
    161161
    162162        # remove any outputs from the previous tests to prevent side effects
    163         rm( (out_file, err_file, test.name), dry_run )
     163        rm( (out_file, test.name), dry_run )
    164164
    165165        options = "-debug" if debug else "-nodebug"
    166166
    167167        # build, skipping to next test on error
    168         make_ret, _ = sh("""%s test=yes DEBUG_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
     168        make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
    169169
    170170        retcode = 0
     
    202202                        error = myfile.read()
    203203
    204 
     204               
    205205        # clean the executable
    206206        sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
     
    221221                if   retcode == TestResult.SUCCESS:     result_txt = "Done"
    222222                elif retcode == TestResult.TIMEOUT:     result_txt = "TIMEOUT"
    223                 else :                                          result_txt = "ERROR code %d" % retcode
     223                else :                                          result_txt = "ERROR"
    224224        else :
    225225                if   retcode == TestResult.SUCCESS:     result_txt = "PASSED"
    226226                elif retcode == TestResult.TIMEOUT:     result_txt = "TIMEOUT"
    227                 else :                                          result_txt = "FAILED with code %d" % retcode
     227                else :                                          result_txt = "FAILED"
    228228
    229229        #print result with error if needed
  • src/tests/thread.c

    rb826e6b rfea3faa  
    44#include <thread>
    55
    6 thread First  { semaphore* lock; };
    7 thread Second { semaphore* lock; };
     6// thread First;
     7// void main(First* this);
    88
    9 void ?{}( First * this, semaphore* lock ) { this->lock = lock; }
    10 void ?{}( Second * this, semaphore* lock ) { this->lock = lock; }
     9// thread Second;
     10// void main(Second* this);
     11
     12thread First  { signal_once* lock; };
     13thread Second { signal_once* lock; };
     14
     15void ?{}( First * this, signal_once* lock ) { this->lock = lock; }
     16void ?{}( Second * this, signal_once* lock ) { this->lock = lock; }
    1117
    1218void main(First* this) {
     
    1521                yield();
    1622        }
    17         V(this->lock);
     23        signal(this->lock);
    1824}
    1925
    2026void main(Second* this) {
    21         P(this->lock);
     27        wait(this->lock);
    2228        for(int i = 0; i < 10; i++) {
    2329                sout | "Second : Suspend No." | i + 1 | endl;
     
    2834
    2935int main(int argc, char* argv[]) {
    30         semaphore lock = { 0 };
     36        signal_once lock;
    3137        sout | "User main begin" | endl;
    3238        {
  • tools/cfa.nanorc

    rb826e6b rfea3faa  
    22## WIP
    33
    4 syntax "cfa" "\.cfa"
     4syntax "cfa" "\.cfa$"
     5## No magic
    56
    67# Macros
     
    1819# Control Flow Structures
    1920color brightyellow "\<(if|else|while|do|for|switch|choose|case|default)\>"
    20 color brightyellow "\<(try|catch(Resume)?|finally)\>"
     21##color brightyellow "\<(try|catch|catchResume|finally)\>"
    2122
    2223# Control Flow Statements
    23 color magenta "\<(goto|return|break|continue|fallthr(u|ough)|throw(Resume)?)\>"
     24color magenta "\<(return|break|continue|fallthru|throw)\>"
    2425
    2526# Operator Names
     
    4546color brightmagenta "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
    4647# Strings and Angle Strings
    47 color yellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
     48color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
    4849# Multiline Strings: This regex is VERY expencive and often too strong.
    4950###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
Note: See TracChangeset for help on using the changeset viewer.