Changes in / [33218c6:e0a653d]
- Files:
-
- 29 added
- 8 deleted
- 180 edited
-
configure (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
doc/LaTeXmacros/common.tex (modified) (5 diffs)
-
doc/LaTeXmacros/enumitem/README (added)
-
doc/LaTeXmacros/enumitem/enumitem.pdf (added)
-
doc/LaTeXmacros/enumitem/enumitem.sty (added)
-
doc/LaTeXmacros/enumitem/enumitem.tex (added)
-
doc/LaTeXmacros/listings/README (added)
-
doc/LaTeXmacros/listings/listings-acm.prf (added)
-
doc/LaTeXmacros/listings/listings-bash.prf (added)
-
doc/LaTeXmacros/listings/listings-fortran.prf (added)
-
doc/LaTeXmacros/listings/listings-lua.prf (added)
-
doc/LaTeXmacros/listings/listings-python.prf (added)
-
doc/LaTeXmacros/listings/listings.cfg (added)
-
doc/LaTeXmacros/listings/listings.dtx (added)
-
doc/LaTeXmacros/listings/listings.ins (added)
-
doc/LaTeXmacros/listings/listings.log (added)
-
doc/LaTeXmacros/listings/listings.pdf (added)
-
doc/LaTeXmacros/listings/listings.sty (added)
-
doc/LaTeXmacros/listings/listings.sty.new (added)
-
doc/LaTeXmacros/listings/lstdoc.sty (added)
-
doc/LaTeXmacros/listings/lstdrvrs.dtx (added)
-
doc/LaTeXmacros/listings/lstdrvrs.ins (added)
-
doc/LaTeXmacros/listings/lstdrvrs.pdf (added)
-
doc/LaTeXmacros/listings/lstlang1.sty (added)
-
doc/LaTeXmacros/listings/lstlang2.sty (added)
-
doc/LaTeXmacros/listings/lstlang3.sty (added)
-
doc/LaTeXmacros/listings/lstmisc.sty (added)
-
doc/LaTeXmacros/lstlang.sty (modified) (3 diffs)
-
doc/bibliography/cfa.bib (modified) (4 diffs)
-
doc/proposals/virtual.txt (modified) (4 diffs)
-
doc/user/EHMHierarchy.fig (modified) (3 diffs)
-
doc/user/Makefile (modified) (1 diff)
-
doc/user/user.tex (modified) (48 diffs)
-
src/CodeGen/CodeGenerator.h (modified) (2 diffs)
-
src/CodeGen/FixMain.h (modified) (2 diffs)
-
src/CodeGen/FixNames.h (modified) (2 diffs)
-
src/CodeGen/GenType.h (modified) (2 diffs)
-
src/CodeGen/Generate.h (modified) (2 diffs)
-
src/CodeGen/OperatorTable.cc (modified) (3 diffs)
-
src/CodeGen/OperatorTable.h (modified) (2 diffs)
-
src/CodeTools/DeclStats.h (modified) (2 diffs)
-
src/CodeTools/TrackLoc.h (modified) (2 diffs)
-
src/Common/CompilerError.h (modified) (2 diffs)
-
src/Common/ScopedMap.h (modified) (2 diffs)
-
src/Common/SemanticError.h (modified) (2 diffs)
-
src/Common/UnimplementedError.h (modified) (2 diffs)
-
src/Common/UniqueName.h (modified) (2 diffs)
-
src/Common/VectorMap.h (modified) (2 diffs)
-
src/Common/utility.h (modified) (2 diffs)
-
src/Concurrency/Keywords.cc (modified) (3 diffs)
-
src/Concurrency/Keywords.h (modified) (3 diffs)
-
src/ControlStruct/ExceptTranslate.cc (modified) (7 diffs)
-
src/ControlStruct/ExceptTranslate.h (modified) (2 diffs)
-
src/ControlStruct/ForExprMutator.h (modified) (2 diffs)
-
src/ControlStruct/LabelFixer.h (modified) (2 diffs)
-
src/ControlStruct/LabelGenerator.h (modified) (2 diffs)
-
src/ControlStruct/MLEMutator.h (modified) (2 diffs)
-
src/ControlStruct/Mutate.h (modified) (2 diffs)
-
src/GenPoly/Box.cc (modified) (3 diffs)
-
src/GenPoly/Box.h (modified) (2 diffs)
-
src/GenPoly/CopyParams.h (modified) (2 diffs)
-
src/GenPoly/DeclMutator.h (modified) (5 diffs)
-
src/GenPoly/ErasableScopedMap.h (modified) (2 diffs)
-
src/GenPoly/FindFunction.h (modified) (2 diffs)
-
src/GenPoly/GenPoly.h (modified) (2 diffs)
-
src/GenPoly/InstantiateGeneric.h (modified) (2 diffs)
-
src/GenPoly/Lvalue.h (modified) (2 diffs)
-
src/GenPoly/PolyMutator.h (modified) (2 diffs)
-
src/GenPoly/ScopedSet.h (modified) (2 diffs)
-
src/GenPoly/ScrubTyVars.h (modified) (2 diffs)
-
src/GenPoly/Specialize.h (modified) (2 diffs)
-
src/InitTweak/FixGlobalInit.h (modified) (2 diffs)
-
src/InitTweak/FixInit.h (modified) (2 diffs)
-
src/InitTweak/GenInit.h (modified) (2 diffs)
-
src/InitTweak/InitTweak.h (modified) (2 diffs)
-
src/MakeLibCfa.h (modified) (2 diffs)
-
src/Makefile.in (modified) (5 diffs)
-
src/Parser/DeclarationNode.cc (modified) (3 diffs)
-
src/Parser/ExpressionNode.cc (modified) (8 diffs)
-
src/Parser/LinkageSpec.h (modified) (2 diffs)
-
src/Parser/ParseNode.h (modified) (5 diffs)
-
src/Parser/ParserTypes.h (modified) (2 diffs)
-
src/Parser/TypeData.cc (modified) (6 diffs)
-
src/Parser/TypeData.h (modified) (3 diffs)
-
src/Parser/TypedefTable.h (modified) (2 diffs)
-
src/Parser/lex.ll (modified) (8 diffs)
-
src/Parser/parser.yy (modified) (18 diffs)
-
src/Parser/parserutility.cc (modified) (2 diffs)
-
src/Parser/parserutility.h (modified) (1 diff)
-
src/ResolvExpr/Alternative.h (modified) (2 diffs)
-
src/ResolvExpr/AlternativeFinder.h (modified) (2 diffs)
-
src/ResolvExpr/AlternativePrinter.h (modified) (2 diffs)
-
src/ResolvExpr/ConversionCost.h (modified) (2 diffs)
-
src/ResolvExpr/Cost.h (modified) (2 diffs)
-
src/ResolvExpr/CurrentObject.h (modified) (2 diffs)
-
src/ResolvExpr/FindOpenVars.h (modified) (2 diffs)
-
src/ResolvExpr/RenameVars.h (modified) (2 diffs)
-
src/ResolvExpr/ResolveTypeof.h (modified) (2 diffs)
-
src/ResolvExpr/Resolver.h (modified) (2 diffs)
-
src/ResolvExpr/TypeEnvironment.h (modified) (2 diffs)
-
src/ResolvExpr/TypeMap.h (modified) (2 diffs)
-
src/ResolvExpr/Unify.h (modified) (2 diffs)
-
src/ResolvExpr/typeops.h (modified) (2 diffs)
-
src/SymTab/Autogen.cc (modified) (2 diffs)
-
src/SymTab/Autogen.h (modified) (2 diffs)
-
src/SymTab/FixFunction.h (modified) (2 diffs)
-
src/SymTab/ImplementationType.h (modified) (2 diffs)
-
src/SymTab/Indexer.h (modified) (2 diffs)
-
src/SymTab/Mangler.h (modified) (2 diffs)
-
src/SymTab/TreeStruct.cc (deleted)
-
src/SymTab/TreeStruct.h (deleted)
-
src/SymTab/Validate.h (modified) (2 diffs)
-
src/SymTab/module.mk (modified) (2 diffs)
-
src/SynTree/AddStmtVisitor.h (modified) (2 diffs)
-
src/SynTree/Attribute.h (modified) (2 diffs)
-
src/SynTree/BaseSyntaxNode.h (modified) (2 diffs)
-
src/SynTree/Constant.cc (modified) (2 diffs)
-
src/SynTree/Constant.h (modified) (3 diffs)
-
src/SynTree/Declaration.h (modified) (5 diffs)
-
src/SynTree/Expression.h (modified) (2 diffs)
-
src/SynTree/Initializer.h (modified) (2 diffs)
-
src/SynTree/Label.h (modified) (2 diffs)
-
src/SynTree/Mutator.h (modified) (3 diffs)
-
src/SynTree/Statement.h (modified) (2 diffs)
-
src/SynTree/SynTree.h (modified) (2 diffs)
-
src/SynTree/Type.h (modified) (3 diffs)
-
src/SynTree/TypeSubstitution.h (modified) (2 diffs)
-
src/SynTree/VarExprReplacer.h (modified) (2 diffs)
-
src/SynTree/Visitor.h (modified) (2 diffs)
-
src/Tuples/Explode.h (modified) (2 diffs)
-
src/Tuples/Tuples.h (modified) (2 diffs)
-
src/benchmark/create_pthrd.c (modified) (1 diff)
-
src/driver/cfa.cc (modified) (4 diffs)
-
src/libcfa/Makefile.am (modified) (5 diffs)
-
src/libcfa/Makefile.in (modified) (21 diffs)
-
src/libcfa/assert (added)
-
src/libcfa/assert.c (modified) (2 diffs)
-
src/libcfa/concurrency/CtxSwitch-i386.S (modified) (3 diffs)
-
src/libcfa/concurrency/CtxSwitch-x86_64.S (modified) (2 diffs)
-
src/libcfa/concurrency/alarm.c (modified) (8 diffs)
-
src/libcfa/concurrency/alarm.h (modified) (4 diffs)
-
src/libcfa/concurrency/coroutine (modified) (3 diffs)
-
src/libcfa/concurrency/coroutine.c (modified) (3 diffs)
-
src/libcfa/concurrency/invoke.c (modified) (3 diffs)
-
src/libcfa/concurrency/invoke.h (modified) (3 diffs)
-
src/libcfa/concurrency/kernel (modified) (6 diffs)
-
src/libcfa/concurrency/kernel.c (modified) (17 diffs)
-
src/libcfa/concurrency/kernel_private.h (modified) (6 diffs)
-
src/libcfa/concurrency/monitor (modified) (3 diffs)
-
src/libcfa/concurrency/monitor.c (modified) (3 diffs)
-
src/libcfa/concurrency/preemption.c (modified) (16 diffs)
-
src/libcfa/concurrency/preemption.h (modified) (3 diffs)
-
src/libcfa/concurrency/thread (modified) (4 diffs)
-
src/libcfa/concurrency/thread.c (modified) (3 diffs)
-
src/libcfa/containers/maybe (modified) (2 diffs)
-
src/libcfa/containers/maybe.c (modified) (1 diff)
-
src/libcfa/containers/pair (modified) (2 diffs)
-
src/libcfa/containers/result (modified) (2 diffs)
-
src/libcfa/containers/result.c (modified) (1 diff)
-
src/libcfa/containers/vector (modified) (2 diffs)
-
src/libcfa/exception.h (modified) (2 diffs)
-
src/libcfa/fstream.c (modified) (2 diffs)
-
src/libcfa/interpose.c (modified) (3 diffs)
-
src/libcfa/interpose.h (modified) (3 diffs)
-
src/libcfa/iostream.c (modified) (4 diffs)
-
src/libcfa/libhdr.h (modified) (2 diffs)
-
src/libcfa/libhdr/libalign.h (modified) (4 diffs)
-
src/libcfa/libhdr/libdebug.h (modified) (2 diffs)
-
src/libcfa/libhdr/libtools.h (modified) (2 diffs)
-
src/libcfa/math (modified) (1 diff)
-
src/libcfa/math.c (added)
-
src/libcfa/startup.h (modified) (3 diffs)
-
src/libcfa/stdhdr/assert.h (modified) (2 diffs)
-
src/libcfa/stdhdr/bfdlink.h (deleted)
-
src/libcfa/stdhdr/gmp.h (modified) (2 diffs)
-
src/libcfa/stdhdr/hwloc.h (deleted)
-
src/libcfa/stdhdr/krb5.h (deleted)
-
src/libcfa/stdhdr/malloc.h (deleted)
-
src/libcfa/stdlib (modified) (2 diffs)
-
src/libcfa/stdlib.c (modified) (3 diffs)
-
src/libcfa/typeobject.c (deleted)
-
src/libcfa/typeobject.h (deleted)
-
src/prelude/builtins.c (modified) (1 diff)
-
src/tests/.expect/32/math.txt (modified) (2 diffs)
-
src/tests/.expect/64/math.txt (modified) (2 diffs)
-
src/tests/.expect/concurrent/sched-int-barge.txt (added)
-
src/tests/alloc.c (modified) (1 diff)
-
src/tests/attributes.c (modified) (2 diffs)
-
src/tests/avltree/avl-private.h (modified) (2 diffs)
-
src/tests/avltree/avl.h (modified) (2 diffs)
-
src/tests/gmp.c (modified) (2 diffs)
-
src/tests/math.c (modified) (3 diffs)
-
src/tests/maybe.c (modified) (1 diff)
-
src/tests/preempt_longrun/Makefile.am (modified) (2 diffs)
-
src/tests/preempt_longrun/Makefile.in (modified) (5 diffs)
-
src/tests/preempt_longrun/barge.c (added)
-
src/tests/preempt_longrun/create.c (modified) (2 diffs)
-
src/tests/preempt_longrun/enter.c (modified) (1 diff)
-
src/tests/preempt_longrun/enter3.c (modified) (1 diff)
-
src/tests/preempt_longrun/processor.c (modified) (2 diffs)
-
src/tests/preempt_longrun/yield.c (modified) (2 diffs)
-
src/tests/result.c (modified) (1 diff)
-
src/tests/sched-int-barge.c (modified) (5 diffs)
-
src/tests/sched-int-block.c (modified) (2 diffs)
-
src/tests/sched-int-disjoint.c (modified) (1 diff)
-
src/tests/sched-int-wait.c (modified) (2 diffs)
-
src/tests/test.py (modified) (1 diff)
-
src/tests/vector/array.h (modified) (2 diffs)
-
src/tests/vector/vector_int.h (modified) (3 diffs)
-
tools/cfa.nanorc (modified) (2 diffs)
-
tools/prettyprinter/ParserTypes.h (modified) (2 diffs)
-
tools/prettyprinter/filter.h (modified) (2 diffs)
-
tools/prettyprinter/lex.ll (modified) (2 diffs)
-
tools/prettyprinter/test.y (modified) (1 diff)
-
tools/prettyprinter/token.cc (modified) (2 diffs)
-
tools/prettyprinter/token.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
configure
r33218c6 re0a653d 3471 3471 case $host_cpu in 3472 3472 i386) 3473 CFLAGS+=" -m32"3474 CXXFLAGS+=" -m32"3475 CFAFLAGS+=" -m32"3476 LDFLAGS+=" -m32"3473 CFLAGS+="-m32" 3474 CXXFLAGS+="-m32" 3475 CFAFLAGS+="-m32" 3476 LDFLAGS+="-m32" 3477 3477 ;; 3478 3478 i686) 3479 CFLAGS+=" -m32"3480 CXXFLAGS+=" -m32"3481 CFAFLAGS+=" -m32"3482 LDFLAGS+=" -m32"3479 CFLAGS+="-m32" 3480 CXXFLAGS+="-m32" 3481 CFAFLAGS+="-m32" 3482 LDFLAGS+="-m32" 3483 3483 ;; 3484 3484 x86_64) 3485 CFLAGS+=" -m64"3486 CXXFLAGS+=" -m64"3487 CFAFLAGS+=" -m64"3488 LDFLAGS+=" -m64"3485 CFLAGS+="-m64" 3486 CXXFLAGS+="-m64" 3487 CFAFLAGS+="-m64" 3488 LDFLAGS+="-m64" 3489 3489 ;; 3490 3490 esac -
configure.ac
r33218c6 re0a653d 167 167 AC_SUBST([MACHINE_TYPE],[$host_cpu]) 168 168 169 if ! test "$host_cpu" = "$build_cpu"; then 169 if ! test "$host_cpu" = "$build_cpu"; then 170 170 case $host_cpu in 171 171 i386) 172 CFLAGS+=" -m32"173 CXXFLAGS+=" -m32"174 CFAFLAGS+=" -m32"175 LDFLAGS+=" -m32"172 CFLAGS+="-m32" 173 CXXFLAGS+="-m32" 174 CFAFLAGS+="-m32" 175 LDFLAGS+="-m32" 176 176 ;; 177 177 i686) 178 CFLAGS+=" -m32"179 CXXFLAGS+=" -m32"180 CFAFLAGS+=" -m32"181 LDFLAGS+=" -m32"178 CFLAGS+="-m32" 179 CXXFLAGS+="-m32" 180 CFAFLAGS+="-m32" 181 LDFLAGS+="-m32" 182 182 ;; 183 183 x86_64) 184 CFLAGS+=" -m64"185 CXXFLAGS+=" -m64"186 CFAFLAGS+=" -m64"187 LDFLAGS+=" -m64"184 CFLAGS+="-m64" 185 CXXFLAGS+="-m64" 186 CFAFLAGS+="-m64" 187 LDFLAGS+="-m64" 188 188 ;; 189 189 esac -
doc/LaTeXmacros/common.tex
r33218c6 re0a653d 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Mon Jul 17 10:21:17201714 %% Update Count : 3 4813 %% Last Modified On : Sun Jun 18 20:32:32 2017 14 %% Update Count : 319 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 36 36 % Names used in the document. 37 37 38 \newcommand{\CFAIcon}{\text sf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name38 \newcommand{\CFAIcon}{\textrm{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name 39 39 \newcommand{\CFA}{\protect\CFAIcon} % safe for section/caption 40 40 \newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall symbolic name … … 55 55 \setlength{\parindentlnth}{\parindent} 56 56 57 \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}}58 \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}}59 60 57 \newlength{\gcolumnposn} % temporary hack because lstlisting does not handle tabs correctly 61 58 \newlength{\columnposn} 62 59 \setlength{\gcolumnposn}{2.5in} 63 60 \setlength{\columnposn}{\gcolumnposn} 64 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@ basicstyle{\LstCommentStyle{#2}}}}61 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@commentstyle{#2}}} 65 62 \newcommand{\CRT}{\global\columnposn=\gcolumnposn} 66 63 … … 134 131 135 132 % inline text and code index (cannot use ©) 136 \newcommand{\Indexc}[ 2][\@empty]{\lstinline[#1]$#2$\index{#2@\lstinline[#1]$#2$}}133 \newcommand{\Indexc}[1]{\lstinline$#1$\index{#1@\lstinline$#1$}} 137 134 % code index (cannot use ©) 138 \newcommand{\indexc}[ 2][\@empty]{\index{#2@\lstinline[#1]$#2$}}135 \newcommand{\indexc}[1]{\index{#1@\lstinline$#1$}} 139 136 140 137 % Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}. … … 234 231 basicstyle=\linespread{0.9}\sf, % reduce line spacing and use sanserif font 235 232 stringstyle=\tt, % use typewriter font 236 tabsize= 6, % Nspace tabbing233 tabsize=4, % 4 space tabbing 237 234 xleftmargin=\parindentlnth, % indent code to paragraph indentation 238 235 extendedchars=true, % allow ASCII characters in the range 128-255 -
doc/LaTeXmacros/lstlang.sty
r33218c6 re0a653d 8 8 %% Created On : Sat May 13 16:34:42 2017 9 9 %% Last Modified By : Peter A. Buhr 10 %% Last Modified On : Wed Jul 12 22:42:09201711 %% Update Count : 1 210 %% Last Modified On : Thu Jun 22 07:40:31 2017 11 %% Update Count : 10 12 12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 13 … … 112 112 finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t, 113 113 otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof, 114 __typeof__, with,zero_t},114 __typeof__, zero_t}, 115 115 morekeywords=[2]{ 116 116 _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex, … … 118 118 moredirectives={defined,include_next}% 119 119 } 120 121 % C++ programming language122 \lstdefinelanguage{C++}[ANSI]{C++}{}123 120 124 121 % uC++ programming language, based on ANSI C++ -
doc/bibliography/cfa.bib
r33218c6 re0a653d 2273 2273 @manual{JavaScript, 2274 2274 keywords = {JavaScript}, 2275 contributer = {pabuhr @plg},2275 contributer = {pabuhr}, 2276 2276 title = {ECMAScript 2015 Language Specification {JavaScript}}, 2277 2277 organization= {ECAM International}, … … 2446 2446 @manual{Erlang, 2447 2447 keywords = {Erlang}, 2448 contributer = {pabuhr @plg},2448 contributer = {pabuhr}, 2449 2449 title = {Erlang Reference Manual User's Guide, Vertion 7.0}, 2450 2450 organization= {Erlang/OTP System Documentation}, … … 2771 2771 publisher = {ACM}, 2772 2772 address = {New York, NY, USA}, 2773 }2774 2775 @article{Yang95,2776 keywords = {software solutions, N-thread, mutual exclusions},2777 contributer = {pabuhr@plg},2778 author = {Jae-Heon Yang and James H. Anderson},2779 title = {A Fast, Scalable Mutual Exclusion Algorithm},2780 journal = {Distributed Computing},2781 publisher = {Springer-Verlag},2782 volume = {9},2783 number = {1},2784 year = {1995},2785 pages = {51-60},2786 2773 } 2787 2774 … … 5065 5052 contributer = {pabuhr@plg}, 5066 5053 author = {Kathleen Jensen and Niklaus Wirth}, 5067 title = {{P}ascal User Manual and Report , ISO Pascal Standard},5054 title = {{P}ascal User Manual and Report}, 5068 5055 publisher = {Springer--Verlag}, 5069 year = 19 91,5070 edition = { 4th},5071 note = {Revised by Andrew B. Mickel and James F. Miner }5056 year = 1985, 5057 edition = {3rd}, 5058 note = {Revised by Andrew B. Mickel and James F. Miner, ISO Pascal Standard} 5072 5059 } 5073 5060 -
doc/proposals/virtual.txt
r33218c6 re0a653d 1 1 Proposal for virtual functionality 2 3 There are two types of virtual inheritance in this proposal, relaxed4 (implicit) and strict (explicit). Relaxed is the simpler case that uses the5 existing trait system with the addition of trait references and vtables.6 Strict adds some constraints and requires some additional notation but allows7 for down-casting.8 9 Relaxed Virtual Inheritance:10 2 11 3 Imagine the following code : … … 28 20 void draw(line*); 29 21 30 While all the members of this simple UI support drawing , creating a UI that31 easily supports both these UI requires some tedious boiler-plate code:22 While all the members of this simple UI support drawing creating a UI that easily 23 supports both these UI requires some tedious boiler-plate code : 32 24 33 25 enum type_t { text, line }; … … 49 41 } 50 42 51 While this code will work as implemented, adding any new widgets or any new 52 widget behaviors requires changing existing code to add the desired 53 functionality. To ease this maintenance effort required CFA introduces the 54 concept of trait references. 43 While this code will work as indented, adding any new widgets or any new widget behaviors 44 requires changing existing code to add the desired functionality. To ease this maintenance 45 effort required CFA introduces the concept of dynamic types, in a manner similar to C++. 55 46 56 Using trait references to implement the above gives the following:47 A simple usage of dynamic type with the previous example would look like : 57 48 58 trait drawableobjects[10];49 drawable* objects[10]; 59 50 fill_objects(objects); 60 51 61 52 while(running) { 62 for(drawable object : objects) {53 for(drawable* object : objects) { 63 54 draw(object); 64 55 } 65 56 } 66 57 67 The keyword trait is optional (by the same rules as the struct keyword). This 68 is not currently supported in CFA and the lookup is not possible to implement 69 statically. Therefore we need to add a new feature to handle having dynamic 70 lookups like this.58 However, this is not currently do-able in the current CFA and furthermore is not 59 possible to implement statically. Therefore we need to add a new feature to handle 60 having dynamic types like this (That is types that are found dynamically not types 61 that change dynamically). 71 62 72 What we really want to do is express the fact that calling draw() on a trait 73 reference should find the underlying type of the given parameter and find how 74 it implements the routine, as in the example with the enumeration and union. 63 C++ uses inheritance and virtual functions to find the 64 desired type dynamically. CFA takes inspiration from this solution. 75 65 76 For instance specifying that the drawable trait reference looks up the type 77 of the first argument to find the implementation would be : 66 What we really want to do is express the fact that calling draw() on a object 67 should find the dynamic type of the parameter before calling the routine, much like the 68 hand written example given above. We can express this by adding the virtual keyword on 69 the parameter of the constraints on our trait: 78 70 79 71 trait drawable(otype T) { … … 81 73 }; 82 74 83 This could be implied in simple cases like this one (single parameter on the84 trait and single generic parameter on the function). In more complex cases it 85 would have to be explicitly given, or a strong convention would have to be 86 enforced (e.g. implementation of trait functions is always drawn from the 87 first polymorphic parameter).75 This expresses the idea that drawable is similar to an abstract base class in C++ and 76 also gives meaning to trying to take a pointer of drawable. That is anything that can 77 be cast to a drawable pointer has the necessary information to call the draw routine on 78 that type. Before that drawable was only a abstract type while now it also points to a 79 piece of storage which specify which behavior the object will have at run time. 88 80 89 Once a function in a trait has been marked as virtual it defines a new 90 function that takes in that trait's reference and then dynamically calls the 91 underlying type implementation. Hence a trait reference becomes a kind of 92 abstract type, cannot be directly instantiated but can still be used. 81 This storage needs to be allocate somewhere. C++ just adds an invisible pointer at 82 the beginning of the struct but we can do something more explicit for users, actually 83 have a visible special field : 93 84 94 One of the limitations of this design is that it does not support double 95 dispatching, which concretely means traits cannot have routines with more than 96 one virtual parameter. The program must have a single table to look up the 97 function on. Using trait references with traits with more than one parameter 98 is also restricted, initially forbidden, see extension. 85 struct text { 86 char* text; 87 vtable drawable; 88 }; 99 89 100 Extension: Multi-parameter Virtual Traits: 90 struct line{ 91 vtable drawable; 92 vec2 start; 93 vec2 end; 94 }; 101 95 102 This implementation can be extended to traits with multiple parameters if 103 one is called out as being the virtual trait. For example : 96 With these semantics, adding a "vtable drawable" means that text pointers and line pointers are now 97 convertible to drawable pointers. This conversion will not necessarily be a type only change however, indeed, 98 the drawable pointer will point to the field "vtable drawable" not the head of the struct. However, since all 99 the types are known at compile time, converting pointers becomes a simple offset operations. 104 100 105 trait iterator(otype T, dtype Item) { 106 Maybe(Item) next(virtual T *); 101 The vtable field contains a pointer to a vtable which contains all the information needed for the caller 102 to find the function pointer of the desired behavior. 103 104 One of the limitations of this design is that it does not support double dispatching, which 105 concretely means traits cannot have routines with more than one virtual parameter. This design 106 would have many ambiguities if it did support multiple virtual parameter. A futher limitation is 107 that traits over more than one type cannot have vtables meaningfully defined for them, as the 108 particular vtable to use would be a function of the other type(s) the trait is defined over. 109 110 It is worth noting that the function pointers in these vtables are bound at object construction, rather than 111 function call-site, as in Cforall's existing polymorphic functions. As such, it is possible that two objects 112 with the same static type would have a different vtable (consider what happens if draw(line*) is overridden 113 between the definitions of two line objects). Given that the virtual drawable* erases static types though, 114 this should not be confusing in practice. A more distressing possibility is that of creating an object that 115 outlives the scope of one of the functions in its vtable. This is certainly a possible bug, but it is of a 116 type that C programmers are familiar with, and should be able to avoid by the usual methods. 117 118 Extensibility. 119 120 One of the obvious critics of this implementation is that it lacks extensibility for classes 121 that cannot be modified (ex: Linux C headers). However this solution can be extended to 122 allow more extensibility by adding "Fat pointers". 123 124 Indeed, users could already "solve" this issue by writing their own fat pointers as such: 125 126 trait MyContext(otype T) { 127 void* get_stack(virtual T*) 128 }; 129 130 void* get_stack(ucontext_t *context); 131 132 struct fat_ucontext_t { 133 vtable MyContext; 134 ucontext_t *context; 107 135 } 108 136 109 iterator(int) generators[10]; 110 111 Which creates a collection of iterators that produce integers, regardless of 112 how those iterators are implemented. This may require a note that this trait 113 is virtual on T and not Item, but noting it on the functions may be enough. 114 115 116 Strict Virtual Inheritance: 117 118 One powerful feature relaxed virtual does not support is the idea of down 119 casting. Once something has been converted into a trait reference there is 120 very little we can do to recover and of the type information, only the trait's 121 required function implementations are kept. 122 123 To allow down casting strict virtual requires that all traits and structures 124 involved be organized into a tree. Each trait or struct must have a unique 125 position on this tree (no multiple inheritance). 126 127 This is declared as follows : 128 129 trait error(otype T) virtual { 130 const char * msg(T *); 137 //Tedious forwarding routine 138 void* get_stack(fat_ucontext_t *ptr) { 139 return get_stack(ptr->context); 131 140 } 132 141 133 trait io_error(otype T) virtual error { 134 FILE * src(T *); 135 } 142 However, users would have to write all the virtual methods they want to override and make 143 them all simply forward to the existing method that takes the corresponding POCO(Plain Old C Object). 136 144 137 struct eof_error virtual io_error { 138 FILE * fd; 145 The alternative we propose is to use language level fat pointers : 146 147 trait MyContext(otype T) { 148 void* get_stack(virtual T*) 139 149 }; 140 150 141 So the trait error is the head of a new tree and io_error is a child of it. 151 void* get_stack(ucontext_t *context); 142 152 143 Also the parent trait is implicitly part of the assertions of the children, 144 so all children implement the same operations as the parent. By the unique 145 path down the tree, we can also uniquely order them so that a prefix of a 146 child's vtable has the same format as its parent's. 153 //The type vptr(ucontext_t) all 154 vptr(ucontext_t) context; 147 155 148 This gives us an important extra feature, runtime checking of the parent-child 149 relationship with a C++ dynamic_cast like operation. Allowing checked 150 conversions from trait references to more particular references, which works 151 if the underlying type is, or is a child of, the new trait type. 156 These behave exactly as the previous example but all the forwarding routines are automatically generated. 152 157 153 Extension: Multiple Parents 158 Bikeshedding. 154 159 155 Although each trait/struct must have a unique position on each tree, it could 156 have positions on multiple trees. All this requires is the ability to give 157 multiple parents, as here : 160 It may be desirable to add fewer new keywords than discussed in this proposal; it is possible that "virtual" 161 could replace both "vtable" and "vptr" above with unambiguous contextual meaning. However, for purposes of 162 clarity in the design discussion it is beneficial to keep the keywords for separate concepts distinct. 158 163 159 trait region(otype T) virtual drawable, collider;160 161 The restriction being, the parents must come from different trees. This162 object (and all of its children) can be cast to either tree. This is handled163 by generating a separate vtable for each tree the structure is in.164 165 Extension: Multi-parameter Strict Virtual166 167 If a trait has multiple parameters then one must be called out to be the one168 we generate separate vtables for, as in :169 170 trait example(otype T, otype U) virtual(T) ...171 172 This can generate a separate vtable for each U for which all the T+U173 implementations are provided. These are then separate nodes in the tree (or174 the root of different trees) as if each was created individually. Providing a175 single unique instance of these nodes would be the most difficult aspect of176 this extension, possibly intractable, though with sufficient hoisting and177 link-once duplication it may be possible.178 179 Example:180 181 trait argument(otype T) virtual {182 char short_name(virtual T *);183 bool is_set(virtual T *);184 };185 186 trait value_argument(otype T, otype U) virtual(T) argument {187 U get_value(virtual T *);188 };189 190 Extension: Structural Inheritance191 192 Currently traits must be the internal nodes and structs the leaf nodes.193 Structs could be made internal nodes as well, in which case the child structs194 would likely structurally inherit the fields of their parents.195 196 197 Storing the Virtual Lookup Table (vtable):198 199 We have so far been silent on how the vtable is created, stored and accessed.200 201 Creation happens at compile time. Function pointers are found by using the202 same best match rules as elsewhere (additional rules for defaults from the203 parent may or may not be required). For strict virtual this must happen at the204 global scope and forbidding static functions, to ensure that a single unique205 vtable is created. Similarly, there may have to be stricter matching rules206 for the functions that go into the vtable, possibly requiring an exact match.207 Relaxed virtual could relax both restrictions, if we allow different vtable208 at different conversion (struct to trait reference) sites. If it is allowed209 local functions being bound to a vtable could cause issues when they go out210 of scope, however this should follow the lifetime rules most C programs211 already follow implicitly.212 213 Most vtables should be stored statically, the only exception being some of214 the relaxed vtables that could have local function pointers. These may be able215 to be stack allocated. All vtables should be immutable and require no manual216 cleanup.217 218 Access has two main options:219 220 The first is through the use of fat pointers, or a tuple of pointers. When the221 object is converted to a trait reference, the pointers to its vtables are222 stored along side it.223 224 This allows for compatibility with existing structures (such as those imported225 from C) and is the default storage method unless a different one is given.226 227 The other is by inlining the vtable pointer as "intrusive vtables". This adds228 a field to the structure to the vtable. The trait reference then has a single229 pointer to this field, the vtable includes an offset to find the beginning of230 the structure again.231 232 This is used if you specify a vtable field in the structure. If given in the233 trait the vtable pointer in the trait reference can then become a single234 pointer to the vtable field and use that to recover the original object235 pointer as well as retrieve all operations.236 237 trait drawable(otype T) {238 vtable drawable;239 };240 241 struct line {242 vtable drawable;243 vec2 start;244 vec2 end;245 };246 247 This inline code allows trait references to be converted to plain pointers248 (although they still must be called specially). The vtable field may just be249 an opaque block of memory or it may allow user access to the vtable. If so250 then there should be some way to retrieve the type of the vtable, which will be251 autogenerated and often unique.252 253 254 Keyword Usage:255 256 It may be desirable to add fewer new keywords than discussed in this proposal.257 It is possible that "virtual" could replace both "vtable" above with258 unambiguous contextual meaning. However, for purposes of clarity in the design259 discussion it is beneficial to keep the keywords for separate concepts distinct.260 261 262 Trait References and Operations:263 264 sizeof(drawable) will return the size of the trait object itself. However :265 266 line a_line;267 drawable widget = a_line;268 sizeof(widget);269 270 Will instead return the sizeof the underlying object, although the trait must271 require that its implementation is sized for there to be a meaningful value272 to return. You may also get the size of the trait reference with273 274 sizeof(&widget);275 276 Calling free on a trait reference will free the memory for the object. It will277 leave the vtables alone, as those are (always?) statically allocated. -
doc/user/EHMHierarchy.fig
r33218c6 re0a653d 1 #FIG 3.2 Produced by xfig version 3.2.5 c1 #FIG 3.2 Produced by xfig version 3.2.5b 2 2 Landscape 3 3 Center … … 19 19 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2 20 20 1 1 1.00 60.00 90.00 21 1950 1425 2925120021 1950 1425 3000 1200 22 22 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2 23 23 1 1 1.00 60.00 90.00 … … 29 29 1 1 1.00 60.00 90.00 30 30 4950 1950 4950 1725 31 4 1 0 50 -1 0 13 0.0000 2 135 225 1950 1650 IO\00132 4 1 0 50 -1 0 13 0.0000 2 135 9154950 1650 Arithmetic\00133 4 1 0 50 -1 0 13 0.0000 2 150 3301350 2100 File\00134 4 1 0 50 -1 0 13 0.0000 2 135 7352550 2100 Network\00135 4 1 0 50 -1 0 13 0.0000 2 180 12153750 2100 DivideByZero\00136 4 1 0 50 -1 0 13 0.0000 2 150 810 4950 2100 Overflow\00137 4 1 0 50 -1 0 13 0.0000 2 150 915 6000 2100 Underflow\00138 4 1 0 50 -1 0 13 0.0000 2 180 8553450 1200 Exception\00131 4 1 0 100 0 0 12 0.0000 0 135 195 1950 1650 IO\001 32 4 1 0 100 0 0 12 0.0000 0 135 870 4950 1650 Arithmetic\001 33 4 1 0 100 0 0 12 0.0000 0 135 315 1350 2100 File\001 34 4 1 0 100 0 0 12 0.0000 0 135 690 2550 2100 Network\001 35 4 1 0 100 0 0 12 0.0000 0 180 1170 3750 2100 DivideByZero\001 36 4 1 0 100 0 0 12 0.0000 0 135 750 4950 2100 Overflow\001 37 4 1 0 100 0 0 12 0.0000 0 135 855 6000 2100 Underflow\001 38 4 1 0 100 0 0 12 0.0000 0 180 840 3450 1200 Exception\001 -
doc/user/Makefile
r33218c6 re0a653d 1 1 ## Define the appropriate configuration variables. 2 2 3 TeXLIB = .:../LaTeXmacros:../ bibliography/:3 TeXLIB = .:../LaTeXmacros:../LaTeXmacros/listings:../LaTeXmacros/enumitem:../bibliography/: 4 4 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error 5 5 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex -
doc/user/user.tex
r33218c6 re0a653d 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sat Jul 22 11:01:19 201714 %% Update Count : 2 87813 %% Last Modified On : Fri Jul 7 10:36:39 2017 14 %% Update Count : 2547 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 57 57 \CFAStyle % use default CFA format-style 58 58 59 \lstnewenvironment{C++}[1][]60 {\lstset{language=C++,moredelim=**[is][\protect\color{red}]{®}{®}#1}}61 {}62 63 59 % inline code ©...© (copyright symbol) emacs: C-q M-) 64 60 % red highlighting ®...® (registered trademark symbol) emacs: C-q M-. … … 141 137 142 138 \CFA{}\index{cforall@\CFA}\footnote{Pronounced ``\Index*{C-for-all}'', and written \CFA, CFA, or \CFL.} is a modern general-purpose programming-language, designed as an evolutionary step forward for the C programming language. 143 The syntax of \CFA builds from Cand should look immediately familiar to C/\Index*[C++]{\CC{}} programmers.139 The syntax of the \CFA language builds from C, and should look immediately familiar to C/\Index*[C++]{\CC{}} programmers. 144 140 % Any language feature that is not described here can be assumed to be using the standard \Celeven syntax. 145 \CFA adds many modern programming-language features that directly lead to increased \emph{\Index{safety}} and \emph{\Index{productivity}}, while maintaining interoperability with existing C programs and achieving similarperformance.146 Like C, \CFA is a statically typed, procedural (non-\Index{object-oriented})language with a low-overhead runtime, meaning there is no global \Index{garbage-collection}, but \Index{regional garbage-collection}\index{garbage-collection!regional} is possible.141 \CFA adds many modern programming-language features that directly lead to increased \emph{\Index{safety}} and \emph{\Index{productivity}}, while maintaining interoperability with existing C programs and achieving C performance. 142 Like C, \CFA is a statically typed, procedural language with a low-overhead runtime, meaning there is no global \Index{garbage-collection}, but \Index{regional garbage-collection}\index{garbage-collection!regional} is possible. 147 143 The primary new features include parametric-polymorphic routines and types, exceptions, concurrency, and modules. 148 144 149 One of the main design philosophies of \CFA is to ``\Index{describe not prescribe}'', which means \CFA tries to provide a pathway from low-level C programming to high-level \CFA programming, but it does not force programmers to ``do the right thing''. 150 Programmers can cautiously add \CFA extensions to their C programs in any order and at any time to incrementally move towards safer, higher-level programming. 151 A programmer is always free to reach back to C from \CFA, for any reason, and in many cases, new \CFA features can be locally switched back to there C counterpart. 152 There is no notion or requirement for \emph{rewriting} a legacy C program in \CFA; 153 instead, a programmer evolves a legacy program into \CFA by incrementally incorporating \CFA features. 154 As well, new programs can be written in \CFA using a combination of C and \CFA features. 155 156 \Index*[C++]{\CC{}} had a similar goal 30 years ago, allowing object-oriented programming to be incrementally added to C. 157 However, \CC currently has the disadvantages of a strong object-oriented bias, multiple legacy design-choices that cannot be updated, and active divergence of the language model from C, all of which requires significant effort and training to incrementally add \CC to a C-based project. 145 One of the main design philosophies of \CFA is to ``describe not prescribe'', which means \CFA tries to provide a pathway from low-level C programming to high-level \CFA programming, but it does not force programmers to ``do the right thing''. 146 Programmers can cautiously add \CFA extensions to their C programs in any order and at any time to incrementally move towards safer, higher-level programming features. 147 A programmer is always free to reach back to C from \CFA for any reason, and in many cases, new \CFA features have a fallback to a C mechanism. 148 There is no notion or requirement for rewriting a legacy C program in \CFA; 149 instead, a programmer evolves an existing C program into \CFA by incrementally incorporating \CFA features. 150 New programs can be written in \CFA using a combination of C and \CFA features. 151 \Index*[C++]{\CC{}} had a similar goal 30 years ago, but currently has the disadvantages of multiple legacy design-choices that cannot be updated and active divergence of the language model from C, requiring significant effort and training to incrementally add \CC to a C-based project. 158 152 In contrast, \CFA has 30 years of hindsight and a clean starting point. 159 153 … … 162 156 \begin{quote2} 163 157 \begin{tabular}{@{}l@{\hspace{1.5em}}l@{\hspace{1.5em}}l@{}} 164 \multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{\CC}} \\ 165 \begin{cfa} 158 \multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CC}} \\ 159 \begin{cfa} 160 #include <fstream>§\indexc{fstream}§ 161 162 int main( void ) { 163 int x = 0, y = 1, z = 2; 164 ®sout | x | y | z | endl;® 165 } 166 \end{cfa} 167 & 168 \begin{lstlisting} 166 169 #include <stdio.h>§\indexc{stdio.h}§ 167 170 … … 170 173 ®printf( "%d %d %d\n", x, y, z );® 171 174 } 172 \end{ cfa}175 \end{lstlisting} 173 176 & 174 \begin{cfa} 175 #include <fstream>§\indexc{fstream}§ 176 177 int main( void ) { 178 int x = 0, y = 1, z = 2; 179 ®sout | x | y | z | endl;®§\indexc{sout}§ 180 } 181 \end{cfa} 182 & 183 \begin{cfa} 177 \begin{lstlisting} 184 178 #include <iostream>§\indexc{iostream}§ 185 179 using namespace std; … … 188 182 ®cout<<x<<" "<<y<<" "<<z<<endl;® 189 183 } 190 \end{ cfa}184 \end{lstlisting} 191 185 \end{tabular} 192 186 \end{quote2} 193 187 While the \CFA I/O looks similar to the \Index*[C++]{\CC{}} output style, there are important differences, such as automatic spacing between variables as in \Index*{Python} (see~\VRef{s:IOLibrary}). 194 188 195 \subsection{Background}196 197 189 This document is a programmer reference-manual for the \CFA programming language. 198 190 The manual covers the core features of the language and runtime-system, with simple examples illustrating syntax and semantics of each feature. 199 191 The manual does not teach programming, i.e., how to combine the new constructs to build complex programs. 200 A reader should already have an intermediate knowledge of control flow, data structures, and concurrency issues to understand the ideas presented ,as well as some experience programming in C/\CC.201 Implementers shouldrefer to the \CFA Programming Language Specification for details about the language syntax and semantics.192 A reader should already have an intermediate knowledge of control flow, data structures, and concurrency issues to understand the ideas presented as well as some experience programming in C/\CC. 193 Implementers may refer to the \CFA Programming Language Specification for details about the language syntax and semantics. 202 194 Changes to the syntax and additional features are expected to be included in later revisions. 203 195 … … 208 200 This installation base and the programmers producing it represent a massive software-engineering investment spanning decades and likely to continue for decades more. 209 201 Even with all its problems, C continues to be popular because it allows writing software at virtually any level in a computer system without restriction. 210 For system programming, where direct access to hardware , storage management, and real-time issues are a requirement, C is usually the onlylanguage of choice.202 For system programming, where direct access to hardware and dealing with real-time issues is a requirement, C is usually the language of choice. 211 203 The TIOBE index~\cite{TIOBE} for March 2016 showed the following programming-language popularity: \Index*{Java} 20.5\%, C 14.5\%, \Index*[C++]{\CC{}} 6.7\%, \Csharp 4.3\%, \Index*{Python} 4.3\%, where the next 50 languages are less than 3\% each with a long tail. 212 204 As well, for 30 years, C has been the number 1 and 2 most popular programming language: … … 224 216 \end{center} 225 217 Hence, C is still an extremely important programming language, with double the usage of \Index*[C++]{\CC{}}; in many cases, \CC is often used solely as a better C. 226 Love it or hate it, C has been an important and influential part of computer science for 40 years and itsappeal is not diminishing.227 Unfortunately, C has many problems and omissions that make it an unacceptable programming language for modern needs.228 229 As stated, the goal of the \CFA project is to engineer modern language -features into C in an evolutionary rather than revolutionary way.218 Love it or hate it, C has been an important and influential part of computer science for 40 years and sit appeal is not diminishing. 219 Unfortunately, C has too many problems and omissions to make it an acceptable programming language for modern needs. 220 221 As stated, the goal of the \CFA project is to engineer modern language features into C in an evolutionary rather than revolutionary way. 230 222 \CC~\cite{C++14,C++} is an example of a similar project; 231 however, it largely extended the C language, and did not address most of C'sexisting problems.\footnote{%223 however, it largely extended the language, and did not address many existing problems.\footnote{% 232 224 Two important existing problems addressed were changing the type of character literals from ©int© to ©char© and enumerator from ©int© to the type of its enumerators.} 233 \Index*{Fortran}~\cite{Fortran08}, \Index*{Ada}~\cite{Ada12}, and \Index*{Cobol}~\cite{Cobol14} are examples of programming languages that took an evolutionary approach, where modern language -features (\eg objects, concurrency) are added and problems fixed within the framework of the existing language.225 \Index*{Fortran}~\cite{Fortran08}, \Index*{Ada}~\cite{Ada12}, and \Index*{Cobol}~\cite{Cobol14} are examples of programming languages that took an evolutionary approach, where modern language features (\eg objects, concurrency) are added and problems fixed within the framework of the existing language. 234 226 \Index*{Java}~\cite{Java8}, \Index*{Go}~\cite{Go}, \Index*{Rust}~\cite{Rust} and \Index*{D}~\cite{D} are examples of the revolutionary approach for modernizing C/\CC, resulting in a new language rather than an extension of the descendent. 235 These languages have different syntax and semantics from C, do not interoperate directly with C, and are not systems languages because of restrictive memory-management orgarbage collection.227 These languages have different syntax and semantics from C, and do not interoperate directly with C, largely because of garbage collection. 236 228 As a result, there is a significant learning curve to move to these languages, and C legacy-code must be rewritten. 237 These costs can be prohibitive for many companies with a large software -base in C/\CC, and a significant number of programmers require retraining to thenew programming language.238 239 The result of this project is a language that is largely backwards compatible with \Index*[C11]{\Celeven{}}~\cite{C11}, but fix es many of the well known C problems while containing modern language-features.229 These costs can be prohibitive for many companies with a large software base in C/\CC, and a significant number of programmers requiring retraining to a new programming language. 230 231 The result of this project is a language that is largely backwards compatible with \Index*[C11]{\Celeven{}}~\cite{C11}, but fixing some of the well known C problems and containing many modern language features. 240 232 Without significant extension to the C programming language, it is becoming unable to cope with the needs of modern programming problems and programmers; 241 233 as a result, it will fade into disuse. 242 234 Considering the large body of existing C code and programmers, there is significant impetus to ensure C is transformed into a modern programming language. 243 While \Index*[C11]{\Celeven{}} made a few simple extensions to the language, nothing was added to address existing problems in the language or to augment the language with modern language -features.244 While some may argue that modern language -features may make C complex and inefficient, it is clear a language without modern capabilities is insufficient for the advanced programming problems existing today.235 While \Index*[C11]{\Celeven{}} made a few simple extensions to the language, nothing was added to address existing problems in the language or to augment the language with modern language features. 236 While some may argue that modern language features may make C complex and inefficient, it is clear a language without modern capabilities is insufficient for the advanced programming problems existing today. 245 237 246 238 247 239 \section{History} 248 240 249 The \CFA project started with \Index*{K-W C}~\cite{Buhr94a,Till89}, which extended C with new declaration syntax, multiple return values from routines, and advanced assignment capabilities using the notion of tuples.241 The \CFA project started with \Index*{K-W C}~\cite{Buhr94a,Till89}, which extended C with new declaration syntax, multiple return values from routines, and extended assignment capabilities using the notion of tuples. 250 242 (See~\cite{Werther96} for similar work in \Index*[C++]{\CC{}}.) 251 The first \CFA implementation of these extensions was by Esteves~\cite{Esteves04}. 252 253 The signature feature of \CFA is \emph{\Index{overload}able} \Index{parametric-polymorphic} functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name): 243 A first \CFA implementation of these extensions was by Esteves~\cite{Esteves04}. 244 The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name): 254 245 \begin{lstlisting} 255 246 ®forall( otype T )® T identity( T val ) { return val; } … … 257 248 \end{lstlisting} 258 249 % extending the C type system with parametric polymorphism and overloading, as opposed to the \Index*[C++]{\CC{}} approach of object-oriented extensions. 259 \CFA{}\hspace{1pt}'s polymorphism was originally formalized by Ditchfi eld~\cite{Ditchfield92}, and first implemented by Bilson~\cite{Bilson03}.250 \CFA{}\hspace{1pt}'s polymorphism was originally formalized by Ditchfiled~\cite{Ditchfield92}, and first implemented by Bilson~\cite{Bilson03}. 260 251 However, at that time, there was little interesting in extending C, so work did not continue. 261 As the saying goes, `` \Index*{What goes around, comes around.}'', and there is now renewed interest in the C programming language because of legacy code-bases, so the \CFA project has been restarted.252 As the saying goes, ``What goes around, comes around.'', and there is now renewed interest in the C programming language because of legacy code-bases, so the \CFA project has been restarted. 262 253 263 254 … … 266 257 267 258 \CFA is designed to integrate directly with existing C programs and libraries. 268 The most important feature of \Index{interoperability} is using the same \Index{calling convention}s, so there is no complex interface oroverhead to call existing C routines.259 The most important feature of \Index{interoperability} is using the same \Index{calling convention}s, so there is no overhead to call existing C routines. 269 260 This feature allows \CFA programmers to take advantage of the existing panoply of C libraries to access thousands of external software features. 270 261 Language developers often state that adequate \Index{library support} takes more work than designing and implementing the language itself. 271 262 Fortunately, \CFA, like \Index*[C++]{\CC{}}, starts with immediate access to all exiting C libraries, and in many cases, can easily wrap library routines with simpler and safer interfaces, at very low cost. 272 Hence, \CFA begins by leveraging the large repository of C libraries , and than allows programmers to incrementally augment their C programs with modern \Index{backward-compatible} features.263 Hence, \CFA begins by leveraging the large repository of C libraries with little cost. 273 264 274 265 \begin{comment} … … 313 304 \end{comment} 314 305 315 However, it is necessary to differentiate between C and \CFA code because of name \Index{overload}ing, as for \CC.306 However, it is necessary to differentiate between C and \CFA code because of name overloading, as for \CC. 316 307 For example, the C math-library provides the following routines for computing the absolute value of the basic types: ©abs©, ©labs©, ©llabs©, ©fabs©, ©fabsf©, ©fabsl©, ©cabsf©, ©cabs©, and ©cabsl©. 317 Whereas, \CFA wraps each of these routines into ones with the overloadedname ©abs©:308 Whereas, \CFA wraps each of these routines into ones with the common name ©abs©: 318 309 \begin{cfa} 319 310 char abs( char ); 320 ®extern "C" {® int abs( int ); ®}® §\C{// use default C routine for int}§ 311 ®extern "C" {® 312 int abs( int ); §\C{// use default C routine for int}§ 313 ®}® // extern "C" 321 314 long int abs( long int ); 322 315 long long int abs( long long int ); … … 333 326 Hence, there is the same need as in \CC, to know if a name is a C or \CFA name, so it can be correctly formed. 334 327 There is no way around this problem, other than C's approach of creating unique names for each pairing of operation and type. 335 336 This example strongly illustrates a core idea in \CFA: \emph{the \Index{power of a name}}. 328 This example strongly illustrates a core idea in \CFA: \emph{the power of a name}. 337 329 The name ``©abs©'' evokes the notion of absolute value, and many mathematical types provide the notion of absolute value. 338 Hence, knowing the name ©abs© issufficient to apply it to any type where it is applicable.339 The time savings and safety of using one name uniformly versus $N$ unique names cannot be underestimated.340 341 342 \section[Compiling a CFA Program]{Compiling a\CFA Program}343 344 The command ©cfa© is used to compile a \CFA program and is based on the \Index{GNU}\Indexc{gcc} command, \eg:345 \begin{cfa} 346 cfa§\indexc{cfa}\index{compilation!cfa@©cfa©}§ [ gcc-options ] C/§\CFA {}§-files [ assembler/loader-files ]330 Hence, knowing the name ©abs© should be sufficient to apply it to any type where it is applicable. 331 The time savings and safety of using one name uniformly versus $N$ unique names should not be underestimated. 332 333 334 \section[Compiling CFA Program]{Compiling \CFA Program} 335 336 The command ©cfa© is used to compile \CFA program(s), and is based on the GNU \Indexc{gcc} command, \eg: 337 \begin{cfa} 338 cfa§\indexc{cfa}\index{compilation!cfa@©cfa©}§ [ gcc-options ] C/§\CFA§-files [ assembler/loader-files ] 347 339 \end{cfa} 348 340 \CFA programs having the following ©gcc© flags turned on: … … 352 344 The 1999 C standard plus GNU extensions. 353 345 \item 354 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}} 346 {\lstset{deletekeywords={inline}} 347 \Indexc{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{©-fgnu89-inline©}} 355 348 Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files. 349 }% 356 350 \end{description} 357 351 The following new \CFA options are available: … … 360 354 \Indexc{-CFA}\index{compilation option!-CFA@©-CFA©} 361 355 Only the C preprocessor and the \CFA translator steps are performed and the transformed program is written to standard output, which makes it possible to examine the code generated by the \CFA translator. 362 The generated code start s with the standard \CFA \Index{prelude}.356 The generated code started with the standard \CFA prelude. 363 357 364 358 \item 365 359 \Indexc{-debug}\index{compilation option!-debug@©-debug©} 366 360 The program is linked with the debugging version of the runtime system. 367 The debug version performs runtime checks to help during the debugging phase of a \CFA program, but can substantially slow program execution.361 The debug version performs runtime checks to help during the debugging phase of a \CFA program, but substantially slows the execution of the program. 368 362 The runtime checks should only be removed after the program is completely debugged. 369 363 \textbf{This option is the default.} … … 372 366 \Indexc{-nodebug}\index{compilation option!-nodebug@©-nodebug©} 373 367 The program is linked with the non-debugging version of the runtime system, so the execution of the program is faster. 374 \Emph{However, no runtime checks or ©assert©s are performed so errors usually result in abnormal program behaviour ortermination.}368 \Emph{However, no runtime checks or ©assert©s are performed so errors usually result in abnormal program termination.} 375 369 376 370 \item … … 392 386 \textbf{This option is the default.} 393 387 394 \begin{comment}395 388 \item 396 389 \Indexc{-no-include-stdhdr}\index{compilation option!-no-include-stdhdr@©-no-include-stdhdr©} 397 390 Do not supply ©extern "C"© wrappers for \Celeven standard include files (see~\VRef{s:StandardHeaders}). 398 391 \textbf{This option is \emph{not} the default.} 399 \end{comment}400 392 \end{description} 401 393 … … 418 410 \item 419 411 \Indexc{__CFA__}\index{preprocessor variables!__CFA__@©__CFA__©}, 420 \Indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@©__CFORALL__©} ,and412 \Indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@©__CFORALL__©} and 421 413 \Indexc{__cforall}\index{preprocessor variables!__cforall@©__cforall©} 422 414 are always available during preprocessing and have no value. 423 415 \end{description} 424 416 These preprocessor variables allow conditional compilation of programs that must work differently in these situations. 425 For example, to toggle between C and \CFA extensions, us ethe following:417 For example, to toggle between C and \CFA extensions, using the following: 426 418 \begin{cfa} 427 419 #ifndef __CFORALL__ … … 434 426 435 427 436 \section{Constant Underscores}437 438 Numeric constants are extended to allow \Index{underscore}s \index{constant!underscore}, \eg:428 \section{Constants Underscores} 429 430 Numeric constants are extended to allow \Index{underscore}s within constants\index{constant!underscore}, \eg: 439 431 \begin{cfa} 440 432 2®_®147®_®483®_®648; §\C{// decimal constant}§ … … 449 441 L®_®§"\texttt{\textbackslash{x}}§®_®§\texttt{ff}§®_®§\texttt{ee}"§; §\C{// wide character constant}§ 450 442 \end{cfa} 451 The rules for placement of underscores are:452 \begin{enumerate} [topsep=5pt,itemsep=5pt,parsep=0pt]443 The rules for placement of underscores is as follows: 444 \begin{enumerate} 453 445 \item 454 446 A sequence of underscores is disallowed, \eg ©12__34© is invalid. … … 471 463 \label{s:BackquoteIdentifiers} 472 464 473 \CFA introduces several new keywords (see \VRef{s:CFAKeywords}) that can clash with existing C variable-names in legacy code. 474 Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism: 465 \CFA accommodates keyword clashes with existing C variable-names by syntactic transformations using the \CFA backquote escape-mechanism: 475 466 \begin{cfa} 476 467 int ®`®otype®`® = 3; §\C{// make keyword an identifier}§ 477 468 double ®`®forall®`® = 3.5; 478 469 \end{cfa} 479 480 470 Existing C programs with keyword clashes can be converted by enclosing keyword identifiers in backquotes, and eventually the identifier name can be changed to a non-keyword name. 481 \VRef[Figure]{f:HeaderFileInterposition} shows how clashes in existing C header-files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©. 482 Several common C header-files with keyword clashes are fixed in the standard \CFA header-library, so there is a seamless programming-experience. 471 \VRef[Figure]{f:InterpositionHeaderFile} shows how clashes in C header files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©: 483 472 484 473 \begin{figure} 485 474 \begin{cfa} 486 // include file uses the CFA keyword " with".487 #if ! defined( with) §\C{// nesting ?}§488 #define with ®`®with®`®§\C{// make keyword an identifier}§475 // include file uses the CFA keyword "otype". 476 #if ! defined( otype ) §\C{// nesting ?}§ 477 #define otype ®`®otype®`® §\C{// make keyword an identifier}§ 489 478 #define __CFA_BFD_H__ 490 #endif 491 492 ®#include_next <bfdlink.h>§\C{// must have internal check for multiple expansion}§493 ® 494 #if defined( with) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§495 #undef with479 #endif // ! otype 480 481 #®include_next® <bfd.h> §\C{// must have internal check for multiple expansion}§ 482 483 #if defined( otype ) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§ 484 #undef otype 496 485 #undef __CFA_BFD_H__ 497 #endif 498 \end{cfa} 499 \caption{ Header-File Interposition}500 \label{f: HeaderFileInterposition}486 #endif // otype && __CFA_BFD_H__ 487 \end{cfa} 488 \caption{Interposition of Header File} 489 \label{f:InterpositionHeaderFile} 501 490 \end{figure} 502 491 503 492 504 \section{ \texorpdfstring{Labelled \LstKeywordStyle{continue} / \LstKeywordStyle{break}}{Labelled continue / break}}493 \section{Labelled Continue/Break} 505 494 506 495 While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure. 507 496 Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting. 508 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline $continue$!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline $break$!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85 }, as in Java.497 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline $continue$!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline $break$!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85,Java}. 509 498 For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement; 510 499 for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement. … … 523 512 ®LF:® for ( ... ) { 524 513 ®LW:® while ( ... ) { 525 ... break ®LC®; ... // terminate compound526 ... break ®LS®; ... // terminate switch527 ... break ®LIF®; ... // terminate if528 ... continue ®LF;® ... // resume loop529 ... break ®LF®; ... // terminate loop530 ... continue ®LW®; ... // resume loop531 ... break ®LW®; ... // terminate loop514 ... break ®LC®; ... // terminate compound 515 ... break ®LS®; ... // terminate switch 516 ... break ®LIF®; ... // terminate if 517 ... continue ®LF;® ... // resume loop 518 ... break ®LF®; ... // terminate loop 519 ... continue ®LW®; ... // resume loop 520 ... break ®LW®; ... // terminate loop 532 521 } // while 533 522 } // for 534 523 } else { 535 ... break ®LIF®; ... // terminate if524 ... break ®LIF®; ... // terminate if 536 525 } // if 537 526 } // switch … … 575 564 LF: for ( ;; ) { 576 565 LW: while ( 1 ) { 577 break LC; // terminate compound578 break LS; // terminate switch579 break LIF; // terminate if580 continue LF; // resume loop581 break LF; // terminate loop582 continue LW; // resume loop583 break LW; // terminate loop566 break LC; // terminate compound 567 break LS; // terminate switch 568 break LIF; // terminate if 569 continue LF; // resume loop 570 break LF; // terminate loop 571 continue LW; // resume loop 572 break LW; // terminate loop 584 573 } // while 585 574 } // for 586 575 } else { 587 break LIF; // terminate if576 break LIF; // terminate if 588 577 } // if 589 578 } // switch … … 624 613 \item 625 614 They cannot branch into a control structure. 626 This restriction prevents missing declarations and/or initializationsat the start of a control structure resulting in undefined behaviour.615 This restriction prevents missing initialization at the start of a control structure resulting in undefined behaviour. 627 616 \end{itemize} 628 617 The advantage of the labelled ©continue©/©break© is allowing static multi-level exits without having to use the ©goto© statement, and tying control flow to the target control structure rather than an arbitrary point in a program. 629 Furthermore, the location of the label at the \emph{beginning} of the target control structure informs the reader (\Index{eye candy})that complex control-flow is occurring in the body of the control structure.618 Furthermore, the location of the label at the \emph{beginning} of the target control structure informs the reader that complex control-flow is occurring in the body of the control structure. 630 619 With ©goto©, the label is at the end of the control structure, which fails to convey this important clue early enough to the reader. 631 620 Finally, using an explicit target for the transfer instead of an implicit target allows new constructs to be added or removed without affecting existing constructs. … … 633 622 634 623 635 \section{ \texorpdfstring{\LstKeywordStyle{switch} Statement}{switch Statement}}624 \section{Switch Statement} 636 625 637 626 C allows a number of questionable forms for the ©switch© statement: … … 674 663 ®// open input file 675 664 ®} else if ( argc == 2 ) { 676 ®// open input file (duplicate)665 ®// open input file 677 666 678 667 ®} else { … … 687 676 \begin{cfa} 688 677 switch ( i ) { 689 ®case 1: case 3: case 5:®// odd values690 // oddaction678 case 1: case 3: case 5: // odd values 679 // same action 691 680 break; 692 ®case 2: case 4: case 6:®// even values693 // evenaction681 case 2: case 4: case 6: // even values 682 // same action 694 683 break; 695 684 } … … 697 686 However, this situation is handled in other languages without fall-through by allowing a list of case values. 698 687 While fall-through itself is not a problem, the problem occurs when fall-through is the default, as this semantics is unintuitive to many programmers and is different from virtually all other programming languages with a ©switch© statement. 699 Hence, default fall-through semantics results in a large number of programming errors as programmers often \emph{forget}the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.688 Hence, default fall-through semantics results in a large number of programming errors as programmers often forget the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through. 700 689 701 690 \item … … 719 708 The problem with this usage is branching into control structures, which is known to cause both comprehension and technical difficulties. 720 709 The comprehension problem occurs from the inability to determine how control reaches a particular point due to the number of branches leading to it. 721 The technical problem results from the inability to ensure declaration and initialization of variables when blocks are not entered at the beginning. 722 There are no positive arguments for this kind of control flow, and therefore, there is a strong impetus to eliminate it. 710 The technical problem results from the inability to ensure allocation and initialization of variables when blocks are not entered at the beginning. 711 Often transferring into a block can bypass variable declaration and/or its initialization, which results in subsequent errors. 712 There are virtually no positive arguments for this kind of control flow, and therefore, there is a strong impetus to eliminate it. 723 713 Nevertheless, C does have an idiom where this capability is used, known as ``\Index*{Duff's device}''~\cite{Duff83}: 724 714 \begin{cfa} … … 780 770 and there is only a medium amount of fall-through from one ©case© clause to the next, and most of these result from a list of case values executing common code, rather than a sequence of case actions that compound. 781 771 \end{itemize} 782 These observations put into perspective the \CFA changes to the ©switch©.772 These observations help to put the \CFA changes to the ©switch© into perspective. 783 773 \begin{enumerate} 784 774 \item … … 801 791 case 7: 802 792 ... 803 ®break® §\C{// redundantexplicit end of switch}§793 ®break® §\C{// explicit end of switch}§ 804 794 default: 805 795 j = 3; … … 807 797 \end{cfa} 808 798 Like the ©switch© statement, the ©choose© statement retains the fall-through semantics for a list of ©case© clauses; 809 Animplicit ©break© is applied only at the end of the \emph{statements} following a ©case© clause.810 Anexplicit ©fallthru© is retained because it is a C-idiom most C programmers expect, and its absence might discourage programmers from using the ©choose© statement.799 the implicit ©break© is applied only at the end of the \emph{statements} following a ©case© clause. 800 The explicit ©fallthru© is retained because it is a C-idiom most C programmers expect, and its absence might discourage programmers from using the ©choose© statement. 811 801 As well, allowing an explicit ©break© from the ©choose© is a carry over from the ©switch© statement, and expected by C programmers. 812 802 \item … … 837 827 838 828 839 \section{ \texorpdfstring{\LstKeywordStyle{case} Clause}{case Clause}}829 \section{Case Clause} 840 830 841 831 C restricts the ©case© clause of a ©switch© statement to a single value. … … 913 903 914 904 915 \section{\texorpdfstring{\LstKeywordStyle{with} Clause / Statement}{with Clause / Statement}}916 \label{s:WithClauseStatement}917 918 In \Index{object-oriented} programming, there is an implicit first parameter, often names \textbf{©self©} or \textbf{©this©}, which is elided.919 \begin{C++}920 class C {921 int i, j;922 int mem() { ®// implicit "this" parameter923 ® i = 1; ®// this->i924 ® j = 3; ®// this->j925 ® }926 }927 \end{C++}928 Since CFA is non-object-oriented, the equivalent object-oriented program looks like:929 \begin{cfa}930 struct S { int i, j; };931 int mem( S &this ) { // explicit "this" parameter932 ®this.®i = 1; // "this" is not elided933 ®this.®j = 2;934 }935 \end{cfa}936 but it is cumbersome having to write "©this.©" many times in a member.937 938 \CFA provides a ©with© clause/statement (see Pascal~\cite[\S~4.F]{Pascal}) to elided the "©this.©" by opening a scope containing field identifiers, changing the qualified fields into variables and giving an opportunity for optimizing qualified references.939 \begin{cfa}940 int mem( S &this ) ®with this® { // with clause941 i = 1; ®// this.i942 ® j = 2; ®// this.j943 ®}944 \end{cfa}945 which extends to multiple routine parameters:946 \begin{cfa}947 struct T { double m, n; };948 int mem2( S &this1, T &this2 ) ®with this1, this2® {949 i = 1; j = 2;950 m = 1.0; n = 2.0;951 }952 \end{cfa}953 954 The statement form is used within a block:955 \begin{cfa}956 int foo() {957 struct S1 { ... } s1;958 struct S2 { ... } s2;959 ®with s1® { // with statement960 // access fields of s1 without qualification961 ®with s2® { // nesting962 // access fields of s1 and s2 without qualification963 }964 }965 ®with s1, s2® {966 // access unambiguous fields of s1 and s2 without qualification967 }968 }969 \end{cfa}970 971 When opening multiple structures, fields with the same name and type are ambiguous and must be fully qualified.972 For fields with the same name but different type, context/cast can be used to disambiguate.973 \begin{cfa}974 struct S { int i; int j; double m; } a, c;975 struct T { int i; int k; int m } b, c;976 ®with a, b® {977 j + k; §\C{// unambiguous, unique names define unique types}§978 i; §\C{// ambiguous, same name and type}§979 a.i + b.i; §\C{// unambiguous, qualification defines unique names}§980 m; §\C{// ambiguous, same name and no context to define unique type}§981 m = 5.0; §\C{// unambiguous, same name and context defines unique type}§982 m = 1; §\C{// unambiguous, same name and context defines unique type}§983 }984 ®with c® { ... } §\C{// ambiguous, same name and no context}§985 ®with (S)c® { ... } §\C{// unambiguous, same name and cast defines unique type}§986 \end{cfa}987 988 989 905 \section{Exception Handling} 990 \label{s:ExceptionHandling}991 906 992 907 Exception handling provides two mechanism: change of control flow from a raise to a handler, and communication from the raise to the handler. 993 Transfer of control can be local, within a routine, or non-local, among routines. 994 Non-local transfer can cause stack unwinding, i.e., non-local routine termination, depending on the kind of raise. 995 \begin{cfa} 996 exception_t E {}; §\C{// exception type}§ 908 \begin{cfa} 909 exception void h( int i ); 910 exception int h( int i, double d ); 911 997 912 void f(...) { 998 ... throw E{}; ... §\C{// termination}§ 999 ... throwResume E{}; ... §\C{// resumption}§ 1000 } 913 ... throw h( 3 ); 914 ... i = resume h( 3, 5.1 ); 915 } 916 1001 917 try { 1002 918 f(...); 1003 } catch ( E e : §boolean-predicate§ ) { §\C{// termination handler}§1004 // re cover and continue1005 } catchResume( E e : §boolean-predicate§ ) { §\C{// resumption handler}§1006 // repair and return919 } catch h( int w ) { 920 // reset 921 } resume h( int p, double x ) { 922 return 17; // recover 1007 923 } finally { 1008 // always executed 1009 } 1010 \end{cfa} 1011 The kind of raise and handler match: ©throw© with ©catch© and ©throwResume© with ©catchResume©. 1012 Then the exception type must match along with any additonal predicate must be true. 1013 The ©catch© and ©catchResume© handlers may appear in any oder. 1014 However, the ©finally© clause must appear at the end of the ©try© statement. 924 } 925 \end{cfa} 926 So the type raised would be the mangled name of the exception prototype and that name would be matched at the handler clauses by comparing the strings. 927 The arguments for the call would have to be packed in a message and unpacked at handler clause and then a call made to the handler. 1015 928 1016 929 … … 1223 1136 1224 1137 1225 \section{Exponentiation Operator} 1226 1227 C, \CC, and Java (and many other programming languages) have no exponentiation operator\index{exponentiation!operator}\index{operator!exponentiation}, \ie $x^y$, and instead use a routine, like \Indexc{pow}, to perform the exponentiation operation. 1228 \CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@\lstinline$?\?$} and ©?\=?©\index{?\\=?@\lstinline$?\=?$}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$. 1229 The priority of the exponentiation operator is between the cast and multiplicative operators, so that ©w * (int)x \ (int)y * z© is parenthesized as ©((w * (((int)x) \ ((int)y))) * z)©. 1230 1231 As for \Index{division}, there are exponentiation operators for integral and floating-point types, including the builtin \Index{complex} types. 1232 Unsigned integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication (or shifting if the base is 2). 1233 Signed integral exponentiation\index{exponentiation!signed integral} is performed with repeated multiplication (or shifting if the base is 2), but yields a floating-point result because $b^{-e}=1/b^e$. 1234 Hence, it is important to designate exponent integral-constants as unsigned or signed: ©3 \ 3u© return an integral result, while ©3 \ 3© returns a floating-point result. 1235 Floating-point exponentiation\index{exponentiation!floating point} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative. 1236 \begin{cfa} 1237 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl; 1238 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 1239 \end{cfa} 1240 Parenthesis are necessary for the complex constants or the expresion is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©. 1241 The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation versions are available. 1242 For returning an integral value, the user type ©T© must define multiplication, ©*©, and one, ©1©; 1243 for returning a floating-point value, an additional divide of type ©T© into a ©double© returning a ©double© (©double ?/?( double, T )©) is necessary for negative exponents. 1244 1245 1246 \section{Pointer / Reference} 1138 \section{Pointer/Reference} 1247 1139 1248 1140 C provides a \newterm{pointer type}; … … 1252 1144 An integer constant expression with the value 0, or such an expression cast to type ©void *©, is called a \newterm{null-pointer constant}.\footnote{ 1253 1145 One way to conceptualize the null pointer is that no variable is placed at this address, so the null-pointer address can be used to denote an uninitialized pointer/reference object; 1254 \ie the null pointer is guaranteed to compare unequal to a pointer to any object or routine. 1255 In general, a value with special meaning among a set of values is called a \emph{\Index{sentinel value}}, \eg ©-1© as a return code value.} 1146 \ie the null pointer is guaranteed to compare unequal to a pointer to any object or routine.} 1256 1147 An address is \newterm{sound}, if it points to a valid memory location in scope, \ie within the program's execution-environment and has not been freed. 1257 1148 Dereferencing an \newterm{unsound} address, including the null pointer, is \Index{undefined}, often resulting in a \Index{memory fault}. … … 1288 1179 \hline 1289 1180 \begin{cfa} 1290 lda r1,100 // load address of x1291 ld r2,(r1) // load value of x1292 lda r3,104 // load address of y1293 st r2,(r3) // store x into y1181 lda r1,100 // load address of x 1182 ld r2,(r1) // load value of x 1183 lda r3,104 // load address of y 1184 st r2,(r3) // store x into y 1294 1185 \end{cfa} 1295 1186 & 1296 1187 \begin{cfa} 1297 1188 1298 ld r2,(100) // load value of x1299 1300 st r2,(104) // store x into y1189 ld r2,(100) // load value of x 1190 1191 st r2,(104) // store x into y 1301 1192 \end{cfa} 1302 1193 \end{tabular} … … 1594 1485 1595 1486 \item 1596 lvalue to reference conversion: \lstinline[deletekeywords= lvalue]$lvalue-type cv1 T$converts to ©cv2 T &©, which allows implicitly converting variables to references.1487 lvalue to reference conversion: \lstinline[deletekeywords={lvalue}]@lvalue-type cv1 T@ converts to ©cv2 T &©, which allows implicitly converting variables to references. 1597 1488 \begin{cfa} 1598 1489 int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &) … … 2703 2594 \begin{cfa}[belowskip=0pt] 2704 2595 char store[®sepSize®]; §\C{// sepSize is the maximum separator size}§ 2705 strcpy( store, sepGet( sout ) ); §\C{// copy current separator}§2706 sepSet( sout, "_" ); §\C{// change separator to underscore}§2596 strcpy( store, sepGet( sout ) ); 2597 sepSet( sout, "_" ); 2707 2598 sout | 1 | 2 | 3 | endl; 2708 2599 \end{cfa} … … 2711 2602 \end{cfa} 2712 2603 \begin{cfa}[belowskip=0pt] 2713 sepSet( sout, store ); §\C{// change separator back to original}§2604 sepSet( sout, store ); 2714 2605 sout | 1 | 2 | 3 | endl; 2715 2606 \end{cfa} … … 3268 3159 \Indexc{gcc} provides ©typeof© to declare a secondary variable from a primary variable. 3269 3160 \CFA also relies heavily on the specification of the left-hand side of assignment for type inferencing, so in many cases it is crucial to specify the type of the left-hand side to select the correct type of the right-hand expression. 3270 Only for overloaded routines \emph{with the same return type}is variable type-inferencing possible.3161 Only for overloaded routines with the same return type is variable type-inferencing possible. 3271 3162 Finally, ©auto© presents the programming problem of tracking down a type when the type is actually needed. 3272 3163 For example, given … … 5367 5258 5368 5259 5369 \section{\ texorpdfstring{\CFA Keywords}{Cforall Keywords}}5260 \section{\CFA Keywords} 5370 5261 \label{s:CFAKeywords} 5371 5262 5372 \CFA introduces the following new keywords.5373 5374 5263 \begin{quote2} 5375 \begin{tabular}{llll l}5264 \begin{tabular}{llll} 5376 5265 \begin{tabular}{@{}l@{}} 5377 ©_A t© \\5266 ©_AT© \\ 5378 5267 ©catch© \\ 5379 5268 ©catchResume© \\ 5380 5269 ©choose© \\ 5381 5270 ©coroutine© \\ 5271 ©disable© \\ 5382 5272 \end{tabular} 5383 5273 & 5384 5274 \begin{tabular}{@{}l@{}} 5385 ©disable© \\5386 5275 ©dtype© \\ 5387 5276 ©enable© \\ 5388 5277 ©fallthrough© \\ 5389 5278 ©fallthru© \\ 5279 ©finally© \\ 5280 ©forall© \\ 5390 5281 \end{tabular} 5391 5282 & 5392 5283 \begin{tabular}{@{}l@{}} 5393 ©finally© \\5394 ©forall© \\5395 5284 ©ftype© \\ 5396 5285 ©lvalue© \\ 5397 5286 ©monitor© \\ 5287 ©mutex© \\ 5288 ©one_t© \\ 5289 ©otype© \\ 5398 5290 \end{tabular} 5399 5291 & 5400 5292 \begin{tabular}{@{}l@{}} 5401 ©mutex© \\5402 ©one_t© \\5403 ©otype© \\5404 5293 ©throw© \\ 5405 5294 ©throwResume© \\ 5406 \end{tabular}5407 &5408 \begin{tabular}{@{}l@{}}5409 5295 ©trait© \\ 5410 5296 ©try© \\ 5411 5297 ©ttype© \\ 5412 ©with© \\5413 5298 ©zero_t© \\ 5414 5299 \end{tabular} … … 5445 5330 g( p1, p2 ) int p1, p2; §\C{// int g( int p1, int p2 );}§ 5446 5331 \end{cfa} 5447 \CFA continues to supportK\&R routine definitions:5332 \CFA supports K\&R routine definitions: 5448 5333 \begin{cfa} 5449 5334 f( a, b, c ) §\C{// default int return}§ … … 5586 5471 \Celeven prescribes the following standard header-files~\cite[\S~7.1.2]{C11} and \CFA adds to this list: 5587 5472 \begin{quote2} 5588 \begin{tabular}{@{}lllll|l@{}} 5589 \multicolumn{5}{c|}{C11} & \multicolumn{1}{c}{\CFA} \\ 5473 \lstset{deletekeywords={float}} 5474 \begin{tabular}{@{}llll|l@{}} 5475 \multicolumn{4}{c|}{C11} & \multicolumn{1}{c}{\CFA} \\ 5590 5476 \hline 5591 5477 \begin{tabular}{@{}l@{}} … … 5595 5481 \Indexc{errno.h} \\ 5596 5482 \Indexc{fenv.h} \\ 5597 \Indexc[deletekeywords=float]{float.h} \\ 5483 \Indexc{float.h} \\ 5484 \Indexc{inttypes.h} \\ 5485 \Indexc{iso646.h} \\ 5598 5486 \end{tabular} 5599 5487 & 5600 5488 \begin{tabular}{@{}l@{}} 5601 \Indexc{inttypes.h} \\5602 \Indexc{iso646.h} \\5603 5489 \Indexc{limits.h} \\ 5604 5490 \Indexc{locale.h} \\ 5605 5491 \Indexc{math.h} \\ 5606 5492 \Indexc{setjmp.h} \\ 5607 \end{tabular}5608 &5609 \begin{tabular}{@{}l@{}}5610 5493 \Indexc{signal.h} \\ 5611 5494 \Indexc{stdalign.h} \\ 5612 5495 \Indexc{stdarg.h} \\ 5613 5496 \Indexc{stdatomic.h} \\ 5614 \Indexc{stdbool.h} \\5615 \Indexc{stddef.h} \\5616 5497 \end{tabular} 5617 5498 & 5618 5499 \begin{tabular}{@{}l@{}} 5500 \Indexc{stdbool.h} \\ 5501 \Indexc{stddef.h} \\ 5619 5502 \Indexc{stdint.h} \\ 5620 5503 \Indexc{stdio.h} \\ … … 5632 5515 \Indexc{wctype.h} \\ 5633 5516 \\ 5517 \\ 5518 \\ 5634 5519 \end{tabular} 5635 5520 & … … 5637 5522 \Indexc{unistd.h} \\ 5638 5523 \Indexc{gmp.h} \\ 5524 \\ 5525 \\ 5639 5526 \\ 5640 5527 \\ … … 5676 5563 The table shows allocation routines supporting different combinations of storage-management capabilities: 5677 5564 \begin{center} 5678 \begin{tabular}{@{} r|r|l|l|l|l@{}}5679 \multicolumn{1}{c}{}&& \multicolumn{1}{c|}{fill} & resize & alignment & array \\5565 \begin{tabular}{@{}lr|l|l|l|l@{}} 5566 & & \multicolumn{1}{c|}{fill} & resize & alignment & array \\ 5680 5567 \hline 5681 5568 C & ©malloc© & no & no & no & no \\ … … 5684 5571 & ©memalign© & no & no & yes & no \\ 5685 5572 & ©posix_memalign© & no & no & yes & no \\ 5686 \hline5687 5573 C11 & ©aligned_alloc© & no & no & yes & no \\ 5688 \hline5689 5574 \CFA & ©alloc© & no/copy/yes & no/yes & no & yes \\ 5690 5575 & ©align_alloc© & no/yes & no & yes & yes \\ -
src/CodeGen/CodeGenerator.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:16:21201713 // Update Count : 5 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 15:48:00 2017 13 // Update Count : 52 14 14 // 15 15 16 #pragma once 16 #ifndef CODEGENV_H 17 #define CODEGENV_H 17 18 18 19 #include <list> // for list … … 165 166 } // namespace CodeGen 166 167 168 #endif // CODEGENV_H 169 167 170 // Local Variables: // 168 171 // tab-width: 4 // -
src/CodeGen/FixMain.h
r33218c6 re0a653d 9 9 // Author : Thierry Delisle 10 10 // Created On : Thr Jan 12 14:11:09 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:16:59 201713 // Update Count : 111 // Last Modified By : 12 // Last Modified On : 13 // Update Count : 0 14 14 // 15 15 16 #pragma once 16 #ifndef FIXMAIN_H 17 #define FIXMAIN_H 17 18 18 19 #include <iosfwd> … … 43 44 }; 44 45 }; 46 47 #endif //FIXMAIN_H -
src/CodeGen/FixNames.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:17:33 201713 // Update Count : 312 // Last Modified On : Mon May 18 23:37:32 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef FIXNAMES_H 17 #define FIXNAMES_H 17 18 18 19 #include <list> // for list … … 25 26 } // namespace CodeGen 26 27 28 #endif // FIXNAMES_H 29 27 30 // Local Variables: // 28 31 // tab-width: 4 // -
src/CodeGen/GenType.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:17:23 201713 // Update Count : 212 // Last Modified On : Mon May 18 23:38:53 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _GENTYPE_H 17 #define _GENTYPE_H 17 18 18 19 #include <string> // for string … … 25 26 } // namespace CodeGen 26 27 28 #endif // _GENTYPE_H 29 27 30 // Local Variables: // 28 31 // tab-width: 4 // -
src/CodeGen/Generate.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:16:35 201713 // Update Count : 212 // Last Modified On : Mon May 18 23:39:51 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef GENERATE_H 17 #define GENERATE_H 17 18 18 19 #include <iostream> // for ostream … … 30 31 } // namespace CodeGen 31 32 33 #endif // GENERATE_H 34 32 35 // Local Variables: // 33 36 // tab-width: 4 // -
src/CodeGen/OperatorTable.cc
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 15 17:12:22 201713 // Update Count : 1 512 // Last Modified On : Tue Dec 13 14:33:05 2016 13 // Update Count : 10 14 14 // 15 15 … … 35 35 { "++?", "++", "_operator_preincr", OT_PREFIXASSIGN }, 36 36 { "--?", "--", "_operator_predecr", OT_PREFIXASSIGN }, 37 { "?\\?", "\\", "_operator_exponential", OT_INFIX },38 37 { "?*?", "*", "_operator_multiply", OT_INFIX }, 39 38 { "?/?", "/", "_operator_divide", OT_INFIX }, … … 53 52 { "?|?", "|", "_operator_bitor", OT_INFIX }, 54 53 { "?=?", "=", "_operator_assign", OT_INFIXASSIGN }, 55 { "?\\=?", "\\=", "_operator_expassign", OT_INFIXASSIGN },56 54 { "?*=?", "*=", "_operator_multassign", OT_INFIXASSIGN }, 57 55 { "?/=?", "/=", "_operator_divassign", OT_INFIXASSIGN }, -
src/CodeGen/OperatorTable.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:17:11 201713 // Update Count : 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jun 24 16:17:57 2015 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef _OPERATORTABLE_H 17 #define _OPERATORTABLE_H 17 18 18 19 #include <string> … … 44 45 } // namespace CodeGen 45 46 47 #endif // _OPERATORTABLE_H 48 46 49 // Local Variables: // 47 50 // tab-width: 4 // -
src/CodeTools/DeclStats.h
r33218c6 re0a653d 9 9 // Author : Aaron Moss 10 10 // Created On : Wed Jan 31 16:40:00 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:17:56 201713 // Update Count : 211 // Last Modified By : Aaron Moss 12 // Last Modified On : Wed Jan 31 16:40:00 2016 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef DECLSTATS_H 17 #define DECLSTATS_H 17 18 18 19 #include <list> // for list … … 27 28 } // namespace CodeTools 28 29 30 #endif // DECLSTATS_H 31 29 32 // Local Variables: // 30 33 // tab-width: 4 // -
src/CodeTools/TrackLoc.h
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Tues May 2 15:40:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:17:44201713 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 3 14:42:00 2017 13 // Update Count : 0 14 14 // 15 15 16 #pragma once 16 #ifndef TRACKLOC_H 17 #define TRACKLOC_H 17 18 18 19 #include <cstddef> // for size_t … … 30 31 } // namespace CodeTools 31 32 33 #endif // TRACKLOC_H 34 32 35 // Local Variables: // 33 36 // tab-width: 4 // -
src/Common/CompilerError.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:18:07 201713 // Update Count : 412 // Last Modified On : Thu Aug 18 23:41:30 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef COMPILER_ERROR_H 17 #define COMPILER_ERROR_H 17 18 18 19 #include <string> … … 30 31 }; 31 32 33 #endif // COMPILER_ERROR_H 34 32 35 // Local Variables: // 33 36 // tab-width: 4 // -
src/Common/ScopedMap.h
r33218c6 re0a653d 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed Dec 2 11:37:00 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:18:24 2017 13 // Update Count : 2 14 // 15 16 #pragma once 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed Dec 2 11:37:00 2015 13 // Update Count : 1 14 // 15 16 #ifndef _SCOPEDMAP_H 17 #define _SCOPEDMAP_H 17 18 18 19 #include <cassert> … … 304 305 }; 305 306 307 #endif // _SCOPEDMAP_H 308 306 309 // Local Variables: // 307 310 // tab-width: 4 // -
src/Common/SemanticError.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:18:59 201713 // Update Count : 612 // Last Modified On : Sat Sep 24 15:13:42 2016 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef SEMANTICERROR_H 17 #define SEMANTICERROR_H 17 18 18 19 #include <exception> // for exception … … 61 62 } 62 63 64 #endif // SEMANTICERROR_H 65 63 66 // Local Variables: // 64 67 // tab-width: 4 // -
src/Common/UnimplementedError.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:18:35 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:23:08 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _UNIMPLEMENTEDERROR_H 17 #define _UNIMPLEMENTEDERROR_H 17 18 18 19 #include <string> … … 30 31 }; 31 32 33 #endif // _UNIMPLEMENTEDERROR_H 34 32 35 // Local Variables: // 33 36 // tab-width: 4 // -
src/Common/UniqueName.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:18:45 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:24:20 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef UNIQUENAME_H 17 #define UNIQUENAME_H 17 18 18 19 #include <string> … … 27 28 }; 28 29 30 #endif // UNIQUENAME_H 31 29 32 // Local Variables: // 30 33 // tab-width: 4 // -
src/Common/VectorMap.h
r33218c6 re0a653d 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // VectorMap.h --7 // ScopedMap.h -- 8 8 // 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed Feb 1 16:55:00 2017 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:19:29 2017 13 // Update Count : 2 14 // 15 16 #pragma once 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed Feb 1 16:55:00 2017 13 // Update Count : 1 14 // 15 16 #ifndef _VECTORMAP_H 17 #define _VECTORMAP_H 17 18 18 19 #include <iterator> … … 244 245 } 245 246 247 #endif // _VECTORMAP_H 248 246 249 // Local Variables: // 247 250 // tab-width: 4 // -
src/Common/utility.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:19:13 2017 13 // Update Count : 33 14 // 15 16 #pragma once 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri May 5 11:03:00 2017 13 // Update Count : 32 14 // 15 16 #ifndef _UTILITY_H 17 #define _UTILITY_H 17 18 18 19 #include <cctype> … … 375 376 } 376 377 378 #endif // _UTILITY_H 379 377 380 // Local Variables: // 378 381 // tab-width: 4 // -
src/Concurrency/Keywords.cc
r33218c6 re0a653d 1 // -*- Mode: CPP -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 11 12 // Last Modified By : 12 13 // Last Modified On : 13 // Update Count : 514 // Update Count : 3 14 15 // 15 16 … … 548 549 } 549 550 }; 550 551 // Local Variables: //552 // mode: c //553 // tab-width: 4 //554 // End: // -
src/Concurrency/Keywords.h
r33218c6 re0a653d 1 // -*- Mode: CPP -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 11 12 // Last Modified By : 12 13 // Last Modified On : 13 // Update Count : 114 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef KEYWORDS_H 18 #define KEYWORDS_H 17 19 18 20 #include <list> // for list … … 26 28 }; 27 29 28 // Local Variables: // 29 // tab-width: 4 // 30 // mode: c++ // 31 // compile-command: "make install" // 32 // End: // 30 #endif //KEYWORDS_H -
src/ControlStruct/ExceptTranslate.cc
r33218c6 re0a653d 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 18 10:09:00 201713 // Update Count : 412 // Last Modified On : Wed Jul 12 15:07:00 2017 13 // Update Count : 3 14 14 // 15 15 … … 50 50 LinkageSpec::Cforall, 51 51 /*bitfieldWidth*/ NULL, 52 new BasicType( noQualifiers, BasicType::SignedInt ),52 new BasicType( emptyQualifiers, BasicType::SignedInt ), 53 53 /*init*/ NULL 54 54 ); … … 59 59 /*bitfieldWidth*/ NULL, 60 60 new PointerType( 61 noQualifiers,62 new BasicType( noQualifiers, BasicType::SignedInt )61 emptyQualifiers, 62 new BasicType( emptyQualifiers, BasicType::SignedInt ) 63 63 ), 64 64 /*init*/ NULL … … 69 69 LinkageSpec::Cforall, 70 70 /*bitfieldWidth*/ NULL, 71 new BasicType( noQualifiers, BasicType::Bool),71 new BasicType(emptyQualifiers, BasicType::Bool), 72 72 /*init*/ NULL 73 73 ); … … 78 78 NULL, 79 79 new PointerType( 80 noQualifiers,80 emptyQualifiers, 81 81 new VoidType( 82 noQualifiers82 emptyQualifiers 83 83 ), 84 84 std::list<Attribute *>{new Attribute("unused")} … … 143 143 LinkageSpec::Cforall, 144 144 NULL, 145 new BasicType( noQualifiers, BasicType::SignedInt ),145 new BasicType( emptyQualifiers, BasicType::SignedInt ), 146 146 new SingleInit( throwStmt->get_expr() ) 147 147 ); … … 444 444 nullptr, 445 445 new StructInstType( 446 noQualifiers,446 emptyQualifiers, 447 447 hook_decl 448 448 ), -
src/ControlStruct/ExceptTranslate.h
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Tus Jun 06 10:13:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:19:23201713 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 30 10:20:00 2017 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef EXCEPT_TRANSLATE_H 17 #define EXCEPT_TRANSLATE_H 17 18 18 19 #include <list> … … 21 22 namespace ControlStruct { 22 23 void translateEHM( std::list< Declaration *> & translationUnit ); 23 // Converts exception handling structures into their underlying C code. Translation does use the exception 24 // handling header, make sure it is visible wherever translation occurs. 24 /* Converts exception handling structures into their underlying C code. 25 * Translation does use the exception handling header, make sure it is 26 * visible wherever translation occurs. 27 */ 25 28 } 26 29 27 // Local Variables: // 28 // tab-width: 4 // 29 // mode: c++ // 30 // compile-command: "make install" // 31 // End: // 30 #endif // EXCEPT_TRANSLATE_H -
src/ControlStruct/ForExprMutator.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:17:08 201713 // Update Count : 412 // Last Modified On : Mon Jan 25 21:22:13 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef FOR_MUTATOR_H 17 #define FOR_MUTATOR_H 17 18 18 19 #include "SynTree/Mutator.h" … … 26 27 } // namespace ControlStruct 27 28 29 #endif // CHOOSE_MUTATOR_H 30 28 31 // Local Variables: // 29 32 // tab-width: 4 // -
src/ControlStruct/LabelFixer.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:17:24 201713 // Update Count : 3 412 // Last Modified On : Tue Jul 12 17:36:16 2016 13 // Update Count : 33 14 14 // 15 15 16 #pragma once 16 #ifndef LABEL_FIXER_H 17 #define LABEL_FIXER_H 17 18 18 19 #include "Common/utility.h" … … 82 83 } // namespace ControlStruct 83 84 85 #endif // LABEL_FIXER_H 86 84 87 // Local Variables: // 85 88 // tab-width: 4 // -
src/ControlStruct/LabelGenerator.h
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:20:14 201713 // Update Count : 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jun 03 14:16:26 2015 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef LABEL_GENERATOR_H 17 #define LABEL_GENERATOR_H 17 18 18 19 #include "SynTree/SynTree.h" … … 34 35 } // namespace ControlStruct 35 36 37 #endif // LABEL_GENERATOR_H 38 36 39 // Local Variables: // 37 40 // tab-width: 4 // -
src/ControlStruct/MLEMutator.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:19:59 201713 // Update Count : 3 512 // Last Modified On : Tue Jul 12 17:37:01 2016 13 // Update Count : 34 14 14 // 15 15 16 #pragma once 16 #ifndef MLE_MUTATOR_H 17 #define MLE_MUTATOR_H 17 18 18 19 #include <map> … … 88 89 } // namespace ControlStruct 89 90 91 #endif // MLE_MUTATOR_H 92 90 93 // Local Variables: // 91 94 // tab-width: 4 // -
src/ControlStruct/Mutate.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:17:59 201713 // Update Count : 312 // Last Modified On : Tue May 19 15:31:20 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef CTRLS_MUTATE_H 17 #define CTRLS_MUTATE_H 17 18 18 19 #include <list> … … 26 27 } // namespace ControlStruct 27 28 29 #endif // CTRLS_MUTATE_H 30 28 31 // Local Variables: // 29 32 // tab-width: 4 // -
src/GenPoly/Box.cc
r33218c6 re0a653d 202 202 }; 203 203 204 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, sizeof expressions of polymorphic types with the proper variable, and strips fields from generic struct declarations.204 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable 205 205 class Pass3 final : public PolyMutator { 206 206 public: … … 210 210 using PolyMutator::mutate; 211 211 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 212 virtual Declaration *mutate( StructDecl *structDecl ) override;213 virtual Declaration *mutate( UnionDecl *unionDecl ) override;214 212 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 215 213 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override; … … 1870 1868 } 1871 1869 1872 /// Strips the members from a generic aggregate1873 void stripGenericMembers(AggregateDecl* decl) {1874 if ( ! decl->get_parameters().empty() ) decl->get_members().clear();1875 }1876 1877 Declaration *Pass3::mutate( StructDecl *structDecl ) {1878 stripGenericMembers( structDecl );1879 return structDecl;1880 }1881 1882 Declaration *Pass3::mutate( UnionDecl *unionDecl ) {1883 stripGenericMembers( unionDecl );1884 return unionDecl;1885 }1886 1887 1870 TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) { 1888 1871 // Initializer *init = 0; -
src/GenPoly/Box.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:23:52 201713 // Update Count : 612 // Last Modified On : Thu Nov 19 17:24:01 2015 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef _BOX_H 17 #define _BOX_H 17 18 18 19 #include <list> … … 24 25 } // namespace GenPoly 25 26 27 #endif // _BOX_H 28 26 29 // Local Variables: // 27 30 // tab-width: 4 // -
src/GenPoly/CopyParams.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:23:09 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:34:25 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _COPYPARAMS_H 17 #define _COPYPARAMS_H 17 18 18 19 #include "SynTree/SynTree.h" … … 23 24 } // namespace GenPoly 24 25 26 #endif // _COPYPARAMS_H 27 25 28 // Local Variables: // 26 29 // tab-width: 4 // -
src/GenPoly/DeclMutator.h
r33218c6 re0a653d 10 10 // Created On : Fri Nov 27 14:44:00 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:21:12 201713 // Update Count : 412 // Last Modified On : Tue Jul 12 17:39:01 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef _DECLMUTATOR_H 17 #define _DECLMUTATOR_H 17 18 18 19 #include <list> … … 26 27 /// Mutates a list of declarations, providing a means of adding new declarations into the list 27 28 class DeclMutator : public Mutator { 28 public:29 public: 29 30 typedef Mutator Parent; 30 31 … … 49 50 /// Called on exit from a scope; overriders should call this as a super-class call 50 51 virtual void doEndScope(); 51 protected:52 protected: 52 53 /// Mutate a statement that forms its own scope 53 54 Statement* mutateStatement( Statement *stmt ); … … 58 59 /// Add a declaration to the list to be added after the current position 59 60 void addDeclarationAfter( Declaration* decl ); 60 private:61 private: 61 62 /// A stack of declarations to add before the current declaration or statement 62 63 std::vector< std::list< Declaration* > > declsToAdd; … … 66 67 } // namespace 67 68 69 #endif // _DECLMUTATOR_H 70 68 71 // Local Variables: // 69 72 // tab-width: 4 // -
src/GenPoly/ErasableScopedMap.h
r33218c6 re0a653d 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed Dec 2 11:37:00 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:23:24 2017 13 // Update Count : 2 14 // 15 16 #pragma once 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed Dec 2 11:37:00 2015 13 // Update Count : 1 14 // 15 16 #ifndef _ERASABLESCOPEDMAP_H 17 #define _ERASABLESCOPEDMAP_H 17 18 18 19 #include <cassert> … … 277 278 } // namespace GenPoly 278 279 280 #endif // _ERASABLESCOPEDMAP_H 281 279 282 // Local Variables: // 280 283 // tab-width: 4 // -
src/GenPoly/FindFunction.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:23:36 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:36:35 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef FINDFUNCTION_H 17 #define FINDFUNCTION_H 17 18 18 19 #include "SynTree/SynTree.h" … … 28 29 } // namespace GenPoly 29 30 31 #endif // FINDFUNCTION_H 32 30 33 // Local Variables: // 31 34 // tab-width: 4 // -
src/GenPoly/GenPoly.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:22:57 201713 // Update Count : 711 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Nov 24 15:24:38 2015 13 // Update Count : 6 14 14 // 15 15 16 #pragma once 16 #ifndef GENPOLY_H 17 #define GENPOLY_H 17 18 18 19 #include <string> … … 110 111 } // namespace GenPoly 111 112 113 #endif // GENPOLY_H 114 112 115 // Local Variables: // 113 116 // tab-width: 4 // -
src/GenPoly/InstantiateGeneric.h
r33218c6 re0a653d 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Aug 04 18:33:00 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:22:42 201713 // Update Count : 211 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Thu Aug 04 18:33:00 2016 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _INSTANTIATEGENERIC_H 17 #define _INSTANTIATEGENERIC_H 17 18 18 19 #include "SynTree/SynTree.h" … … 25 26 } // namespace GenPoly 26 27 28 #endif // _INSTANTIATEGENERIC_H 29 27 30 // Local Variables: // 28 31 // tab-width: 4 // -
src/GenPoly/Lvalue.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:21:59 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:42:09 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _LVALUE_H 17 #define _LVALUE_H 17 18 18 19 #include <list> … … 25 26 } // namespace GenPoly 26 27 28 #endif // _LVALUE_H 29 27 30 // Local Variables: // 28 31 // tab-width: 4 // -
src/GenPoly/PolyMutator.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:20:31 201713 // Update Count : 712 // Last Modified On : Tue Jul 12 17:39:41 2016 13 // Update Count : 6 14 14 // 15 15 16 #pragma once 16 #ifndef _POLYMUTATOR_H 17 #define _POLYMUTATOR_H 17 18 18 19 #include <map> … … 65 66 } // namespace 66 67 68 #endif // _POLYMUTATOR_H 69 67 70 // Local Variables: // 68 71 // tab-width: 4 // -
src/GenPoly/ScopedSet.h
r33218c6 re0a653d 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Dec 3 11:51:00 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:22:17 2017 13 // Update Count : 2 14 // 15 16 #pragma once 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Thu Dec 3 11:51:00 2015 13 // Update Count : 1 14 // 15 16 #ifndef _SCOPEDSET_H 17 #define _SCOPEDSET_H 17 18 18 19 #include <iterator> … … 246 247 } // namespace GenPoly 247 248 249 #endif // _SCOPEDSET_H 250 248 251 // Local Variables: // 249 252 // tab-width: 4 // -
src/GenPoly/ScrubTyVars.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:21:47 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:48:14 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _SCRUBTYVARS_H 17 #define _SCRUBTYVARS_H 17 18 18 19 #include <string> … … 94 95 } // namespace GenPoly 95 96 97 #endif // _SCRUBTYVARS_H 98 96 99 // Local Variables: // 97 100 // tab-width: 4 // -
src/GenPoly/Specialize.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:22:31 201713 // Update Count : 212 // Last Modified On : Tue May 19 07:53:58 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef _SPECIALIZE_H 17 #define _SPECIALIZE_H 17 18 18 19 #include <list> … … 25 26 } // namespace GenPoly 26 27 28 #endif // _SPECIALIZE_H 29 27 30 // Local Variables: // 28 31 // tab-width: 4 // -
src/InitTweak/FixGlobalInit.h
r33218c6 re0a653d 9 9 // Author : Rob Schluntz 10 10 // Created On : Mon May 04 15:14:56 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:30:54 201713 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 16:07:47 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef FIX_GLOBAL_INIT_H 17 #define FIX_GLOBAL_INIT_H 17 18 18 19 #include <string> … … 33 34 } // namespace 34 35 36 #endif // GENPOLY_POLYMUTATOR_H 37 35 38 // Local Variables: // 36 39 // tab-width: 4 // -
src/InitTweak/FixInit.h
r33218c6 re0a653d 9 9 // Author : Rob Schluntz 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:31:06 201713 // Update Count : 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:27:52 2016 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef FIX_INIT_H 17 #define FIX_INIT_H 17 18 18 19 #include <string> … … 29 30 } // namespace 30 31 32 #endif // GENPOLY_POLYMUTATOR_H 33 31 34 // Local Variables: // 32 35 // tab-width: 4 // -
src/InitTweak/GenInit.h
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:31:19 201713 // Update Count : 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:27:19 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef GEN_INIT_H 17 #define GEN_INIT_H 17 18 18 19 #include <string> … … 34 35 } // namespace 35 36 37 #endif // INITTWEAK_GENINIT_H 38 36 39 // Local Variables: // 37 40 // tab-width: 4 // -
src/InitTweak/InitTweak.h
r33218c6 re0a653d 9 9 // Author : Rob Schluntz 10 10 // Created On : Fri May 13 11:26:36 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:30:33 201713 // Update Count : 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:35:36 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef INIT_TWEAK_H 17 #define INIT_TWEAK_H 17 18 18 19 #include <string> … … 115 116 } // namespace 116 117 118 #endif // INITTWEAK_GENINIT_H 119 117 120 // Local Variables: // 118 121 // tab-width: 4 // -
src/MakeLibCfa.h
r33218c6 re0a653d 10 10 // Created On : Sat May 16 10:42:14 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:31:35 201713 // Update Count : 212 // Last Modified On : Sat May 16 10:43:29 2015 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef LIBCFA_MAKELIBCFA_H 17 #define LIBCFA_MAKELIBCFA_H 17 18 18 19 #include <list> // for list … … 24 25 } // namespace LibCfa 25 26 27 #endif // LIBCFA_MAKELIBCFA_H 28 26 29 // Local Variables: // 27 30 // tab-width: 4 // -
src/Makefile.in
r33218c6 re0a653d 216 216 SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \ 217 217 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \ 218 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \219 218 SynTree/driver_cfa_cpp-Type.$(OBJEXT) \ 220 219 SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \ … … 515 514 SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \ 516 515 SymTab/FixFunction.cc SymTab/ImplementationType.cc \ 517 SymTab/TypeEquality.cc SymTab/Autogen.cc Sy mTab/TreeStruct.cc \518 SynTree/ Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \516 SymTab/TypeEquality.cc SymTab/Autogen.cc SynTree/Type.cc \ 517 SynTree/VoidType.cc SynTree/BasicType.cc \ 519 518 SynTree/PointerType.cc SynTree/ArrayType.cc \ 520 519 SynTree/FunctionType.cc SynTree/ReferenceToType.cc \ … … 849 848 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \ 850 849 SymTab/$(DEPDIR)/$(am__dirstamp) 851 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \852 SymTab/$(DEPDIR)/$(am__dirstamp)853 850 SynTree/$(am__dirstamp): 854 851 @$(MKDIR_P) SynTree … … 1036 1033 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@ 1037 1034 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@ 1038 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po@am__quote@1039 1035 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@ 1040 1036 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@ … … 2088 2084 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2089 2085 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi` 2090 2091 SymTab/driver_cfa_cpp-TreeStruct.o: SymTab/TreeStruct.cc2092 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc2093 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po2094 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.o' libtool=no @AMDEPBACKSLASH@2095 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@2096 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc2097 2098 SymTab/driver_cfa_cpp-TreeStruct.obj: SymTab/TreeStruct.cc2099 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`2100 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po2101 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.obj' libtool=no @AMDEPBACKSLASH@2102 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@2103 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`2104 2086 2105 2087 SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc -
src/Parser/DeclarationNode.cc
r33218c6 re0a653d 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jul 14 16:55:00 201713 // Update Count : 10 2012 // Last Modified On : Wed Jun 28 15:27:00 2017 13 // Update Count : 1019 14 14 // 15 15 … … 253 253 newnode->type->aggregate.fields = fields; 254 254 newnode->type->aggregate.body = body; 255 newnode->type->aggregate.tagged = false;256 newnode->type->aggregate.parent = nullptr;257 255 return newnode; 258 256 } // DeclarationNode::newAggregate … … 275 273 return newnode; 276 274 } // DeclarationNode::newEnumConstant 277 278 DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {279 assert( name );280 DeclarationNode * newnode = new DeclarationNode;281 newnode->type = new TypeData( TypeData::Aggregate );282 newnode->type->aggregate.kind = kind;283 newnode->type->aggregate.name = name;284 newnode->type->aggregate.actuals = actuals;285 newnode->type->aggregate.fields = fields;286 newnode->type->aggregate.body = body;287 newnode->type->aggregate.tagged = true;288 newnode->type->aggregate.parent = parent;289 return newnode;290 } // DeclarationNode::newTreeStruct291 275 292 276 DeclarationNode * DeclarationNode::newName( string * name ) { -
src/Parser/ExpressionNode.cc
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:17:07 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tus Jul 18 10:08:00201713 // Update Count : 5 5011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:08:15 2017 13 // Update Count : 542 14 14 // 15 15 … … 46 46 // type. 47 47 48 Type::Qualifiers noQualifiers; // no qualifiers on constants48 Type::Qualifiers emptyQualifiers; // no qualifiers on constants 49 49 50 50 static inline bool checkU( char c ) { return c == 'u' || c == 'U'; } … … 118 118 } // if 119 119 120 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) ); 121 121 delete &str; // created by lex 122 122 return ret; … … 153 153 } // if 154 154 155 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );155 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) ); 156 156 delete &str; // created by lex 157 157 return ret; … … 159 159 160 160 Expression *build_constantChar( const std::string & str ) { 161 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );161 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) ); 162 162 delete &str; // created by lex 163 163 return ret; … … 166 166 ConstantExpr *build_constantStr( const std::string & str ) { 167 167 // string should probably be a primitive type 168 ArrayType *at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),168 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 169 169 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 170 170 false, false ); … … 176 176 177 177 Expression *build_constantZeroOne( const std::string & str ) { 178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( noQualifiers ) : (Type*)new OneType( noQualifiers ), str,178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str, 179 179 str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) ); 180 180 delete &str; // created by lex … … 231 231 } 232 232 233 // Must harmonize with OperKinds.234 233 static const char *OperName[] = { 235 234 // diadic 236 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "? \\?", "?*?", "?/?", "?%?", "||", "&&",235 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&", 237 236 "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?", 238 "?=?", "?@=?", "? \\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",237 "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?", 239 238 "?[?]", "...", 240 239 // monadic -
src/Parser/LinkageSpec.h
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:32:16201713 // Update Count : 1 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jul 7 11:03:00 2017 13 // Update Count : 13 14 14 // 15 15 16 #pragma once 16 #ifndef LINKAGESPEC_H 17 #define LINKAGESPEC_H 17 18 18 19 #include <string> … … 77 78 }; 78 79 80 #endif // LINKAGESPEC_H 81 79 82 // Local Variables: // 80 83 // tab-width: 4 // -
src/Parser/ParseNode.h
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:32:30 201713 // Update Count : 7 8611 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:00:00 2017 13 // Update Count : 779 14 14 // 15 15 16 #pragma once 16 #ifndef PARSENODE_H 17 #define PARSENODE_H 17 18 18 19 #include <string> … … 140 141 }; 141 142 142 // Must harmonize with OperName.143 143 enum class OperKinds { 144 144 // diadic 145 SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp,Mul, Div, Mod, Or, And,145 SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And, 146 146 BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq, 147 Assign, AtAssn, ExpAssn,MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,147 Assign, AtAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn, 148 148 Index, Range, 149 149 // monadic … … 248 248 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 249 249 250 // Perhaps this would best fold into newAggragate.251 static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body );252 253 250 DeclarationNode(); 254 251 ~DeclarationNode(); … … 335 332 336 333 static UniqueName anonymous; 337 338 // Temp to test TreeStruct339 const std::string * parent_name;340 334 }; // DeclarationNode 341 335 … … 449 443 std::ostream & operator<<( std::ostream & out, const ParseNode * node ); 450 444 445 #endif // PARSENODE_H 446 451 447 // Local Variables: // 452 448 // tab-width: 4 // -
src/Parser/ParserTypes.h
r33218c6 re0a653d 10 10 // Created On : Sat Sep 22 08:58:10 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:33:28201713 // Update Count : 3 5012 // Last Modified On : Wed Jun 28 22:10:17 2017 13 // Update Count : 349 14 14 // 15 15 16 #pragma once 16 #ifndef PARSER_HH 17 #define PARSER_HH 17 18 18 19 int yylex(); … … 41 42 }; // Token 42 43 44 #endif // PARSER_HH 45 43 46 // Local Variables: // 44 47 // tab-width: 4 // -
src/Parser/TypeData.cc
r33218c6 re0a653d 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 18 10:10:00 201713 // Update Count : 56 612 // Last Modified On : Wed Jun 28 15:28:00 2017 13 // Update Count : 564 14 14 // 15 15 … … 63 63 aggregate.fields = nullptr; 64 64 aggregate.body = false; 65 aggregate.tagged = false;66 aggregate.parent = nullptr;67 65 break; 68 66 case AggregateInst: … … 123 121 delete aggregate.actuals; 124 122 delete aggregate.fields; 125 delete aggregate.parent;126 123 // delete aggregate; 127 124 break; … … 195 192 newtype->aggregate.kind = aggregate.kind; 196 193 newtype->aggregate.body = aggregate.body; 197 newtype->aggregate.tagged = aggregate.tagged;198 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;199 194 break; 200 195 case AggregateInst: … … 454 449 case TypeData::Builtin: 455 450 if(td->builtintype == DeclarationNode::Zero) { 456 return new ZeroType( noQualifiers );451 return new ZeroType( emptyQualifiers ); 457 452 } 458 453 else if(td->builtintype == DeclarationNode::One) { 459 return new OneType( noQualifiers );454 return new OneType( emptyQualifiers ); 460 455 } 461 456 else { … … 624 619 switch ( td->aggregate.kind ) { 625 620 case DeclarationNode::Struct: 626 if ( td->aggregate.tagged ) {627 at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage );628 buildForall( td->aggregate.params, at->get_parameters() );629 break;630 }631 621 case DeclarationNode::Coroutine: 632 622 case DeclarationNode::Monitor: -
src/Parser/TypeData.h
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:18:36 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:32:47201713 // Update Count : 18 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 2017 13 // Update Count : 186 14 14 // 15 15 16 #pragma once 16 #ifndef TYPEDATA_H 17 #define TYPEDATA_H 17 18 18 19 #include "ParseNode.h" … … 30 31 DeclarationNode * fields; 31 32 bool body; 32 33 bool tagged;34 const std::string * parent;35 33 }; 36 34 … … 115 113 void buildKRFunction( const TypeData::Function_t & function ); 116 114 115 #endif // TYPEDATA_H 116 117 117 // Local Variables: // 118 118 // tab-width: 4 // -
src/Parser/TypedefTable.h
r33218c6 re0a653d 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:33:14 201713 // Update Count : 3 412 // Last Modified On : Wed Jun 28 21:56:34 2017 13 // Update Count : 33 14 14 // 15 15 16 #pragma once 16 #ifndef TYPEDEFTABLE_H 17 #define TYPEDEFTABLE_H 17 18 18 19 #include <map> … … 90 91 }; 91 92 93 #endif // TYPEDEFTABLE_H 94 92 95 // Local Variables: // 93 96 // tab-width: 4 // -
src/Parser/lex.ll
r33218c6 re0a653d 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Mon Jul 24 08:27:23201713 * Update Count : 5 4512 * Last Modified On : Tue Jul 11 21:30:51 2017 13 * Update Count : 534 14 14 */ 15 15 … … 125 125 op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post} 126 126 127 op_binary_only "/"|"%"|" \\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>="127 op_binary_only "/"|"%"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>=" 128 128 op_binary_over {op_unary_binary}|{op_binary_only} 129 129 // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@=" … … 136 136 137 137 %% 138 /* line directives */138 /* line directives */ 139 139 ^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" { 140 140 /* " stop highlighting */ … … 232 232 int { KEYWORD_RETURN(INT); } 233 233 __int128 { KEYWORD_RETURN(INT); } // GCC 234 __int128_t { KEYWORD_RETURN(INT); } // GCC235 234 __label__ { KEYWORD_RETURN(LABEL); } // GCC 236 235 long { KEYWORD_RETURN(LONG); } … … 267 266 __typeof { KEYWORD_RETURN(TYPEOF); } // GCC 268 267 __typeof__ { KEYWORD_RETURN(TYPEOF); } // GCC 269 __uint128_t { KEYWORD_RETURN(INT); } // GCC270 268 union { KEYWORD_RETURN(UNION); } 271 269 unsigned { KEYWORD_RETURN(UNSIGNED); } 272 270 __builtin_va_list { KEYWORD_RETURN(VALIST); } // GCC 273 virtual { KEYWORD_RETURN(VIRTUAL); } // CFA274 271 void { KEYWORD_RETURN(VOID); } 275 272 volatile { KEYWORD_RETURN(VOLATILE); } … … 277 274 __volatile__ { KEYWORD_RETURN(VOLATILE); } // GCC 278 275 while { KEYWORD_RETURN(WHILE); } 279 with { KEYWORD_RETURN(WITH); } // CFA280 276 zero_t { NUMERIC_RETURN(ZERO_T); } // CFA 281 277 … … 340 336 "-" { ASCIIOP_RETURN(); } 341 337 "*" { ASCIIOP_RETURN(); } 342 "\\" { ASCIIOP_RETURN(); } // CFA, exponentiation343 338 "/" { ASCIIOP_RETURN(); } 344 339 "%" { ASCIIOP_RETURN(); } … … 365 360 "+=" { NAMEDOP_RETURN(PLUSassign); } 366 361 "-=" { NAMEDOP_RETURN(MINUSassign); } 367 "\\=" { NAMEDOP_RETURN(EXPassign); } // CFA, exponentiation368 362 "*=" { NAMEDOP_RETURN(MULTassign); } 369 363 "/=" { NAMEDOP_RETURN(DIVassign); } -
src/Parser/parser.yy
r33218c6 re0a653d 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Jul 24 09:01:14201713 // Update Count : 24 6311 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 11 13:39:00 2017 13 // Update Count : 2416 14 14 // 15 15 … … 118 118 %token RESTRICT // C99 119 119 %token ATOMIC // C11 120 %token FORALL LVALUE MUTEX VIRTUAL // CFA 121 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 120 %token FORALL LVALUE MUTEX // CFA 121 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T 122 %token VALIST // GCC 122 123 %token BOOL COMPLEX IMAGINARY // C99 123 %token ZERO_T ONE_T // CFA124 %token VALIST // GCC125 124 %token TYPEOF LABEL // GCC 126 125 %token ENUM STRUCT UNION … … 130 129 %token ATTRIBUTE EXTENSION // GCC 131 130 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN 132 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH// CFA131 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT // CFA 133 132 %token ASM // C99, extension ISO/IEC 9899:1999 Section J.5.10(1) 134 133 %token ALIGNAS ALIGNOF GENERIC STATICASSERT // C11 … … 152 151 %token ELLIPSIS // ... 153 152 154 %token EXPassign MULTassign DIVassign MODassign // \= *= /= %=153 %token MULTassign DIVassign MODassign // *= /= %=/ 155 154 %token PLUSassign MINUSassign // += -= 156 155 %token LSassign RSassign // <<= >>= … … 169 168 %type<op> ptrref_operator unary_operator assignment_operator 170 169 %type<en> primary_expression postfix_expression unary_expression 171 %type<en> cast_expression exponential_expression multiplicative_expression additive_expression 172 %type<en> shift_expression relational_expression equality_expression 173 %type<en> AND_expression exclusive_OR_expression inclusive_OR_expression 174 %type<en> logical_AND_expression logical_OR_expression 175 %type<en> conditional_expression constant_expression assignment_expression assignment_expression_opt 170 %type<en> cast_expression multiplicative_expression additive_expression shift_expression 171 %type<en> relational_expression equality_expression AND_expression exclusive_OR_expression 172 %type<en> inclusive_OR_expression logical_AND_expression logical_OR_expression conditional_expression 173 %type<en> constant_expression assignment_expression assignment_expression_opt 176 174 %type<en> comma_expression comma_expression_opt 177 %type<en> argument_expression_list argument_expression default_initialize_opt175 %type<en> argument_expression_list argument_expression assignment_opt 178 176 %type<fctl> for_control_expression 179 177 %type<en> subrange … … 186 184 // statements 187 185 %type<sn> labeled_statement compound_statement expression_statement selection_statement 188 %type<sn> iteration_statement jump_statement 189 %type<sn> with_statement exception_statement asm_statement 186 %type<sn> iteration_statement jump_statement exception_statement asm_statement 190 187 %type<sn> fall_through_opt fall_through 191 188 %type<sn> statement statement_list 192 189 %type<sn> block_item_list block_item 193 %type<sn> with_clause_opt190 %type<sn> case_clause 194 191 %type<en> case_value 195 %type<sn> case_ clause case_value_list case_label case_label_list192 %type<sn> case_value_list case_label case_label_list 196 193 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 197 194 %type<sn> /* handler_list */ handler_clause finally_clause … … 571 568 | '(' type_no_function ')' cast_expression 572 569 { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 573 // VIRTUAL cannot be opt because of look ahead issues574 | '(' VIRTUAL ')' cast_expression575 { $$ = new ExpressionNode( build_cast( nullptr, $4 ) ); }576 | '(' VIRTUAL type_no_function ')' cast_expression577 { $$ = new ExpressionNode( build_cast( $3, $5 ) ); }578 570 // | '(' type_no_function ')' tuple 579 571 // { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 580 572 ; 581 573 582 exponential_expression:574 multiplicative_expression: 583 575 cast_expression 584 | exponential_expression '\\' cast_expression 585 { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); } 586 ; 587 588 multiplicative_expression: 589 exponential_expression 590 | multiplicative_expression '*' exponential_expression 576 | multiplicative_expression '*' cast_expression 591 577 { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); } 592 | multiplicative_expression '/' exponential_expression578 | multiplicative_expression '/' cast_expression 593 579 { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); } 594 | multiplicative_expression '%' exponential_expression580 | multiplicative_expression '%' cast_expression 595 581 { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); } 596 582 ; … … 691 677 '=' { $$ = OperKinds::Assign; } 692 678 | ATassign { $$ = OperKinds::AtAssn; } 693 | EXPassign { $$ = OperKinds::ExpAssn; }694 679 | MULTassign { $$ = OperKinds::MulAssn; } 695 680 | DIVassign { $$ = OperKinds::DivAssn; } … … 744 729 | iteration_statement 745 730 | jump_statement 746 | with_statement747 731 | exception_statement 748 732 | asm_statement … … 952 936 ; 953 937 954 with_statement:955 WITH '(' tuple_expression_list ')' compound_statement956 { $$ = (StatementNode *)0; } // FIX ME957 ;958 959 938 exception_statement: 960 939 TRY compound_statement handler_clause … … 986 965 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 987 966 988 | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 989 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); } 990 | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 991 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); } 992 ; 993 994 handler_predicate_opt: 995 //empty 996 | ';' conditional_expression 967 | handler_key '(' push push exception_declaration pop ')' compound_statement pop 968 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $8 ) ); } 969 | handler_clause handler_key '(' push push exception_declaration pop ')' compound_statement pop 970 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $9 ) ) ); } 997 971 ; 998 972 … … 1521 1495 | IMAGINARY // C99 1522 1496 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); } 1497 | VALIST // GCC, __builtin_va_list 1498 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 1523 1499 | ZERO_T 1524 1500 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); } 1525 1501 | ONE_T 1526 1502 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); } 1527 | VALIST // GCC, __builtin_va_list1528 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }1529 1503 ; 1530 1504 … … 1686 1660 | aggregate_key attribute_list_opt typegen_name // CFA 1687 1661 { $$ = $3->addQualifiers( $2 ); } 1688 1689 // Temp, testing TreeStruct1690 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name1691 {1692 typedefTable.makeTypedef( *$4 ); // create typedef1693 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $1694 forall = false; // reset1695 }1696 '{' field_declaration_list '}'1697 {1698 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,1699 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );1700 }1701 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname1702 {1703 typedefTable.makeTypedef( *$4 ); // create typedef1704 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $1705 forall = false; // reset1706 }1707 '{' field_declaration_list '}'1708 {1709 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,1710 $4, $5, nullptr, $8, true )->addQualifiers( $3 );1711 }1712 1662 ; 1713 1663 … … 1888 1838 cfa_parameter_declaration: // CFA, new & old style parameter declaration 1889 1839 parameter_declaration 1890 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt1840 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt 1891 1841 { $$ = $1->addName( $2 ); } 1892 | cfa_abstract_tuple identifier_or_type_name default_initialize_opt1842 | cfa_abstract_tuple identifier_or_type_name assignment_opt 1893 1843 // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator). 1894 1844 { $$ = $1->addName( $2 ); } 1895 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt1845 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt 1896 1846 { $$ = $2->addName( $3 )->addQualifiers( $1 ); } 1897 1847 | cfa_function_specifier … … 1910 1860 parameter_declaration: 1911 1861 // No SUE declaration in parameter list. 1912 declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt1862 declaration_specifier_nobody identifier_parameter_declarator assignment_opt 1913 1863 { 1914 1864 typedefTable.addToEnclosingScope( TypedefTable::ID ); 1915 1865 $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); 1916 1866 } 1917 | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt1867 | declaration_specifier_nobody type_parameter_redeclarator assignment_opt 1918 1868 { 1919 1869 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 1923 1873 1924 1874 abstract_parameter_declaration: 1925 declaration_specifier_nobody default_initialize_opt1875 declaration_specifier_nobody assignment_opt 1926 1876 { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); } 1927 | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt1877 | declaration_specifier_nobody abstract_parameter_declarator assignment_opt 1928 1878 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 1929 1879 ; … … 2262 2212 ; 2263 2213 2264 with_clause_opt:2265 // empty2266 { $$ = (StatementNode *)0; } // FIX ME2267 | WITH '(' tuple_expression_list ')'2268 { $$ = (StatementNode *)0; } // FIX ME2269 ;2270 2271 2214 function_definition: 2272 cfa_function_declaration with_clause_opt compound_statement// CFA2215 cfa_function_declaration compound_statement // CFA 2273 2216 { 2274 2217 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2275 2218 typedefTable.leaveScope(); 2276 $$ = $1->addFunctionBody( $ 3);2277 } 2278 | declaration_specifier function_declarator with_clause_optcompound_statement2219 $$ = $1->addFunctionBody( $2 ); 2220 } 2221 | declaration_specifier function_declarator compound_statement 2279 2222 { 2280 2223 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2281 2224 typedefTable.leaveScope(); 2282 $$ = $2->addFunctionBody( $ 4)->addType( $1 );2283 } 2284 | type_qualifier_list function_declarator with_clause_optcompound_statement2225 $$ = $2->addFunctionBody( $3 )->addType( $1 ); 2226 } 2227 | type_qualifier_list function_declarator compound_statement 2285 2228 { 2286 2229 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2287 2230 typedefTable.leaveScope(); 2288 $$ = $2->addFunctionBody( $ 4)->addQualifiers( $1 );2289 } 2290 | declaration_qualifier_list function_declarator with_clause_optcompound_statement2231 $$ = $2->addFunctionBody( $3 )->addQualifiers( $1 ); 2232 } 2233 | declaration_qualifier_list function_declarator compound_statement 2291 2234 { 2292 2235 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2293 2236 typedefTable.leaveScope(); 2294 $$ = $2->addFunctionBody( $ 4)->addQualifiers( $1 );2295 } 2296 | declaration_qualifier_list type_qualifier_list function_declarator with_clause_optcompound_statement2237 $$ = $2->addFunctionBody( $3 )->addQualifiers( $1 ); 2238 } 2239 | declaration_qualifier_list type_qualifier_list function_declarator compound_statement 2297 2240 { 2298 2241 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2299 2242 typedefTable.leaveScope(); 2300 $$ = $3->addFunctionBody( $ 5)->addQualifiers( $2 )->addQualifiers( $1 );2243 $$ = $3->addFunctionBody( $4 )->addQualifiers( $2 )->addQualifiers( $1 ); 2301 2244 } 2302 2245 2303 2246 // Old-style K&R function definition, OBSOLESCENT (see 4) 2304 | declaration_specifier KR_function_declarator push KR_declaration_list_opt with_clause_optcompound_statement2247 | declaration_specifier KR_function_declarator push KR_declaration_list_opt compound_statement 2305 2248 { 2306 2249 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2307 2250 typedefTable.leaveScope(); 2308 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $ 6)->addType( $1 );2309 } 2310 | type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_optcompound_statement2251 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addType( $1 ); 2252 } 2253 | type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement 2311 2254 { 2312 2255 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2313 2256 typedefTable.leaveScope(); 2314 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $ 6)->addQualifiers( $1 );2257 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addQualifiers( $1 ); 2315 2258 } 2316 2259 2317 2260 // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4) 2318 | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_optcompound_statement2261 | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement 2319 2262 { 2320 2263 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2321 2264 typedefTable.leaveScope(); 2322 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $ 6)->addQualifiers( $1 );2323 } 2324 | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_optcompound_statement2265 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $5 )->addQualifiers( $1 ); 2266 } 2267 | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement 2325 2268 { 2326 2269 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2327 2270 typedefTable.leaveScope(); 2328 $$ = $3->addOldDeclList( $5 )->addFunctionBody( $ 7)->addQualifiers( $2 )->addQualifiers( $1 );2271 $$ = $3->addOldDeclList( $5 )->addFunctionBody( $6 )->addQualifiers( $2 )->addQualifiers( $1 ); 2329 2272 } 2330 2273 ; … … 3088 3031 ; 3089 3032 3090 default_initialize_opt:3033 assignment_opt: 3091 3034 // empty 3092 3035 { $$ = nullptr; } -
src/Parser/parserutility.cc
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:30:39 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tus Jul 18 10:12:00201713 // Update Count : 811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 22:11:32 2017 13 // Update Count : 7 14 14 // 15 15 … … 26 26 UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) ); 27 27 comparison->get_args().push_back( orig ); 28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( noQualifiers ), "0", (unsigned long long int)0 ) ) );28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0", (unsigned long long int)0 ) ) ); 29 29 return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 30 30 } -
src/Parser/parserutility.h
r33218c6 re0a653d 10 10 // Created On : Sat May 16 15:31:46 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:32:58201713 // Update Count : 412 // Last Modified On : Wed Jun 28 22:11:40 2017 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef PARSEUTILITY_H 17 #define PARSEUTILITY_H 17 18 18 19 #include "SynTree/SynTree.h" 19 20 20 21 Expression *notZeroExpr( Expression *orig ); 22 23 #endif // PARSEUTILITY_H 21 24 22 25 // Local Variables: // -
src/ResolvExpr/Alternative.h
r33218c6 re0a653d 10 10 // Created On : Sat May 16 23:45:43 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:36:36 201713 // Update Count : 312 // Last Modified On : Sat May 16 23:54:39 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef ALTERNATIVE_H 17 #define ALTERNATIVE_H 17 18 18 19 #include <list> … … 46 47 } // namespace ResolvExpr 47 48 49 #endif // ALTERNATIVE_H 50 48 51 // Local Variables: // 49 52 // tab-width: 4 // -
src/ResolvExpr/AlternativeFinder.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 23:56:12 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:35:32 201713 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Apr 19 11:44:53 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef ALTERNATIVEFINDER_H 17 #define ALTERNATIVEFINDER_H 17 18 18 19 #include <set> … … 131 132 } // namespace ResolvExpr 132 133 134 #endif // ALTERNATIVEFINDER_H 135 133 136 // Local Variables: // 134 137 // tab-width: 4 // -
src/ResolvExpr/AlternativePrinter.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 06:55:43 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:37:09 201713 // Update Count : 412 // Last Modified On : Sun May 17 06:57:12 2015 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef ALTERNATIVEPRINTER_H 17 #define ALTERNATIVEPRINTER_H 17 18 18 19 #include <iostream> … … 33 34 } // namespace ResolvExpr 34 35 36 #endif // ALTERNATIVEPRINTER_H 37 35 38 // Local Variables: // 36 39 // tab-width: 4 // -
src/ResolvExpr/ConversionCost.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 09:37:28 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:38:24 201713 // Update Count : 412 // Last Modified On : Wed Mar 2 17:35:56 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef CONVERSIONCOST_H 17 #define CONVERSIONCOST_H 17 18 18 19 #include "SynTree/Visitor.h" … … 50 51 } // namespace ResolvExpr 51 52 53 #endif // CONVERSIONCOST_H */ 54 52 55 // Local Variables: // 53 56 // tab-width: 4 // -
src/ResolvExpr/Cost.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 09:39:50 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:35:55 201713 // Update Count : 511 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jul 22 16:43:10 2015 13 // Update Count : 4 14 14 // 15 15 16 #pragma once 16 #ifndef COST_H 17 #define COST_H 17 18 18 19 #include <iostream> … … 113 114 } // namespace ResolvExpr 114 115 116 #endif // COST_H 117 115 118 // Local Variables: // 116 119 // tab-width: 4 // -
src/ResolvExpr/CurrentObject.h
r33218c6 re0a653d 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Jun 8 11:07:25 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:36:48201713 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jun 8 11:07:41 2017 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef CURRENT_OBJECT_H 17 #define CURRENT_OBJECT_H 17 18 18 19 #include <stack> … … 49 50 } // namespace ResolvExpr 50 51 52 #endif // CURRENT_OBJECT_H 53 51 54 // Local Variables: // 52 55 // tab-width: 4 // -
src/ResolvExpr/FindOpenVars.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 09:46:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:35:18 201713 // Update Count : 312 // Last Modified On : Sun May 17 09:47:20 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef FINDOPENVARS_H 17 #define FINDOPENVARS_H 17 18 18 19 #include "Unify.h" … … 24 25 } // namespace ResolvExpr 25 26 27 #endif // FINDOPENVARS_H 28 26 29 // Local Variables: // 27 30 // tab-width: 4 // -
src/ResolvExpr/RenameVars.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 12:10:28 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:33:54 201713 // Update Count : 412 // Last Modified On : Wed Mar 2 17:36:39 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef RESOLVEXPR_RENAMEVARS_H 17 #define RESOLVEXPR_RENAMEVARS_H 17 18 18 19 #include <list> … … 55 56 } // namespace ResolvExpr 56 57 58 #endif // RENAMEVARS_H 59 57 60 // Local Variables: // 58 61 // tab-width: 4 // -
src/ResolvExpr/ResolveTypeof.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 12:14:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:38:35 201713 // Update Count : 312 // Last Modified On : Sun May 17 12:16:29 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef RESOLVETYPEOF_H 17 #define RESOLVETYPEOF_H 17 18 18 19 #include "SynTree/SynTree.h" … … 23 24 } // namespace ResolvExpr 24 25 26 #endif // RESOLVETYPEOF_H 27 25 28 // Local Variables: // 26 29 // tab-width: 4 // -
src/ResolvExpr/Resolver.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 12:18:34 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:36:57 201713 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Apr 14 15:06:53 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef RESOLVER_H 17 #define RESOLVER_H 17 18 18 19 #include "SynTree/SynTree.h" … … 28 29 } // namespace ResolvExpr 29 30 31 #endif // RESOLVER_H 32 30 33 // Local Variables: // 31 34 // tab-width: 4 // -
src/ResolvExpr/TypeEnvironment.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 12:24:58 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:35:45 201713 // Update Count : 312 // Last Modified On : Sun May 17 12:26:52 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef TYPEENVIRONMENT_H 17 #define TYPEENVIRONMENT_H 17 18 18 19 #include <string> … … 98 99 } // namespace ResolvExpr 99 100 101 #endif // TYPEENVIRONMENT_H */ 102 100 103 // Local Variables: // 101 104 // tab-width: 4 // -
src/ResolvExpr/TypeMap.h
r33218c6 re0a653d 9 9 // Author : Aaron B. Moss 10 10 // Created On : Fri Feb 19 13:55:00 2016 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:37:19 2017 13 // Update Count : 2 14 // 15 16 #pragma once 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Fri Feb 19 13:55:00 2016 13 // Update Count : 1 14 // 15 16 #ifndef _TYPEMAP_H 17 #define _TYPEMAP_H 17 18 18 19 #include <map> … … 203 204 } // namespace ResolvExpr 204 205 206 #endif // _TYPEMAP_H 207 205 208 // Local Variables: // 206 209 // tab-width: 4 // -
src/ResolvExpr/Unify.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 13:09:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 23:09:34 201713 // Update Count : 312 // Last Modified On : Sun May 17 13:10:34 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef UNIFY_H 17 #define UNIFY_H 17 18 18 19 #include <map> … … 71 72 } // namespace ResolvExpr 72 73 74 #endif // UNIFY_H 75 73 76 // Local Variables: // 74 77 // tab-width: 4 // -
src/ResolvExpr/typeops.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 07:28:22 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:36:18 201713 // Update Count : 312 // Last Modified On : Sun May 17 07:33:11 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef TYPEOPS_H 17 #define TYPEOPS_H 17 18 18 19 #include "SynTree/SynTree.h" … … 156 157 } // namespace ResolvExpr 157 158 159 #endif // TYPEOPS_H 160 158 161 // Local Variables: // 159 162 // tab-width: 4 // -
src/SymTab/Autogen.cc
r33218c6 re0a653d 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jul 14 16:41:00 201713 // Update Count : 6 212 // Last Modified On : Wed Jun 28 15:30:00 2017 13 // Update Count : 61 14 14 // 15 15 #include "Autogen.h" … … 407 407 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) { 408 408 // Builtins do not use autogeneration. 409 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin CFA||409 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin || 410 410 aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) { 411 411 return; -
src/SymTab/Autogen.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 21:53:34 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:50:25201713 // Update Count : 1 512 // Last Modified On : Wed Jun 21 17:25:26 2017 13 // Update Count : 14 14 14 // 15 15 16 #pragma once 16 #ifndef AUTOGEN_H 17 #define AUTOGEN_H 17 18 18 19 #include <cassert> // for assert … … 182 183 } 183 184 } // namespace SymTab 184 185 // Local Variables: // 186 // tab-width: 4 // 187 // mode: c++ // 188 // compile-command: "make install" // 189 // End: // 190 185 #endif // AUTOGEN_H -
src/SymTab/FixFunction.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 17:02:08 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:45:55 201713 // Update Count : 412 // Last Modified On : Wed Mar 2 17:34:06 2016 13 // Update Count : 3 14 14 // 15 15 16 #pragma once 16 #ifndef FIXFUNCTION_H 17 #define FIXFUNCTION_H 17 18 18 19 #include "SynTree/Mutator.h" // for Mutator … … 49 50 } // namespace SymTab 50 51 52 #endif // FIXFUNCTION_H 53 51 54 // Local Variables: // 52 55 // tab-width: 4 // -
src/SymTab/ImplementationType.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 21:35:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:46:19 201713 // Update Count : 312 // Last Modified On : Sun May 17 21:37:15 2015 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef IMPLEMENTATIONTYPE_H 17 #define IMPLEMENTATIONTYPE_H 17 18 18 19 class Type; … … 31 32 } // namespace SymTab 32 33 34 #endif // IMPLEMENTATIONTYPE_H 35 33 36 // Local Variables: // 34 37 // tab-width: 4 // -
src/SymTab/Indexer.h
r33218c6 re0a653d 10 10 // Created On : Sun May 17 21:38:55 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:46:34 201713 // Update Count : 712 // Last Modified On : Wed Mar 2 17:34:14 2016 13 // Update Count : 6 14 14 // 15 15 16 #pragma once 16 #ifndef INDEXER_H 17 #define INDEXER_H 17 18 18 19 #include <iosfwd> // for ostream … … 147 148 } // namespace SymTab 148 149 150 #endif // INDEXER_H 151 149 152 // Local Variables: // 150 153 // tab-width: 4 // -
src/SymTab/Mangler.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:44:03 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:45:30 201713 // Update Count : 1 511 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 19 15:48:46 2015 13 // Update Count : 14 14 14 // 15 15 16 #pragma once 16 #ifndef MANGLER_H 17 #define MANGLER_H 17 18 18 19 #include <map> // for map, map<>::value_compare … … 80 81 } // SymTab 81 82 83 #endif // MANGLER_H 84 82 85 // Local Variables: // 83 86 // tab-width: 4 // -
src/SymTab/Validate.h
r33218c6 re0a653d 11 11 // Created On : Sun May 17 21:53:34 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sat Jul 22 09:46:07 201714 // Update Count : 413 // Last Modified On : Tue May 19 16:49:43 2015 14 // Update Count : 3 15 15 // 16 16 17 #pragma once 17 #ifndef VALIDATE_H 18 #define VALIDATE_H 18 19 19 20 #include <list> // for list … … 30 31 } // namespace SymTab 31 32 33 #endif // VALIDATE_H 34 32 35 // Local Variables: // 33 36 // tab-width: 4 // -
src/SymTab/module.mk
r33218c6 re0a653d 10 10 ## Author : Richard C. Bilson 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 ## Last Modified By : Andrew Beach13 ## Last Modified On : Wed Jul 12 13:06:00 201714 ## Update Count : 312 ## Last Modified By : Rob Schluntz 13 ## Last Modified On : Tue Jul 07 16:22:23 2015 14 ## Update Count : 2 15 15 ############################################################################### 16 16 … … 21 21 SymTab/ImplementationType.cc \ 22 22 SymTab/TypeEquality.cc \ 23 SymTab/Autogen.cc \ 24 SymTab/TreeStruct.cc 23 SymTab/Autogen.cc -
src/SynTree/AddStmtVisitor.h
r33218c6 re0a653d 10 10 // Created On : Wed Jun 22 12:05:48 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:51:08 201713 // Update Count : 912 // Last Modified On : Tue Jul 12 17:50:32 2016 13 // Update Count : 8 14 14 // 15 15 16 #pragma once 16 #ifndef ADD_STATEMENT_VISITOR_H 17 #define ADD_STATEMENT_VISITOR_H 17 18 18 19 #include <list> … … 41 42 }; 42 43 43 // Local Variables: // 44 // tab-width: 4 // 45 // mode: c++ // 46 // compile-command: "make install" // 47 // End: // 44 #endif // ADD_STATEMENT_VISITOR_H -
src/SynTree/Attribute.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:54:14201713 // Update Count : 3 912 // Last Modified On : Wed Jan 18 16:27:11 2017 13 // Update Count : 38 14 14 // 15 15 16 #pragma once 16 #ifndef GCC_ATTRIBUTE_H 17 #define GCC_ATTRIBUTE_H 17 18 18 19 #include "SynTree.h" … … 41 42 const std::list< Attribute * > noAttributes; 42 43 44 #endif 45 43 46 // Local Variables: // 44 47 // tab-width: 4 // -
src/SynTree/BaseSyntaxNode.h
r33218c6 re0a653d 14 14 // 15 15 16 #pragma once 16 #ifndef BASE_SYNTAX_NODE_H 17 #define BASE_SYNTAX_NODE_H 17 18 18 19 #include "Common/utility.h" … … 28 29 }; 29 30 31 #endif // BASE_SYNTAX_NODE_H 32 30 33 // Local Variables: // 31 34 // tab-width: 4 // -
src/SynTree/Constant.cc
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jul 14 14:50:00 201713 // Update Count : 2 912 // Last Modified On : Thr Jun 22 10:11:00 2017 13 // Update Count : 28 14 14 // 15 15 … … 46 46 } 47 47 48 Constant Constant::null( Type * ptrtype ) {49 if ( nullptr == ptrtype ) {50 ptrtype = new PointerType(51 Type::Qualifiers(),52 new VoidType( Type::Qualifiers() )53 );54 }55 56 return Constant( ptrtype, "0", (unsigned long long int)0 );57 }58 59 48 unsigned long long Constant::get_ival() const { 60 49 assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); -
src/SynTree/Constant.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:54:46201713 // Update Count : 1 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:13:00 2017 13 // Update Count : 15 14 14 // 15 15 16 #pragma once 16 #ifndef CONSTANT_H 17 #define CONSTANT_H 17 18 18 19 #include "SynTree.h" … … 43 44 static Constant from_double( double d ); 44 45 45 /// generates a null pointer value for the given type. void * if omitted.46 static Constant null( Type * ptrtype = nullptr );47 48 46 virtual void accept( Visitor & v ) { v.visit( this ); } 49 47 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } … … 60 58 }; 61 59 60 #endif // CONSTANT_H 61 62 62 // Local Variables: // 63 63 // tab-width: 4 // -
src/SynTree/Declaration.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:52:59 2017 13 // Update Count : 124 14 // 15 16 #pragma once 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:31:00 2017 13 // Update Count : 122 14 // 15 16 #ifndef DECLARATION_H 17 #define DECLARATION_H 17 18 18 19 #include <string> … … 265 266 typedef AggregateDecl Parent; 266 267 public: 267 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {} 268 StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {} 268 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {} 269 269 StructDecl( const StructDecl &other ) : Parent( other ) {} 270 270 … … 273 273 bool is_thread() { return kind == DeclarationNode::Thread; } 274 274 275 // Tagged/Tree Structure Excetion276 bool get_tagged() { return tagged; }277 void set_tagged( bool newValue ) { tagged = newValue; }278 bool has_parent() { return parent_name != ""; }279 std::string get_parentName() { return parent_name; }280 281 275 virtual StructDecl *clone() const { return new StructDecl( *this ); } 282 276 virtual void accept( Visitor &v ) { v.visit( this ); } … … 285 279 DeclarationNode::Aggregate kind; 286 280 virtual std::string typeString() const; 287 288 bool tagged;289 std::string parent_name;290 281 }; 291 282 … … 351 342 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 352 343 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); 344 345 #endif // DECLARATION_H 353 346 354 347 // Local Variables: // -
src/SynTree/Expression.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:53:16201713 // Update Count : 4 212 // Last Modified On : Thu Mar 30 16:44:00 2017 13 // Update Count : 41 14 14 // 15 15 16 #pragma once 16 #ifndef EXPRESSION_H 17 #define EXPRESSION_H 17 18 18 19 #include <map> … … 797 798 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 798 799 800 #endif // EXPRESSION_H 801 799 802 // Local Variables: // 800 803 // tab-width: 4 // -
src/SynTree/Initializer.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:52:02 201713 // Update Count : 2 112 // Last Modified On : Thu Mar 23 16:12:42 2017 13 // Update Count : 20 14 14 // 15 15 16 #pragma once 16 #ifndef INITIALIZER_H 17 #define INITIALIZER_H 17 18 18 19 #include <cassert> … … 140 141 std::ostream & operator<<( std::ostream & out, const Designation * des ); 141 142 143 #endif // INITIALIZER_H 144 142 145 // Local Variables: // 143 146 // tab-width: 4 // -
src/SynTree/Label.h
r33218c6 re0a653d 10 10 // Created On : Wed Jun 8 12:53:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 22 09:52:44 201713 // Update Count : 312 // Last Modified On : Sun Aug 7 14:44:29 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef LABEL_H 17 #define LABEL_H 17 18 18 19 #include <string> … … 50 51 static const std::list< Label > noLabels; 51 52 53 #endif // LABEL_H 54 52 55 // Local Variables: // 53 56 // tab-width: 4 // -
src/SynTree/Mutator.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:51:30 201713 // Update Count : 1 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 15:45:00 2017 13 // Update Count : 14 14 14 // 15 15 #include <cassert> … … 18 18 #include "Common/SemanticError.h" 19 19 20 #pragma once 20 #ifndef MUTATOR_H 21 #define MUTATOR_H 21 22 22 23 class Mutator { … … 149 150 } 150 151 152 #endif // MUTATOR_H 153 151 154 // Local Variables: // 152 155 // tab-width: 4 // -
src/SynTree/Statement.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:54:32201713 // Update Count : 6 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:35:00 2017 13 // Update Count : 67 14 14 // 15 15 16 #pragma once 16 #ifndef STATEMENT_H 17 #define STATEMENT_H 17 18 18 19 #include "BaseSyntaxNode.h" … … 427 428 std::ostream & operator<<( std::ostream & out, const Statement * statement ); 428 429 430 #endif // STATEMENT_H 431 429 432 // Local Variables: // 430 433 // tab-width: 4 // -
src/SynTree/SynTree.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:51:46201713 // Update Count : 1011 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 17:00:00 2017 13 // Update Count : 9 14 14 // 15 15 16 #pragma once 16 #ifndef SYNTREE_H 17 #define SYNTREE_H 17 18 18 19 #include <string> … … 134 135 class Attribute; 135 136 137 #endif // SYNTREE_H 138 136 139 // Local Variables: // 137 140 // tab-width: 4 // -
src/SynTree/Type.h
r33218c6 re0a653d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:53:29201713 // Update Count : 1 5112 // Last Modified On : Thu Mar 23 16:16:36 2017 13 // Update Count : 149 14 14 // 15 15 16 #pragma once 16 #ifndef TYPE_H 17 #define TYPE_H 17 18 18 19 #include "BaseSyntaxNode.h" … … 171 172 }; 172 173 173 extern Type::Qualifiers noQualifiers; // no qualifiers on constants174 extern Type::Qualifiers emptyQualifiers; // no qualifiers on constants 174 175 175 176 class VoidType : public Type { … … 601 602 std::ostream & operator<<( std::ostream & out, const Type * type ); 602 603 604 #endif // TYPE_H 605 603 606 // Local Variables: // 604 607 // tab-width: 4 // -
src/SynTree/TypeSubstitution.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:52:24 201713 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Apr 29 15:00:20 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef TYPESUBSTITUTION_H 17 #define TYPESUBSTITUTION_H 17 18 18 19 #include <map> … … 179 180 std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub ); 180 181 182 #endif // TYPESUBSTITUTION_H 183 181 184 // Local Variables: // 182 185 // tab-width: 4 // -
src/SynTree/VarExprReplacer.h
r33218c6 re0a653d 9 9 // Author : Rob Schluntz 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:53:41 201713 // Update Count : 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:27:52 2016 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef VAR_EXPR_REPLACER_H 17 #define VAR_EXPR_REPLACER_H 17 18 18 19 #include <map> … … 34 35 }; 35 36 37 #endif // VAR_EXPR_REPLACER_H 38 36 39 // Local Variables: // 37 40 // tab-width: 4 // -
src/SynTree/Visitor.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:54:04201713 // Update Count : 1 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 08 15:45:00 2017 13 // Update Count : 11 14 14 // 15 15 16 #pragma once 16 #ifndef VISITOR_H 17 #define VISITOR_H 17 18 18 19 #include "SynTree.h" … … 173 174 } 174 175 176 #endif // VISITOR_H 177 175 178 // Local Variables: // 176 179 // tab-width: 4 // -
src/Tuples/Explode.h
r33218c6 re0a653d 9 9 // Author : Rob Schluntz 10 10 // Created On : Wed Nov 9 13:12:24 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:55:16 201713 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Nov 9 13:20:24 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef _EXPLODE_H_ 17 #define _EXPLODE_H_ 17 18 18 19 #include "ResolvExpr/AlternativeFinder.h" … … 94 95 } // namespace Tuples 95 96 97 #endif // _TUPLE_ASSIGNMENT_H_ 98 96 99 // Local Variables: // 97 100 // tab-width: 4 // -
src/Tuples/Tuples.h
r33218c6 re0a653d 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:55:00 201713 // Update Count : 1 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Nov 9 13:17:58 2016 13 // Update Count : 15 14 14 // 15 15 16 #pragma once 16 #ifndef _TUPLES_H_ 17 #define _TUPLES_H_ 17 18 18 19 #include <string> … … 48 49 } // namespace Tuples 49 50 51 #endif // _TUPLE_ASSIGNMENT_H_ 52 50 53 // Local Variables: // 51 54 // tab-width: 4 // -
src/benchmark/create_pthrd.c
r33218c6 re0a653d 14 14 n = atoi(argv[1]); 15 15 } 16 printf(" create %lu pthreads ...", n);16 printf("%lu\n", n); 17 17 18 18 for (size_t i = 0; i < n; i++) { 19 pthread_t thread; 20 if (pthread_create(&thread, NULL, foo, NULL) < 0) { 21 perror( "failure" ); 19 pthread_attr_t attr; 20 if (pthread_attr_init(&attr) < 0) { 22 21 return 1; 23 22 } 24 25 if (pthread_join( thread, NULL) < 0) { 26 perror( "failure" ); 23 if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) < 0) { 24 return 1; 25 } 26 pthread_t thread; 27 if (pthread_create(&thread, &attr, foo, NULL) < 0) { 27 28 return 1; 28 29 } 29 30 } 30 printf("finish\n"); 31 pthread_exit(NULL); 32 return 0; 31 33 } -
src/driver/cfa.cc
r33218c6 re0a653d 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 20 15:54:45 201713 // Update Count : 15 612 // Last Modified On : Fri Jan 20 14:38:45 2017 13 // Update Count : 155 14 14 // 15 15 … … 76 76 bool cpp_flag = false; // -E or -M flag, preprocessor only 77 77 bool std_flag = false; // -std= flag 78 bool noincstd_flag = false; // -no-include-stdhdr= flag 78 79 bool debugging __attribute(( unused )) = false; // -g flag 79 80 … … 133 134 } else if ( arg == "-nohelp" ) { 134 135 help = false; // strip the nohelp flag 136 } else if ( arg == "-no-include-stdhdr" ) { 137 noincstd_flag = true; // strip the no-include-stdhdr flag 135 138 } else if ( arg == "-compiler" ) { 136 139 // use the user specified compiler … … 231 234 args[nargs] = "-I" CFA_INCDIR; 232 235 nargs += 1; 233 args[nargs] = "-I" CFA_INCDIR "/stdhdr"; 234 nargs += 1; 236 if ( ! noincstd_flag ) { // do not use during build 237 args[nargs] = "-I" CFA_INCDIR "/stdhdr"; 238 nargs += 1; 239 } // if 235 240 args[nargs] = "-I" CFA_INCDIR "/concurrency"; 236 241 nargs += 1; -
src/libcfa/Makefile.am
r33218c6 re0a653d 10 10 ## Author : Peter A. Buhr 11 11 ## Created On : Sun May 31 08:54:01 2015 12 ## Last Modified By : Peter A. Buhr13 ## Last Modified On : Thu Jul 20 23:09:34201714 ## Update Count : 2 2012 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jun 28 15:36:00 2017 14 ## Update Count : 215 15 15 ############################################################################### 16 16 … … 39 39 40 40 AM_CCASFLAGS = @CFA_FLAGS@ 41 CFLAGS = -quiet - I${abs_top_srcdir}/src/libcfa/stdhdr -XCFA -t -B${abs_top_srcdir}/src/driver ${EXTRA_FLAGS}41 CFLAGS = -quiet -no-include-stdhdr -XCFA -t -B${abs_top_srcdir}/src/driver ${EXTRA_FLAGS} 42 42 CC = ${abs_top_srcdir}/src/driver/cfa 43 43 44 headers = fstream iostream iterator limitsrational stdlib \44 headers = assert fstream iostream iterator limits math rational stdlib \ 45 45 containers/maybe containers/pair containers/result containers/vector 46 46 … … 51 51 52 52 libobjs = ${headers:=.o} 53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ 54 assert.c exception.c typeobject.c 53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} exception.c 55 54 56 55 # not all platforms support concurrency, add option do disable it … … 69 68 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 70 69 71 libcfa_a-typeobject.o : typeobject.c72 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<73 74 70 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 75 71 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 76 72 77 73 libcfa_d_a-exception.o : exception.c 78 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<79 80 libcfa_d_a-typeobject.o : typeobject.c81 74 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 82 75 … … 91 84 92 85 cfa_includedir = $(CFA_INCDIR) 93 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} mathgmp concurrency/invoke.h86 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h 94 87 95 88 CLEANFILES = libcfa-prelude.c -
src/libcfa/Makefile.in
r33218c6 re0a653d 149 149 libcfa_d_a_LIBADD = 150 150 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 151 libhdr/libdebug.c fstream.c iostream.c iterator.c limits.c \152 rational.c stdlib.c containers/maybe.c containers/pair.c \153 containers/ result.c containers/vector.c \151 libhdr/libdebug.c assert.c fstream.c iostream.c iterator.c \ 152 limits.c math.c rational.c stdlib.c containers/maybe.c \ 153 containers/pair.c containers/result.c containers/vector.c \ 154 154 concurrency/coroutine.c concurrency/thread.c \ 155 concurrency/kernel.c concurrency/monitor.c assert.c \ 156 exception.c typeobject.c \ 155 concurrency/kernel.c concurrency/monitor.c exception.c \ 157 156 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \ 158 157 concurrency/invoke.c concurrency/preemption.c … … 162 161 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-kernel.$(OBJEXT) \ 163 162 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-monitor.$(OBJEXT) 164 am__objects_2 = libcfa_d_a-fstream.$(OBJEXT) \ 165 libcfa_d_a-iostream.$(OBJEXT) libcfa_d_a-iterator.$(OBJEXT) \ 166 libcfa_d_a-limits.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \ 163 am__objects_2 = libcfa_d_a-assert.$(OBJEXT) \ 164 libcfa_d_a-fstream.$(OBJEXT) libcfa_d_a-iostream.$(OBJEXT) \ 165 libcfa_d_a-iterator.$(OBJEXT) libcfa_d_a-limits.$(OBJEXT) \ 166 libcfa_d_a-math.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \ 167 167 libcfa_d_a-stdlib.$(OBJEXT) \ 168 168 containers/libcfa_d_a-maybe.$(OBJEXT) \ … … 177 177 libcfa_d_a-interpose.$(OBJEXT) \ 178 178 libhdr/libcfa_d_a-libdebug.$(OBJEXT) $(am__objects_2) \ 179 libcfa_d_a-assert.$(OBJEXT) libcfa_d_a-exception.$(OBJEXT) \ 180 libcfa_d_a-typeobject.$(OBJEXT) $(am__objects_3) 179 libcfa_d_a-exception.$(OBJEXT) $(am__objects_3) 181 180 am_libcfa_d_a_OBJECTS = $(am__objects_4) 182 181 libcfa_d_a_OBJECTS = $(am_libcfa_d_a_OBJECTS) … … 184 183 libcfa_a_LIBADD = 185 184 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 186 libhdr/libdebug.c fstream.c iostream.c iterator.c limits.c \187 rational.c stdlib.c containers/maybe.c containers/pair.c \188 containers/ result.c containers/vector.c \185 libhdr/libdebug.c assert.c fstream.c iostream.c iterator.c \ 186 limits.c math.c rational.c stdlib.c containers/maybe.c \ 187 containers/pair.c containers/result.c containers/vector.c \ 189 188 concurrency/coroutine.c concurrency/thread.c \ 190 concurrency/kernel.c concurrency/monitor.c assert.c \ 191 exception.c typeobject.c \ 189 concurrency/kernel.c concurrency/monitor.c exception.c \ 192 190 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \ 193 191 concurrency/invoke.c concurrency/preemption.c … … 196 194 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-kernel.$(OBJEXT) \ 197 195 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-monitor.$(OBJEXT) 198 am__objects_6 = libcfa_a-fstream.$(OBJEXT) libcfa_a-iostream.$(OBJEXT) \ 199 libcfa_a-iterator.$(OBJEXT) libcfa_a-limits.$(OBJEXT) \ 196 am__objects_6 = libcfa_a-assert.$(OBJEXT) libcfa_a-fstream.$(OBJEXT) \ 197 libcfa_a-iostream.$(OBJEXT) libcfa_a-iterator.$(OBJEXT) \ 198 libcfa_a-limits.$(OBJEXT) libcfa_a-math.$(OBJEXT) \ 200 199 libcfa_a-rational.$(OBJEXT) libcfa_a-stdlib.$(OBJEXT) \ 201 200 containers/libcfa_a-maybe.$(OBJEXT) \ … … 210 209 libcfa_a-interpose.$(OBJEXT) \ 211 210 libhdr/libcfa_a-libdebug.$(OBJEXT) $(am__objects_6) \ 212 libcfa_a-assert.$(OBJEXT) libcfa_a-exception.$(OBJEXT) \ 213 libcfa_a-typeobject.$(OBJEXT) $(am__objects_7) 211 libcfa_a-exception.$(OBJEXT) $(am__objects_7) 214 212 am_libcfa_a_OBJECTS = $(am__objects_8) 215 213 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS) … … 260 258 *) (install-info --version) >/dev/null 2>&1;; \ 261 259 esac 262 am__nobase_cfa_include_HEADERS_DIST = fstream iostream iterator limits\263 rational stdlib containers/maybe containers/pair \260 am__nobase_cfa_include_HEADERS_DIST = assert fstream iostream iterator \ 261 limits math rational stdlib containers/maybe containers/pair \ 264 262 containers/result containers/vector concurrency/coroutine \ 265 263 concurrency/thread concurrency/kernel concurrency/monitor \ 266 ${shell echo stdhdr/*} mathgmp concurrency/invoke.h264 ${shell echo stdhdr/*} gmp concurrency/invoke.h 267 265 HEADERS = $(nobase_cfa_include_HEADERS) 268 266 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) … … 308 306 CFA_NAME = @CFA_NAME@ 309 307 CFA_PREFIX = @CFA_PREFIX@ 310 CFLAGS = -quiet - I${abs_top_srcdir}/src/libcfa/stdhdr -XCFA -t -B${abs_top_srcdir}/src/driver ${EXTRA_FLAGS}308 CFLAGS = -quiet -no-include-stdhdr -XCFA -t -B${abs_top_srcdir}/src/driver ${EXTRA_FLAGS} 311 309 CPP = @CPP@ 312 310 CPPFLAGS = @CPPFLAGS@ … … 414 412 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@ 415 413 AM_CCASFLAGS = @CFA_FLAGS@ 416 headers = fstream iostream iterator limitsrational stdlib \414 headers = assert fstream iostream iterator limits math rational stdlib \ 417 415 containers/maybe containers/pair containers/result \ 418 416 containers/vector $(am__append_3) 419 417 libobjs = ${headers:=.o} 420 418 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ 421 assert.c exception.c typeobject.c $(am__append_4)419 exception.c $(am__append_4) 422 420 libcfa_a_SOURCES = ${libsrc} 423 421 libcfa_a_CFLAGS = -nodebug -O2 … … 426 424 stdhdr = ${shell echo stdhdr/*} 427 425 cfa_includedir = $(CFA_INCDIR) 428 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} mathgmp concurrency/invoke.h426 nobase_cfa_include_HEADERS = ${headers} ${stdhdr} gmp concurrency/invoke.h 429 427 CLEANFILES = libcfa-prelude.c 430 428 all: all-am … … 592 590 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-libcfa-prelude.Po@am__quote@ 593 591 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-limits.Po@am__quote@ 592 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-math.Po@am__quote@ 594 593 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@ 595 594 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-stdlib.Po@am__quote@ 596 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-typeobject.Po@am__quote@597 595 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@ 598 596 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-exception.Po@am__quote@ … … 603 601 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-libcfa-prelude.Po@am__quote@ 604 602 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-limits.Po@am__quote@ 603 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-math.Po@am__quote@ 605 604 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@ 606 605 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@ 607 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-typeobject.Po@am__quote@608 606 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@ 609 607 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@ … … 699 697 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_d_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 700 698 699 libcfa_d_a-assert.o: assert.c 700 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 701 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po 702 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.o' libtool=no @AMDEPBACKSLASH@ 703 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 704 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 705 706 libcfa_d_a-assert.obj: assert.c 707 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 708 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po 709 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.obj' libtool=no @AMDEPBACKSLASH@ 710 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 711 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 712 701 713 libcfa_d_a-fstream.o: fstream.c 702 714 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-fstream.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-fstream.Tpo -c -o libcfa_d_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c … … 755 767 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-limits.obj `if test -f 'limits.c'; then $(CYGPATH_W) 'limits.c'; else $(CYGPATH_W) '$(srcdir)/limits.c'; fi` 756 768 769 libcfa_d_a-math.o: math.c 770 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 771 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po 772 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_d_a-math.o' libtool=no @AMDEPBACKSLASH@ 773 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 774 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 775 776 libcfa_d_a-math.obj: math.c 777 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-math.Tpo -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 778 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-math.Tpo $(DEPDIR)/libcfa_d_a-math.Po 779 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_d_a-math.obj' libtool=no @AMDEPBACKSLASH@ 780 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 781 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 782 757 783 libcfa_d_a-rational.o: rational.c 758 784 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-rational.Tpo -c -o libcfa_d_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c … … 895 921 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-monitor.obj `if test -f 'concurrency/monitor.c'; then $(CYGPATH_W) 'concurrency/monitor.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/monitor.c'; fi` 896 922 897 libcfa_d_a-assert.o: assert.c898 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c899 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po900 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.o' libtool=no @AMDEPBACKSLASH@901 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@902 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c903 904 libcfa_d_a-assert.obj: assert.c905 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-assert.Tpo -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`906 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-assert.Tpo $(DEPDIR)/libcfa_d_a-assert.Po907 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_d_a-assert.obj' libtool=no @AMDEPBACKSLASH@908 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@909 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`910 911 923 libcfa_d_a-exception.obj: exception.c 912 924 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-exception.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-exception.Tpo -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi` … … 916 928 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi` 917 929 918 libcfa_d_a-typeobject.obj: typeobject.c919 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-typeobject.Tpo -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`920 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-typeobject.Tpo $(DEPDIR)/libcfa_d_a-typeobject.Po921 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='typeobject.c' object='libcfa_d_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@922 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@923 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`924 925 930 concurrency/libcfa_d_a-alarm.o: concurrency/alarm.c 926 931 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-alarm.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo -c -o concurrency/libcfa_d_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c … … 993 998 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 994 999 1000 libcfa_a-assert.o: assert.c 1001 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 1002 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po 1003 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.o' libtool=no @AMDEPBACKSLASH@ 1004 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1005 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c 1006 1007 libcfa_a-assert.obj: assert.c 1008 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 1009 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po 1010 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.obj' libtool=no @AMDEPBACKSLASH@ 1011 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1012 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi` 1013 995 1014 libcfa_a-fstream.o: fstream.c 996 1015 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-fstream.o -MD -MP -MF $(DEPDIR)/libcfa_a-fstream.Tpo -c -o libcfa_a-fstream.o `test -f 'fstream.c' || echo '$(srcdir)/'`fstream.c … … 1049 1068 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-limits.obj `if test -f 'limits.c'; then $(CYGPATH_W) 'limits.c'; else $(CYGPATH_W) '$(srcdir)/limits.c'; fi` 1050 1069 1070 libcfa_a-math.o: math.c 1071 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.o -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 1072 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po 1073 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_a-math.o' libtool=no @AMDEPBACKSLASH@ 1074 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1075 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.o `test -f 'math.c' || echo '$(srcdir)/'`math.c 1076 1077 libcfa_a-math.obj: math.c 1078 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-math.obj -MD -MP -MF $(DEPDIR)/libcfa_a-math.Tpo -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 1079 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-math.Tpo $(DEPDIR)/libcfa_a-math.Po 1080 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='math.c' object='libcfa_a-math.obj' libtool=no @AMDEPBACKSLASH@ 1081 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1082 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-math.obj `if test -f 'math.c'; then $(CYGPATH_W) 'math.c'; else $(CYGPATH_W) '$(srcdir)/math.c'; fi` 1083 1051 1084 libcfa_a-rational.o: rational.c 1052 1085 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-rational.o -MD -MP -MF $(DEPDIR)/libcfa_a-rational.Tpo -c -o libcfa_a-rational.o `test -f 'rational.c' || echo '$(srcdir)/'`rational.c … … 1189 1222 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-monitor.obj `if test -f 'concurrency/monitor.c'; then $(CYGPATH_W) 'concurrency/monitor.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/monitor.c'; fi` 1190 1223 1191 libcfa_a-assert.o: assert.c1192 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.o -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c1193 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po1194 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.o' libtool=no @AMDEPBACKSLASH@1195 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@1196 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c1197 1198 libcfa_a-assert.obj: assert.c1199 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-assert.obj -MD -MP -MF $(DEPDIR)/libcfa_a-assert.Tpo -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`1200 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-assert.Tpo $(DEPDIR)/libcfa_a-assert.Po1201 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libcfa_a-assert.obj' libtool=no @AMDEPBACKSLASH@1202 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@1203 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`1204 1205 1224 libcfa_a-exception.obj: exception.c 1206 1225 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-exception.obj -MD -MP -MF $(DEPDIR)/libcfa_a-exception.Tpo -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi` … … 1209 1228 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1210 1229 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi` 1211 1212 libcfa_a-typeobject.obj: typeobject.c1213 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_a-typeobject.Tpo -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`1214 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-typeobject.Tpo $(DEPDIR)/libcfa_a-typeobject.Po1215 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='typeobject.c' object='libcfa_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@1216 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@1217 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`1218 1230 1219 1231 concurrency/libcfa_a-alarm.o: concurrency/alarm.c … … 1509 1521 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1510 1522 1511 libcfa_a-typeobject.o : typeobject.c1512 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<1513 1514 1523 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 1515 1524 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1516 1525 1517 1526 libcfa_d_a-exception.o : exception.c 1518 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<1519 1520 libcfa_d_a-typeobject.o : typeobject.c1521 1527 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1522 1528 -
src/libcfa/assert.c
r33218c6 re0a653d 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 20 15:10:26 201713 // Update Count : 211 // Last Modified By : Thierry Delisle 12 // Last Modified On : Mon Nov 28 12:27:26 2016 13 // Update Count : 0 14 14 // 15 15 16 #include <assert.h>17 #include <stdarg.h> // varargs18 #include <stdio.h> // fprintf 16 #include "assert" 17 #include "stdlib" // abort 18 19 19 #include "libhdr/libdebug.h" 20 20 21 21 extern "C" { 22 #include <stdarg.h> // varargs 23 #include <stdio.h> // fprintf 24 22 25 extern const char * __progname; // global name of running executable (argv[0]) 23 26 … … 44 47 abort(); 45 48 } 49 46 50 } 47 51 -
src/libcfa/concurrency/CtxSwitch-i386.S
r33218c6 re0a653d 1 // -*- Mode: Asm -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Dec 6 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:29:25 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : Tue Dec 6 12:27:26 2016 14 // Update Count : 0 14 15 // 15 16 // This library is free software; you can redistribute it and/or modify it … … 98 99 99 100 // Local Variables: // 100 // mode: c // 101 // tab-width: 4 // 101 // compile-command: "make install" // 102 102 // End: // -
src/libcfa/concurrency/CtxSwitch-x86_64.S
r33218c6 re0a653d 1 // -*- Mode: Asm -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:28:11 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : Mon Nov 28 12:27:26 2016 14 // Update Count : 0 14 15 // 15 16 // This library is free software; you can redistribute it and/or modify it -
src/libcfa/concurrency/alarm.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Fri Jun 2 11:31:25 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:35:18 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 30 31 31 32 //============================================================================================= 32 // time type33 //=============================================================================================34 35 #define one_second 1_000_000_000ul36 #define one_milisecond 1_000_000ul37 #define one_microsecond 1_000ul38 #define one_nanosecond 1ul39 40 __cfa_time_t zero_time = { 0 };41 42 void ?{}( __cfa_time_t * this ) { this->val = 0; }43 void ?{}( __cfa_time_t * this, zero_t zero ) { this->val = 0; }44 45 void ?{}( itimerval * this, __cfa_time_t * alarm ) {46 this->it_value.tv_sec = alarm->val / one_second; // seconds47 this->it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds48 this->it_interval.tv_sec = 0;49 this->it_interval.tv_usec = 0;50 }51 52 53 void ?{}( __cfa_time_t * this, timespec * curr ) {54 uint64_t secs = curr->tv_sec;55 uint64_t nsecs = curr->tv_nsec;56 this->val = (secs * one_second) + nsecs;57 }58 59 __cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs ) {60 this->val = 0;61 return *this;62 }63 64 __cfa_time_t from_s ( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1_000_000_000ul; return ret; }65 __cfa_time_t from_ms( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1_000_000ul; return ret; }66 __cfa_time_t from_us( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1_000ul; return ret; }67 __cfa_time_t from_ns( uint64_t val ) { __cfa_time_t ret; ret.val = val * 1ul; return ret; }68 69 //=============================================================================================70 33 // Clock logic 71 34 //============================================================================================= … … 74 37 timespec curr; 75 38 clock_gettime( CLOCK_REALTIME, &curr ); 76 return (__cfa_time_t){ &curr }; 39 __cfa_time_t curr_time = ((__cfa_time_t)curr.tv_sec * TIMEGRAN) + curr.tv_nsec; 40 // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : current time is %lu\n", curr_time ); 41 return curr_time; 77 42 } 78 43 79 44 void __kernel_set_timer( __cfa_time_t alarm ) { 80 itimerval val = { &alarm }; 45 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : set timer to %lu\n", (__cfa_time_t)alarm ); 46 itimerval val; 47 val.it_value.tv_sec = alarm / TIMEGRAN; // seconds 48 val.it_value.tv_usec = (alarm % TIMEGRAN) / ( TIMEGRAN / 1_000_000L ); // microseconds 49 val.it_interval.tv_sec = 0; 50 val.it_interval.tv_usec = 0; 81 51 setitimer( ITIMER_REAL, &val, NULL ); 82 52 } … … 86 56 //============================================================================================= 87 57 88 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time) {58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) { 89 59 this->thrd = thrd; 90 60 this->alarm = alarm; … … 95 65 } 96 66 97 void ?{}( alarm_node_t * this, processor * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time) {67 void ?{}( alarm_node_t * this, processor * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ) { 98 68 this->proc = proc; 99 69 this->alarm = alarm; … … 183 153 184 154 void register_self( alarm_node_t * this ) { 185 alarm_list_t * alarms = &event_kernel->alarms; 155 disable_interrupts(); 156 verify( !systemProcessor->pending_alarm ); 157 lock( &systemProcessor->alarm_lock DEBUG_CTX2 ); 158 { 159 verify( validate( &systemProcessor->alarms ) ); 160 bool first = !systemProcessor->alarms.head; 186 161 187 disable_interrupts(); 188 lock( &event_kernel->lock DEBUG_CTX2 ); 189 { 190 verify( validate( alarms ) ); 191 bool first = !alarms->head; 192 193 insert( alarms, this ); 162 insert( &systemProcessor->alarms, this ); 163 if( systemProcessor->pending_alarm ) { 164 tick_preemption(); 165 } 194 166 if( first ) { 195 __kernel_set_timer( alarms->head->alarm - __kernel_get_time() );167 __kernel_set_timer( systemProcessor->alarms.head->alarm - __kernel_get_time() ); 196 168 } 197 169 } 198 unlock( & event_kernel->lock );170 unlock( &systemProcessor->alarm_lock ); 199 171 this->set = true; 200 172 enable_interrupts( DEBUG_CTX ); … … 202 174 203 175 void unregister_self( alarm_node_t * this ) { 176 // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Kernel : unregister %p start\n", this ); 204 177 disable_interrupts(); 205 lock( & event_kernel->lock DEBUG_CTX2 );178 lock( &systemProcessor->alarm_lock DEBUG_CTX2 ); 206 179 { 207 verify( validate( & event_kernel->alarms ) );208 remove( & event_kernel->alarms, this );180 verify( validate( &systemProcessor->alarms ) ); 181 remove( &systemProcessor->alarms, this ); 209 182 } 210 unlock( & event_kernel->lock );183 unlock( &systemProcessor->alarm_lock ); 211 184 enable_interrupts( DEBUG_CTX ); 212 185 this->set = false; 186 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Kernel : unregister %p end\n", this ); 213 187 } 214 215 // Local Variables: //216 // mode: c //217 // tab-width: 4 //218 // End: // -
src/libcfa/concurrency/alarm.h
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Fri Jun 2 11:31:25 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:59:27 201713 // Update Count : 312 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef ALARM_H 18 #define ALARM_H 17 19 18 20 #include <stdbool.h> 19 #include <stdint.h>20 21 21 #include <assert.h> 22 #include "assert" 23 24 typedef unsigned long int __cfa_time_t; 22 25 23 26 struct thread_desc; 24 27 struct processor; 25 28 26 struct timespec;27 struct itimerval;28 29 //=============================================================================================30 // time type31 //=============================================================================================32 33 struct __cfa_time_t {34 uint64_t val;35 };36 37 // ctors38 void ?{}( __cfa_time_t * this );39 void ?{}( __cfa_time_t * this, zero_t zero );40 void ?{}( __cfa_time_t * this, timespec * curr );41 void ?{}( itimerval * this, __cfa_time_t * alarm );42 43 __cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs );44 45 // logical ops46 static inline bool ?==?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val == rhs.val; }47 static inline bool ?!=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val != rhs.val; }48 static inline bool ?>? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val > rhs.val; }49 static inline bool ?<? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val < rhs.val; }50 static inline bool ?>=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >= rhs.val; }51 static inline bool ?<=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <= rhs.val; }52 53 static inline bool ?==?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val == rhs; }54 static inline bool ?!=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val != rhs; }55 static inline bool ?>? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val > rhs; }56 static inline bool ?<? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val < rhs; }57 static inline bool ?>=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >= rhs; }58 static inline bool ?<=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <= rhs; }59 60 // addition/substract61 static inline __cfa_time_t ?+?( __cfa_time_t lhs, __cfa_time_t rhs ) {62 __cfa_time_t ret;63 ret.val = lhs.val + rhs.val;64 return ret;65 }66 67 static inline __cfa_time_t ?-?( __cfa_time_t lhs, __cfa_time_t rhs ) {68 __cfa_time_t ret;69 ret.val = lhs.val - rhs.val;70 return ret;71 }72 73 __cfa_time_t from_s ( uint64_t );74 __cfa_time_t from_ms( uint64_t );75 __cfa_time_t from_us( uint64_t );76 __cfa_time_t from_ns( uint64_t );77 78 extern __cfa_time_t zero_time;79 80 29 //============================================================================================= 81 30 // Clock logic 82 31 //============================================================================================= 32 33 #define TIMEGRAN 1_000_000_000L // nanosecond granularity, except for timeval 83 34 84 35 __cfa_time_t __kernel_get_time(); … … 105 56 typedef alarm_node_t ** __alarm_it_t; 106 57 107 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time);108 void ?{}( alarm_node_t * this, processor * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time);58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ); 59 void ?{}( alarm_node_t * this, processor * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 ); 109 60 void ^?{}( alarm_node_t * this ); 110 61 … … 125 76 void unregister_self( alarm_node_t * this ); 126 77 78 #endif 79 127 80 // Local Variables: // 128 // mode: c//81 // mode: CFA // 129 82 // tab-width: 6 // 130 83 // End: // -
src/libcfa/concurrency/coroutine
r33218c6 re0a653d 10 10 // Author : Thierry Delisle 11 11 // Created On : Mon Nov 28 12:27:26 2016 12 // Last Modified By : Peter A. Buhr13 // Last Modified On : Sat Jul 22 09:57:17 201714 // Update Count : 212 // Last Modified By : Thierry Delisle 13 // Last Modified On : Mon Nov 28 12:27:26 2016 14 // Update Count : 0 15 15 // 16 16 17 #pragma once 17 #ifndef COROUTINES_H 18 #define COROUTINES_H 18 19 19 #include <assert.h>20 #include "assert" 20 21 #include "invoke.h" 21 22 … … 62 63 63 64 // Get current coroutine 64 extern thread_local coroutine_desc * volatilethis_coroutine;65 extern volatile thread_local coroutine_desc * this_coroutine; 65 66 66 67 // Private wrappers for context switch and stack creation … … 128 129 } 129 130 131 #endif //COROUTINES_H 132 130 133 // Local Variables: // 131 134 // mode: c // -
src/libcfa/concurrency/coroutine.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:34:57 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : Mon Nov 28 12:27:26 2016 14 // Update Count : 0 14 15 // 15 16 … … 25 26 } 26 27 27 #include "kernel_private.h" 28 #include "kernel" 29 #include "libhdr.h" 28 30 29 31 #define __CFA_INVOKE_PRIVATE__ 30 32 #include "invoke.h" 31 33 34 extern volatile thread_local processor * this_processor; 32 35 33 36 //----------------------------------------------------------------------------- -
src/libcfa/concurrency/invoke.c
r33218c6 re0a653d 1 // -*- Mode: C -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Jan 17 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:28:33 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 141 142 #endif 142 143 } 143 144 // Local Variables: //145 // mode: c //146 // tab-width: 4 //147 // End: // -
src/libcfa/concurrency/invoke.h
r33218c6 re0a653d 1 // -*- Mode: C -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Jan 17 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:28:56 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 129 130 } 130 131 #endif 131 132 // Local Variables: //133 // mode: c //134 // tab-width: 4 //135 // End: // -
src/libcfa/concurrency/kernel
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Jan 17 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:58:39 201713 // Update Count : 212 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef KERNEL_H 18 #define KERNEL_H 17 19 18 20 #include <stdbool.h> … … 26 28 //----------------------------------------------------------------------------- 27 29 // Locks 28 void lock ( spinlock * DEBUG_CTX_PARAM2 ); // Lock the spinlock, spin if already acquired 29 void lock _yield( spinlock * DEBUG_CTX_PARAM2 ); // Lock the spinlock, yield repeatedly if already acquired30 bool try_lock ( spinlock * DEBUG_CTX_PARAM2 ); // Lock the spinlock, return false if already acquired 31 void unlock ( spinlock * ); // Unlock the spinlock30 bool try_lock ( spinlock * DEBUG_CTX_PARAM2 ); 31 void lock ( spinlock * DEBUG_CTX_PARAM2 ); 32 void lock_yield( spinlock * DEBUG_CTX_PARAM2 ); 33 void unlock ( spinlock * ); 32 34 33 35 struct semaphore { … … 46 48 // Cluster 47 49 struct cluster { 48 spinlock ready_queue_lock; // Ready queue locks 49 __thread_queue_t ready_queue; // Ready queue for threads 50 unsigned long long int preemption; // Preemption rate on this cluster 50 __thread_queue_t ready_queue; 51 spinlock lock; 51 52 }; 52 53 … … 75 76 static inline void ^?{}(FinishAction * this) {} 76 77 77 // Processor78 // Wrapper around kernel threads79 78 struct processor { 80 // Main state 81 struct processorCtx_t * runner; // Coroutine ctx who does keeps the state of the processor 82 cluster * cltr; // Cluster from which to get threads 83 pthread_t kernel_thread; // Handle to pthreads 79 struct processorCtx_t * runner; 80 cluster * cltr; 81 pthread_t kernel_thread; 84 82 85 // Termination 86 volatile bool do_terminate; // Set to true to notify the processor should terminate 87 semaphore terminated; // Termination synchronisation 83 semaphore terminated; 84 volatile bool is_terminated; 88 85 89 // RunThread data 90 struct FinishAction finish; // Action to do after a thread is ran 86 struct FinishAction finish; 91 87 92 // Preemption data 93 struct alarm_node_t * preemption_alarm; // Node which is added in the discrete event simulaiton 94 bool pending_preemption; // If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible 88 struct alarm_node_t * preemption_alarm; 89 unsigned int preemption; 95 90 96 #ifdef __CFA_DEBUG__ 97 char * last_enable; // Last function to enable preemption on this processor 98 #endif 91 bool pending_preemption; 92 93 char * last_enable; 99 94 }; 100 95 … … 103 98 void ^?{}(processor * this); 104 99 100 #endif //KERNEL_H 101 105 102 // Local Variables: // 106 // mode: c//107 // tab-width: 4//103 // mode: CFA // 104 // tab-width: 6 // 108 105 // End: // -
src/libcfa/concurrency/kernel.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Jan 17 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:33:18 201713 // Update Count : 212 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 41 42 //----------------------------------------------------------------------------- 42 43 // Kernel storage 43 KERNEL_STORAGE(cluster, mainCluster); 44 KERNEL_STORAGE(processor, mainProcessor); 45 KERNEL_STORAGE(processorCtx_t, mainProcessorCtx); 46 KERNEL_STORAGE(thread_desc, mainThread); 44 #define KERNEL_STORAGE(T,X) static char X##Storage[sizeof(T)] 45 46 KERNEL_STORAGE(processorCtx_t, systemProcessorCtx); 47 KERNEL_STORAGE(cluster, systemCluster); 48 KERNEL_STORAGE(system_proc_t, systemProcessor); 49 KERNEL_STORAGE(thread_desc, mainThread); 47 50 KERNEL_STORAGE(machine_context_t, mainThreadCtx); 48 51 49 cluster * mainCluster;50 processor * mainProcessor;52 cluster * systemCluster; 53 system_proc_t * systemProcessor; 51 54 thread_desc * mainThread; 52 55 … … 54 57 // Global state 55 58 56 thread_local coroutine_desc * volatile this_coroutine; 57 thread_local thread_desc * volatile this_thread; 58 thread_local processor * volatile this_processor; 59 60 volatile thread_local bool preemption_in_progress = 0; 59 volatile thread_local processor * this_processor; 60 volatile thread_local coroutine_desc * this_coroutine; 61 volatile thread_local thread_desc * this_thread; 61 62 volatile thread_local unsigned short disable_preempt_count = 1; 62 63 … … 83 84 84 85 this->limit = (void *)(((intptr_t)this->base) - this->size); 85 this->context = & storage_mainThreadCtx;86 this->context = &mainThreadCtxStorage; 86 87 this->top = this->base; 87 88 } … … 123 124 124 125 void ?{}(processor * this) { 125 this{ mainCluster };126 this{ systemCluster }; 126 127 } 127 128 … … 129 130 this->cltr = cltr; 130 131 (&this->terminated){ 0 }; 131 this-> do_terminate= false;132 this->is_terminated = false; 132 133 this->preemption_alarm = NULL; 134 this->preemption = default_preemption(); 133 135 this->pending_preemption = false; 134 136 … … 139 141 this->cltr = cltr; 140 142 (&this->terminated){ 0 }; 141 this-> do_terminate= false;143 this->is_terminated = false; 142 144 this->preemption_alarm = NULL; 145 this->preemption = default_preemption(); 143 146 this->pending_preemption = false; 144 147 this->kernel_thread = pthread_self(); 145 148 146 149 this->runner = runner; 147 LIB_DEBUG_PRINT_SAFE("Kernel : constructing mainprocessor context %p\n", runner);150 LIB_DEBUG_PRINT_SAFE("Kernel : constructing system processor context %p\n", runner); 148 151 runner{ this }; 149 152 } 150 153 154 LIB_DEBUG_DO( bool validate( alarm_list_t * this ); ) 155 156 void ?{}(system_proc_t * this, cluster * cltr, processorCtx_t * runner) { 157 (&this->alarms){}; 158 (&this->alarm_lock){}; 159 this->pending_alarm = false; 160 161 (&this->proc){ cltr, runner }; 162 163 verify( validate( &this->alarms ) ); 164 } 165 151 166 void ^?{}(processor * this) { 152 if( ! this-> do_terminate) {167 if( ! this->is_terminated ) { 153 168 LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", this); 154 this-> do_terminate= true;169 this->is_terminated = true; 155 170 P( &this->terminated ); 156 171 pthread_join( this->kernel_thread, NULL ); … … 160 175 void ?{}(cluster * this) { 161 176 ( &this->ready_queue ){}; 162 ( &this->ready_queue_lock ){}; 163 164 this->preemption = default_preemption(); 177 ( &this->lock ){}; 165 178 } 166 179 … … 185 198 186 199 thread_desc * readyThread = NULL; 187 for( unsigned int spin_count = 0; ! this-> do_terminate; spin_count++ )200 for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ ) 188 201 { 189 202 readyThread = nextThread( this->cltr ); … … 329 342 verifyf( thrd->next == NULL, "Expected null got %p", thrd->next ); 330 343 331 lock( &this_processor->cltr->ready_queue_lock DEBUG_CTX2 );332 append( & this_processor->cltr->ready_queue, thrd );333 unlock( & this_processor->cltr->ready_queue_lock );344 lock( &systemProcessor->proc.cltr->lock DEBUG_CTX2 ); 345 append( &systemProcessor->proc.cltr->ready_queue, thrd ); 346 unlock( &systemProcessor->proc.cltr->lock ); 334 347 335 348 verify( disable_preempt_count > 0 ); … … 338 351 thread_desc * nextThread(cluster * this) { 339 352 verify( disable_preempt_count > 0 ); 340 lock( &this-> ready_queue_lock DEBUG_CTX2 );353 lock( &this->lock DEBUG_CTX2 ); 341 354 thread_desc * head = pop_head( &this->ready_queue ); 342 unlock( &this-> ready_queue_lock );355 unlock( &this->lock ); 343 356 verify( disable_preempt_count > 0 ); 344 357 return head; … … 438 451 // Start by initializing the main thread 439 452 // SKULLDUGGERY: the mainThread steals the process main thread 440 // which will then be scheduled by the mainProcessor normally441 mainThread = (thread_desc *)& storage_mainThread;453 // which will then be scheduled by the systemProcessor normally 454 mainThread = (thread_desc *)&mainThreadStorage; 442 455 current_stack_info_t info; 443 456 mainThread{ &info }; … … 445 458 LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n"); 446 459 447 // Initialize the maincluster448 mainCluster = (cluster *)&storage_mainCluster;449 mainCluster{};450 451 LIB_DEBUG_PRINT_SAFE("Kernel : maincluster ready\n");452 453 // Initialize the main processor and the mainprocessor ctx460 // Initialize the system cluster 461 systemCluster = (cluster *)&systemClusterStorage; 462 systemCluster{}; 463 464 LIB_DEBUG_PRINT_SAFE("Kernel : System cluster ready\n"); 465 466 // Initialize the system processor and the system processor ctx 454 467 // (the coroutine that contains the processing control flow) 455 mainProcessor = (processor *)&storage_mainProcessor; 456 mainProcessor{ mainCluster, (processorCtx_t *)&storage_mainProcessorCtx }; 468 systemProcessor = (system_proc_t *)&systemProcessorStorage; 469 systemProcessor{ systemCluster, (processorCtx_t *)&systemProcessorCtxStorage }; 470 471 // Add the main thread to the ready queue 472 // once resume is called on systemProcessor->runner the mainThread needs to be scheduled like any normal thread 473 ScheduleThread(mainThread); 457 474 458 475 //initialize the global state variables 459 this_processor = mainProcessor;476 this_processor = &systemProcessor->proc; 460 477 this_thread = mainThread; 461 478 this_coroutine = &mainThread->cor; 479 disable_preempt_count = 1; 462 480 463 481 // Enable preemption 464 482 kernel_start_preemption(); 465 483 466 // Add the main thread to the ready queue 467 // once resume is called on mainProcessor->runner the mainThread needs to be scheduled like any normal thread 468 ScheduleThread(mainThread); 469 470 // SKULLDUGGERY: Force a context switch to the main processor to set the main thread's context to the current UNIX 484 // SKULLDUGGERY: Force a context switch to the system processor to set the main thread's context to the current UNIX 471 485 // context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that 472 486 // mainThread is on the ready queue when this call is made. 473 resume( mainProcessor->runner );487 resume( systemProcessor->proc.runner ); 474 488 475 489 … … 486 500 disable_interrupts(); 487 501 488 // SKULLDUGGERY: Notify the mainProcessor it needs to terminates.502 // SKULLDUGGERY: Notify the systemProcessor it needs to terminates. 489 503 // When its coroutine terminates, it return control to the mainThread 490 504 // which is currently here 491 mainProcessor->do_terminate= true;505 systemProcessor->proc.is_terminated = true; 492 506 suspend(); 493 507 … … 497 511 kernel_stop_preemption(); 498 512 499 // Destroy the mainprocessor and its context in reverse order of construction513 // Destroy the system processor and its context in reverse order of construction 500 514 // These were manually constructed so we need manually destroy them 501 ^( mainProcessor->runner){};502 ^( mainProcessor){};515 ^(systemProcessor->proc.runner){}; 516 ^(systemProcessor){}; 503 517 504 518 // Final step, destroy the main thread since it is no longer needed … … 684 698 return top; 685 699 } 686 687 700 // Local Variables: // 688 701 // mode: c // -
src/libcfa/concurrency/kernel_private.h
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Mon Feb 13 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:58:09 201713 // Update Count : 212 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef KERNEL_PRIVATE_H 18 #define KERNEL_PRIVATE_H 17 19 18 20 #include "libhdr.h" … … 29 31 extern "C" { 30 32 void disable_interrupts(); 31 void enable_interrupts_no Poll();33 void enable_interrupts_noRF(); 32 34 void enable_interrupts( DEBUG_CTX_PARAM ); 33 35 } … … 43 45 thread_desc * nextThread(cluster * this); 44 46 45 //Block current thread and release/wake-up the following resources46 47 void BlockInternal(void); 47 48 void BlockInternal(spinlock * lock); … … 64 65 void spin(processor * this, unsigned int * spin_count); 65 66 66 struct event_kernel_t { 67 struct system_proc_t { 68 processor proc; 69 67 70 alarm_list_t alarms; 68 spinlock lock; 71 spinlock alarm_lock; 72 73 bool pending_alarm; 69 74 }; 70 75 71 extern event_kernel_t * event_kernel; 72 73 extern thread_local coroutine_desc * volatile this_coroutine; 74 extern thread_local thread_desc * volatile this_thread; 75 extern thread_local processor * volatile this_processor; 76 77 extern volatile thread_local bool preemption_in_progress; 76 extern cluster * systemCluster; 77 extern system_proc_t * systemProcessor; 78 extern volatile thread_local processor * this_processor; 79 extern volatile thread_local coroutine_desc * this_coroutine; 80 extern volatile thread_local thread_desc * this_thread; 78 81 extern volatile thread_local unsigned short disable_preempt_count; 79 82 … … 87 90 extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst); 88 91 89 //----------------------------------------------------------------------------- 90 // Utils 91 #define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)] 92 #endif //KERNEL_PRIVATE_H 92 93 93 94 // Local Variables: // -
src/libcfa/concurrency/monitor
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Thd Feb 23 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:59:01 201713 // Update Count : 312 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef MONITOR_H 18 #define MONITOR_H 17 19 18 20 #include <stddef.h> 19 21 20 #include <assert.h>22 #include "assert" 21 23 #include "invoke.h" 22 24 #include "stdlib" … … 97 99 void __accept_internal( unsigned short count, __acceptable_t * acceptables, void (*func)(void) ); 98 100 99 // Local Variables: // 100 // mode: c // 101 // tab-width: 4 // 102 // End: // 101 #endif //MONITOR_H -
src/libcfa/concurrency/monitor.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Thd Feb 23 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:37:11 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 527 528 return head; 528 529 } 529 530 // Local Variables: //531 // mode: c //532 // tab-width: 4 //533 // End: // -
src/libcfa/concurrency/preemption.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Mon Jun 5 14:20:42 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:36:05 201713 // Update Count : 212 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 33 34 #endif 34 35 35 //TODO move to defaults36 36 #define __CFA_DEFAULT_PREEMPTION__ 10000 37 37 38 //TODO move to defaults39 38 __attribute__((weak)) unsigned int default_preemption() { 40 39 return __CFA_DEFAULT_PREEMPTION__; 41 40 } 42 41 43 // Short hands for signal context information44 42 #define __CFA_SIGCXT__ ucontext_t * 45 43 #define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt 46 44 47 // FwdDeclarations : timeout handlers48 45 static void preempt( processor * this ); 49 46 static void timeout( thread_desc * this ); 50 47 51 // FwdDeclarations : Signal handlers52 48 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ); 49 void sigHandler_alarm ( __CFA_SIGPARMS__ ); 53 50 void sigHandler_segv ( __CFA_SIGPARMS__ ); 54 51 void sigHandler_abort ( __CFA_SIGPARMS__ ); 55 52 56 // FwdDeclarations : sigaction wrapper57 53 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ); 58 59 // FwdDeclarations : alarm thread main 60 void * alarm_loop( __attribute__((unused)) void * args ); 61 62 // Machine specific register name 54 LIB_DEBUG_DO( bool validate( alarm_list_t * this ); ) 55 63 56 #ifdef __x86_64__ 64 57 #define CFA_REG_IP REG_RIP … … 67 60 #endif 68 61 69 KERNEL_STORAGE(event_kernel_t, event_kernel); // private storage for event kernel70 event_kernel_t * event_kernel; // kernel public handle to even kernel71 static pthread_t alarm_thread; // pthread handle to alarm thread72 73 void ?{}(event_kernel_t * this) {74 (&this->alarms){};75 (&this->lock){};76 }77 62 78 63 //============================================================================================= … … 80 65 //============================================================================================= 81 66 82 // Get next expired node83 static inline alarm_node_t * get_expired( alarm_list_t * alarms, __cfa_time_t currtime ) {84 if( !alarms->head ) return NULL; // If no alarms return null85 if( alarms->head->alarm >= currtime ) return NULL; // If alarms head not expired return null86 return pop(alarms); // Otherwise just pop head87 }88 89 // Tick one frame of the Discrete Event Simulation for alarms90 67 void tick_preemption() { 91 alarm_node_t * node = NULL; // Used in the while loop but cannot be declared in the while condition92 alarm_list_t * alarms = &event_kernel->alarms; // Local copy for ease of reading 93 __cfa_time_t currtime = __kernel_get_time(); // Check current time once so we everything "happens at once"94 95 //Loop throught every thing expired96 while( node = get_expired( alarms, currtime ) ) {97 98 // Check if this is a kernel 68 // LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Ticking preemption\n" ); 69 70 alarm_list_t * alarms = &systemProcessor->alarms; 71 __cfa_time_t currtime = __kernel_get_time(); 72 while( alarms->head && alarms->head->alarm < currtime ) { 73 alarm_node_t * node = pop(alarms); 74 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ticking %p\n", node ); 75 99 76 if( node->kernel_alarm ) { 100 77 preempt( node->proc ); … … 104 81 } 105 82 106 // Check if this is a periodic alarm107 __cfa_time_t period = node->period; 108 if( period > 0 ) {109 node->alarm = currtime + period; // Alarm is periodic, add currtime to it (used cached current time)110 insert( alarms, node ); // Reinsert the node for the next time it triggers83 verify( validate( alarms ) ); 84 85 if( node->period > 0 ) { 86 node->alarm = currtime + node->period; 87 insert( alarms, node ); 111 88 } 112 89 else { 113 node->set = false; // Node is one-shot, just mark it as not pending 114 } 115 } 116 117 // If there are still alarms pending, reset the timer 118 if( alarms->head ) { __kernel_set_timer( alarms->head->alarm - currtime ); } 119 } 120 121 // Update the preemption of a processor and notify interested parties 90 node->set = false; 91 } 92 } 93 94 if( alarms->head ) { 95 __kernel_set_timer( alarms->head->alarm - currtime ); 96 } 97 98 verify( validate( alarms ) ); 99 // LIB_DEBUG_PRINT_BUFFER_LOCAL( STDERR_FILENO, "Ticking preemption done\n" ); 100 } 101 122 102 void update_preemption( processor * this, __cfa_time_t duration ) { 103 LIB_DEBUG_PRINT_BUFFER_DECL( STDERR_FILENO, "Processor : %p updating preemption to %lu\n", this, duration ); 104 123 105 alarm_node_t * alarm = this->preemption_alarm; 106 duration *= 1000; 124 107 125 108 // Alarms need to be enabled … … 151 134 152 135 extern "C" { 153 // Disable interrupts by incrementing the counter154 136 void disable_interrupts() { 155 137 __attribute__((unused)) unsigned short new_val = __atomic_add_fetch_2( &disable_preempt_count, 1, __ATOMIC_SEQ_CST ); 156 verify( new_val < 65_000u ); // If this triggers someone is disabling interrupts without enabling them 157 } 158 159 // Enable interrupts by decrementing the counter 160 // If counter reaches 0, execute any pending CtxSwitch 138 verify( new_val < (unsigned short)65_000 ); 139 verify( new_val != (unsigned short) 0 ); 140 } 141 142 void enable_interrupts_noRF() { 143 __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST ); 144 verify( prev != (unsigned short) 0 ); 145 } 146 161 147 void enable_interrupts( DEBUG_CTX_PARAM ) { 162 processor * proc = this_processor; // Cache the processor now since interrupts can start happening after the atomic add 163 thread_desc * thrd = this_thread; // Cache the thread now since interrupts can start happening after the atomic add 164 148 processor * proc = this_processor; 149 thread_desc * thrd = this_thread; 165 150 unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST ); 166 verify( prev != 0u ); // If this triggers someone is enabled already enabled interruptsverify( prev != 0u ); 167 168 // Check if we need to prempt the thread because an interrupt was missed 151 verify( prev != (unsigned short) 0 ); 169 152 if( prev == 1 && proc->pending_preemption ) { 170 153 proc->pending_preemption = false; … … 172 155 } 173 156 174 // For debugging purposes : keep track of the last person to enable the interrupts175 157 LIB_DEBUG_DO( proc->last_enable = caller; ) 176 158 } 177 178 // Disable interrupts by incrementint the counter 179 // Don't execute any pending CtxSwitch even if counter reaches 0 180 void enable_interrupts_noPoll() { 181 __attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST ); 182 verify( prev != 0u ); // If this triggers someone is enabled already enabled interrupts 183 } 184 } 185 186 // sigprocmask wrapper : unblock a single signal 159 } 160 187 161 static inline void signal_unblock( int sig ) { 188 162 sigset_t mask; … … 195 169 } 196 170 197 // sigprocmask wrapper : block a single signal198 171 static inline void signal_block( int sig ) { 199 172 sigset_t mask; … … 206 179 } 207 180 208 // kill wrapper : signal a processor 181 static inline bool preemption_ready() { 182 return disable_preempt_count == 0; 183 } 184 185 static inline void defer_ctxSwitch() { 186 this_processor->pending_preemption = true; 187 } 188 189 static inline void defer_alarm() { 190 systemProcessor->pending_alarm = true; 191 } 192 209 193 static void preempt( processor * this ) { 210 194 pthread_kill( this->kernel_thread, SIGUSR1 ); 211 195 } 212 196 213 // reserved for future use214 197 static void timeout( thread_desc * this ) { 215 198 //TODO : implement waking threads 216 199 } 217 200 218 219 // Check if a CtxSwitch signal handler shoud defer220 // If true : preemption is safe221 // If false : preemption is unsafe and marked as pending222 static inline bool preemption_ready() {223 bool ready = disable_preempt_count == 0 && !preemption_in_progress; // Check if preemption is safe224 this_processor->pending_preemption = !ready; // Adjust the pending flag accordingly225 return ready;226 }227 228 201 //============================================================================================= 229 202 // Kernel Signal Startup/Shutdown logic 230 203 //============================================================================================= 231 204 232 // Startup routine to activate preemption 233 // Called from kernel_startup 205 static pthread_t alarm_thread; 206 void * alarm_loop( __attribute__((unused)) void * args ); 207 234 208 void kernel_start_preemption() { 235 209 LIB_DEBUG_PRINT_SAFE("Kernel : Starting preemption\n"); 236 237 // Start with preemption disabled until ready 238 disable_preempt_count = 1; 239 240 // Initialize the event kernel 241 event_kernel = (event_kernel_t *)&storage_event_kernel; 242 event_kernel{}; 243 244 // Setup proper signal handlers 245 __kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO ); // CtxSwitch handler 246 // __kernel_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO ); // Failure handler 247 // __kernel_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO ); // Failure handler 210 __kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO ); 211 // __kernel_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO ); 212 // __kernel_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO ); 248 213 249 214 signal_block( SIGALRM ); … … 252 217 } 253 218 254 // Shutdown routine to deactivate preemption255 // Called from kernel_shutdown256 219 void kernel_stop_preemption() { 257 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopping\n");258 259 // Block all signals since we are already shutting down260 220 sigset_t mask; 261 221 sigfillset( &mask ); 262 222 sigprocmask( SIG_BLOCK, &mask, NULL ); 263 223 264 // Notify the alarm thread of the shutdown 265 sigval val = { 1 }; 266 pthread_sigqueue( alarm_thread, SIGALRM, val ); 267 268 // Wait for the preemption thread to finish 224 pthread_kill( alarm_thread, SIGINT ); 269 225 pthread_join( alarm_thread, NULL ); 270 271 // Preemption is now fully stopped272 273 226 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopped\n"); 274 227 } 275 228 276 // Raii ctor/dtor for the preemption_scope277 // Used by thread to control when they want to receive preemption signals278 229 void ?{}( preemption_scope * this, processor * proc ) { 279 (&this->alarm){ proc , zero_time, zero_time};230 (&this->alarm){ proc }; 280 231 this->proc = proc; 281 232 this->proc->preemption_alarm = &this->alarm; 282 283 update_preemption( this->proc, from_us(this->proc->cltr->preemption) ); 233 update_preemption( this->proc, this->proc->preemption ); 284 234 } 285 235 … … 287 237 disable_interrupts(); 288 238 289 update_preemption( this->proc, zero_time);239 update_preemption( this->proc, 0 ); 290 240 } 291 241 … … 294 244 //============================================================================================= 295 245 296 // Context switch signal handler297 // Receives SIGUSR1 signal and causes the current thread to yield298 246 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) { 299 247 LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); ) 300 301 // Check if it is safe to preempt here 302 if( !preemption_ready() ) { return; } 303 304 preemption_in_progress = true; // Sync flag : prevent recursive calls to the signal handler 305 signal_unblock( SIGUSR1 ); // We are about to CtxSwitch out of the signal handler, let other handlers in 306 preemption_in_progress = false; // Clear the in progress flag 307 308 // Preemption can occur here 309 310 BlockInternal( (thread_desc*)this_thread ); // Do the actual CtxSwitch 311 } 312 313 // Main of the alarm thread 314 // Waits on SIGALRM and send SIGUSR1 to whom ever needs it 248 if( preemption_ready() ) { 249 signal_unblock( SIGUSR1 ); 250 BlockInternal( (thread_desc*)this_thread ); 251 } 252 else { 253 defer_ctxSwitch(); 254 } 255 } 256 257 // void sigHandler_alarm( __CFA_SIGPARMS__ ) { 258 // LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); ) 259 // verify( this_processor == systemProcessor ); 260 261 // if( try_lock( &systemProcessor->alarm_lock DEBUG_CTX2 ) ) { 262 // tick_preemption(); 263 // systemProcessor->pending_alarm = false; 264 // unlock( &systemProcessor->alarm_lock ); 265 // } 266 // else { 267 // defer_alarm(); 268 // } 269 270 // signal_unblock( SIGALRM ); 271 272 // if( preemption_ready() && this_processor->pending_preemption ) { 273 274 // this_processor->pending_preemption = false; 275 // BlockInternal( (thread_desc*)this_thread ); 276 // } 277 // } 278 315 279 void * alarm_loop( __attribute__((unused)) void * args ) { 316 // Block sigalrms to control when they arrive317 280 sigset_t mask; 318 281 sigemptyset( &mask ); 319 282 sigaddset( &mask, SIGALRM ); 283 sigaddset( &mask, SIGUSR2 ); 284 sigaddset( &mask, SIGINT ); 320 285 321 286 if ( pthread_sigmask( SIG_BLOCK, &mask, NULL ) == -1 ) { … … 323 288 } 324 289 325 // Main loop326 290 while( true ) { 327 // Wait for a sigalrm 328 siginfo_t info; 329 int sig = sigwaitinfo( &mask, &info ); 330 331 // If another signal arrived something went wrong 332 assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int); 333 334 LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int ); 335 // Switch on the code (a.k.a. the sender) to 336 switch( info.si_code ) 337 { 338 // Timers can apparently be marked as sent for the kernel 339 // In either case, tick preemption 340 case SI_TIMER: 341 case SI_KERNEL: 342 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n"); 343 lock( &event_kernel->lock DEBUG_CTX2 ); 344 tick_preemption(); 345 unlock( &event_kernel->lock ); 346 break; 347 // Signal was not sent by the kernel but by an other thread 348 case SI_QUEUE: 349 // For now, other thread only signal the alarm thread to shut it down 350 // If this needs to change use info.si_value and handle the case here 351 goto EXIT; 352 } 353 } 354 355 EXIT: 356 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n"); 357 return NULL; 358 } 359 360 // Sigaction wrapper : register an signal handler 291 int sig; 292 if( sigwait( &mask, &sig ) != 0 ) { 293 abortf( "internal error, sigwait" ); 294 } 295 296 switch( sig) { 297 case SIGALRM: 298 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n"); 299 lock( &systemProcessor->alarm_lock DEBUG_CTX2 ); 300 tick_preemption(); 301 unlock( &systemProcessor->alarm_lock ); 302 break; 303 case SIGUSR2: 304 //TODO other actions 305 break; 306 case SIGINT: 307 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n"); 308 return NULL; 309 default: 310 abortf( "internal error, sigwait returned sig %d", sig ); 311 break; 312 } 313 } 314 } 315 361 316 static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) { 362 317 struct sigaction act; … … 374 329 } 375 330 376 // Sigaction wrapper : restore default handler 331 typedef void (*sa_handler_t)(int); 332 377 333 static void __kernel_sigdefault( int sig ) { 378 334 struct sigaction act; 379 335 380 act.sa_handler = SIG_DFL;336 // act.sa_handler = SIG_DFL; 381 337 act.sa_flags = 0; 382 338 sigemptyset( &act.sa_mask ); … … 486 442 // raise( SIGABRT ); 487 443 // } 488 489 // Local Variables: //490 // mode: c //491 // tab-width: 4 //492 // End: // -
src/libcfa/concurrency/preemption.h
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Mon Jun 5 14:20:42 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:34:25 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef PREEMPTION_H 18 #define PREEMPTION_H 17 19 18 20 #include "alarm.h" … … 33 35 void ^?{}( preemption_scope * this ); 34 36 35 // Local Variables: // 36 // mode: c // 37 // tab-width: 4 // 38 // End: // 37 #endif //PREEMPTION_H -
src/libcfa/concurrency/thread
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Jan 17 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:59:40 201713 // Update Count : 312 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef THREADS_H 18 #define THREADS_H 17 19 18 #include <assert.h>20 #include "assert" 19 21 #include "invoke.h" 20 22 … … 52 54 } 53 55 54 extern thread_local thread_desc * volatilethis_thread;56 extern volatile thread_local thread_desc * this_thread; 55 57 56 58 forall( dtype T | is_thread(T) ) … … 82 84 void yield( unsigned times ); 83 85 86 #endif //THREADS_H 87 84 88 // Local Variables: // 85 89 // mode: c // -
src/libcfa/concurrency/thread.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Tue Jan 17 12:27:26 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:34:46 201713 // Update Count : 112 // Last Modified By : Thierry Delisle 13 // Last Modified On : -- 14 // Update Count : 0 14 15 // 15 16 … … 86 87 87 88 void yield( void ) { 88 BlockInternal( this_thread );89 BlockInternal( (thread_desc *)this_thread ); 89 90 } 90 91 -
src/libcfa/containers/maybe
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Wed May 24 14:43:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:00:52201713 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 16 15:42:00 2017 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 17 #ifndef MAYBE_H 18 #define MAYBE_H 17 19 18 20 #include <stdbool.h> … … 64 66 void set_none(maybe(T) * this); 65 67 66 // Local Variables: // 67 // mode: c // 68 // tab-width: 4 // 69 // End: // 68 #endif // MAYBE_H -
src/libcfa/containers/maybe.c
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Wed May 24 15:40:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Th u Jul 20 15:23:50 201713 // Update Count : 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr May 25 15:24:00 2017 13 // Update Count : 1 14 14 // 15 15 16 16 #include <containers/maybe> 17 #include <assert .h>17 #include <assert> 18 18 19 19 -
src/libcfa/containers/pair
r33218c6 re0a653d 9 9 // Author : Aaron Moss 10 10 // Created On : Wed Apr 12 15:32:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:59:53201713 // Update Count : 211 // Last Modified By : Aaron Moss 12 // Last Modified On : Wed Apr 12 15:32:00 2017 13 // Update Count : 1 14 14 // 15 15 16 #pragma once 16 #ifndef PAIR_H 17 #define PAIR_H 17 18 18 19 forall(otype R, otype S) struct pair { … … 43 44 int ?>=?(pair(R, S) p, pair(R, S) q); 44 45 46 #endif // PAIR_H 47 45 48 // Local Variables: // 46 49 // mode: c // -
src/libcfa/containers/result
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Wed May 24 14:45:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:00:44201713 // Update Count : 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 16 15:41:00 2017 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 17 #ifndef RESULT_H 18 #define RESULT_H 17 19 18 20 #include <stdbool.h> … … 76 78 void set_error(result(T, E) * this, E error); 77 79 78 // Local Variables: // 79 // mode: c // 80 // tab-width: 4 // 81 // End: // 80 #endif // RESULT_H -
src/libcfa/containers/result.c
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Wed May 24 15:40:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Th u Jul 20 15:23:58201713 // Update Count : 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr May 25 15:27:00 2017 13 // Update Count : 1 14 14 // 15 15 16 16 #include <containers/result> 17 #include <assert .h>17 #include <assert> 18 18 19 19 -
src/libcfa/containers/vector
r33218c6 re0a653d 10 10 // Created On : Tue Jul 5 18:00:07 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 10:01:18 201713 // Update Count : 312 // Last Modified On : Tue Jul 5 18:01:35 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef VECTOR_H 17 #define VECTOR_H 17 18 18 19 extern "C" { … … 165 166 // } 166 167 168 #endif // VECTOR_H 169 167 170 // Local Variables: // 168 171 // mode: c // -
src/libcfa/exception.h
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jun 26 15:11:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:57:02201713 // Update Count : 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 11 16:31:00 2017 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef EXCEPTION_H 17 #define EXCEPTION_H 18 17 19 18 20 // Later to be a special structure type. … … 53 55 } 54 56 #endif 57 58 #endif //EXCEPTION_H -
src/libcfa/fstream.c
r33218c6 re0a653d 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 20 15:20:49201713 // Update Count : 25 212 // Last Modified On : Thu Jul 6 18:38:25 2017 13 // Update Count : 251 14 14 // 15 15 16 16 #include "fstream" 17 17 18 extern "C" { 18 19 #include <stdio.h> // vfprintf, vfscanf 19 20 #include <stdlib.h> // exit … … 23 24 #include <float.h> // DBL_DIG, LDBL_DIG 24 25 #include <complex.h> // creal, cimag 25 #include <assert.h> 26 } 27 #include "assert" 26 28 27 29 #define IO_MSG "I/O error: " -
src/libcfa/interpose.c
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Wed Mar 29 16:10:31 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:27:33 201713 // Update Count : 112 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 0 14 15 // 15 16 … … 140 141 } 141 142 } 142 143 // Local Variables: //144 // mode: c //145 // tab-width: 4 //146 // End: // -
src/libcfa/interpose.h
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Wed Mar 29 15:56:41 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 22:33:02 201713 // Update Count : 212 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef INTERPOSE_H 18 #define INTERPOSE_H 17 19 18 20 void * interpose_symbol( const char* symbol, , const char *version ); … … 21 23 extern __typeof__( exit ) libc_abort __attribute__(( noreturn )); 22 24 23 // Local Variables: // 24 // mode: c // 25 // tab-width: 4 // 26 // End: // 25 #endif //INTERPOSE_H -
src/libcfa/iostream.c
r33218c6 re0a653d 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 16 21:12:03201713 // Update Count : 39 812 // Last Modified On : Thu Jul 6 18:14:17 2017 13 // Update Count : 396 14 14 // 15 15 … … 125 125 forall( dtype ostype | ostream( ostype ) ) 126 126 ostype * ?|?( ostype * os, float _Complex fc ) { 127 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 128 fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) ); 127 os | crealf( fc ); 128 _Bool temp = sepDisable( os ); // disable separators within complex value 129 if ( cimagf( fc ) >= 0 ) os | '+'; // negative value prints '-' 130 os | cimagf( fc ) | 'i'; 131 sepReset( os, temp ); // reset separator 129 132 return os; 130 133 } // ?|? … … 132 135 forall( dtype ostype | ostream( ostype ) ) 133 136 ostype * ?|?( ostype * os, double _Complex dc ) { 134 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 135 fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) ); 137 os | creal( dc ); 138 _Bool temp = sepDisable( os ); // disable separators within complex value 139 if ( cimag( dc ) >= 0 ) os | '+'; // negative value prints '-' 140 os | cimag( dc ) | 'i'; 141 sepReset( os, temp ); // reset separator 136 142 return os; 137 143 } // ?|? … … 139 145 forall( dtype ostype | ostream( ostype ) ) 140 146 ostype * ?|?( ostype * os, long double _Complex ldc ) { 141 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 142 fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) ); 147 os | creall( ldc ); 148 _Bool temp = sepDisable( os ); // disable separators within complex value 149 if ( cimagl( ldc ) >= 0 ) os | '+'; // negative value prints '-' 150 os | cimagl( ldc ) | 'i'; 151 sepReset( os, temp ); // reset separator 143 152 return os; 144 153 } // ?|? -
src/libcfa/libhdr.h
r33218c6 re0a653d 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:56:32 201713 // Update Count : 111 // Last Modified By : Thierry Delisle 12 // Last Modified On : Mon Nov 28 12:27:26 2016 13 // Update Count : 0 14 14 // 15 15 16 #pragma once 16 #ifndef __LIB_HDR_H__ 17 #define __LIB_HDR_H__ 17 18 18 19 #include "libalign.h" … … 20 21 #include "libtools.h" 21 22 23 #endif //__LIB_HDR_H__ 24 22 25 // Local Variables: // 23 26 // mode: c // -
src/libcfa/libhdr/libalign.h
r33218c6 re0a653d 1 // -*- Mode: C++ -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jul 21 23:05:35 201713 // Update Count : 212 // Last Modified By : Thierry Delisle 13 // Last Modified On : Mon Nov 28 12:27:26 2016 14 // Update Count : 0 14 15 // 15 16 // This library is free software; you can redistribute it and/or modify it … … 27 28 // 28 29 29 #pragma once30 30 31 #include <assert.h> 31 #ifndef __LIB_ALIGN_H__ 32 #define __LIB_ALIGN_H__ 33 34 #include "assert" 32 35 #include <stdbool.h> 33 36 … … 58 61 } // uCeiling 59 62 63 64 #endif // __LIB_ALIGN_H__ 65 66 60 67 // Local Variables: // 61 68 // compile-command: "make install" // -
src/libcfa/libhdr/libdebug.h
r33218c6 re0a653d 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:02:24 201713 // Update Count : 111 // Last Modified By : Thierry Delisle 12 // Last Modified On : Mon Nov 28 12:27:26 2016 13 // Update Count : 0 14 14 // 15 15 16 #pragma once 16 #ifndef __LIB_DEBUG_H__ 17 #define __LIB_DEBUG_H__ 17 18 18 19 #ifdef __CFA_DEBUG__ … … 77 78 #endif 78 79 80 #endif //__LIB_DEBUG_H__ 81 79 82 // Local Variables: // 80 83 // mode: c // -
src/libcfa/libhdr/libtools.h
r33218c6 re0a653d 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:02:10 201713 // Update Count : 111 // Last Modified By : Thierry Delisle 12 // Last Modified On : Mon Nov 28 12:27:26 2016 13 // Update Count : 0 14 14 // 15 15 16 #pragma once 16 #ifndef __LIB_TOOLS_H__ 17 #define __LIB_TOOLS_H__ 17 18 18 19 // void abortf( const char *fmt, ... ) { … … 29 30 #endif 30 31 32 #endif //__LIB_TOOLS_H__ 33 31 34 // Local Variables: // 32 35 // mode: c // -
src/libcfa/math
r33218c6 re0a653d 10 10 // Created On : Mon Apr 18 23:37:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 17:03:13201713 // Update Count : 10112 // Last Modified On : Fri Jul 7 09:34:15 2017 13 // Update Count : 61 14 14 // 15 15 16 16 #pragma once 17 17 18 #include <math.h> 19 #include <complex.h> 20 21 static inline float ?%?( float x, float y ) { return fmodf( x, y ); } 22 static inline float fmod( float x, float y ) { return fmodf( x, y ); } 23 static inline double ?%?( double x, double y ) { return fmod( x, y ); } 18 extern "C" { 19 #include <math.h> // fpclassify, isfinite, isnormal, isnan, isinf 20 } // extern "C" 21 22 float ?%?( float, float ); 23 float fmod( float, float ); 24 double ?%?( double, double ); 24 25 // extern "C" { double fmod( double, double ); } 25 static inline long double ?%?( long double x, long double y ) { return fmodl( x, y ); } 26 static inline long double fmod( long double x, long double y ) { return fmodl( x, y ); } 27 28 static inline float remainder( float x, float y ) { return remainderf( x, y ); } 26 long double ?%?( long double, long double ); 27 long double fmod( long double, long double ); 28 29 float remainder( float, float ); 29 30 // extern "C" { double remainder( double, double ); } 30 static inline long double remainder( long double x, long double y ) { return remainderl( x, y ); } 31 32 static inline float remquo( float x, float y, int * quo ) { return remquof( x, y, quo ); } 33 // extern "C" { double remquo( double x, double y, int * quo ); } 34 static inline long double remquo( long double x, long double y, int * quo ) { return remquol( x, y, quo ); } 35 static inline [ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; } 36 static inline [ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; } 37 static inline [ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; } 38 39 // alternative name for remquo 40 static inline float div( float x, float y, int * quo ) { return remquof( x, y, quo ); } 41 static inline double div( double x, double y, int * quo ) { return remquo( x, y, quo ); } 42 static inline long double div( long double x, long double y, int * quo ) { return remquol( x, y, quo ); } 43 static inline [ int, float ] div( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; } 44 static inline [ int, double ] div( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; } 45 static inline [ int, long double ] div( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; } 46 47 static inline float fma( float x, float y, float z ) { return fmaf( x, y, z ); } 31 long double remainder( long double, long double ); 32 33 [ int, float ] remquo( float, float ); 34 float remquo( float, float, int * ); 35 [ int, double ] remquo( double, double ); 36 // extern "C" { double remquo( double, double, int * ); } 37 [ int, long double ] remquo( long double, long double ); 38 long double remquo( long double, long double, int * ); 39 40 [ int, float ] div( float, float ); // alternative name for remquo 41 float div( float, float, int * ); 42 [ int, double ] div( double, double ); 43 // extern "C" { double div( double, double, int * ); } 44 [ int, long double ] div( long double, long double ); 45 long double div( long double, long double, int * ); 46 47 float fma( float, float, float ); 48 48 // extern "C" { double fma( double, double, double ); } 49 static inline long double fma( long double x, long double y, long double z ) { return fmal( x, y, z ); } 50 51 static inline float fdim( float x, float y ) { return fdimf( x, y ); } 49 long double fma( long double, long double, long double ); 50 51 float fdim( float, float ); 52 52 // extern "C" { double fdim( double, double ); } 53 static inline long double fdim( long double x, long double y ) { return fdiml( x, y ); } 54 55 static inline float nan( const char * tag ) { return nanf( tag ); } 53 long double fdim( long double, long double ); 54 55 float nan( const char * ); 56 56 // extern "C" { double nan( const char * ); } 57 static inline long double nan( const char * tag ) { return nanl( tag ); } 57 long double nan( const char * ); 58 58 59 59 //---------------------- Exponential ---------------------- 60 60 61 static inline float exp( float x ) { return expf( x ); } 61 float exp( float ); 62 62 // extern "C" { double exp( double ); } 63 static inline long double exp( long double x ) { return expl( x ); } 64 static inline float _Complex exp( float _Complex x ) { return cexpf( x ); } 65 static inline double _Complex exp( double _Complex x ) { return cexp( x ); } 66 static inline long double _Complex exp( long double _Complex x ) { return cexpl( x ); } 67 68 static inline float exp2( float x ) { return exp2f( x ); } 63 long double exp( long double ); 64 float _Complex exp( float _Complex ); 65 double _Complex exp( double _Complex ); 66 long double _Complex exp( long double _Complex ); 67 68 float exp2( float ); 69 69 // extern "C" { double exp2( double ); } 70 static inline long double exp2( long double x ) { return exp2l( x ); } 71 // static inline float _Complex exp2( float _Complex x ) { return cexp2f( x ); }72 // static inline double _Complex exp2( double _Complex x ) { return cexp2( x ); }73 // static inline long double _Complex exp2( long double _Complex x ) { return cexp2l( x ); }74 75 static inline float expm1( float x ) { return expm1f( x ); } 70 long double exp2( long double ); 71 // float _Complex exp2( float _Complex ); 72 // double _Complex exp2( double _Complex ); 73 // long double _Complex exp2( long double _Complex ); 74 75 float expm1( float ); 76 76 // extern "C" { double expm1( double ); } 77 static inline long double expm1( long double x ) { return expm1l( x ); } 78 79 static inline float pow( float x, float y ) { return powf( x, y ); } 77 long double expm1( long double ); 78 79 float log( float ); 80 // extern "C" { double log( double ); } 81 long double log( long double ); 82 float _Complex log( float _Complex ); 83 double _Complex log( double _Complex ); 84 long double _Complex log( long double _Complex ); 85 86 float log2( float ); 87 // extern "C" { double log2( double ); } 88 long double log2( long double ); 89 // float _Complex log2( float _Complex ); 90 // double _Complex log2( double _Complex ); 91 // long double _Complex log2( long double _Complex ); 92 93 float log10( float ); 94 // extern "C" { double log10( double ); } 95 long double log10( long double ); 96 // float _Complex log10( float _Complex ); 97 // double _Complex log10( double _Complex ); 98 // long double _Complex log10( long double _Complex ); 99 100 float log1p( float ); 101 // extern "C" { double log1p( double ); } 102 long double log1p( long double ); 103 104 int ilogb( float ); 105 // extern "C" { int ilogb( double ); } 106 int ilogb( long double ); 107 108 float logb( float ); 109 // extern "C" { double logb( double ); } 110 long double logb( long double ); 111 112 //---------------------- Power ---------------------- 113 114 float sqrt( float ); 115 // extern "C" { double sqrt( double ); } 116 long double sqrt( long double ); 117 float _Complex sqrt( float _Complex ); 118 double _Complex sqrt( double _Complex ); 119 long double _Complex sqrt( long double _Complex ); 120 121 float cbrt( float ); 122 // extern "C" { double cbrt( double ); } 123 long double cbrt( long double ); 124 125 float hypot( float, float ); 126 // extern "C" { double hypot( double, double ); } 127 long double hypot( long double, long double ); 128 129 float pow( float, float ); 80 130 // extern "C" { double pow( double, double ); } 81 static inline long double pow( long double x, long double y ) { return powl( x, y ); } 82 static inline float _Complex pow( float _Complex x, float _Complex y ) { return cpowf( x, y ); } 83 static inline double _Complex pow( double _Complex x, double _Complex y ) { return cpow( x, y ); } 84 static inline long double _Complex pow( long double _Complex x, long double _Complex y ) { return cpowl( x, y ); } 85 86 //---------------------- Logarithm ---------------------- 87 88 static inline float log( float x ) { return logf( x ); } 89 // extern "C" { double log( double ); } 90 static inline long double log( long double x ) { return logl( x ); } 91 static inline float _Complex log( float _Complex x ) { return clogf( x ); } 92 static inline double _Complex log( double _Complex x ) { return clog( x ); } 93 static inline long double _Complex log( long double _Complex x ) { return clogl( x ); } 94 95 static inline float log2( float x ) { return log2f( x ); } 96 // extern "C" { double log2( double ); } 97 static inline long double log2( long double x ) { return log2l( x ); } 98 // static inline float _Complex log2( float _Complex x ) { return clog2f( x ); } 99 // static inline double _Complex log2( double _Complex x ) { return clog2( x ); } 100 // static inline long double _Complex log2( long double _Complex x ) { return clog2l( x ); } 101 102 static inline float log10( float x ) { return log10f( x ); } 103 // extern "C" { double log10( double ); } 104 static inline long double log10( long double x ) { return log10l( x ); } 105 // static inline float _Complex log10( float _Complex x ) { return clog10f( x ); } 106 // static inline double _Complex log10( double _Complex x ) { return clog10( x ); } 107 // static inline long double _Complex log10( long double _Complex x ) { return clog10l( x ); } 108 109 static inline float log1p( float x ) { return log1pf( x ); } 110 // extern "C" { double log1p( double ); } 111 static inline long double log1p( long double x ) { return log1pl( x ); } 112 113 static inline int ilogb( float x ) { return ilogbf( x ); } 114 // extern "C" { int ilogb( double ); } 115 static inline int ilogb( long double x ) { return ilogbl( x ); } 116 117 static inline float logb( float x ) { return logbf( x ); } 118 // extern "C" { double logb( double ); } 119 static inline long double logb( long double x ) { return logbl( x ); } 120 121 static inline float sqrt( float x ) { return sqrtf( x ); } 122 // extern "C" { double sqrt( double ); } 123 static inline long double sqrt( long double x ) { return sqrtl( x ); } 124 static inline float _Complex sqrt( float _Complex x ) { return csqrtf( x ); } 125 static inline double _Complex sqrt( double _Complex x ) { return csqrt( x ); } 126 static inline long double _Complex sqrt( long double _Complex x ) { return csqrtl( x ); } 127 128 static inline float cbrt( float x ) { return cbrtf( x ); } 129 // extern "C" { double cbrt( double ); } 130 static inline long double cbrt( long double x ) { return cbrtl( x ); } 131 132 static inline float hypot( float x, float y ) { return hypotf( x, y ); } 133 // extern "C" { double hypot( double, double ); } 134 static inline long double hypot( long double x, long double y ) { return hypotl( x, y ); } 131 long double pow( long double, long double ); 132 float _Complex pow( float _Complex, float _Complex ); 133 double _Complex pow( double _Complex, double _Complex ); 134 long double _Complex pow( long double _Complex, long double _Complex ); 135 135 136 136 //---------------------- Trigonometric ---------------------- 137 137 138 static inline float sin( float x ) { return sinf( x ); } 138 float sin( float ); 139 139 // extern "C" { double sin( double ); } 140 static inline long double sin( long double x ) { return sinl( x ); } 141 static inline float _Complex sin( float _Complex x ) { return csinf( x ); } 142 static inline double _Complex sin( double _Complex x ) { return csin( x ); } 143 static inline long double _Complex sin( long double _Complex x ) { return csinl( x ); } 144 145 static inline float cos( float x ) { return cosf( x ); } 140 long double sin( long double ); 141 float _Complex sin( float _Complex ); 142 double _Complex sin( double _Complex ); 143 long double _Complex sin( long double _Complex ); 144 145 float cos( float ); 146 146 // extern "C" { double cos( double ); } 147 static inline long double cos( long double x ) { return cosl( x ); } 148 static inline float _Complex cos( float _Complex x ) { return ccosf( x ); } 149 static inline double _Complex cos( double _Complex x ) { return ccos( x ); } 150 static inline long double _Complex cos( long double _Complex x ) { return ccosl( x ); } 151 152 static inline float tan( float x ) { return tanf( x ); } 147 long double cos( long double ); 148 float _Complex cos( float _Complex ); 149 double _Complex cos( double _Complex ); 150 long double _Complex cos( long double _Complex ); 151 152 float tan( float ); 153 153 // extern "C" { double tan( double ); } 154 static inline long double tan( long double x ) { return tanl( x ); } 155 static inline float _Complex tan( float _Complex x ) { return ctanf( x ); } 156 static inline double _Complex tan( double _Complex x ) { return ctan( x ); } 157 static inline long double _Complex tan( long double _Complex x ) { return ctanl( x ); } 158 159 static inline float asin( float x ) { return asinf( x ); } 154 long double tan( long double ); 155 float _Complex tan( float _Complex ); 156 double _Complex tan( double _Complex ); 157 long double _Complex tan( long double _Complex ); 158 159 float asin( float ); 160 160 // extern "C" { double asin( double ); } 161 static inline long double asin( long double x ) { return asinl( x ); } 162 static inline float _Complex asin( float _Complex x ) { return casinf( x ); } 163 static inline double _Complex asin( double _Complex x ) { return casin( x ); } 164 static inline long double _Complex asin( long double _Complex x ) { return casinl( x ); } 165 166 static inline float acos( float x ) { return acosf( x ); } 161 long double asin( long double ); 162 float _Complex asin( float _Complex ); 163 double _Complex asin( double _Complex ); 164 long double _Complex asin( long double _Complex ); 165 166 float acos( float ); 167 167 // extern "C" { double acos( double ); } 168 static inline long double acos( long double x ) { return acosl( x ); } 169 static inline float _Complex acos( float _Complex x ) { return cacosf( x ); } 170 static inline double _Complex acos( double _Complex x ) { return cacos( x ); } 171 static inline long double _Complex acos( long double _Complex x ) { return cacosl( x ); } 172 173 static inline float atan( float x ) { return atanf( x ); } 168 long double acos( long double ); 169 float _Complex acos( float _Complex ); 170 double _Complex acos( double _Complex ); 171 long double _Complex acos( long double _Complex ); 172 173 float atan( float ); 174 174 // extern "C" { double atan( double ); } 175 static inline long double atan( long double x ) { return atanl( x ); } 176 static inline float _Complex atan( float _Complex x ) { return catanf( x ); } 177 static inline double _Complex atan( double _Complex x ) { return catan( x ); } 178 static inline long double _Complex atan( long double _Complex x ) { return catanl( x ); } 179 180 static inline float atan2( float x, float y ) { return atan2f( x, y ); } 175 long double atan( long double ); 176 float _Complex atan( float _Complex ); 177 double _Complex atan( double _Complex ); 178 long double _Complex atan( long double _Complex ); 179 180 float atan2( float, float ); 181 181 // extern "C" { double atan2( double, double ); } 182 static inline long double atan2( long double x, long double y ) { return atan2l( x, y ); } 183 184 // alternative name for atan2 185 static inline float atan( float x, float y ) { return atan2f( x, y ); } 186 static inline double atan( double x, double y ) { return atan2( x, y ); } 187 static inline long double atan( long double x, long double y ) { return atan2l( x, y ); } 182 long double atan2( long double, long double ); 183 184 float atan( float, float ); // alternative name for atan2 185 double atan( double, double ); 186 long double atan( long double, long double ); 188 187 189 188 //---------------------- Hyperbolic ---------------------- 190 189 191 static inline float sinh( float x ) { return sinhf( x ); } 190 float sinh( float ); 192 191 // extern "C" { double sinh( double ); } 193 static inline long double sinh( long double x ) { return sinhl( x ); } 194 static inline float _Complex sinh( float _Complex x ) { return csinhf( x ); } 195 static inline double _Complex sinh( double _Complex x ) { return csinh( x ); } 196 static inline long double _Complex sinh( long double _Complex x ) { return csinhl( x ); } 197 198 static inline float cosh( float x ) { return coshf( x ); } 192 long double sinh( long double ); 193 float _Complex sinh( float _Complex ); 194 double _Complex sinh( double _Complex ); 195 long double _Complex sinh( long double _Complex ); 196 197 float cosh( float ); 199 198 // extern "C" { double cosh( double ); } 200 static inline long double cosh( long double x ) { return coshl( x ); } 201 static inline float _Complex cosh( float _Complex x ) { return ccoshf( x ); } 202 static inline double _Complex cosh( double _Complex x ) { return ccosh( x ); } 203 static inline long double _Complex cosh( long double _Complex x ) { return ccoshl( x ); } 204 205 static inline float tanh( float x ) { return tanhf( x ); } 199 long double cosh( long double ); 200 float _Complex cosh( float _Complex ); 201 double _Complex cosh( double _Complex ); 202 long double _Complex cosh( long double _Complex ); 203 204 float tanh( float ); 206 205 // extern "C" { double tanh( double ); } 207 static inline long double tanh( long double x ) { return tanhl( x ); } 208 static inline float _Complex tanh( float _Complex x ) { return ctanhf( x ); } 209 static inline double _Complex tanh( double _Complex x ) { return ctanh( x ); } 210 static inline long double _Complex tanh( long double _Complex x ) { return ctanhl( x ); } 211 212 static inline float asinh( float x ) { return asinhf( x ); } 206 long double tanh( long double ); 207 float _Complex tanh( float _Complex ); 208 double _Complex tanh( double _Complex ); 209 long double _Complex tanh( long double _Complex ); 210 211 float asinh( float ); 213 212 // extern "C" { double asinh( double ); } 214 static inline long double asinh( long double x ) { return asinhl( x ); } 215 static inline float _Complex asinh( float _Complex x ) { return casinhf( x ); } 216 static inline double _Complex asinh( double _Complex x ) { return casinh( x ); } 217 static inline long double _Complex asinh( long double _Complex x ) { return casinhl( x ); } 218 219 static inline float acosh( float x ) { return acoshf( x ); } 213 long double asinh( long double ); 214 float _Complex asinh( float _Complex ); 215 double _Complex asinh( double _Complex ); 216 long double _Complex asinh( long double _Complex ); 217 218 float acosh( float ); 220 219 // extern "C" { double acosh( double ); } 221 static inline long double acosh( long double x ) { return acoshl( x ); } 222 static inline float _Complex acosh( float _Complex x ) { return cacoshf( x ); } 223 static inline double _Complex acosh( double _Complex x ) { return cacosh( x ); } 224 static inline long double _Complex acosh( long double _Complex x ) { return cacoshl( x ); } 225 226 static inline float atanh( float x ) { return atanhf( x ); } 220 long double acosh( long double ); 221 float _Complex acosh( float _Complex ); 222 double _Complex acosh( double _Complex ); 223 long double _Complex acosh( long double _Complex ); 224 225 float atanh( float ); 227 226 // extern "C" { double atanh( double ); } 228 static inline long double atanh( long double x ) { return atanhl( x ); } 229 static inline float _Complex atanh( float _Complex x ) { return catanhf( x ); } 230 static inline double _Complex atanh( double _Complex x ) { return catanh( x ); } 231 static inline long double _Complex atanh( long double _Complex x ) { return catanhl( x ); } 227 long double atanh( long double ); 228 float _Complex atanh( float _Complex ); 229 double _Complex atanh( double _Complex ); 230 long double _Complex atanh( long double _Complex ); 232 231 233 232 //---------------------- Error / Gamma ---------------------- 234 233 235 static inline float erf( float x ) { return erff( x ); } 234 float erf( float ); 236 235 // extern "C" { double erf( double ); } 237 static inline long double erf( long double x ) { return erfl( x ); } 236 long double erf( long double ); 238 237 // float _Complex erf( float _Complex ); 239 238 // double _Complex erf( double _Complex ); 240 239 // long double _Complex erf( long double _Complex ); 241 240 242 static inline float erfc( float x ) { return erfcf( x ); } 241 float erfc( float ); 243 242 // extern "C" { double erfc( double ); } 244 static inline long double erfc( long double x ) { return erfcl( x ); } 243 long double erfc( long double ); 245 244 // float _Complex erfc( float _Complex ); 246 245 // double _Complex erfc( double _Complex ); 247 246 // long double _Complex erfc( long double _Complex ); 248 247 249 static inline float lgamma( float x ) { return lgammaf( x ); } 248 float lgamma( float ); 250 249 // extern "C" { double lgamma( double ); } 251 static inline long double lgamma( long double x ) { return lgammal( x ); } 252 static inline float lgamma( float x, int * sign ) { return lgammaf_r( x, sign ); } 253 static inline double lgamma( double x, int * sign ) { return lgamma_r( x, sign ); } 254 static inline long double lgamma( long double x, int * sign ) { return lgammal_r( x, sign ); } 255 256 static inline float tgamma( float x ) { return tgammaf( x ); } 250 long double lgamma( long double ); 251 float lgamma( float, int * ); 252 double lgamma( double, int * ); 253 long double lgamma( long double, int * ); 254 255 float tgamma( float ); 257 256 // extern "C" { double tgamma( double ); } 258 static inline long double tgamma( long double x ) { return tgammal( x ); } 257 long double tgamma( long double ); 259 258 260 259 //---------------------- Nearest Integer ---------------------- 261 260 262 static inline float floor( float x ) { return floorf( x ); } 261 float floor( float ); 263 262 // extern "C" { double floor( double ); } 264 static inline long double floor( long double x ) { return floorl( x ); } 265 266 static inline float ceil( float x ) { return ceilf( x ); } 263 long double floor( long double ); 264 265 float ceil( float ); 267 266 // extern "C" { double ceil( double ); } 268 static inline long double ceil( long double x ) { return ceill( x ); } 269 270 static inline float trunc( float x ) { return truncf( x ); } 267 long double ceil( long double ); 268 269 float trunc( float ); 271 270 // extern "C" { double trunc( double ); } 272 static inline long double trunc( long double x ) { return truncl( x ); } 273 274 static inline float rint( float x ) { return rintf( x ); } 275 // extern "C" { double rint( double x ); } 276 static inline long double rint( long double x ) { return rintl( x ); } 277 static inline long int rint( float x ) { return lrintf( x ); } 278 static inline long int rint( double x ) { return lrint( x ); } 279 static inline long int rint( long double x ) { return lrintl( x ); } 280 static inline long long int rint( float x ) { return llrintf( x ); } 281 static inline long long int rint( double x ) { return llrint( x ); } 282 static inline long long int rint( long double x ) { return llrintl( x ); } 283 284 static inline long int lrint( float x ) { return lrintf( x ); } 271 long double trunc( long double ); 272 273 float rint( float ); 274 long double rint( long double ); 275 long int rint( float ); 276 long int rint( double ); 277 long int rint( long double ); 278 long long int rint( float ); 279 long long int rint( double ); 280 long long int rint( long double ); 281 282 long int lrint( float ); 285 283 // extern "C" { long int lrint( double ); } 286 static inline long int lrint( long double x ) { return lrintl( x ); } 287 static inline long long int llrint( float x ) { return llrintf( x ); } 284 long int lrint( long double ); 285 long long int llrint( float ); 288 286 // extern "C" { long long int llrint( double ); } 289 static inline long long int llrint( long double x ) { return llrintl( x ); } 290 291 static inline float nearbyint( float x ) { return nearbyintf( x ); } 287 long long int llrint( long double ); 288 289 float nearbyint( float ); 292 290 // extern "C" { double nearbyint( double ); } 293 static inline long double nearbyint( long double x ) { return nearbyintl( x ); } 294 295 static inline float round( float x ) { return roundf( x ); } 296 // extern "C" { double round( double x ); } 297 static inline long double round( long double x ) { return roundl( x ); } 298 static inline long int round( float x ) { return lroundf( x ); } 299 static inline long int round( double x ) { return lround( x ); } 300 static inline long int round( long double x ) { return lroundl( x ); } 301 static inline long long int round( float x ) { return llroundf( x ); } 302 static inline long long int round( double x ) { return llround( x ); } 303 static inline long long int round( long double x ) { return llroundl( x ); } 304 305 static inline long int lround( float x ) { return lroundf( x ); } 291 long double nearbyint( long double ); 292 293 float round( float ); 294 long double round( long double ); 295 long int round( float ); 296 long int round( double ); 297 long int round( long double ); 298 long long int round( float ); 299 long long int round( double ); 300 long long int round( long double ); 301 302 long int lround( float ); 306 303 // extern "C" { long int lround( double ); } 307 static inline long int lround( long double x ) { return lroundl( x ); } 308 static inline long long int llround( float x ) { return llroundf( x ); } 304 long int lround( long double ); 305 long long int llround( float ); 309 306 // extern "C" { long long int llround( double ); } 310 static inline long long int llround( long double x ) { return llroundl( x ); } 307 long long int llround( long double ); 311 308 312 309 //---------------------- Manipulation ---------------------- 313 310 314 static inline float copysign( float x, float y ) { return copysignf( x, y ); } 311 float copysign( float, float ); 315 312 // extern "C" { double copysign( double, double ); } 316 static inline long double copysign( long double x, long double y ) { return copysignl( x, y ); } 317 318 static inline float frexp( float x, int * ip ) { return frexpf( x, ip ); } 313 long double copysign( long double, long double ); 314 315 float frexp( float, int * ); 319 316 // extern "C" { double frexp( double, int * ); } 320 static inline long double frexp( long double x, int * ip ) { return frexpl( x, ip ); } 321 322 static inline float ldexp( float x, int exp2 ) { return ldexpf( x, exp2 ); } 317 long double frexp( long double, int * ); 318 319 float ldexp( float, int ); 323 320 // extern "C" { double ldexp( double, int ); } 324 static inline long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); } 325 326 static inline [ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; } 327 static inline float modf( float x, float * i ) { return modff( x, i ); } 328 static inline [ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; } 321 long double ldexp( long double, int ); 322 323 [ float, float ] modf( float ); 324 float modf( float, float * ); 325 [ double, double ] modf( double ); 329 326 // extern "C" { double modf( double, double * ); } 330 static inline [ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; } 331 static inline long double modf( long double x, long double * i ) { return modfl( x, i ); } 332 333 static inline float nextafter( float x, float y ) { return nextafterf( x, y ); } 327 [ long double, long double ] modf( long double ); 328 long double modf( long double, long double * ); 329 330 float nextafter( float, float ); 334 331 // extern "C" { double nextafter( double, double ); } 335 static inline long double nextafter( long double x, long double y ) { return nextafterl( x, y ); } 336 337 static inline float nexttoward( float x, long double y ) { return nexttowardf( x, y ); } 332 long double nextafter( long double, long double ); 333 334 float nexttoward( float, long double ); 338 335 // extern "C" { double nexttoward( double, long double ); } 339 static inline long double nexttoward( long double x, long double y ) { return nexttowardl( x, y ); } 340 341 static inline float scalbn( float x, int exp ) { return scalbnf( x, exp ); } 336 long double nexttoward( long double, long double ); 337 338 float scalbn( float, int ); 342 339 // extern "C" { double scalbn( double, int ); } 343 static inline long double scalbn( long double x, int exp ) { return scalbnl( x, exp ); } 344 static inline float scalbn( float x, long int exp ) { return scalblnf( x, exp ); } 345 static inline double scalbn( double x, long int exp ) { return scalbln( x, exp ); } 346 static inline long double scalbn( long double x, long int exp ) { return scalblnl( x, exp ); } 347 348 static inline float scalbln( float x, long int exp ) { return scalblnf( x, exp ); } 340 long double scalbn( long double, int ); 341 342 float scalbln( float, long int ); 349 343 // extern "C" { double scalbln( double, long int ); } 350 static inline long double scalbln( long double x, long int exp ) { return scalblnl( x, exp ); } 344 long double scalbln( long double, long int ); 351 345 352 346 // Local Variables: // -
src/libcfa/startup.h
r33218c6 re0a653d 1 // -*- Mode: CFA -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 9 10 // Author : Thierry Delisle 10 11 // Created On : Wed Mar 29 15:56:41 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 20 21:37:11 201713 // Update Count : 212 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 0 14 15 // 15 16 16 #pragma once 17 #ifndef STARTUP_H 18 #define STARTUP_H 17 19 18 20 #if GCC_VERSION > 50000 … … 32 34 #endif 33 35 34 // Local Variables: // 35 // mode: c // 36 // tab-width: 4 // 37 // End: // 36 #endif //STARTUP_H -
src/libcfa/stdhdr/assert.h
r33218c6 re0a653d 10 10 // Created On : Mon Jul 4 23:25:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jul 20 21:06:48 201713 // Update Count : 1112 // Last Modified On : Tue Jul 5 20:34:23 2016 13 // Update Count : 8 14 14 // 15 15 … … 18 18 #endif //__CFORALL__ 19 19 20 // has internal check for multiple expansion 20 21 #include_next <assert.h> 21 22 #ifdef NDEBUG23 #define assertf( expr, fmt, ... ) ((void)0)24 #else25 #define __STRINGIFY__(str) #str26 #define __VSTRINGIFY__(str) __STRINGIFY__(str)27 #define assertf(expr, fmt, ...) ((expr) ? ((void)0) : __assert_fail_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ))28 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) __attribute__((noreturn));29 #endif30 22 31 23 #ifdef __CFORALL__ -
src/libcfa/stdhdr/gmp.h
r33218c6 re0a653d 1 // -*- Mode: C -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 10 11 // Created On : Sun May 14 23:46:01 2017 11 12 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 20 18:10:52201713 // Update Count : 413 // Last Modified On : Sun May 14 23:46:34 2017 14 // Update Count : 1 14 15 // 15 16 -
src/libcfa/stdlib
r33218c6 re0a653d 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 20 14:32:37201713 // Update Count : 2 2012 // Last Modified On : Fri Jul 7 09:34:49 2017 13 // Update Count : 219 14 14 // 15 15 … … 18 18 //--------------------------------------- 19 19 20 extern "C" { 20 21 #ifndef EXIT_FAILURE 21 22 #define EXIT_FAILURE 1 // failing exit status 22 23 #define EXIT_SUCCESS 0 // successful exit status 23 24 #endif // ! EXIT_FAILURE 25 } // extern "C" 24 26 25 27 //--------------------------------------- -
src/libcfa/stdlib.c
r33218c6 re0a653d 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Ju l 20 16:01:40201713 // Update Count : 28 212 // Last Modified On : Thu Jun 1 21:52:57 2017 13 // Update Count : 280 14 14 // 15 15 … … 18 18 //--------------------------------------- 19 19 20 extern "C" { 20 21 #define _XOPEN_SOURCE 600 // posix_memalign, *rand48 21 22 #include <stdlib.h> // malloc, free, calloc, realloc, memalign, posix_memalign, bsearch … … 24 25 #include <math.h> // fabsf, fabs, fabsl 25 26 #include <complex.h> // _Complex_I 27 } // extern "C" 26 28 27 29 // resize, non-array types -
src/prelude/builtins.c
r33218c6 re0a653d 1 //2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // builtins.c --8 //9 // Author : Peter A. Buhr10 // Created On : Fri Jul 21 16:21:03 201711 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:34:20 201713 // Update Count : 1314 //15 16 // exception implementation17 18 1 typedef unsigned long long __cfaabi_exception_type_t; 19 2 20 3 #include "../libcfa/exception.h" 21 22 // exponentiation operator implementation23 24 extern "C" {25 float powf( float x, float y );26 double pow( double x, double y );27 long double powl( long double x, long double y );28 float _Complex cpowf( float _Complex x, _Complex float z );29 double _Complex cpow( double _Complex x, _Complex double z );30 long double _Complex cpowl( long double _Complex x, _Complex long double z );31 } // extern "C"32 33 static inline float ?\?( float x, float y ) { return powf( x, y ); }34 static inline double ?\?( double x, double y ) { return pow( x, y ); }35 static inline long double ?\?( long double x, long double y ) { return powl( x, y ); }36 static inline float _Complex ?\?( float _Complex x, _Complex float y ) { return cpowf(x, y ); }37 static inline double _Complex ?\?( double _Complex x, _Complex double y ) { return cpow( x, y ); }38 static inline long double _Complex ?\?( long double _Complex x, _Complex long double y ) { return cpowl( x, y ); }39 40 static inline long int ?\?( long int ep, unsigned long int y ) { // disallow negative exponent41 if ( y == 0 ) return 1; // base case42 if ( ep == 2 ) return ep << (y - 1); // special case, positive shifting only43 typeof( ep ) op = 1; // accumulate odd product44 for ( ; y > 1; y >>= 1 ) { // squaring exponentiation, O(log2 y)45 if ( (y & 1) == 1 ) op *= ep; // odd ?46 ep *= ep;47 } // for48 return ep * op;49 } // ?\?50 51 // FIX ME, cannot resolve the "T op = 1".52 53 // static inline forall( otype T | { void ?{}( T * this, one_t ); T ?*?( T, T ); } )54 // T ?\?( T ep, unsigned long int y ) {55 // if ( y == 0 ) return 1;56 // T op = 1;57 // for ( ; y > 1; y >>= 1 ) { // squaring exponentiation, O(log2 y)58 // if ( (y & 1) == 1 ) op = op * ep; // odd ?59 // ep = ep * ep;60 // } // for61 // return ep * op;62 // } // ?\?63 64 // unsigned computation may be faster and larger65 static inline unsigned long int ?\?( unsigned long int ep, unsigned long int y ) { // disallow negative exponent66 if ( y == 0 ) return 1; // base case67 if ( ep == 2 ) return ep << (y - 1); // special case, positive shifting only68 typeof( ep ) op = 1; // accumulate odd product69 for ( ; y > 1; y >>= 1 ) { // squaring exponentiation, O(log2 y)70 if ( (y & 1) == 1 ) op *= ep; // odd ?71 ep *= ep;72 } // for73 return ep * op;74 } // ?\?75 76 static inline double ?\?( long int x, signed long int y ) { // allow negative exponent77 if ( y >= 0 ) return (double)(x \ (unsigned long int)y);78 else return 1.0 / x \ (unsigned int)(-y);79 } // ?\?80 81 static inline forall( otype T | { void ?{}( T * this, one_t ); T ?*?( T, T ); double ?/?( double, T ); } )82 double ?\?( T x, signed long int y ) {83 if ( y >= 0 ) return (double)(x \ (unsigned long int)y);84 else return 1.0 / x \ (unsigned long int)(-y);85 } // ?\?86 87 static inline long int ?\=?( long int * x, unsigned long int y ) { *x = *x \ y; return *x; }88 static inline unsigned long int ?\=?( unsigned long int * x, unsigned long int y ) { *x = *x \ y; return *x; }89 static inline int ?\=?( int * x, unsigned long int y ) { *x = *x \ y; return *x; }90 static inline unsigned int ?\=?( unsigned int * x, unsigned long int y ) { *x = *x \ y; return *x; }91 92 // Local Variables: //93 // mode: c //94 // tab-width: 4 //95 // End: // -
src/tests/.expect/32/math.txt
r33218c6 re0a653d 9 9 exp2:2 2 2 10 10 expm1:1.71828 1.71828182845905 1.71828182845904524 11 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i12 16 25613 912673 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i14 11 log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 15 12 log2:3 3 3 … … 21 18 cbrt:3 3 3 22 19 hypot:1.41421 1.4142135623731 1.41421356237309505 20 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i 23 21 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i 24 22 cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i -
src/tests/.expect/64/math.txt
r33218c6 re0a653d 9 9 exp2:2 2 2 10 10 expm1:1.71828 1.71828182845905 1.71828182845904524 11 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614627i12 16 25613 912673 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i14 11 log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 15 12 log2:3 3 3 … … 21 18 cbrt:3 3 3 22 19 hypot:1.41421 1.4142135623731 1.41421356237309505 20 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i 23 21 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i 24 22 cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i -
src/tests/alloc.c
r33218c6 re0a653d 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 20 16:01:10201713 // Update Count : 31 812 // Last Modified On : Fri Jun 2 15:13:03 2017 13 // Update Count : 316 14 14 // 15 15 16 #include <assert.h> 16 #include <assert> 17 extern "C" { 17 18 #include <malloc.h> // malloc_usable_size 18 19 #include <stdint.h> // uintptr_t 19 20 #include <stdlib.h> // posix_memalign 21 } // extern 20 22 #include <fstream> 21 23 #include <stdlib> // access C malloc, realloc -
src/tests/attributes.c
r33218c6 re0a653d 1 // -*- Mode: C -*- 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo … … 10 11 // Created On : Mon Feb 6 16:07:02 2017 11 12 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 23:05:52201713 // Update Count : 313 // Last Modified On : Mon Feb 6 16:08:21 2017 14 // Update Count : 2 14 15 // 15 16 -
src/tests/avltree/avl-private.h
r33218c6 re0a653d 1 # pragma once1 #ifndef AVL_PRIVATE_H 2 2 #include "avl.h" 3 3 … … 14 14 forall(otype K | Comparable(K), otype V) 15 15 int height(tree(K, V) * t); 16 17 #endif -
src/tests/avltree/avl.h
r33218c6 re0a653d 1 #pragma once 1 #ifndef AVL_TREE_H 2 #define AVL_TREE_H 2 3 3 4 extern "C" { … … 103 104 // printTree(t, 0); 104 105 // } 106 107 108 #endif -
src/tests/gmp.c
r33218c6 re0a653d 10 10 // Created On : Tue Apr 19 08:55:51 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 13 16:35:01201713 // Update Count : 54 112 // Last Modified On : Wed May 24 22:05:38 2017 13 // Update Count : 540 14 14 // 15 15 … … 95 95 // Local Variables: // 96 96 // tab-width: 4 // 97 // compile-command: "cfa gmp.c -l gmp" //97 // compile-command: "cfa gmp.c -l gmp" // 98 98 // End: // -
src/tests/math.c
r33218c6 re0a653d 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 10:32:04201713 // Update Count : 7 312 // Last Modified On : Wed May 24 13:04:33 2017 13 // Update Count : 71 14 14 // 15 15 … … 46 46 sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ) | endl; 47 47 sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L ) | endl; 48 sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.0DL+1.0LI, 1.0DL+1.0LI ) | endl;49 50 int b = 4;51 unsigned int e = 2;52 b \= e;53 sout | b | b \ e | endl;54 sout | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi) | endl;55 56 //---------------------- Logarithm ----------------------57 58 48 sout | "log:" | log( 1.0F ) | log( 1.0D ) | log( 1.0L ) | log( 1.0F+1.0FI ) | log( 1.0D+1.0DI ) | log( 1.0DL+1.0LI ) | endl; 59 49 sout | "log2:" | log2( 8.0F ) | log2( 8.0D ) | log2( 8.0L ) | endl; … … 63 53 sout | "logb:" | logb( 8.0F ) | logb( 8.0D ) | logb( 8.0L ) | endl; 64 54 55 //---------------------- Power ---------------------- 56 65 57 sout | "sqrt:" | sqrt( 1.0F ) | sqrt( 1.0D ) | sqrt( 1.0L ) | sqrt( 1.0F+1.0FI ) | sqrt( 1.0D+1.0DI ) | sqrt( 1.0DL+1.0LI ) | endl; 66 58 sout | "cbrt:" | cbrt( 27.0F ) | cbrt( 27.0D ) | cbrt( 27.0L ) | endl; 67 59 sout | "hypot:" | hypot( 1.0F, -1.0F ) | hypot( 1.0D, -1.0D ) | hypot( 1.0L, -1.0L ) | endl; 60 sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.0DL+1.0LI, 1.0DL+1.0LI ) | endl; 68 61 69 62 //---------------------- Trigonometric ---------------------- -
src/tests/maybe.c
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Thr May 25 16:02:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 20 15:24:07201713 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri May 16 15:43:00 2017 13 // Update Count : 0 14 14 // 15 15 16 #include <assert .h>16 #include <assert> 17 17 #include <containers/maybe> 18 18 -
src/tests/preempt_longrun/Makefile.am
r33218c6 re0a653d 16 16 17 17 repeats=10 18 max_time= 60018 max_time=30 19 19 preempt=1_000ul 20 20 … … 25 25 CC = @CFA_BINDIR@/@CFA_NAME@ 26 26 27 TESTS = b lock create disjoint enter enter3 processor stack wait yield27 TESTS = barge block create disjoint enter enter3 processor stack wait yield 28 28 29 29 .INTERMEDIATE: ${TESTS} 30 30 31 31 all-local: ${TESTS:=.run} 32 33 clean-local:34 rm -f ${TESTS}35 32 36 33 % : %.c ${CC} -
src/tests/preempt_longrun/Makefile.in
r33218c6 re0a653d 449 449 top_srcdir = @top_srcdir@ 450 450 repeats = 10 451 max_time = 600451 max_time = 30 452 452 preempt = 1_000ul 453 453 REPEAT = ${abs_top_srcdir}/tools/repeat -s 454 454 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt} 455 TESTS = b lock create disjoint enter enter3 processor stack wait yield455 TESTS = barge block create disjoint enter enter3 processor stack wait yield 456 456 all: all-am 457 457 … … 635 635 TEST_LOGS="$$log_list"; \ 636 636 exit $$? 637 barge.log: barge 638 @p='barge'; \ 639 b='barge'; \ 640 $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ 641 --log-file $$b.log --trs-file $$b.trs \ 642 $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 643 "$$tst" $(AM_TESTS_FD_REDIRECT) 637 644 block.log: block 638 645 @p='block'; \ … … 783 790 clean: clean-am 784 791 785 clean-am: clean-generic clean-localmostlyclean-am792 clean-am: clean-generic mostlyclean-am 786 793 787 794 distclean: distclean-am … … 850 857 851 858 .PHONY: all all-am all-local check check-TESTS check-am clean \ 852 clean-generic c lean-local cscopelist-am ctags-am distclean \859 clean-generic cscopelist-am ctags-am distclean \ 853 860 distclean-generic distdir dvi dvi-am html html-am info info-am \ 854 861 install install-am install-data install-data-am install-dvi \ … … 868 875 all-local: ${TESTS:=.run} 869 876 870 clean-local:871 rm -f ${TESTS}872 873 877 % : %.c ${CC} 874 878 ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@} -
src/tests/preempt_longrun/create.c
r33218c6 re0a653d 1 1 #include <kernel> 2 2 #include <thread> 3 4 static const unsigned long N = 2_000ul;5 3 6 4 #ifndef PREEMPTION_RATE … … 17 15 18 16 int main(int argc, char* argv[]) { 19 processor p; 20 for(int i = 0; i < N; i++) { 17 for(int i = 0; i < 10_000ul; i++) { 21 18 worker_t w[7]; 22 19 } -
src/tests/preempt_longrun/enter.c
r33218c6 re0a653d 3 3 #include <thread> 4 4 5 #undef N 5 6 static const unsigned long N = 70_000ul; 6 7 -
src/tests/preempt_longrun/enter3.c
r33218c6 re0a653d 3 3 #include <thread> 4 4 5 #undef N 5 6 static const unsigned long N = 50_000ul; 6 7 -
src/tests/preempt_longrun/processor.c
r33218c6 re0a653d 1 1 #include <kernel> 2 2 #include <thread> 3 4 static const unsigned long N = 5_000ul;5 3 6 4 #ifndef PREEMPTION_RATE … … 17 15 18 16 int main(int argc, char* argv[]) { 19 for(int i = 0; i < N; i++) {17 for(int i = 0; i < 10_000ul; i++) { 20 18 processor p; 21 19 } -
src/tests/preempt_longrun/yield.c
r33218c6 re0a653d 1 1 #include <kernel> 2 2 #include <thread> 3 4 static const unsigned long N = 325_000ul;5 3 6 4 #ifndef PREEMPTION_RATE … … 15 13 16 14 void main(worker_t * this) { 17 for(int i = 0; i < N; i++) {15 for(int i = 0; i < 325_000ul; i++) { 18 16 yield(); 19 17 } -
src/tests/result.c
r33218c6 re0a653d 9 9 // Author : Andrew Beach 10 10 // Created On : Thr May 25 16:50:00 2017 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 20 15:24:12201713 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 16 15:42:00 2017 13 // Update Count : 0 14 14 // 15 15 16 #include <assert .h>16 #include <assert> 17 17 #include <containers/result> 18 18 -
src/tests/sched-int-barge.c
r33218c6 re0a653d 5 5 #include <thread> 6 6 7 static const unsigned long N = 50_000ul;8 9 #ifndef PREEMPTION_RATE10 #define PREEMPTION_RATE 10_000ul11 #endif12 13 unsigned int default_preemption() {14 return 0;15 }16 7 enum state_t { WAIT, SIGNAL, BARGE }; 17 8 … … 19 10 20 11 monitor global_data_t { 21 volatilebool done;12 bool done; 22 13 int counter; 23 14 state_t state; … … 60 51 c->do_wait2 = ((unsigned)rand48()) % (c->do_signal); 61 52 62 if(c->do_wait1 == c->do_wait2) sout | "Same" | endl;53 // if(c->do_wait1 == c->do_wait2) sout | "Same" | endl; 63 54 } 64 55 … … 82 73 } 83 74 84 if( c->counter >= N) c->done = true;75 if( c->counter >= 100_000 ) c->done = true; 85 76 return !c->done; 86 77 } … … 98 89 } 99 90 100 static thread_desc * volatile the_threads;101 102 91 int main(int argc, char* argv[]) { 103 rand48seed(0); 104 processor p; 105 { 106 Threads t[17]; 107 the_threads = (thread_desc*)t; 108 } 92 rand48seed(0); 93 processor p; 94 { 95 Threads t[17]; 96 } 109 97 } -
src/tests/sched-int-block.c
r33218c6 re0a653d 5 5 #include <thread> 6 6 7 #include <time.h> 8 9 static const unsigned long N = 5_000ul; 10 11 #ifndef PREEMPTION_RATE 12 #define PREEMPTION_RATE 10_000ul 7 #ifndef N 8 #define N 10_000 13 9 #endif 14 15 unsigned int default_preemption() {16 return PREEMPTION_RATE;17 }18 10 19 11 enum state_t { WAITED, SIGNAL, BARGE }; … … 109 101 110 102 int main(int argc, char* argv[]) { 111 rand48seed( time( NULL ));103 rand48seed(0); 112 104 done = false; 113 105 processor p; -
src/tests/sched-int-disjoint.c
r33218c6 re0a653d 4 4 #include <thread> 5 5 6 static const unsigned long N = 10_000ul; 7 8 #ifndef PREEMPTION_RATE 9 #define PREEMPTION_RATE 10_000ul 6 #ifndef N 7 #define N 10_000 10 8 #endif 11 12 unsigned int default_preemption() {13 return PREEMPTION_RATE;14 }15 9 16 10 enum state_t { WAIT, SIGNAL, BARGE }; -
src/tests/sched-int-wait.c
r33218c6 re0a653d 5 5 #include <thread> 6 6 7 static const unsigned long N = 10_000ul; 8 9 #ifndef PREEMPTION_RATE 10 #define PREEMPTION_RATE 10_000ul 7 #ifndef N 8 #define N 10_000 11 9 #endif 12 13 unsigned int default_preemption() {14 return PREEMPTION_RATE;15 }16 10 17 11 monitor global_t {}; … … 120 114 int main(int argc, char* argv[]) { 121 115 waiter_left = 4; 122 processor p [2];116 processor p; 123 117 sout | "Starting" | endl; 124 118 { -
src/tests/test.py
r33218c6 re0a653d 221 221 if retcode == TestResult.SUCCESS: result_txt = "Done" 222 222 elif retcode == TestResult.TIMEOUT: result_txt = "TIMEOUT" 223 else : result_txt = "ERROR code %d" % retcode223 else : result_txt = "ERROR" 224 224 else : 225 225 if retcode == TestResult.SUCCESS: result_txt = "PASSED" 226 226 elif retcode == TestResult.TIMEOUT: result_txt = "TIMEOUT" 227 else : result_txt = "FAILED with code %d" % retcode227 else : result_txt = "FAILED" 228 228 229 229 #print result with error if needed -
src/tests/vector/array.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:04:20 201713 // Update Count : 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Apr 27 17:26:04 2016 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef ARRAY_H 17 #define ARRAY_H 17 18 18 19 //#include <iterator> … … 44 45 elt_type * end( array_type * array ); 45 46 47 #endif // ARRAY_H 48 46 49 // Local Variables: // 47 50 // tab-width: 4 // -
src/tests/vector/vector_int.h
r33218c6 re0a653d 9 9 // Author : Richard C. Bilson 10 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 10:04:02 201713 // Update Count : 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Apr 27 17:26:59 2016 13 // Update Count : 2 14 14 // 15 15 16 #pragma once 16 #ifndef VECTOR_INT_H 17 #define VECTOR_INT_H 17 18 18 19 // A flexible array, similar to a C++ vector, that holds integers and can be resized dynamically … … 25 26 26 27 void ?{}( vector_int * ); // allocate vector with default capacity 27 void ?{}( vector_int *, int reserve ); // allocate vector with specified capacity28 void ?{}( vector_int * vec, vector_int other ); // copy constructor28 void ?{}( vector_int *, int reserve ); // allocate vector with specified capacity 29 void ?{}( vector_int * vec, vector_int other ); // copy constructor 29 30 void ^?{}( vector_int * ); // deallocate vector's storage 30 31 … … 35 36 36 37 lvalue int ?[?]( vector_int * vec, int index ); // access to arbitrary element (does not resize) 37 int last( vector_int * vec ); // return last element 38 int last( vector_int * vec ); // return last element 39 40 #endif // VECTOR_INT_H 38 41 39 42 // Local Variables: // -
tools/cfa.nanorc
r33218c6 re0a653d 8 8 9 9 # Types 10 color green "\<(forall| trait|(o|d|f|t)type|mutex|_Bool|volatile|virtual)\>"10 color green "\<(forall|otype|dtype|ftype|trait|mutex|_Bool|volatile)\>" 11 11 color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|auto)\>" 12 12 color green "\<(static|const|struct|union|typedef|extern|(un)?signed|inline)\>" … … 14 14 15 15 # Declarations 16 color brightgreen "\<(struct|union|typedef|trait|coroutine|monitor|thread)\>" 17 color brightgreen "\<(with)\>" 16 color brightgreen "\<(struct|union|typedef|trait|coroutine|monitor)\>" 18 17 19 18 # Control Flow Structures -
tools/prettyprinter/ParserTypes.h
r33218c6 re0a653d 13 13 // Created On : Sun Dec 16 15:00:49 2001 14 14 // Last Modified By : Peter A. Buhr 15 // Last Modified On : Sat Jul 22 10:13:09201716 // Update Count : 17 515 // Last Modified On : Wed Jun 28 22:59:27 2017 16 // Update Count : 174 17 17 // 18 18 19 #pragma once 19 #ifndef __PARSER_HH__ 20 #define __PARSER_HH__ 20 21 21 22 int yylex(); … … 25 26 #include "token.h" 26 27 28 #endif // __PARSER_HH__ 29 27 30 // Local Variables: // 28 31 // mode: c++ // -
tools/prettyprinter/filter.h
r33218c6 re0a653d 10 10 // Created On : Tue Apr 9 22:31:18 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 10:12:55201713 // Update Count : 1 112 // Last Modified On : Thu Jun 29 08:28:32 2017 13 // Update Count : 10 14 14 // 15 15 16 #pragma once 16 #ifndef __FILTER_H__ 17 #define __FILTER_H__ 17 18 18 19 #include "ParserTypes.h" … … 27 28 void HTML( Token * tree ); 28 29 30 #endif // __FILTER_H__ 31 29 32 // Local Variables: // 30 33 // mode: c++ // -
tools/prettyprinter/lex.ll
r33218c6 re0a653d 1 /* 1 /* -*- Mode: C -*- 2 * 2 3 * Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 4 * … … 10 11 * Created On : Sat Dec 15 11:45:59 2001 11 12 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Fri Jul 21 23:06:16201713 * Update Count : 25 413 * Last Modified On : Wed Jun 28 22:57:17 2017 14 * Update Count : 253 14 15 */ 15 16 -
tools/prettyprinter/test.y
r33218c6 re0a653d 15 15 ; 16 16 17 rules1 : 18 /* empty */ 19 {} 17 rules1 : /* empty */ 20 18 | xxx 21 19 /* fred */ yyy -
tools/prettyprinter/token.cc
r33218c6 re0a653d 1 // -*- Mode: C++ -*- 1 2 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 3 // Copyright (C) Peter A. Buhr 2017 6 4 // 7 5 // Pretty Printer, Copyright (C) Richard C. Bilson and Rodolfo G. Esteves 2001 … … 12 10 // Created On : Wed Jun 28 22:46:23 2017 13 11 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Fri Jul 21 23:07:04201715 // Update Count : 1012 // Last Modified On : Thu Jun 29 09:33:49 2017 13 // Update Count : 9 16 14 // 17 15 -
tools/prettyprinter/token.h
r33218c6 re0a653d 10 10 // Created On : Wed Jun 28 22:47:58 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 10:12:42201713 // Update Count : 612 // Last Modified On : Wed Jun 28 23:02:06 2017 13 // Update Count : 5 14 14 // 15 15 16 #pragma once 16 #ifndef __TOKEN_H__ 17 #define __TOKEN_H__ 17 18 18 19 struct Token { … … 34 35 }; 35 36 37 #endif // __TOKEN_H__ 38 36 39 // Local Variables: // 37 40 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.