Changeset 95b8aa7 for libcfa/src
- Timestamp:
- Jan 11, 2019, 3:36:48 PM (7 years ago)
- 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. - Location:
- libcfa/src
- Files:
-
- 19 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/Makefile.am
rff5caaf r95b8aa7 17 17 # create object files in directory with source files 18 18 AUTOMAKE_OPTIONS = foreign subdir-objects 19 A RFLAGS = cr19 ACLOCAL_AMFLAGS = -I automake 20 20 21 21 include $(srcdir)/../../src/cfa.make 22 22 23 23 libdir = ${CFA_LIBDIR} 24 lib_L IBRARIES = libcfa.a24 lib_LTLIBRARIES = libcfa.la 25 25 26 26 VPATH += :../prelude … … 31 31 # The built sources must not depend on the installed headers 32 32 AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@ 33 AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@33 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@ 34 34 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@ 35 35 CFACC = @CFACC@ … … 37 37 #---------------------------------------------------------------------------------------------------------------- 38 38 if BUILDLIB 39 headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa 39 40 headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \ 40 41 containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa 41 42 42 headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa43 44 43 # not all platforms support concurrency, add option do disable it 44 headers_nosrc += concurrency/invoke.h 45 45 headers += concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa 46 47 headers_nosrc += concurrency/invoke.h48 46 49 47 libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa} … … 63 61 64 62 # add dependency of cfa files 65 libobjs = $(addsuffix . o, $(basename $(filter %.cfa,$(libsrc))))63 libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc)))) 66 64 $(libobjs) : @CFACC@ @CFACPP@ prelude.cfa 67 65 … … 70 68 libdeps = $(join \ 71 69 $(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \ 72 $(notdir ${libobjs:. o=.Po}) \70 $(notdir ${libobjs:.lo=.Plo}) \ 73 71 ) 74 72 … … 76 74 77 75 prelude.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 ${@} 79 77 78 prelude.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 ${@} 80 81 81 82 82 83 #---------------------------------------------------------------------------------------------------------------- 83 libcfa_a_SOURCES = prelude.cfa ${libsrc} 84 libcfa_la_SOURCES = prelude.cfa ${libsrc} 85 libcfa_la_LDFLAGS = -version-info @CFA_VERSION@ 84 86 85 stdhdr = $ {shell find ${srcdir}/stdhdr -type f -printf "%p "}87 stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ") 86 88 87 89 cfa_includedir = $(CFA_INCDIR) -
libcfa/src/Makefile.in
rff5caaf r95b8aa7 90 90 PRE_UNINSTALL = : 91 91 POST_UNINSTALL = : 92 build_triplet = @build@ 93 host_triplet = @host@ 92 94 subdir = src 93 95 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 94 am__aclocal_m4_deps = $(top_srcdir)/../automake/cfa.m4 \ 95 $(top_srcdir)/configure.ac 96 am__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 96 102 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 97 103 $(ACLOCAL_M4) … … 129 135 } 130 136 am__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 \ 137 LTLIBRARIES = $(lib_LTLIBRARIES) 138 libcfa_la_LIBADD = 139 am__libcfa_la_SOURCES_DIST = prelude.cfa startup.cfa interpose.cfa \ 140 140 bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa \ 141 141 fstream.cfa iostream.cfa iterator.cfa limits.cfa rational.cfa \ … … 148 148 concurrency/invoke.c concurrency/preemption.cfa 149 149 am__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 163 am_libcfa_la_OBJECTS = prelude.lo $(am__objects_2) 164 libcfa_la_OBJECTS = $(am_libcfa_la_OBJECTS) 165 AM_V_lt = $(am__v_lt_@AM_V@) 166 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) 167 am__v_lt_0 = --silent 168 am__v_lt_1 = 169 libcfa_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 170 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 171 $(libcfa_la_LDFLAGS) $(LDFLAGS) -o $@ 173 172 AM_V_P = $(am__v_P_@AM_V@) 174 173 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) … … 184 183 am__v_at_1 = 185 184 DEFAULT_INCLUDES = -I.@am__isrc@ 186 depcomp = $(SHELL) $(top_srcdir)/ ./automake/depcomp185 depcomp = $(SHELL) $(top_srcdir)/automake/depcomp 187 186 am__depfiles_maybe = depfiles 188 187 am__mv = mv -f 189 188 CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 190 189 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) 190 LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ 191 $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \ 192 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 193 $(AM_CCASFLAGS) $(CCASFLAGS) 191 194 AM_V_CPPAS = $(am__v_CPPAS_@AM_V@) 192 195 am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@) … … 195 198 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 196 199 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 200 LTCOMPILE = $(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) 197 204 AM_V_CC = $(am__v_CC_@AM_V@) 198 205 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) … … 200 207 am__v_CC_1 = 201 208 CCLD = $(CC) 202 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 209 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 210 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 211 $(AM_LDFLAGS) $(LDFLAGS) -o $@ 203 212 AM_V_CCLD = $(am__v_CCLD_@AM_V@) 204 213 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) 205 214 am__v_CCLD_0 = @echo " CCLD " $@; 206 215 am__v_CCLD_1 = 207 SOURCES = $(libcfa_ a_SOURCES)208 DIST_SOURCES = $(am__libcfa_ a_SOURCES_DIST)216 SOURCES = $(libcfa_la_SOURCES) 217 DIST_SOURCES = $(am__libcfa_la_SOURCES_DIST) 209 218 am__can_run_installinfo = \ 210 219 case $$AM_UPDATE_INFO_DIR in \ … … 212 221 *) (install-info --version) >/dev/null 2>&1;; \ 213 222 esac 214 am__nobase_cfa_include_HEADERS_DIST = $ {shell find ${srcdir}/stdhdr \215 -type f -printf "%p " }fstream.hfa iostream.hfa iterator.hfa \223 am__nobase_cfa_include_HEADERS_DIST = $(shell find $(srcdir)/stdhdr \ 224 -type f -printf "%p ") fstream.hfa iostream.hfa iterator.hfa \ 216 225 limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \ 217 226 containers/maybe.hfa containers/pair.hfa containers/result.hfa \ … … 242 251 CTAGS = ctags 243 252 am__DIST_COMMON = $(srcdir)/../../src/cfa.make $(srcdir)/Makefile.in \ 244 $(top_srcdir)/ ./automake/depcomp253 $(top_srcdir)/automake/depcomp 245 254 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 246 255 VPATH = @srcdir@ :../prelude … … 248 257 AMTAR = @AMTAR@ 249 258 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 259 AR = @AR@ 250 260 ARCHITECTURE = @ARCHITECTURE@ 251 261 ARCH_FLAGS = @ARCH_FLAGS@ … … 266 276 CFA_NAME = @CFA_NAME@ 267 277 CFA_PREFIX = @CFA_PREFIX@ 278 CFA_VERSION = @CFA_VERSION@ 268 279 CFLAGS = @CFLAGS@ 269 280 CONFIGURATION = @CONFIGURATION@ … … 271 282 CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@ 272 283 CONFIG_CFLAGS = @CONFIG_CFLAGS@ 284 CPP = @CPP@ 273 285 CPPFLAGS = @CPPFLAGS@ 274 286 CXX = @CXX@ 287 CXXCPP = @CXXCPP@ 275 288 CXXDEPMODE = @CXXDEPMODE@ 276 289 CXXFLAGS = @CXXFLAGS@ … … 278 291 DEFS = @DEFS@ 279 292 DEPDIR = @DEPDIR@ 293 DLLTOOL = @DLLTOOL@ 280 294 DRIVER_DIR = @DRIVER_DIR@ 295 DSYMUTIL = @DSYMUTIL@ 296 DUMPBIN = @DUMPBIN@ 281 297 ECHO_C = @ECHO_C@ 282 298 ECHO_N = @ECHO_N@ 283 299 ECHO_T = @ECHO_T@ 300 EGREP = @EGREP@ 284 301 EXEEXT = @EXEEXT@ 302 FGREP = @FGREP@ 303 GREP = @GREP@ 285 304 INSTALL = @INSTALL@ 286 305 INSTALL_DATA = @INSTALL_DATA@ … … 288 307 INSTALL_SCRIPT = @INSTALL_SCRIPT@ 289 308 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 309 LD = @LD@ 290 310 LDFLAGS = @LDFLAGS@ 291 311 LIBOBJS = @LIBOBJS@ 292 312 LIBS = @LIBS@ 313 LIBTOOL = @LIBTOOL@ 314 LIPO = @LIPO@ 315 LN_S = @LN_S@ 293 316 LTLIBOBJS = @LTLIBOBJS@ 317 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 294 318 MAKEINFO = @MAKEINFO@ 319 MANIFEST_TOOL = @MANIFEST_TOOL@ 295 320 MKDIR_P = @MKDIR_P@ 321 NM = @NM@ 322 NMEDIT = @NMEDIT@ 323 OBJDUMP = @OBJDUMP@ 296 324 OBJEXT = @OBJEXT@ 325 OTOOL = @OTOOL@ 326 OTOOL64 = @OTOOL64@ 297 327 PACKAGE = @PACKAGE@ 298 328 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ … … 304 334 PATH_SEPARATOR = @PATH_SEPARATOR@ 305 335 RANLIB = @RANLIB@ 336 SED = @SED@ 306 337 SET_MAKE = @SET_MAKE@ 307 338 SHELL = @SHELL@ … … 312 343 abs_top_builddir = @abs_top_builddir@ 313 344 abs_top_srcdir = @abs_top_srcdir@ 345 ac_ct_AR = @ac_ct_AR@ 314 346 ac_ct_CC = @ac_ct_CC@ 315 347 ac_ct_CXX = @ac_ct_CXX@ 348 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 316 349 am__include = @am__include@ 317 350 am__leading_dot = @am__leading_dot@ … … 320 353 am__untar = @am__untar@ 321 354 bindir = @bindir@ 355 build = @build@ 322 356 build_alias = @build_alias@ 357 build_cpu = @build_cpu@ 358 build_os = @build_os@ 359 build_vendor = @build_vendor@ 323 360 builddir = @builddir@ 324 361 datadir = @datadir@ … … 327 364 dvidir = @dvidir@ 328 365 exec_prefix = @exec_prefix@ 366 host = @host@ 329 367 host_alias = @host_alias@ 368 host_cpu = @host_cpu@ 369 host_os = @host_os@ 370 host_vendor = @host_vendor@ 330 371 htmldir = @htmldir@ 331 372 includedir = @includedir@ … … 355 396 # create object files in directory with source files 356 397 AUTOMAKE_OPTIONS = foreign subdir-objects 357 A RFLAGS = cr398 ACLOCAL_AMFLAGS = -I automake 358 399 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS) 400 LTCFACOMPILE = $(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 359 405 AM_V_CFA = $(am__v_CFA_@AM_V@) 360 406 am__v_CFA_ = $(am__v_CFA_@AM_DEFAULT_V@) 361 407 am__v_CFA_0 = @echo " CFA " $@; 362 408 am__v_CFA_1 = 363 lib_LIBRARIES = libcfa.a 409 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 410 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 411 am__v_JAVAC_0 = @echo " JAVAC " $@; 412 am__v_JAVAC_1 = 413 AM_V_GOC = $(am__v_GOC_@AM_V@) 414 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 415 am__v_GOC_0 = @echo " GOC " $@; 416 am__v_GOC_1 = 417 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) 418 AM_V_UPP = $(am__v_UPP_@AM_V@) 419 am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@) 420 am__v_UPP_0 = @echo " UPP " $@; 421 am__v_UPP_1 = 422 lib_LTLIBRARIES = libcfa.la 364 423 365 424 # AM_CFLAGS for all cfa source … … 368 427 # The built sources must not depend on the installed headers 369 428 AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@ 370 AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@429 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@ 371 430 AM_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 372 440 @BUILDLIB_FALSE@headers = 373 374 #----------------------------------------------------------------------------------------------------------------375 376 # not all platforms support concurrency, add option do disable it377 441 @BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa \ 378 442 @BUILDLIB_TRUE@ limits.hfa rational.hfa time.hfa stdlib.hfa \ … … 382 446 @BUILDLIB_TRUE@ concurrency/thread.hfa concurrency/kernel.hfa \ 383 447 @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.h389 448 @BUILDLIB_FALSE@libsrc = 390 449 … … 402 461 403 462 # add dependency of cfa files 404 libobjs = $(addsuffix . o, $(basename $(filter %.cfa,$(libsrc))))463 libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc)))) 405 464 406 465 # .deps inclusion is not done automatically by automake for new languages 407 466 libdeps = $(join \ 408 467 $(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \ 409 $(notdir ${libobjs:. o=.Po}) \468 $(notdir ${libobjs:.lo=.Plo}) \ 410 469 ) 411 470 412 471 413 472 #---------------------------------------------------------------------------------------------------------------- 414 libcfa_a_SOURCES = prelude.cfa ${libsrc} 415 stdhdr = ${shell find ${srcdir}/stdhdr -type f -printf "%p "} 473 libcfa_la_SOURCES = prelude.cfa ${libsrc} 474 libcfa_la_LDFLAGS = -version-info @CFA_VERSION@ 475 stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ") 416 476 cfa_includedir = $(CFA_INCDIR) 417 477 nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc} … … 419 479 420 480 .SUFFIXES: 421 .SUFFIXES: .S .c .cfa . o .obj481 .SUFFIXES: .S .c .cfa .lo .o .obj 422 482 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../../src/cfa.make $(am__configure_deps) 423 483 @for dep in $?; do \ … … 450 510 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 451 511 $(am__aclocal_m4_deps): 452 install-libLIBRARIES: $(lib_LIBRARIES) 512 513 install-libLTLIBRARIES: $(lib_LTLIBRARIES) 453 514 @$(NORMAL_INSTALL) 454 @list='$(lib_L IBRARIES)'; test -n "$(libdir)" || list=; \515 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ 455 516 list2=; for p in $$list; do \ 456 517 if test -f $$p; then \ … … 461 522 echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ 462 523 $(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 528 uninstall-libLTLIBRARIES: 529 @$(NORMAL_UNINSTALL) 530 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ 467 531 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"; \ 473 535 done 474 536 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) 537 clean-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 } 483 547 bits/$(am__dirstamp): 484 548 @$(MKDIR_P) bits … … 487 551 @$(MKDIR_P) bits/$(DEPDIR) 488 552 @: > bits/$(DEPDIR)/$(am__dirstamp) 489 bits/debug.$(OBJEXT): bits/$(am__dirstamp) \ 490 bits/$(DEPDIR)/$(am__dirstamp) 553 bits/debug.lo: bits/$(am__dirstamp) bits/$(DEPDIR)/$(am__dirstamp) 491 554 containers/$(am__dirstamp): 492 555 @$(MKDIR_P) containers … … 495 558 @$(MKDIR_P) containers/$(DEPDIR) 496 559 @: > containers/$(DEPDIR)/$(am__dirstamp) 497 containers/maybe. $(OBJEXT): containers/$(am__dirstamp) \560 containers/maybe.lo: containers/$(am__dirstamp) \ 498 561 containers/$(DEPDIR)/$(am__dirstamp) 499 containers/pair. $(OBJEXT): containers/$(am__dirstamp) \562 containers/pair.lo: containers/$(am__dirstamp) \ 500 563 containers/$(DEPDIR)/$(am__dirstamp) 501 containers/result. $(OBJEXT): containers/$(am__dirstamp) \564 containers/result.lo: containers/$(am__dirstamp) \ 502 565 containers/$(DEPDIR)/$(am__dirstamp) 503 containers/vector. $(OBJEXT): containers/$(am__dirstamp) \566 containers/vector.lo: containers/$(am__dirstamp) \ 504 567 containers/$(DEPDIR)/$(am__dirstamp) 505 568 concurrency/$(am__dirstamp): … … 509 572 @$(MKDIR_P) concurrency/$(DEPDIR) 510 573 @: > concurrency/$(DEPDIR)/$(am__dirstamp) 511 concurrency/coroutine. $(OBJEXT): concurrency/$(am__dirstamp) \574 concurrency/coroutine.lo: concurrency/$(am__dirstamp) \ 512 575 concurrency/$(DEPDIR)/$(am__dirstamp) 513 concurrency/thread. $(OBJEXT): concurrency/$(am__dirstamp) \576 concurrency/thread.lo: concurrency/$(am__dirstamp) \ 514 577 concurrency/$(DEPDIR)/$(am__dirstamp) 515 concurrency/kernel. $(OBJEXT): concurrency/$(am__dirstamp) \578 concurrency/kernel.lo: concurrency/$(am__dirstamp) \ 516 579 concurrency/$(DEPDIR)/$(am__dirstamp) 517 concurrency/monitor. $(OBJEXT): concurrency/$(am__dirstamp) \580 concurrency/monitor.lo: concurrency/$(am__dirstamp) \ 518 581 concurrency/$(DEPDIR)/$(am__dirstamp) 519 concurrency/mutex. $(OBJEXT): concurrency/$(am__dirstamp) \582 concurrency/mutex.lo: concurrency/$(am__dirstamp) \ 520 583 concurrency/$(DEPDIR)/$(am__dirstamp) 521 concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT): \ 522 concurrency/$(am__dirstamp) \ 584 concurrency/CtxSwitch-@ARCHITECTURE@.lo: concurrency/$(am__dirstamp) \ 523 585 concurrency/$(DEPDIR)/$(am__dirstamp) 524 concurrency/alarm. $(OBJEXT): concurrency/$(am__dirstamp) \586 concurrency/alarm.lo: concurrency/$(am__dirstamp) \ 525 587 concurrency/$(DEPDIR)/$(am__dirstamp) 526 concurrency/invoke. $(OBJEXT): concurrency/$(am__dirstamp) \588 concurrency/invoke.lo: concurrency/$(am__dirstamp) \ 527 589 concurrency/$(DEPDIR)/$(am__dirstamp) 528 concurrency/preemption. $(OBJEXT): concurrency/$(am__dirstamp) \590 concurrency/preemption.lo: concurrency/$(am__dirstamp) \ 529 591 concurrency/$(DEPDIR)/$(am__dirstamp) 530 592 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 593 libcfa.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) 535 595 536 596 mostlyclean-compile: 537 597 -rm -f *.$(OBJEXT) 538 598 -rm -f bits/*.$(OBJEXT) 599 -rm -f bits/*.lo 539 600 -rm -f concurrency/*.$(OBJEXT) 601 -rm -f concurrency/*.lo 540 602 -rm -f containers/*.$(OBJEXT) 603 -rm -f containers/*.lo 541 604 542 605 distclean-compile: 543 606 -rm -f *.tab.c 544 607 545 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.P o@am__quote@546 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.P o@am__quote@547 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.P o@am__quote@548 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/invoke.P o@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@ 549 612 550 613 .S.o: … … 564 627 @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 565 628 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 566 637 .c.o: 567 638 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ … … 579 650 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 580 651 @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 661 mostlyclean-libtool: 662 -rm -f *.lo 663 664 clean-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 581 669 install-nobase_cfa_includeHEADERS: $(nobase_cfa_include_HEADERS) 582 670 @$(NORMAL_INSTALL) … … 688 776 check-am: all-am 689 777 check: check-am 690 all-am: Makefile $(L IBRARIES) $(HEADERS)778 all-am: Makefile $(LTLIBRARIES) $(HEADERS) 691 779 installdirs: 692 780 for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cfa_includedir)"; do \ … … 731 819 clean: clean-am 732 820 733 clean-am: clean-generic clean-libLIBRARIES mostlyclean-am 821 clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ 822 mostlyclean-am 734 823 735 824 distclean: distclean-am … … 757 846 install-dvi-am: 758 847 759 install-exec-am: install-libL IBRARIES848 install-exec-am: install-libLTLIBRARIES 760 849 761 850 install-html: install-html-am … … 787 876 mostlyclean: mostlyclean-am 788 877 789 mostlyclean-am: mostlyclean-compile mostlyclean-generic 878 mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 879 mostlyclean-libtool 790 880 791 881 pdf: pdf-am … … 797 887 ps-am: 798 888 799 uninstall-am: uninstall-libL IBRARIES \889 uninstall-am: uninstall-libLTLIBRARIES \ 800 890 uninstall-nobase_cfa_includeHEADERS 801 891 … … 803 893 804 894 .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 \ 811 902 install-nobase_cfa_includeHEADERS install-pdf install-pdf-am \ 812 903 install-ps install-ps-am install-strip installcheck \ 813 904 installcheck-am installdirs maintainer-clean \ 814 905 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_includeHEADERS906 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 818 909 819 910 .PRECIOUS: Makefile … … 824 915 $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 825 916 $(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 826 922 $(libobjs) : @CFACC@ @CFACPP@ prelude.cfa 827 923 … … 829 925 830 926 prelude.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 929 prelude.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 ${@} 832 932 833 933 #---------------------------------------------------------------------------------------------------------------- -
libcfa/src/bits/locks.hfa
rff5caaf r95b8aa7 37 37 #endif 38 38 39 #if defined( __i386 ) || defined( __x86_64 ) || defined( __ARM_ARCH )40 // Intel recommendation41 #define __ALIGN__ __attribute__(( aligned (128) ))42 #elif defined( __sparc )43 #define __ALIGN__ CALIGN44 #else45 #error unsupported architecture46 #endif47 48 39 struct __spinlock_t { 49 40 // 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; 54 42 #ifdef __CFA_DEBUG__ 55 43 // previous function to acquire the lock … … 58 46 void* prev_thrd; 59 47 #endif 60 } __ALIGN__;48 }; 61 49 62 50 #ifdef __cforall -
libcfa/src/concurrency/coroutine.cfa
rff5caaf r95b8aa7 22 22 #include <string.h> 23 23 #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 24 28 #include <sys/mman.h> 25 29 } … … 29 33 #define __CFA_INVOKE_PRIVATE__ 30 34 #include "invoke.h" 35 36 extern "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 } 31 43 32 44 //----------------------------------------------------------------------------- … … 67 79 starter = NULL; 68 80 last = NULL; 69 } 70 71 void ^?{}(coroutine_desc& this) {} 81 cancellation = NULL; 82 } 83 84 void ^?{}(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 } 72 103 73 104 // Part of the Public API … … 105 136 // Safety note : This could cause some false positives due to preemption 106 137 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 } 107 142 } //ctxSwitchDirect 108 143 … … 162 197 } 163 198 164 void __leave_coroutine( void) {199 void __leave_coroutine() { 165 200 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, 168 206 "Attempt to suspend/leave coroutine \"%.256s\" (%p) that has never been resumed.\n" 169 207 "Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.", 170 208 src->name, src ); 171 assertf( s rc->starter->state != Halted,209 assertf( starter->state != Halted, 172 210 "Attempt by coroutine \"%.256s\" (%p) to suspend/leave back to terminated coroutine \"%.256s\" (%p).\n" 173 211 "Possible cause is terminated coroutine's main routine has already returned.", 174 src->name, src, s rc->starter->name, src->starter );175 176 CoroutineCtxSwitch( src, s rc->starter );212 src->name, src, starter->name, starter ); 213 214 CoroutineCtxSwitch( src, starter ); 177 215 } 178 216 } -
libcfa/src/concurrency/invoke.c
rff5caaf r95b8aa7 17 17 #include <stdlib.h> 18 18 #include <stdio.h> 19 #include <unwind.h> 19 20 20 21 #include "invoke.h" … … 50 51 main( this ); 51 52 52 cor->state = Halted;53 54 53 //Final suspend, should never return 55 54 __leave_coroutine(); 56 55 __cabi_abort( "Resumed dead coroutine" ); 56 } 57 58 static _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 77 void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage) __attribute__ ((__noreturn__)); 78 void _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(); 57 82 } 58 83 -
libcfa/src/concurrency/invoke.h
rff5caaf r95b8aa7 59 59 volatile bool in_progress; 60 60 } preemption_state; 61 } kernelTLS ;61 } kernelTLS __attribute__ ((tls_model ( "initial-exec" ))); 62 62 } 63 63 … … 80 80 81 81 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 90 105 struct __waitfor_mask_t { 91 106 // the index of the accepted function, -1 if none -
libcfa/src/concurrency/kernel.cfa
rff5caaf r95b8aa7 57 57 //----------------------------------------------------------------------------- 58 58 // Global state 59 thread_local struct KernelThreadData kernelTLS = {59 thread_local struct KernelThreadData kernelTLS __attribute__ ((tls_model ( "initial-exec" ))) = { 60 60 NULL, 61 61 NULL, -
libcfa/src/concurrency/kernel_private.hfa
rff5caaf r95b8aa7 79 79 }; 80 80 81 extern volatile thread_local __cfa_kernel_preemption_state_t preemption_state ;81 extern volatile thread_local __cfa_kernel_preemption_state_t preemption_state __attribute__ ((tls_model ( "initial-exec" ))); 82 82 83 83 //----------------------------------------------------------------------------- -
libcfa/src/exception.c
rff5caaf r95b8aa7 246 246 } 247 247 248 #if defined(PIC) 249 #warning Exceptions not yet supported when using Position-Independent Code 250 __attribute__((noinline)) 251 void __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 248 257 // This is our personality routine. For every stack frame anotated with ".cfi_personality 0x3,__gcfa_personality_v0". 249 258 // This function will be called twice when unwinding. Once in the search phased and once in the cleanup phase. … … 477 486 ); 478 487 #endif // __i386 || __x86_64 488 #endif //PIC -
libcfa/src/fstream.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 10 18:19:40201813 // Update Count : 28412 // Last Modified On : Mon Dec 24 18:33:38 2018 13 // Update Count : 304 14 14 // 15 15 … … 20 20 #include <stdarg.h> // varargs 21 21 #include <string.h> // strlen 22 #include <stdbool.h> // true/false23 22 #include <float.h> // DBL_DIG, LDBL_DIG 24 23 #include <complex.h> // creal, cimag … … 27 26 #define IO_MSG "I/O error: " 28 27 29 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, const char * separator, const char * tupleSeparator ) {28 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool prt, const char * separator, const char * tupleSeparator ) { 30 29 os.file = file; 31 30 os.sepDefault = sepDefault; 32 31 os.sepOnOff = sepOnOff; 32 os.nlOnOff = nlOnOff; 33 os.prt = prt; 33 34 sepSet( os, separator ); 34 35 sepSetCur( os, sepGet( os ) ); … … 44 45 bool getNL( ofstream & os ) { return os.sawNL; } 45 46 void setNL( ofstream & os, bool state ) { os.sawNL = state; } 47 bool getANL( ofstream & os ) { return os.nlOnOff; } 48 bool getPrt( ofstream & os ) { return os.prt; } 49 void setPrt( ofstream & os, bool state ) { os.prt = state; } 46 50 47 51 // public … … 72 76 } // sepEnable 73 77 78 void nlOn( ofstream & os ) { os.nlOnOff = true; } 79 void nlOff( ofstream & os ) { os.nlOnOff = false; } 80 74 81 const char * sepGet( ofstream & os ) { return os.separator; } 75 82 void sepSet( ofstream & os, const char * s ) { … … 103 110 } // if 104 111 #endif // __CFA_DEBUG__ 105 (os){ file, true, false, " ", ", " };112 (os){ file, true, false, true, false, " ", ", " }; 106 113 } // open 107 114 … … 143 150 va_end( args ); 144 151 152 setPrt( os, true ); // called in output cascade 145 153 sepReset( os ); // reset separator 146 154 return len; 147 155 } // fmt 148 156 149 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };157 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, true, false, " ", ", " }; 150 158 ofstream & sout = soutFile; 151 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };159 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, true, false, " ", ", " }; 152 160 ofstream & serr = serrFile; 153 161 -
libcfa/src/fstream.hfa
rff5caaf r95b8aa7 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 11 13:54:27201813 // Update Count : 1 3212 // Last Modified On : Mon Dec 24 18:33:41 2018 13 // Update Count : 149 14 14 // 15 15 … … 23 23 bool sepDefault; 24 24 bool sepOnOff; 25 bool nlOnOff; 26 bool prt; // print text 25 27 bool sawNL; 26 28 const char * sepCur; … … 37 39 bool getNL( ofstream & ); 38 40 void setNL( ofstream &, bool ); 41 bool getANL( ofstream & ); 42 bool getPrt( ofstream & ); 43 void setPrt( ofstream &, bool ); 39 44 40 45 // public … … 43 48 bool sepDisable( ofstream & ); 44 49 bool sepEnable( ofstream & ); 50 void nlOn( ofstream & ); 51 void nlOff( ofstream & ); 45 52 46 53 const char * sepGet( ofstream & ); … … 55 62 void close( ofstream & ); 56 63 ofstream & write( ofstream &, const char * data, size_t size ); 57 int fmt( ofstream &, const char f mt[], ... );64 int fmt( ofstream &, const char format[], ... ); 58 65 59 66 void ?{}( ofstream & os ); … … 76 83 ifstream & read( ifstream & is, char * data, size_t size ); 77 84 ifstream & ungetc( ifstream & is, char c ); 78 int fmt( ifstream &, const char f mt[], ... );85 int fmt( ifstream &, const char format[], ... ); 79 86 80 87 void ?{}( ifstream & is ); -
libcfa/src/gmp.hfa
rff5caaf r95b8aa7 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Dec 7 09:10:41 201713 // Update Count : 2 112 // Last Modified On : Tue Dec 4 23:25:51 2018 13 // Update Count : 22 14 14 // 15 15 … … 262 262 } // ?|? 263 263 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 } // ?|? 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 } // ?|? 271 272 void ?|?( ostype & os, Int mp ) { 273 (ostype)(os | mp); if ( getANL( os ) ) nl( os ); 274 } // ?|? 275 } // distribution 271 276 272 277 // Local Variables: // -
libcfa/src/iostream.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 11 13:56:43201813 // Update Count : 47312 // Last Modified On : Mon Dec 24 18:33:40 2018 13 // Update Count : 589 14 14 // 15 15 … … 19 19 #include <stdio.h> 20 20 #include <stdbool.h> // true/false 21 //#include <string.h> 21 //#include <string.h> // strlen, strcmp 22 22 extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); 23 23 extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); … … 32 32 return os; 33 33 } // ?|? 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 ); 52 63 } // ?|? 53 64 … … 57 68 return os; 58 69 } // ?|? 70 void & ?|?( ostype & os, short int si ) { 71 (ostype &)(os | si); nl( os ); 72 } // ?|? 59 73 60 74 ostype & ?|?( ostype & os, unsigned short int usi ) { … … 63 77 return os; 64 78 } // ?|? 79 void & ?|?( ostype & os, unsigned short int usi ) { 80 (ostype &)(os | usi); nl( os ); 81 } // ?|? 65 82 66 83 ostype & ?|?( ostype & os, int i ) { … … 69 86 return os; 70 87 } // ?|? 88 void & ?|?( ostype & os, int i ) { 89 (ostype &)(os | i); nl( os ); 90 } // ?|? 71 91 72 92 ostype & ?|?( ostype & os, unsigned int ui ) { … … 75 95 return os; 76 96 } // ?|? 97 void & ?|?( ostype & os, unsigned int ui ) { 98 (ostype &)(os | ui); nl( os ); 99 } // ?|? 77 100 78 101 ostype & ?|?( ostype & os, long int li ) { … … 81 104 return os; 82 105 } // ?|? 106 void & ?|?( ostype & os, long int li ) { 107 (ostype &)(os | li); nl( os ); 108 } // ?|? 83 109 84 110 ostype & ?|?( ostype & os, unsigned long int uli ) { … … 87 113 return os; 88 114 } // ?|? 115 void & ?|?( ostype & os, unsigned long int uli ) { 116 (ostype &)(os | uli); nl( os ); 117 } // ?|? 89 118 90 119 ostype & ?|?( ostype & os, long long int lli ) { … … 93 122 return os; 94 123 } // ?|? 124 void & ?|?( ostype & os, long long int lli ) { 125 (ostype &)(os | lli); nl( os ); 126 } // ?|? 95 127 96 128 ostype & ?|?( ostype & os, unsigned long long int ulli ) { … … 99 131 return os; 100 132 } // ?|? 133 void & ?|?( ostype & os, unsigned long long int ulli ) { 134 (ostype &)(os | ulli); nl( os ); 135 } // ?|? 101 136 102 137 ostype & ?|?( ostype & os, float f ) { … … 105 140 return os; 106 141 } // ?|? 142 void & ?|?( ostype & os, float f ) { 143 (ostype &)(os | f); nl( os ); 144 } // ?|? 107 145 108 146 ostype & ?|?( ostype & os, double d ) { … … 111 149 return os; 112 150 } // ?|? 151 void & ?|?( ostype & os, double d ) { 152 (ostype &)(os | d); nl( os ); 153 } // ?|? 113 154 114 155 ostype & ?|?( ostype & os, long double ld ) { … … 117 158 return os; 118 159 } // ?|? 160 void & ?|?( ostype & os, long double ld ) { 161 (ostype &)(os | ld); nl( os ); 162 } // ?|? 119 163 120 164 ostype & ?|?( ostype & os, float _Complex fc ) { … … 123 167 return os; 124 168 } // ?|? 169 void & ?|?( ostype & os, float _Complex fc ) { 170 (ostype &)(os | fc); nl( os ); 171 } // ?|? 125 172 126 173 ostype & ?|?( ostype & os, double _Complex dc ) { … … 129 176 return os; 130 177 } // ?|? 178 void & ?|?( ostype & os, double _Complex dc ) { 179 (ostype &)(os | dc); nl( os ); 180 } // ?|? 131 181 132 182 ostype & ?|?( ostype & os, long double _Complex ldc ) { … … 134 184 fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) ); 135 185 return os; 186 } // ?|? 187 void & ?|?( ostype & os, long double _Complex ldc ) { 188 (ostype &)(os | ldc); nl( os ); 136 189 } // ?|? 137 190 … … 174 227 return write( os, str, len ); 175 228 } // ?|? 229 void ?|?( ostype & os, const char * str ) { 230 (ostype &)(os | str); nl( os ); 231 } // ?|? 176 232 177 233 // ostype & ?|?( ostype & os, const char16_t * str ) { … … 200 256 return os; 201 257 } // ?|? 202 258 void ?|?( ostype & os, const void * p ) { 259 (ostype &)(os | p); nl( os ); 260 } // ?|? 203 261 204 262 // manipulators 205 263 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 207 271 } // ?|? 208 272 209 273 ostype & sep( ostype & os ) { 210 os | sepGet( os ); 211 return os; 274 return (ostype &)(os | sepGet( os )); 212 275 } // sep 213 276 214 277 ostype & sepTuple( ostype & os ) { 215 os | sepGetTuple( os ); 216 return os; 278 return os | sepGetTuple( os ); 217 279 } // sepTuple 218 280 219 ostype & endl( ostype & os ) { 220 os | '\n'; 281 ostype & nl( ostype & os ) { 282 (ostype &)(os | '\n'); 283 setPrt( os, false ); // turn off 221 284 setNL( os, true ); 222 285 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 226 298 227 299 ostype & sepOn( ostype & os ) { 228 sepOn( os ); 300 sepOn( os ); // call void returning 229 301 return os; 230 302 } // sepOn 231 303 232 304 ostype & sepOff( ostype & os ) { 233 sepOff( os ); 305 sepOff( os ); // call void returning 234 306 return os; 235 307 } // sepOff 236 308 237 309 ostype & sepEnable( ostype & os ) { 238 sepEnable( os ); 310 sepEnable( os ); // call void returning 239 311 return os; 240 312 } // sepEnable 241 313 242 314 ostype & sepDisable( ostype & os ) { 243 sepDisable( os ); 315 sepDisable( os ); // call void returning 244 316 return os; 245 317 } // 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 246 328 } // distribution 247 329 248 249 330 // 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 } // ?|? 331 forall( 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 258 348 259 349 //--------------------------------------- 260 350 261 351 // 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 } // ?|?352 forall( 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 273 363 274 364 //--------------------------------------- … … 386 476 } // ?|? 387 477 388 istype & endl( istype & is ) {478 istype & nl( istype & is ) { 389 479 fmt( is, "%*[ \t\f\n\r\v]" ); // ignore whitespace 390 480 return is; 391 } // endl481 } // nl 392 482 } // distribution 393 483 … … 410 500 // Local Variables: // 411 501 // tab-width: 4 // 412 // compile-command: "cfa iostream.c " //502 // compile-command: "cfa iostream.cfa" // 413 503 // End: // -
libcfa/src/iostream.hfa
rff5caaf r95b8aa7 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 11 08:22:49201813 // Update Count : 15612 // Last Modified On : Mon Dec 24 18:33:40 2018 13 // Update Count : 220 14 14 // 15 15 … … 20 20 trait ostream( dtype ostype ) { 21 21 // private 22 bool sepPrt( ostype & ); // returnseparator state (on/off)22 bool sepPrt( ostype & ); // get separator state (on/off) 23 23 void sepReset( ostype & ); // set separator state to default state 24 24 void sepReset( ostype &, bool ); // set separator and default state 25 25 const char * sepGetCur( ostype & ); // get current separator string 26 26 void sepSetCur( ostype &, const char * ); // set current separator string 27 bool getNL( ostype & ); // check newline27 bool getNL( ostype & ); // check newline 28 28 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 29 32 // public 30 33 void sepOn( ostype & ); // turn separator state on 31 34 void sepOff( ostype & ); // turn separator state off 32 35 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 34 39 35 40 const char * sepGet( ostype & ); // get separator string … … 43 48 void close( ostype & os ); 44 49 ostype & write( ostype &, const char *, size_t ); 45 int fmt( ostype &, const char f mt[], ... );50 int fmt( ostype &, const char format[], ... ); 46 51 }; // ostream 47 52 … … 58 63 forall( dtype ostype | ostream( ostype ) ) { 59 64 ostype & ?|?( ostype &, bool ); 65 void ?|?( ostype &, bool ); 60 66 61 67 ostype & ?|?( ostype &, char ); 68 void ?|?( ostype &, char ); 62 69 ostype & ?|?( ostype &, signed char ); 70 void ?|?( ostype &, signed char ); 63 71 ostype & ?|?( ostype &, unsigned char ); 72 void ?|?( ostype &, unsigned char ); 64 73 65 74 ostype & ?|?( ostype &, short int ); 75 void ?|?( ostype &, short int ); 66 76 ostype & ?|?( ostype &, unsigned short int ); 77 void ?|?( ostype &, unsigned short int ); 67 78 ostype & ?|?( ostype &, int ); 79 void ?|?( ostype &, int ); 68 80 ostype & ?|?( ostype &, unsigned int ); 81 void ?|?( ostype &, unsigned int ); 69 82 ostype & ?|?( ostype &, long int ); 83 void ?|?( ostype &, long int ); 70 84 ostype & ?|?( ostype &, long long int ); 85 void ?|?( ostype &, long long int ); 71 86 ostype & ?|?( ostype &, unsigned long int ); 87 void ?|?( ostype &, unsigned long int ); 72 88 ostype & ?|?( ostype &, unsigned long long int ); 89 void ?|?( ostype &, unsigned long long int ); 73 90 74 91 ostype & ?|?( ostype &, float ); // FIX ME: should not be required 92 void ?|?( ostype &, float ); // FIX ME: should not be required 75 93 ostype & ?|?( ostype &, double ); 94 void ?|?( ostype &, double ); 76 95 ostype & ?|?( ostype &, long double ); 96 void ?|?( ostype &, long double ); 77 97 78 98 ostype & ?|?( ostype &, float _Complex ); 99 void ?|?( ostype &, float _Complex ); 79 100 ostype & ?|?( ostype &, double _Complex ); 101 void ?|?( ostype &, double _Complex ); 80 102 ostype & ?|?( ostype &, long double _Complex ); 103 void ?|?( ostype &, long double _Complex ); 81 104 82 105 ostype & ?|?( ostype &, const char * ); 106 void ?|?( ostype &, const char * ); 83 107 // ostype & ?|?( ostype &, const char16_t * ); 84 108 #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous … … 87 111 // ostype & ?|?( ostype &, const wchar_t * ); 88 112 ostype & ?|?( ostype &, const void * ); 113 void ?|?( ostype &, const void * ); 89 114 90 115 // manipulators 91 116 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 & ); 93 121 ostype & sep( ostype & ); 94 122 ostype & sepTuple( ostype & ); … … 97 125 ostype & sepDisable( ostype & ); 98 126 ostype & sepEnable( ostype & ); 127 ostype & nlOn( ostype & ); 128 ostype & nlOff( ostype & ); 99 129 } // distribution 100 130 101 131 // tuples 102 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) 103 ostype & ?|?( ostype & os, T arg, Params rest ); 132 forall( 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 104 136 105 137 // 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 ); 138 forall( 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 111 142 112 143 //--------------------------------------- … … 119 150 istype & read( istype &, char *, size_t ); 120 151 istype & ungetc( istype &, char ); 121 int fmt( istype &, const char f mt[], ... );152 int fmt( istype &, const char format[], ... ); 122 153 }; // istream 123 154 … … 152 183 // manipulators 153 184 istype & ?|?( istype &, istype & (*)( istype & ) ); 154 istype & endl( istype & is );185 istype & nl( istype & is ); 155 186 } // distribution 156 187 … … 164 195 165 196 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 199 forall( 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 171 205 172 206 // Local Variables: // -
libcfa/src/iterator.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 7 08:38:23 201713 // Update Count : 2 812 // Last Modified On : Fri Nov 2 07:17:37 2018 13 // Update Count : 29 14 14 // 15 15 … … 33 33 // Local Variables: // 34 34 // tab-width: 4 // 35 // compile-command: "cfa iterator.c " //35 // compile-command: "cfa iterator.cfa" // 36 36 // End: // -
libcfa/src/rational.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jun 2 09:24:33201813 // Update Count : 1 6212 // Last Modified On : Sun Dec 23 22:56:49 2018 13 // Update Count : 170 14 14 // 15 15 … … 35 35 static RationalImpl simplify( RationalImpl & n, RationalImpl & d ) { 36 36 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."; 38 38 exit( EXIT_FAILURE ); 39 39 } // exit … … 175 175 } // ?|? 176 176 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 181 186 } // distribution 182 187 -
libcfa/src/rational.hfa
rff5caaf r95b8aa7 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Sat Jun 2 09:10:01201815 // Update Count : 10 514 // Last Modified On : Tue Dec 4 23:07:46 2018 15 // Update Count : 106 16 16 // 17 17 … … 92 92 istype & ?|?( istype &, Rational(RationalImpl) & ); 93 93 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 96 98 } // distribution 97 99 -
libcfa/src/stdlib.hfa
rff5caaf r95b8aa7 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 27 07:21:36201813 // Update Count : 34 512 // Last Modified On : Mon Dec 17 15:37:45 2018 13 // Update Count : 346 14 14 // 15 15 … … 178 178 179 179 static 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 ); } 181 181 unsigned int ato( const char * sptr ) { return (unsigned int)strtoul( sptr, 0, 10 ); } 182 182 long int ato( const char * sptr ) { return strtol( sptr, 0, 10 ); } -
libcfa/src/time.cfa
rff5caaf r95b8aa7 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 6 22:26:00201813 // Update Count : 3712 // Last Modified On : Sun Dec 23 22:57:48 2018 13 // Update Count : 57 14 14 // 15 15 … … 31 31 32 32 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 } // ?|? 33 forall( 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 43 48 44 49 … … 137 142 } // strftime 138 143 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 } // ?|? 144 forall( 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 157 166 158 167 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.