Changeset 95b8aa7 for libcfa/src


Ignore:
Timestamp:
Jan 11, 2019, 3:36:48 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
e1f7eef
Parents:
ff5caaf (diff), 52ffa30 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Pull fixes for deferred_resn from other branch

Location:
libcfa/src
Files:
19 edited
1 moved

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    rff5caaf r95b8aa7  
    1717# create object files in directory with source files
    1818AUTOMAKE_OPTIONS = foreign subdir-objects
    19 ARFLAGS = cr
     19ACLOCAL_AMFLAGS  = -I automake
    2020
    2121include $(srcdir)/../../src/cfa.make
    2222
    2323libdir = ${CFA_LIBDIR}
    24 lib_LIBRARIES =  libcfa.a
     24lib_LTLIBRARIES =  libcfa.la
    2525
    2626VPATH += :../prelude
     
    3131# The built sources must not depend on the installed headers
    3232AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
    33 AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     33AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    3434AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
    3535CFACC = @CFACC@
     
    3737#----------------------------------------------------------------------------------------------------------------
    3838if BUILDLIB
     39headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa
    3940headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    4041          containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
    4142
    42 headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa
    43 
    4443# not all platforms support concurrency, add option do disable it
     44headers_nosrc += concurrency/invoke.h
    4545headers += concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
    46 
    47 headers_nosrc += concurrency/invoke.h
    4846
    4947libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa}
     
    6361
    6462# add dependency of cfa files
    65 libobjs = $(addsuffix .o, $(basename $(filter %.cfa,$(libsrc))))
     63libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc))))
    6664$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
    6765
     
    7068libdeps = $(join \
    7169        $(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \
    72         $(notdir ${libobjs:.o=.Po}) \
     70        $(notdir ${libobjs:.lo=.Plo}) \
    7371)
    7472
     
    7674
    7775prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
    78         ${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     76        ${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree @CONFIG_CFAFLAGS@ -XCFA -l ${<} -c -o ${@}
    7977
     78prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     79        ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
     80        @CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree @CONFIG_CFAFLAGS@ -XCFA -l ${<} -c -o ${@}
    8081
    8182
    8283#----------------------------------------------------------------------------------------------------------------
    83 libcfa_a_SOURCES = prelude.cfa ${libsrc}
     84libcfa_la_SOURCES = prelude.cfa ${libsrc}
     85libcfa_la_LDFLAGS = -version-info @CFA_VERSION@
    8486
    85 stdhdr = ${shell find ${srcdir}/stdhdr -type f -printf "%p "}
     87stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ")
    8688
    8789cfa_includedir = $(CFA_INCDIR)
  • libcfa/src/Makefile.in

    rff5caaf r95b8aa7  
    9090PRE_UNINSTALL = :
    9191POST_UNINSTALL = :
     92build_triplet = @build@
     93host_triplet = @host@
    9294subdir = src
    9395ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    94 am__aclocal_m4_deps = $(top_srcdir)/../automake/cfa.m4 \
    95         $(top_srcdir)/configure.ac
     96am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \
     97        $(top_srcdir)/automake/ltoptions.m4 \
     98        $(top_srcdir)/automake/ltsugar.m4 \
     99        $(top_srcdir)/automake/ltversion.m4 \
     100        $(top_srcdir)/automake/lt~obsolete.m4 \
     101        $(top_srcdir)/../automake/cfa.m4 $(top_srcdir)/configure.ac
    96102am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    97103        $(ACLOCAL_M4)
     
    129135  }
    130136am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cfa_includedir)"
    131 LIBRARIES = $(lib_LIBRARIES)
    132 AR = ar
    133 AM_V_AR = $(am__v_AR_@AM_V@)
    134 am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
    135 am__v_AR_0 = @echo "  AR      " $@;
    136 am__v_AR_1 =
    137 libcfa_a_AR = $(AR) $(ARFLAGS)
    138 libcfa_a_LIBADD =
    139 am__libcfa_a_SOURCES_DIST = prelude.cfa startup.cfa interpose.cfa \
     137LTLIBRARIES = $(lib_LTLIBRARIES)
     138libcfa_la_LIBADD =
     139am__libcfa_la_SOURCES_DIST = prelude.cfa startup.cfa interpose.cfa \
    140140        bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa \
    141141        fstream.cfa iostream.cfa iterator.cfa limits.cfa rational.cfa \
     
    148148        concurrency/invoke.c concurrency/preemption.cfa
    149149am__dirstamp = $(am__leading_dot)dirstamp
    150 @BUILDLIB_TRUE@am__objects_1 = fstream.$(OBJEXT) iostream.$(OBJEXT) \
    151 @BUILDLIB_TRUE@ iterator.$(OBJEXT) limits.$(OBJEXT) \
    152 @BUILDLIB_TRUE@ rational.$(OBJEXT) time.$(OBJEXT) \
    153 @BUILDLIB_TRUE@ stdlib.$(OBJEXT) common.$(OBJEXT) \
    154 @BUILDLIB_TRUE@ containers/maybe.$(OBJEXT) \
    155 @BUILDLIB_TRUE@ containers/pair.$(OBJEXT) \
    156 @BUILDLIB_TRUE@ containers/result.$(OBJEXT) \
    157 @BUILDLIB_TRUE@ containers/vector.$(OBJEXT) \
    158 @BUILDLIB_TRUE@ concurrency/coroutine.$(OBJEXT) \
    159 @BUILDLIB_TRUE@ concurrency/thread.$(OBJEXT) \
    160 @BUILDLIB_TRUE@ concurrency/kernel.$(OBJEXT) \
    161 @BUILDLIB_TRUE@ concurrency/monitor.$(OBJEXT) \
    162 @BUILDLIB_TRUE@ concurrency/mutex.$(OBJEXT)
    163 @BUILDLIB_TRUE@am__objects_2 = startup.$(OBJEXT) interpose.$(OBJEXT) \
    164 @BUILDLIB_TRUE@ bits/debug.$(OBJEXT) assert.$(OBJEXT) \
    165 @BUILDLIB_TRUE@ exception.$(OBJEXT) virtual.$(OBJEXT) \
    166 @BUILDLIB_TRUE@ heap.$(OBJEXT) $(am__objects_1) \
    167 @BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT) \
    168 @BUILDLIB_TRUE@ concurrency/alarm.$(OBJEXT) \
    169 @BUILDLIB_TRUE@ concurrency/invoke.$(OBJEXT) \
    170 @BUILDLIB_TRUE@ concurrency/preemption.$(OBJEXT)
    171 am_libcfa_a_OBJECTS = prelude.$(OBJEXT) $(am__objects_2)
    172 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
     150@BUILDLIB_TRUE@am__objects_1 = fstream.lo iostream.lo iterator.lo \
     151@BUILDLIB_TRUE@ limits.lo rational.lo time.lo stdlib.lo \
     152@BUILDLIB_TRUE@ common.lo containers/maybe.lo \
     153@BUILDLIB_TRUE@ containers/pair.lo containers/result.lo \
     154@BUILDLIB_TRUE@ containers/vector.lo concurrency/coroutine.lo \
     155@BUILDLIB_TRUE@ concurrency/thread.lo concurrency/kernel.lo \
     156@BUILDLIB_TRUE@ concurrency/monitor.lo concurrency/mutex.lo
     157@BUILDLIB_TRUE@am__objects_2 = startup.lo interpose.lo bits/debug.lo \
     158@BUILDLIB_TRUE@ assert.lo exception.lo virtual.lo heap.lo \
     159@BUILDLIB_TRUE@ $(am__objects_1) \
     160@BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.lo \
     161@BUILDLIB_TRUE@ concurrency/alarm.lo concurrency/invoke.lo \
     162@BUILDLIB_TRUE@ concurrency/preemption.lo
     163am_libcfa_la_OBJECTS = prelude.lo $(am__objects_2)
     164libcfa_la_OBJECTS = $(am_libcfa_la_OBJECTS)
     165AM_V_lt = $(am__v_lt_@AM_V@)
     166am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
     167am__v_lt_0 = --silent
     168am__v_lt_1 =
     169libcfa_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     170        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
     171        $(libcfa_la_LDFLAGS) $(LDFLAGS) -o $@
    173172AM_V_P = $(am__v_P_@AM_V@)
    174173am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    184183am__v_at_1 =
    185184DEFAULT_INCLUDES = -I.@am__isrc@
    186 depcomp = $(SHELL) $(top_srcdir)/./automake/depcomp
     185depcomp = $(SHELL) $(top_srcdir)/automake/depcomp
    187186am__depfiles_maybe = depfiles
    188187am__mv = mv -f
    189188CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    190189        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
     190LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
     191        $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \
     192        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
     193        $(AM_CCASFLAGS) $(CCASFLAGS)
    191194AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
    192195am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
     
    195198COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    196199        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
     200LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     201        $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
     202        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
     203        $(AM_CFLAGS) $(CFLAGS)
    197204AM_V_CC = $(am__v_CC_@AM_V@)
    198205am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
     
    200207am__v_CC_1 =
    201208CCLD = $(CC)
    202 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
     209LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     210        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
     211        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    203212AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    204213am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
    205214am__v_CCLD_0 = @echo "  CCLD    " $@;
    206215am__v_CCLD_1 =
    207 SOURCES = $(libcfa_a_SOURCES)
    208 DIST_SOURCES = $(am__libcfa_a_SOURCES_DIST)
     216SOURCES = $(libcfa_la_SOURCES)
     217DIST_SOURCES = $(am__libcfa_la_SOURCES_DIST)
    209218am__can_run_installinfo = \
    210219  case $$AM_UPDATE_INFO_DIR in \
     
    212221    *) (install-info --version) >/dev/null 2>&1;; \
    213222  esac
    214 am__nobase_cfa_include_HEADERS_DIST = ${shell find ${srcdir}/stdhdr \
    215         -type f -printf "%p "} fstream.hfa iostream.hfa iterator.hfa \
     223am__nobase_cfa_include_HEADERS_DIST = $(shell find $(srcdir)/stdhdr \
     224        -type f -printf "%p ") fstream.hfa iostream.hfa iterator.hfa \
    216225        limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    217226        containers/maybe.hfa containers/pair.hfa containers/result.hfa \
     
    242251CTAGS = ctags
    243252am__DIST_COMMON = $(srcdir)/../../src/cfa.make $(srcdir)/Makefile.in \
    244         $(top_srcdir)/./automake/depcomp
     253        $(top_srcdir)/automake/depcomp
    245254DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    246255VPATH = @srcdir@ :../prelude
     
    248257AMTAR = @AMTAR@
    249258AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     259AR = @AR@
    250260ARCHITECTURE = @ARCHITECTURE@
    251261ARCH_FLAGS = @ARCH_FLAGS@
     
    266276CFA_NAME = @CFA_NAME@
    267277CFA_PREFIX = @CFA_PREFIX@
     278CFA_VERSION = @CFA_VERSION@
    268279CFLAGS = @CFLAGS@
    269280CONFIGURATION = @CONFIGURATION@
     
    271282CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
    272283CONFIG_CFLAGS = @CONFIG_CFLAGS@
     284CPP = @CPP@
    273285CPPFLAGS = @CPPFLAGS@
    274286CXX = @CXX@
     287CXXCPP = @CXXCPP@
    275288CXXDEPMODE = @CXXDEPMODE@
    276289CXXFLAGS = @CXXFLAGS@
     
    278291DEFS = @DEFS@
    279292DEPDIR = @DEPDIR@
     293DLLTOOL = @DLLTOOL@
    280294DRIVER_DIR = @DRIVER_DIR@
     295DSYMUTIL = @DSYMUTIL@
     296DUMPBIN = @DUMPBIN@
    281297ECHO_C = @ECHO_C@
    282298ECHO_N = @ECHO_N@
    283299ECHO_T = @ECHO_T@
     300EGREP = @EGREP@
    284301EXEEXT = @EXEEXT@
     302FGREP = @FGREP@
     303GREP = @GREP@
    285304INSTALL = @INSTALL@
    286305INSTALL_DATA = @INSTALL_DATA@
     
    288307INSTALL_SCRIPT = @INSTALL_SCRIPT@
    289308INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
     309LD = @LD@
    290310LDFLAGS = @LDFLAGS@
    291311LIBOBJS = @LIBOBJS@
    292312LIBS = @LIBS@
     313LIBTOOL = @LIBTOOL@
     314LIPO = @LIPO@
     315LN_S = @LN_S@
    293316LTLIBOBJS = @LTLIBOBJS@
     317LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
    294318MAKEINFO = @MAKEINFO@
     319MANIFEST_TOOL = @MANIFEST_TOOL@
    295320MKDIR_P = @MKDIR_P@
     321NM = @NM@
     322NMEDIT = @NMEDIT@
     323OBJDUMP = @OBJDUMP@
    296324OBJEXT = @OBJEXT@
     325OTOOL = @OTOOL@
     326OTOOL64 = @OTOOL64@
    297327PACKAGE = @PACKAGE@
    298328PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
     
    304334PATH_SEPARATOR = @PATH_SEPARATOR@
    305335RANLIB = @RANLIB@
     336SED = @SED@
    306337SET_MAKE = @SET_MAKE@
    307338SHELL = @SHELL@
     
    312343abs_top_builddir = @abs_top_builddir@
    313344abs_top_srcdir = @abs_top_srcdir@
     345ac_ct_AR = @ac_ct_AR@
    314346ac_ct_CC = @ac_ct_CC@
    315347ac_ct_CXX = @ac_ct_CXX@
     348ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
    316349am__include = @am__include@
    317350am__leading_dot = @am__leading_dot@
     
    320353am__untar = @am__untar@
    321354bindir = @bindir@
     355build = @build@
    322356build_alias = @build_alias@
     357build_cpu = @build_cpu@
     358build_os = @build_os@
     359build_vendor = @build_vendor@
    323360builddir = @builddir@
    324361datadir = @datadir@
     
    327364dvidir = @dvidir@
    328365exec_prefix = @exec_prefix@
     366host = @host@
    329367host_alias = @host_alias@
     368host_cpu = @host_cpu@
     369host_os = @host_os@
     370host_vendor = @host_vendor@
    330371htmldir = @htmldir@
    331372includedir = @includedir@
     
    355396# create object files in directory with source files
    356397AUTOMAKE_OPTIONS = foreign subdir-objects
    357 ARFLAGS = cr
     398ACLOCAL_AMFLAGS = -I automake
    358399CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
     400LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     401        $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \
     402        $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) \
     403        $(AM_CFLAGS) $(CFLAGS)
     404
    359405AM_V_CFA = $(am__v_CFA_@AM_V@)
    360406am__v_CFA_ = $(am__v_CFA_@AM_DEFAULT_V@)
    361407am__v_CFA_0 = @echo "  CFA     " $@;
    362408am__v_CFA_1 =
    363 lib_LIBRARIES = libcfa.a
     409AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)
     410am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)
     411am__v_JAVAC_0 = @echo "  JAVAC   " $@;
     412am__v_JAVAC_1 =
     413AM_V_GOC = $(am__v_GOC_@AM_V@)
     414am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)
     415am__v_GOC_0 = @echo "  GOC     " $@;
     416am__v_GOC_1 =
     417UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
     418AM_V_UPP = $(am__v_UPP_@AM_V@)
     419am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@)
     420am__v_UPP_0 = @echo "  UPP     " $@;
     421am__v_UPP_1 =
     422lib_LTLIBRARIES = libcfa.la
    364423
    365424# AM_CFLAGS for all cfa source
     
    368427# The built sources must not depend on the installed headers
    369428AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
    370 AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     429AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    371430AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     431@BUILDLIB_FALSE@headers_nosrc =
     432
     433#----------------------------------------------------------------------------------------------------------------
     434
     435# not all platforms support concurrency, add option do disable it
     436@BUILDLIB_TRUE@headers_nosrc = math.hfa gmp.hfa time_t.hfa \
     437@BUILDLIB_TRUE@ bits/align.hfa bits/containers.hfa \
     438@BUILDLIB_TRUE@ bits/defs.hfa bits/debug.hfa bits/locks.hfa \
     439@BUILDLIB_TRUE@ concurrency/invoke.h
    372440@BUILDLIB_FALSE@headers =
    373 
    374 #----------------------------------------------------------------------------------------------------------------
    375 
    376 # not all platforms support concurrency, add option do disable it
    377441@BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa \
    378442@BUILDLIB_TRUE@ limits.hfa rational.hfa time.hfa stdlib.hfa \
     
    382446@BUILDLIB_TRUE@ concurrency/thread.hfa concurrency/kernel.hfa \
    383447@BUILDLIB_TRUE@ concurrency/monitor.hfa concurrency/mutex.hfa
    384 @BUILDLIB_FALSE@headers_nosrc =
    385 @BUILDLIB_TRUE@headers_nosrc = math.hfa gmp.hfa time_t.hfa \
    386 @BUILDLIB_TRUE@ bits/align.hfa bits/containers.hfa \
    387 @BUILDLIB_TRUE@ bits/defs.hfa bits/debug.hfa bits/locks.hfa \
    388 @BUILDLIB_TRUE@ concurrency/invoke.h
    389448@BUILDLIB_FALSE@libsrc =
    390449
     
    402461
    403462# add dependency of cfa files
    404 libobjs = $(addsuffix .o, $(basename $(filter %.cfa,$(libsrc))))
     463libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc))))
    405464
    406465# .deps inclusion is not done automatically by automake for new languages
    407466libdeps = $(join \
    408467        $(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \
    409         $(notdir ${libobjs:.o=.Po}) \
     468        $(notdir ${libobjs:.lo=.Plo}) \
    410469)
    411470
    412471
    413472#----------------------------------------------------------------------------------------------------------------
    414 libcfa_a_SOURCES = prelude.cfa ${libsrc}
    415 stdhdr = ${shell find ${srcdir}/stdhdr -type f -printf "%p "}
     473libcfa_la_SOURCES = prelude.cfa ${libsrc}
     474libcfa_la_LDFLAGS = -version-info @CFA_VERSION@
     475stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ")
    416476cfa_includedir = $(CFA_INCDIR)
    417477nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc}
     
    419479
    420480.SUFFIXES:
    421 .SUFFIXES: .S .c .cfa .o .obj
     481.SUFFIXES: .S .c .cfa .lo .o .obj
    422482$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/../../src/cfa.make $(am__configure_deps)
    423483        @for dep in $?; do \
     
    450510        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    451511$(am__aclocal_m4_deps):
    452 install-libLIBRARIES: $(lib_LIBRARIES)
     512
     513install-libLTLIBRARIES: $(lib_LTLIBRARIES)
    453514        @$(NORMAL_INSTALL)
    454         @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
     515        @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
    455516        list2=; for p in $$list; do \
    456517          if test -f $$p; then \
     
    461522          echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
    462523          $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
    463           echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
    464           $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
    465         @$(POST_INSTALL)
    466         @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
     524          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
     525          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
     526        }
     527
     528uninstall-libLTLIBRARIES:
     529        @$(NORMAL_UNINSTALL)
     530        @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
    467531        for p in $$list; do \
    468           if test -f $$p; then \
    469             $(am__strip_dir) \
    470             echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
    471             ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
    472           else :; fi; \
     532          $(am__strip_dir) \
     533          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
     534          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
    473535        done
    474536
    475 uninstall-libLIBRARIES:
    476         @$(NORMAL_UNINSTALL)
    477         @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
    478         files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
    479         dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir)
    480 
    481 clean-libLIBRARIES:
    482         -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
     537clean-libLTLIBRARIES:
     538        -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
     539        @list='$(lib_LTLIBRARIES)'; \
     540        locs=`for p in $$list; do echo $$p; done | \
     541              sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
     542              sort -u`; \
     543        test -z "$$locs" || { \
     544          echo rm -f $${locs}; \
     545          rm -f $${locs}; \
     546        }
    483547bits/$(am__dirstamp):
    484548        @$(MKDIR_P) bits
     
    487551        @$(MKDIR_P) bits/$(DEPDIR)
    488552        @: > bits/$(DEPDIR)/$(am__dirstamp)
    489 bits/debug.$(OBJEXT): bits/$(am__dirstamp) \
    490         bits/$(DEPDIR)/$(am__dirstamp)
     553bits/debug.lo: bits/$(am__dirstamp) bits/$(DEPDIR)/$(am__dirstamp)
    491554containers/$(am__dirstamp):
    492555        @$(MKDIR_P) containers
     
    495558        @$(MKDIR_P) containers/$(DEPDIR)
    496559        @: > containers/$(DEPDIR)/$(am__dirstamp)
    497 containers/maybe.$(OBJEXT): containers/$(am__dirstamp) \
     560containers/maybe.lo: containers/$(am__dirstamp) \
    498561        containers/$(DEPDIR)/$(am__dirstamp)
    499 containers/pair.$(OBJEXT): containers/$(am__dirstamp) \
     562containers/pair.lo: containers/$(am__dirstamp) \
    500563        containers/$(DEPDIR)/$(am__dirstamp)
    501 containers/result.$(OBJEXT): containers/$(am__dirstamp) \
     564containers/result.lo: containers/$(am__dirstamp) \
    502565        containers/$(DEPDIR)/$(am__dirstamp)
    503 containers/vector.$(OBJEXT): containers/$(am__dirstamp) \
     566containers/vector.lo: containers/$(am__dirstamp) \
    504567        containers/$(DEPDIR)/$(am__dirstamp)
    505568concurrency/$(am__dirstamp):
     
    509572        @$(MKDIR_P) concurrency/$(DEPDIR)
    510573        @: > concurrency/$(DEPDIR)/$(am__dirstamp)
    511 concurrency/coroutine.$(OBJEXT): concurrency/$(am__dirstamp) \
     574concurrency/coroutine.lo: concurrency/$(am__dirstamp) \
    512575        concurrency/$(DEPDIR)/$(am__dirstamp)
    513 concurrency/thread.$(OBJEXT): concurrency/$(am__dirstamp) \
     576concurrency/thread.lo: concurrency/$(am__dirstamp) \
    514577        concurrency/$(DEPDIR)/$(am__dirstamp)
    515 concurrency/kernel.$(OBJEXT): concurrency/$(am__dirstamp) \
     578concurrency/kernel.lo: concurrency/$(am__dirstamp) \
    516579        concurrency/$(DEPDIR)/$(am__dirstamp)
    517 concurrency/monitor.$(OBJEXT): concurrency/$(am__dirstamp) \
     580concurrency/monitor.lo: concurrency/$(am__dirstamp) \
    518581        concurrency/$(DEPDIR)/$(am__dirstamp)
    519 concurrency/mutex.$(OBJEXT): concurrency/$(am__dirstamp) \
     582concurrency/mutex.lo: concurrency/$(am__dirstamp) \
    520583        concurrency/$(DEPDIR)/$(am__dirstamp)
    521 concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT):  \
    522         concurrency/$(am__dirstamp) \
     584concurrency/CtxSwitch-@ARCHITECTURE@.lo: concurrency/$(am__dirstamp) \
    523585        concurrency/$(DEPDIR)/$(am__dirstamp)
    524 concurrency/alarm.$(OBJEXT): concurrency/$(am__dirstamp) \
     586concurrency/alarm.lo: concurrency/$(am__dirstamp) \
    525587        concurrency/$(DEPDIR)/$(am__dirstamp)
    526 concurrency/invoke.$(OBJEXT): concurrency/$(am__dirstamp) \
     588concurrency/invoke.lo: concurrency/$(am__dirstamp) \
    527589        concurrency/$(DEPDIR)/$(am__dirstamp)
    528 concurrency/preemption.$(OBJEXT): concurrency/$(am__dirstamp) \
     590concurrency/preemption.lo: concurrency/$(am__dirstamp) \
    529591        concurrency/$(DEPDIR)/$(am__dirstamp)
    530592
    531 libcfa.a: $(libcfa_a_OBJECTS) $(libcfa_a_DEPENDENCIES) $(EXTRA_libcfa_a_DEPENDENCIES)
    532         $(AM_V_at)-rm -f libcfa.a
    533         $(AM_V_AR)$(libcfa_a_AR) libcfa.a $(libcfa_a_OBJECTS) $(libcfa_a_LIBADD)
    534         $(AM_V_at)$(RANLIB) libcfa.a
     593libcfa.la: $(libcfa_la_OBJECTS) $(libcfa_la_DEPENDENCIES) $(EXTRA_libcfa_la_DEPENDENCIES)
     594        $(AM_V_CCLD)$(libcfa_la_LINK) -rpath $(libdir) $(libcfa_la_OBJECTS) $(libcfa_la_LIBADD) $(LIBS)
    535595
    536596mostlyclean-compile:
    537597        -rm -f *.$(OBJEXT)
    538598        -rm -f bits/*.$(OBJEXT)
     599        -rm -f bits/*.lo
    539600        -rm -f concurrency/*.$(OBJEXT)
     601        -rm -f concurrency/*.lo
    540602        -rm -f containers/*.$(OBJEXT)
     603        -rm -f containers/*.lo
    541604
    542605distclean-compile:
    543606        -rm -f *.tab.c
    544607
    545 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Po@am__quote@
    546 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Po@am__quote@
    547 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.Po@am__quote@
    548 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/invoke.Po@am__quote@
     608@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Plo@am__quote@
     609@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Plo@am__quote@
     610@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.Plo@am__quote@
     611@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/invoke.Plo@am__quote@
    549612
    550613.S.o:
     
    564627@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    565628
     629.S.lo:
     630@am__fastdepCCAS_TRUE@  $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     631@am__fastdepCCAS_TRUE@  $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     632@am__fastdepCCAS_TRUE@  $(am__mv) $$depbase.Tpo $$depbase.Plo
     633@AMDEP_TRUE@@am__fastdepCCAS_FALSE@     $(AM_V_CPPAS)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
     634@AMDEP_TRUE@@am__fastdepCCAS_FALSE@     DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     635@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LTCPPASCOMPILE) -c -o $@ $<
     636
    566637.c.o:
    567638@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     
    579650@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    580651@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
     652
     653.c.lo:
     654@am__fastdepCC_TRUE@    $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     655@am__fastdepCC_TRUE@    $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     656@am__fastdepCC_TRUE@    $(am__mv) $$depbase.Tpo $$depbase.Plo
     657@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
     658@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     659@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
     660
     661mostlyclean-libtool:
     662        -rm -f *.lo
     663
     664clean-libtool:
     665        -rm -rf .libs _libs
     666        -rm -rf bits/.libs bits/_libs
     667        -rm -rf concurrency/.libs concurrency/_libs
     668        -rm -rf containers/.libs containers/_libs
    581669install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS)
    582670        @$(NORMAL_INSTALL)
     
    688776check-am: all-am
    689777check: check-am
    690 all-am: Makefile $(LIBRARIES) $(HEADERS)
     778all-am: Makefile $(LTLIBRARIES) $(HEADERS)
    691779installdirs:
    692780        for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cfa_includedir)"; do \
     
    731819clean: clean-am
    732820
    733 clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
     821clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
     822        mostlyclean-am
    734823
    735824distclean: distclean-am
     
    757846install-dvi-am:
    758847
    759 install-exec-am: install-libLIBRARIES
     848install-exec-am: install-libLTLIBRARIES
    760849
    761850install-html: install-html-am
     
    787876mostlyclean: mostlyclean-am
    788877
    789 mostlyclean-am: mostlyclean-compile mostlyclean-generic
     878mostlyclean-am: mostlyclean-compile mostlyclean-generic \
     879        mostlyclean-libtool
    790880
    791881pdf: pdf-am
     
    797887ps-am:
    798888
    799 uninstall-am: uninstall-libLIBRARIES \
     889uninstall-am: uninstall-libLTLIBRARIES \
    800890        uninstall-nobase_cfa_includeHEADERS
    801891
     
    803893
    804894.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
    805         clean-libLIBRARIES cscopelist-am ctags ctags-am distclean \
    806         distclean-compile distclean-generic distclean-tags distdir dvi \
    807         dvi-am html html-am info info-am install install-am \
    808         install-data install-data-am install-dvi install-dvi-am \
    809         install-exec install-exec-am install-html install-html-am \
    810         install-info install-info-am install-libLIBRARIES install-man \
     895        clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
     896        ctags-am distclean distclean-compile distclean-generic \
     897        distclean-libtool distclean-tags distdir dvi dvi-am html \
     898        html-am info info-am install install-am install-data \
     899        install-data-am install-dvi install-dvi-am install-exec \
     900        install-exec-am install-html install-html-am install-info \
     901        install-info-am install-libLTLIBRARIES install-man \
    811902        install-nobase_cfa_includeHEADERS install-pdf install-pdf-am \
    812903        install-ps install-ps-am install-strip installcheck \
    813904        installcheck-am installdirs maintainer-clean \
    814905        maintainer-clean-generic maintainer-clean-local mostlyclean \
    815         mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
    816         tags tags-am uninstall uninstall-am uninstall-libLIBRARIES \
    817         uninstall-nobase_cfa_includeHEADERS
     906        mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
     907        pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
     908        uninstall-libLTLIBRARIES uninstall-nobase_cfa_includeHEADERS
    818909
    819910.PRECIOUS: Makefile
     
    824915        $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    825916        $(am__mv) $$depbase.Tpo $$depbase.Po
     917
     918.cfa.lo:
     919        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     920        $(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     921        $(am__mv) $$depbase.Tpo $$depbase.Plo
    826922$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
    827923
     
    829925
    830926prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
    831         ${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     927        ${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree @CONFIG_CFAFLAGS@ -XCFA -l ${<} -c -o ${@}
     928
     929prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     930        ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
     931        @CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree @CONFIG_CFAFLAGS@ -XCFA -l ${<} -c -o ${@}
    832932
    833933#----------------------------------------------------------------------------------------------------------------
  • libcfa/src/bits/locks.hfa

    rff5caaf r95b8aa7  
    3737#endif
    3838
    39 #if defined( __i386 ) || defined( __x86_64 ) || defined( __ARM_ARCH )
    40         // Intel recommendation
    41         #define __ALIGN__ __attribute__(( aligned (128) ))
    42 #elif defined( __sparc )
    43         #define __ALIGN__ CALIGN
    44 #else
    45         #error unsupported architecture
    46 #endif
    47 
    4839struct __spinlock_t {
    4940        // Wrap in struct to prevent false sharing with debug info
    50         struct {
    51                 // Align lock on 128-bit boundary
    52                 __ALIGN__ volatile bool lock;
    53         };
     41        volatile bool lock;
    5442        #ifdef __CFA_DEBUG__
    5543                // previous function to acquire the lock
     
    5846                void* prev_thrd;
    5947        #endif
    60 } __ALIGN__;
     48};
    6149
    6250#ifdef __cforall
  • libcfa/src/concurrency/coroutine.cfa

    rff5caaf r95b8aa7  
    2222#include <string.h>
    2323#include <unistd.h>
     24// use this define to make unwind.h play nice, definetely a hack
     25#define HIDE_EXPORTS
     26#include <unwind.h>
     27#undef HIDE_EXPORTS
    2428#include <sys/mman.h>
    2529}
     
    2933#define __CFA_INVOKE_PRIVATE__
    3034#include "invoke.h"
     35
     36extern "C" {
     37      void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage) __attribute__ ((__noreturn__));
     38      static void _CtxCoroutine_UnwindCleanup(_Unwind_Reason_Code, struct _Unwind_Exception *) __attribute__ ((__noreturn__));
     39      static void _CtxCoroutine_UnwindCleanup(_Unwind_Reason_Code, struct _Unwind_Exception *) {
     40            abort();
     41      }
     42}
    3143
    3244//-----------------------------------------------------------------------------
     
    6779      starter = NULL;
    6880      last = NULL;
    69 }
    70 
    71 void ^?{}(coroutine_desc& this) {}
     81      cancellation = NULL;
     82}
     83
     84void ^?{}(coroutine_desc& this) {
     85      if(this.state != Halted) {
     86            coroutine_desc * src = TL_GET( this_coroutine );
     87            coroutine_desc * dst = &this;
     88
     89            struct _Unwind_Exception storage;
     90            storage.exception_class = -1;
     91            storage.exception_cleanup = _CtxCoroutine_UnwindCleanup;
     92            this.cancellation = &storage;
     93            this.last = src;
     94
     95              // not resuming self ?
     96              if ( src == dst ) {
     97                      abort( "Attempt by coroutine %.256s (%p) to terminate itself.\n", src->name, src );
     98            }
     99
     100              CoroutineCtxSwitch( src, dst );
     101      }
     102}
    72103
    73104// Part of the Public API
     
    105136      // Safety note : This could cause some false positives due to preemption
    106137      verify( TL_GET( preemption_state.enabled ) || TL_GET( this_processor )->do_terminate );
     138
     139      if( unlikely(src->cancellation != NULL) ) {
     140            _CtxCoroutine_Unwind(src->cancellation);
     141      }
    107142} //ctxSwitchDirect
    108143
     
    162197      }
    163198
    164       void __leave_coroutine(void) {
     199      void __leave_coroutine() {
    165200            coroutine_desc * src = TL_GET( this_coroutine ); // optimization
    166 
    167             assertf( src->starter != 0,
     201            coroutine_desc * starter = src->cancellation != 0 ? src->last : src->starter;
     202
     203            src->state = Halted;
     204
     205            assertf( starter != 0,
    168206                  "Attempt to suspend/leave coroutine \"%.256s\" (%p) that has never been resumed.\n"
    169207                  "Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
    170208                  src->name, src );
    171             assertf( src->starter->state != Halted,
     209            assertf( starter->state != Halted,
    172210                  "Attempt by coroutine \"%.256s\" (%p) to suspend/leave back to terminated coroutine \"%.256s\" (%p).\n"
    173211                  "Possible cause is terminated coroutine's main routine has already returned.",
    174                   src->name, src, src->starter->name, src->starter );
    175 
    176             CoroutineCtxSwitch( src, src->starter );
     212                  src->name, src, starter->name, starter );
     213
     214            CoroutineCtxSwitch( src, starter );
    177215      }
    178216}
  • libcfa/src/concurrency/invoke.c

    rff5caaf r95b8aa7  
    1717#include <stdlib.h>
    1818#include <stdio.h>
     19#include <unwind.h>
    1920
    2021#include "invoke.h"
     
    5051        main( this );
    5152
    52         cor->state = Halted;
    53 
    5453        //Final suspend, should never return
    5554        __leave_coroutine();
    5655        __cabi_abort( "Resumed dead coroutine" );
     56}
     57
     58static _Unwind_Reason_Code _CtxCoroutine_UnwindStop(
     59        __attribute((__unused__)) int version,
     60        _Unwind_Action actions,
     61        __attribute((__unused__)) _Unwind_Exception_Class exceptionClass,
     62        __attribute((__unused__)) struct _Unwind_Exception * unwind_exception,
     63        __attribute((__unused__)) struct _Unwind_Context * context,
     64        __attribute((__unused__)) void * param
     65) {
     66        if( actions & _UA_END_OF_STACK  ) {
     67                // We finished unwinding the coroutine,
     68                // leave it
     69                __leave_coroutine();
     70                __cabi_abort( "Resumed dead coroutine" );
     71        }
     72        if( actions & _UA_CLEANUP_PHASE ) return _URC_NO_REASON;
     73
     74        return _URC_FATAL_PHASE2_ERROR;
     75}
     76
     77void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage) __attribute__ ((__noreturn__));
     78void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage) {
     79        _Unwind_Reason_Code ret = _Unwind_ForcedUnwind( storage, _CtxCoroutine_UnwindStop, NULL );
     80        printf("UNWIND ERROR %d after force unwind\n", ret);
     81        abort();
    5782}
    5883
  • libcfa/src/concurrency/invoke.h

    rff5caaf r95b8aa7  
    5959                                volatile bool in_progress;
    6060                        } preemption_state;
    61                 } kernelTLS;
     61                } kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
    6262        }
    6363
     
    8080
    8181        struct coroutine_desc {
    82                 struct coStack_t stack;                                                 // stack information of the coroutine
    83                 const char * name;                                                              // textual name for coroutine/task, initialized by uC++ generated code
    84                 int errno_;                                                                             // copy of global UNIX variable errno
    85                 enum coroutine_state state;                                             // current execution status for coroutine
    86                 struct coroutine_desc * starter;                                // first coroutine to resume this one
    87                 struct coroutine_desc * last;                                   // last coroutine to resume this one
    88         };
    89 
     82                // stack information of the coroutine
     83                struct coStack_t stack;
     84
     85                // textual name for coroutine/task, initialized by uC++ generated code
     86                const char * name;
     87
     88                // copy of global UNIX variable errno
     89                int errno_;
     90
     91                // current execution status for coroutine
     92                enum coroutine_state state;
     93                // first coroutine to resume this one
     94                struct coroutine_desc * starter;
     95
     96                // last coroutine to resume this one
     97                struct coroutine_desc * last;
     98
     99                // If non-null stack must be unwound with this exception
     100                struct _Unwind_Exception * cancellation;
     101
     102        };
     103
     104        // struct which calls the monitor is accepting
    90105        struct __waitfor_mask_t {
    91106                // the index of the accepted function, -1 if none
  • libcfa/src/concurrency/kernel.cfa

    rff5caaf r95b8aa7  
    5757//-----------------------------------------------------------------------------
    5858// Global state
    59 thread_local struct KernelThreadData kernelTLS = {
     59thread_local struct KernelThreadData kernelTLS __attribute__ ((tls_model ( "initial-exec" ))) = {
    6060        NULL,
    6161        NULL,
  • libcfa/src/concurrency/kernel_private.hfa

    rff5caaf r95b8aa7  
    7979};
    8080
    81 extern volatile thread_local __cfa_kernel_preemption_state_t preemption_state;
     81extern volatile thread_local __cfa_kernel_preemption_state_t preemption_state __attribute__ ((tls_model ( "initial-exec" )));
    8282
    8383//-----------------------------------------------------------------------------
  • libcfa/src/exception.c

    rff5caaf r95b8aa7  
    246246}
    247247
     248#if defined(PIC)
     249#warning Exceptions not yet supported when using Position-Independent Code
     250__attribute__((noinline))
     251void __cfaabi_ehm__try_terminate(void (*try_block)(),
     252                void (*catch_block)(int index, exception_t * except),
     253                __attribute__((unused)) int (*match_block)(exception_t * except)) {
     254        abort();
     255}
     256#else
    248257// This is our personality routine.  For every stack frame anotated with ".cfi_personality 0x3,__gcfa_personality_v0".
    249258// This function will be called twice when unwinding.  Once in the search phased and once in the cleanup phase.
     
    477486);
    478487#endif // __i386 || __x86_64
     488#endif //PIC
  • libcfa/src/fstream.cfa

    rff5caaf r95b8aa7  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 10 18:19:40 2018
    13 // Update Count     : 284
     12// Last Modified On : Mon Dec 24 18:33:38 2018
     13// Update Count     : 304
    1414//
    1515
     
    2020#include <stdarg.h>                                                                             // varargs
    2121#include <string.h>                                                                             // strlen
    22 #include <stdbool.h>                                                                    // true/false
    2322#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    2423#include <complex.h>                                                                    // creal, cimag
     
    2726#define IO_MSG "I/O error: "
    2827
    29 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, const char * separator, const char * tupleSeparator ) {
     28void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool prt, const char * separator, const char * tupleSeparator ) {
    3029        os.file = file;
    3130        os.sepDefault = sepDefault;
    3231        os.sepOnOff = sepOnOff;
     32        os.nlOnOff = nlOnOff;
     33        os.prt = prt;
    3334        sepSet( os, separator );
    3435        sepSetCur( os, sepGet( os ) );
     
    4445bool getNL( ofstream & os ) { return os.sawNL; }
    4546void setNL( ofstream & os, bool state ) { os.sawNL = state; }
     47bool getANL( ofstream & os ) { return os.nlOnOff; }
     48bool getPrt( ofstream & os ) { return os.prt; }
     49void setPrt( ofstream & os, bool state ) { os.prt = state; }
    4650
    4751// public
     
    7276} // sepEnable
    7377
     78void nlOn( ofstream & os ) { os.nlOnOff = true; }
     79void nlOff( ofstream & os ) { os.nlOnOff = false; }
     80
    7481const char * sepGet( ofstream & os ) { return os.separator; }
    7582void sepSet( ofstream & os, const char * s ) {
     
    103110        } // if
    104111        #endif // __CFA_DEBUG__
    105         (os){ file, true, false, " ", ", " };
     112        (os){ file, true, false, true, false, " ", ", " };
    106113} // open
    107114
     
    143150        va_end( args );
    144151
     152        setPrt( os, true );                                                                     // called in output cascade
    145153        sepReset( os );                                                                         // reset separator
    146154        return len;
    147155} // fmt
    148156
    149 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };
     157static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, true, false, " ", ", " };
    150158ofstream & sout = soutFile;
    151 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };
     159static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, true, false, " ", ", " };
    152160ofstream & serr = serrFile;
    153161
  • libcfa/src/fstream.hfa

    rff5caaf r95b8aa7  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 13:54:27 2018
    13 // Update Count     : 132
     12// Last Modified On : Mon Dec 24 18:33:41 2018
     13// Update Count     : 149
    1414//
    1515
     
    2323        bool sepDefault;
    2424        bool sepOnOff;
     25        bool nlOnOff;
     26        bool prt;                                                                                       // print text
    2527        bool sawNL;
    2628        const char * sepCur;
     
    3739bool getNL( ofstream & );
    3840void setNL( ofstream &, bool );
     41bool getANL( ofstream & );
     42bool getPrt( ofstream & );
     43void setPrt( ofstream &, bool );
    3944
    4045// public
     
    4348bool sepDisable( ofstream & );
    4449bool sepEnable( ofstream & );
     50void nlOn( ofstream & );
     51void nlOff( ofstream & );
    4552
    4653const char * sepGet( ofstream & );
     
    5562void close( ofstream & );
    5663ofstream & write( ofstream &, const char * data, size_t size );
    57 int fmt( ofstream &, const char fmt[], ... );
     64int fmt( ofstream &, const char format[], ... );
    5865
    5966void ?{}( ofstream & os );
     
    7683ifstream & read( ifstream & is, char * data, size_t size );
    7784ifstream & ungetc( ifstream & is, char c );
    78 int fmt( ifstream &, const char fmt[], ... );
     85int fmt( ifstream &, const char format[], ... );
    7986
    8087void ?{}( ifstream & is );
  • libcfa/src/gmp.hfa

    rff5caaf r95b8aa7  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec  7 09:10:41 2017
    13 // Update Count     : 21
     12// Last Modified On : Tue Dec  4 23:25:51 2018
     13// Update Count     : 22
    1414//
    1515
     
    262262} // ?|?
    263263
    264 static inline forall( dtype ostype | ostream( ostype ) )
    265 ostype & ?|?( ostype & os, Int mp ) {
    266         if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    267         gmp_printf( "%Zd", mp.mpz );
    268         sepOn( os );
    269         return os;
    270 } // ?|?
     264static inline forall( dtype ostype | ostream( ostype ) ) {
     265        ostype & ?|?( ostype & os, Int mp ) {
     266                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     267                gmp_printf( "%Zd", mp.mpz );
     268                sepOn( os );
     269                return os;
     270        } // ?|?
     271
     272        void ?|?( ostype & os, Int mp ) {
     273                (ostype)(os | mp); if ( getANL( os ) ) nl( os );
     274        } // ?|?
     275} // distribution
    271276
    272277// Local Variables: //
  • libcfa/src/iostream.cfa

    rff5caaf r95b8aa7  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 13:56:43 2018
    13 // Update Count     : 473
     12// Last Modified On : Mon Dec 24 18:33:40 2018
     13// Update Count     : 589
    1414//
    1515
     
    1919#include <stdio.h>
    2020#include <stdbool.h>                                                                    // true/false
    21 //#include <string.h>                                                                           // strlen, strcmp
     21//#include <string.h>                                                                   // strlen, strcmp
    2222extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
    2323extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
     
    3232                return os;
    3333        } // ?|?
    34 
    35         ostype & ?|?( ostype & os, char ch ) {
    36                 fmt( os, "%c", ch );
    37                 if ( ch == '\n' ) setNL( os, true );
    38                 sepOff( os );
    39                 return os;
    40         } // ?|?
    41 
    42         ostype & ?|?( ostype & os, signed char c ) {
    43                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    44                 fmt( os, "%hhd", c );
    45                 return os;
    46         } // ?|?
    47 
    48         ostype & ?|?( ostype & os, unsigned char c ) {
    49                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    50                 fmt( os, "%hhu", c );
    51                 return os;
     34        void ?|?( ostype & os, bool b ) {
     35                (ostype &)(os | b); nl( os );
     36        } // ?|?
     37
     38        ostype & ?|?( ostype & os, char c ) {
     39                fmt( os, "%c", c );
     40                if ( c == '\n' ) setNL( os, true );
     41                return sepOff( os );
     42        } // ?|?
     43        void ?|?( ostype & os, char c ) {
     44                (ostype &)(os | c); nl( os );
     45        } // ?|?
     46
     47        ostype & ?|?( ostype & os, signed char sc ) {
     48                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     49                fmt( os, "%hhd", sc );
     50                return os;
     51        } // ?|?
     52        void ?|?( ostype & os, signed char sc ) {
     53                (ostype &)(os | sc); nl( os );
     54        } // ?|?
     55
     56        ostype & ?|?( ostype & os, unsigned char usc ) {
     57                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     58                fmt( os, "%hhu", usc );
     59                return os;
     60        } // ?|?
     61        void ?|?( ostype & os, unsigned char usc ) {
     62                (ostype &)(os | usc); nl( os );
    5263        } // ?|?
    5364
     
    5768                return os;
    5869        } // ?|?
     70        void & ?|?( ostype & os, short int si ) {
     71                (ostype &)(os | si); nl( os );
     72        } // ?|?
    5973
    6074        ostype & ?|?( ostype & os, unsigned short int usi ) {
     
    6377                return os;
    6478        } // ?|?
     79        void & ?|?( ostype & os, unsigned short int usi ) {
     80                (ostype &)(os | usi); nl( os );
     81        } // ?|?
    6582
    6683        ostype & ?|?( ostype & os, int i ) {
     
    6986                return os;
    7087        } // ?|?
     88        void & ?|?( ostype & os, int i ) {
     89                (ostype &)(os | i); nl( os );
     90        } // ?|?
    7191
    7292        ostype & ?|?( ostype & os, unsigned int ui ) {
     
    7595                return os;
    7696        } // ?|?
     97        void & ?|?( ostype & os, unsigned int ui ) {
     98                (ostype &)(os | ui); nl( os );
     99        } // ?|?
    77100
    78101        ostype & ?|?( ostype & os, long int li ) {
     
    81104                return os;
    82105        } // ?|?
     106        void & ?|?( ostype & os, long int li ) {
     107                (ostype &)(os | li); nl( os );
     108        } // ?|?
    83109
    84110        ostype & ?|?( ostype & os, unsigned long int uli ) {
     
    87113                return os;
    88114        } // ?|?
     115        void & ?|?( ostype & os, unsigned long int uli ) {
     116                (ostype &)(os | uli); nl( os );
     117        } // ?|?
    89118
    90119        ostype & ?|?( ostype & os, long long int lli ) {
     
    93122                return os;
    94123        } // ?|?
     124        void & ?|?( ostype & os, long long int lli ) {
     125                (ostype &)(os | lli); nl( os );
     126        } // ?|?
    95127
    96128        ostype & ?|?( ostype & os, unsigned long long int ulli ) {
     
    99131                return os;
    100132        } // ?|?
     133        void & ?|?( ostype & os, unsigned long long int ulli ) {
     134                (ostype &)(os | ulli); nl( os );
     135        } // ?|?
    101136
    102137        ostype & ?|?( ostype & os, float f ) {
     
    105140                return os;
    106141        } // ?|?
     142        void & ?|?( ostype & os, float f ) {
     143                (ostype &)(os | f); nl( os );
     144        } // ?|?
    107145
    108146        ostype & ?|?( ostype & os, double d ) {
     
    111149                return os;
    112150        } // ?|?
     151        void & ?|?( ostype & os, double d ) {
     152                (ostype &)(os | d); nl( os );
     153        } // ?|?
    113154
    114155        ostype & ?|?( ostype & os, long double ld ) {
     
    117158                return os;
    118159        } // ?|?
     160        void & ?|?( ostype & os, long double ld ) {
     161                (ostype &)(os | ld); nl( os );
     162        } // ?|?
    119163
    120164        ostype & ?|?( ostype & os, float _Complex fc ) {
     
    123167                return os;
    124168        } // ?|?
     169        void & ?|?( ostype & os, float _Complex fc ) {
     170                (ostype &)(os | fc); nl( os );
     171        } // ?|?
    125172
    126173        ostype & ?|?( ostype & os, double _Complex dc ) {
     
    129176                return os;
    130177        } // ?|?
     178        void & ?|?( ostype & os, double _Complex dc ) {
     179                (ostype &)(os | dc); nl( os );
     180        } // ?|?
    131181
    132182        ostype & ?|?( ostype & os, long double _Complex ldc ) {
     
    134184                fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
    135185                return os;
     186        } // ?|?
     187        void & ?|?( ostype & os, long double _Complex ldc ) {
     188                (ostype &)(os | ldc); nl( os );
    136189        } // ?|?
    137190
     
    174227                return write( os, str, len );
    175228        } // ?|?
     229        void ?|?( ostype & os, const char * str ) {
     230                (ostype &)(os | str); nl( os );
     231        } // ?|?
    176232
    177233//      ostype & ?|?( ostype & os, const char16_t * str ) {
     
    200256                return os;
    201257        } // ?|?
    202 
     258        void ?|?( ostype & os, const void * p ) {
     259                (ostype &)(os | p); nl( os );
     260        } // ?|?
    203261
    204262        // manipulators
    205263        ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    206                 return manip( os );
     264                (ostype &)(manip( os ));
     265                return os;
     266        } // ?|?
     267        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
     268                (ostype &)(manip( os ));
     269                if ( getPrt( os ) ) nl( os );                                   // something printed ?
     270                setPrt( os, false );                                                    // turn off
    207271        } // ?|?
    208272
    209273        ostype & sep( ostype & os ) {
    210                 os | sepGet( os );
    211                 return os;
     274                return (ostype &)(os | sepGet( os ));
    212275        } // sep
    213276
    214277        ostype & sepTuple( ostype & os ) {
    215                 os | sepGetTuple( os );
    216                 return os;
     278                return os | sepGetTuple( os );
    217279        } // sepTuple
    218280
    219         ostype & endl( ostype & os ) {
    220                 os | '\n';
     281        ostype & nl( ostype & os ) {
     282                (ostype &)(os | '\n');
     283                setPrt( os, false );                                                    // turn off
    221284                setNL( os, true );
    222285                flush( os );
    223                 sepOff( os );                                                                   // prepare for next line
    224                 return os;
    225         } // endl
     286                return sepOff( os );                                                    // prepare for next line
     287        } // nl
     288
     289        void nl( ostype & os ) {
     290                if ( getANL( os ) ) (ostype &)(nl( os ));               // implementation only
     291                else setPrt( os, false );                                               // turn off
     292        } // nl
     293
     294        ostype & nonl( ostype & os ) {
     295                setPrt( os, false );                                                    // turn off
     296                return os;
     297        } // nonl
    226298
    227299        ostype & sepOn( ostype & os ) {
    228                 sepOn( os );
     300                sepOn( os );                                                                    // call void returning
    229301                return os;
    230302        } // sepOn
    231303
    232304        ostype & sepOff( ostype & os ) {
    233                 sepOff( os );
     305                sepOff( os );                                                                   // call void returning
    234306                return os;
    235307        } // sepOff
    236308
    237309        ostype & sepEnable( ostype & os ) {
    238                 sepEnable( os );
     310                sepEnable( os );                                                                // call void returning
    239311                return os;
    240312        } // sepEnable
    241313
    242314        ostype & sepDisable( ostype & os ) {
    243                 sepDisable( os );
     315                sepDisable( os );                                                               // call void returning
    244316                return os;
    245317        } // sepDisable
     318
     319        ostype & nlOn( ostype & os ) {
     320                nlOn( os );                                                                             // call void returning
     321                return os;
     322        } // nlOn
     323
     324        ostype & nlOff( ostype & os ) {
     325                nlOff( os );                                                                    // call void returning
     326                return os;
     327        } // nlOff
    246328} // distribution
    247329
    248 
    249330// tuples
    250 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } )
    251 ostype & ?|?( ostype & os, T arg, Params rest ) {
    252         os | arg;                                                                                       // print first argument
    253         sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    254         os | rest;                                                                                      // print remaining arguments
    255         sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
    256         return os;
    257 } // ?|?
     331forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     332        ostype & ?|?( ostype & os, T arg, Params rest ) {
     333                (ostype &)(os | arg);                                                   // print first argument
     334                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     335                (ostype &)(os | rest);                                                  // print remaining arguments
     336                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     337                return os;
     338        } // ?|?
     339        void ?|?( ostype & os, T arg, Params rest ) {
     340                // (ostype &)(?|?( os, arg, rest )); nl( os );
     341                (ostype &)(os | arg);                                                   // print first argument
     342                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     343                (ostype &)(os | rest);                                                  // print remaining arguments
     344                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     345                nl( os );
     346        } // ?|?
     347} // distribution
    258348
    259349//---------------------------------------
    260350
    261351// writes the range [begin, end) to the given stream
    262 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    263 void write( iterator_type begin, iterator_type end, ostype & os ) {
    264         void print( elt_type i ) { os | i; }
    265         for_each( begin, end, print );
    266 } // ?|?
    267 
    268 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    269 void write_reverse( iterator_type begin, iterator_type end, ostype & os ) {
    270         void print( elt_type i ) { os | i; }
    271         for_each_reverse( begin, end, print );
    272 } // ?|?
     352forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     353        void write( iterator_type begin, iterator_type end, ostype & os ) {
     354                void print( elt_type i ) { os | i; }
     355                for_each( begin, end, print );
     356        } // ?|?
     357
     358        void write_reverse( iterator_type begin, iterator_type end, ostype & os ) {
     359                void print( elt_type i ) { os | i; }
     360                for_each_reverse( begin, end, print );
     361        } // ?|?
     362} // distribution
    273363
    274364//---------------------------------------
     
    386476        } // ?|?
    387477
    388         istype & endl( istype & is ) {
     478        istype & nl( istype & is ) {
    389479                fmt( is, "%*[ \t\f\n\r\v]" );                                   // ignore whitespace
    390480                return is;
    391         } // endl
     481        } // nl
    392482} // distribution
    393483
     
    410500// Local Variables: //
    411501// tab-width: 4 //
    412 // compile-command: "cfa iostream.c" //
     502// compile-command: "cfa iostream.cfa" //
    413503// End: //
  • libcfa/src/iostream.hfa

    rff5caaf r95b8aa7  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 08:22:49 2018
    13 // Update Count     : 156
     12// Last Modified On : Mon Dec 24 18:33:40 2018
     13// Update Count     : 220
    1414//
    1515
     
    2020trait ostream( dtype ostype ) {
    2121        // private
    22         bool sepPrt( ostype & );                                                        // return separator state (on/off)
     22        bool sepPrt( ostype & );                                                        // get separator state (on/off)
    2323        void sepReset( ostype & );                                                      // set separator state to default state
    2424        void sepReset( ostype &, bool );                                        // set separator and default state
    2525        const char * sepGetCur( ostype & );                                     // get current separator string
    2626        void sepSetCur( ostype &, const char * );                       // set current separator string
    27         bool getNL( ostype & );                                                 // check newline
     27        bool getNL( ostype & );                                                         // check newline
    2828        void setNL( ostype &, bool );                                           // saw newline
     29        bool getANL( ostype & );                                                        // get auto newline (on/off)
     30        bool getPrt( ostype & );                                                        // get fmt called in output cascade
     31        void setPrt( ostype &, bool );                                          // set fmt called in output cascade
    2932        // public
    3033        void sepOn( ostype & );                                                         // turn separator state on
    3134        void sepOff( ostype & );                                                        // turn separator state off
    3235        bool sepDisable( ostype & );                                            // set default state to off, and return previous state
    33         bool sepEnable( ostype & );                                             // set default state to on, and return previous state
     36        bool sepEnable( ostype & );                                                     // set default state to on, and return previous state
     37        void nlOn( ostype & );                                                          // turn auto-newline state on
     38        void nlOff( ostype & );                                                         // turn auto-newline state off
    3439
    3540        const char * sepGet( ostype & );                                        // get separator string
     
    4348        void close( ostype & os );
    4449        ostype & write( ostype &, const char *, size_t );
    45         int fmt( ostype &, const char fmt[], ... );
     50        int fmt( ostype &, const char format[], ... );
    4651}; // ostream
    4752
     
    5863forall( dtype ostype | ostream( ostype ) ) {
    5964        ostype & ?|?( ostype &, bool );
     65        void ?|?( ostype &, bool );
    6066
    6167        ostype & ?|?( ostype &, char );
     68        void ?|?( ostype &, char );
    6269        ostype & ?|?( ostype &, signed char );
     70        void ?|?( ostype &, signed char );
    6371        ostype & ?|?( ostype &, unsigned char );
     72        void ?|?( ostype &, unsigned char );
    6473
    6574        ostype & ?|?( ostype &, short int );
     75        void ?|?( ostype &, short int );
    6676        ostype & ?|?( ostype &, unsigned short int );
     77        void ?|?( ostype &, unsigned short int );
    6778        ostype & ?|?( ostype &, int );
     79        void ?|?( ostype &, int );
    6880        ostype & ?|?( ostype &, unsigned int );
     81        void ?|?( ostype &, unsigned int );
    6982        ostype & ?|?( ostype &, long int );
     83        void ?|?( ostype &, long int );
    7084        ostype & ?|?( ostype &, long long int );
     85        void ?|?( ostype &, long long int );
    7186        ostype & ?|?( ostype &, unsigned long int );
     87        void ?|?( ostype &, unsigned long int );
    7288        ostype & ?|?( ostype &, unsigned long long int );
     89        void ?|?( ostype &, unsigned long long int );
    7390
    7491        ostype & ?|?( ostype &, float ); // FIX ME: should not be required
     92        void ?|?( ostype &, float ); // FIX ME: should not be required
    7593        ostype & ?|?( ostype &, double );
     94        void ?|?( ostype &, double );
    7695        ostype & ?|?( ostype &, long double );
     96        void ?|?( ostype &, long double );
    7797
    7898        ostype & ?|?( ostype &, float _Complex );
     99        void ?|?( ostype &, float _Complex );
    79100        ostype & ?|?( ostype &, double _Complex );
     101        void ?|?( ostype &, double _Complex );
    80102        ostype & ?|?( ostype &, long double _Complex );
     103        void ?|?( ostype &, long double _Complex );
    81104
    82105        ostype & ?|?( ostype &, const char * );
     106        void ?|?( ostype &, const char * );
    83107        // ostype & ?|?( ostype &, const char16_t * );
    84108#if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
     
    87111        // ostype & ?|?( ostype &, const wchar_t * );
    88112        ostype & ?|?( ostype &, const void * );
     113        void ?|?( ostype &, const void * );
    89114
    90115        // manipulators
    91116        ostype & ?|?( ostype &, ostype & (*)( ostype & ) );
    92         ostype & endl( ostype & );
     117        void ?|?( ostype &, ostype & (*)( ostype & ) );
     118        ostype & nl( ostype & );
     119        void nl( ostype & );
     120        ostype & nonl( ostype & );
    93121        ostype & sep( ostype & );
    94122        ostype & sepTuple( ostype & );
     
    97125        ostype & sepDisable( ostype & );
    98126        ostype & sepEnable( ostype & );
     127        ostype & nlOn( ostype & );
     128        ostype & nlOff( ostype & );
    99129} // distribution
    100130
    101131// tuples
    102 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } )
    103 ostype & ?|?( ostype & os, T arg, Params rest );
     132forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     133        ostype & ?|?( ostype & os, T arg, Params rest );
     134        void ?|?( ostype & os, T arg, Params rest );
     135} // distribution
    104136
    105137// writes the range [begin, end) to the given stream
    106 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    107 void write( iterator_type begin, iterator_type end, ostype & os );
    108 
    109 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    110 void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     138forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     139        void write( iterator_type begin, iterator_type end, ostype & os );
     140        void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     141} // distribution
    111142
    112143//---------------------------------------
     
    119150        istype & read( istype &, char *, size_t );
    120151        istype & ungetc( istype &, char );
    121         int fmt( istype &, const char fmt[], ... );
     152        int fmt( istype &, const char format[], ... );
    122153}; // istream
    123154
     
    152183        // manipulators
    153184        istype & ?|?( istype &, istype & (*)( istype & ) );
    154         istype & endl( istype & is );
     185        istype & nl( istype & is );
    155186} // distribution
    156187
     
    164195
    165196
    166 #include <time_t.hfa>                                                                           // Duration (constructors) / Time (constructors)
    167 
    168 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Duration dur );
    169 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Time time );
    170 
     197#include <time_t.hfa>                                                                   // Duration (constructors) / Time (constructors)
     198
     199forall( dtype ostype | ostream( ostype ) ) {
     200        ostype & ?|?( ostype & os, Duration dur );
     201        void ?|?( ostype & os, Duration dur );
     202        ostype & ?|?( ostype & os, Time time );
     203        void ?|?( ostype & os, Time time );
     204} // distribution
    171205
    172206// Local Variables: //
  • libcfa/src/iterator.cfa

    rff5caaf r95b8aa7  
    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 : Fri Nov  2 07:17:37 2018
     13// Update Count     : 29
    1414//
    1515
     
    3333// Local Variables: //
    3434// tab-width: 4 //
    35 // compile-command: "cfa iterator.c" //
     35// compile-command: "cfa iterator.cfa" //
    3636// End: //
  • libcfa/src/rational.cfa

    rff5caaf r95b8aa7  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun  2 09:24:33 2018
    13 // Update Count     : 162
     12// Last Modified On : Sun Dec 23 22:56:49 2018
     13// Update Count     : 170
    1414//
    1515
     
    3535        static RationalImpl simplify( RationalImpl & n, RationalImpl & d ) {
    3636                if ( d == (RationalImpl){0} ) {
    37                         serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl;
     37                        serr | "Invalid rational number construction: denominator cannot be equal to 0.";
    3838                        exit( EXIT_FAILURE );
    3939                } // exit
     
    175175        } // ?|?
    176176
    177         forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } )
    178         ostype & ?|?( ostype & os, Rational(RationalImpl ) r ) {
    179                 return os | r.numerator | '/' | r.denominator;
    180         } // ?|?
     177        forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } ) {
     178                ostype & ?|?( ostype & os, Rational(RationalImpl) r ) {
     179                        return os | r.numerator | '/' | r.denominator;
     180                } // ?|?
     181
     182                void ?|?( ostype & os, Rational(RationalImpl) r ) {
     183                        (ostype &)(os | r); nl( os );
     184                } // ?|?
     185        } // distribution
    181186} // distribution
    182187
  • libcfa/src/rational.hfa

    rff5caaf r95b8aa7  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Sat Jun  2 09:10:01 2018
    15 // Update Count     : 105
     14// Last Modified On : Tue Dec  4 23:07:46 2018
     15// Update Count     : 106
    1616//
    1717
     
    9292        istype & ?|?( istype &, Rational(RationalImpl) & );
    9393
    94         forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } )
    95         ostype & ?|?( ostype &, Rational(RationalImpl ) );
     94        forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } ) {
     95                ostype & ?|?( ostype &, Rational(RationalImpl) );
     96                void ?|?( ostype &, Rational(RationalImpl) );
     97        } // distribution
    9698} // distribution
    9799
  • libcfa/src/stdlib.hfa

    rff5caaf r95b8aa7  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 27 07:21:36 2018
    13 // Update Count     : 345
     12// Last Modified On : Mon Dec 17 15:37:45 2018
     13// Update Count     : 346
    1414//
    1515
     
    178178
    179179static inline {
    180         int ato( const char * sptr ) {return (int)strtol( sptr, 0, 10 ); }
     180        int ato( const char * sptr ) { return (int)strtol( sptr, 0, 10 ); }
    181181        unsigned int ato( const char * sptr ) { return (unsigned int)strtoul( sptr, 0, 10 ); }
    182182        long int ato( const char * sptr ) { return strtol( sptr, 0, 10 ); }
  • libcfa/src/time.cfa

    rff5caaf r95b8aa7  
    1010// Created On       : Tue Mar 27 13:33:14 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May  6 22:26:00 2018
    13 // Update Count     : 37
     12// Last Modified On : Sun Dec 23 22:57:48 2018
     13// Update Count     : 57
    1414//
    1515
     
    3131
    3232
    33 forall( dtype ostype | ostream( ostype ) )
    34 ostype & ?|?( ostype & os, Duration dur ) with( dur ) {
    35         os | tv / TIMEGRAN;                                                                     // print seconds
    36         long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;           // compute nanoseconds
    37         if ( ns != 0 ) {                                                                        // some ?
    38                 char buf[16];
    39                 os | nanomsd( ns, buf );                                                // print nanoseconds
    40         } // if
    41         return os;
    42 } // ?|?
     33forall( dtype ostype | ostream( ostype ) ) {
     34        ostype & ?|?( ostype & os, Duration dur ) with( dur ) {
     35                (ostype &)(os | tv / TIMEGRAN);                                 // print seconds
     36                long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;   // compute nanoseconds
     37                if ( ns != 0 ) {                                                                // some ?
     38                        char buf[16];
     39                        (ostype &)(os | nanomsd( ns, buf ));                    // print nanoseconds
     40                } // if
     41                return os;
     42        } // ?|?
     43
     44        void ?|?( ostype & os, Duration dur ) with( dur ) {
     45                (ostype &)(os | dur); nl( os );
     46        } // ?|?
     47} // distribution
    4348
    4449
     
    137142} // strftime
    138143
    139 forall( dtype ostype | ostream( ostype ) )
    140 ostype & ?|?( ostype & os, Time time ) with( time ) {
    141         char buf[32];                                                                           // at least 26
    142         time_t s = tv / TIMEGRAN;
    143     ctime_r( &s, (char *)&buf );                                                // 26 characters: "Wed Jun 30 21:49:08 1993\n"
    144         buf[24] = '\0';                                                                         // remove trailing '\n'
    145         long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;           // compute nanoseconds
    146         if ( ns == 0 ) {                                                                        // none ?
    147                 os | buf;                                                                               // print date/time/year
    148         } else {
    149                 buf[19] = '\0';                                                                 // truncate to "Wed Jun 30 21:49:08"
    150                 os | buf;                                                                               // print date/time
    151                 char buf2[16];
    152                 nanomsd( ns, buf2 );                                                    // compute nanoseconds
    153                 os | buf2 | ' ' | &buf[20];                                             // print nanoseconds and year
    154         } // if
    155         return os;
    156 } // ?|?
     144forall( dtype ostype | ostream( ostype ) ) {
     145        ostype & ?|?( ostype & os, Time time ) with( time ) {
     146                char buf[32];                                                                   // at least 26
     147                time_t s = tv / TIMEGRAN;
     148                ctime_r( &s, (char *)&buf );                                    // 26 characters: "Wed Jun 30 21:49:08 1993\n"
     149                buf[24] = '\0';                                                                 // remove trailing '\n'
     150                long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;   // compute nanoseconds
     151                if ( ns == 0 ) {                                                                // none ?
     152                        (ostype &)(os | buf);                                                   // print date/time/year
     153                } else {
     154                        buf[19] = '\0';                                                         // truncate to "Wed Jun 30 21:49:08"
     155                        char buf2[16];
     156                        nanomsd( ns, buf2 );                                            // compute nanoseconds
     157                        (ostype &)(os | buf | buf2 | ' ' | &buf[20]);   // print date/time, nanoseconds and year
     158                } // if
     159                return os;
     160        } // ?|?
     161
     162        void ?|?( ostype & os, Time time ) with( time ) {
     163                (ostype &)(os | time); nl( os );
     164        } // ?|?
     165} // distribution
    157166
    158167// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.