Changes in / [32cab5b:b2fe1c9]


Ignore:
Files:
4 added
246 deleted
113 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    r32cab5b rb2fe1c9  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Mon Mar 19 17:18:23 2018
    14 %% Update Count     : 379
     13%% Last Modified On : Sat Feb 17 21:58:43 2018
     14%% Update Count     : 369
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    101101% index macros
    102102\newcommand{\italic}[1]{\emph{\hyperpage{#1}}}
    103 \newcommand{\Definition}[1]{\textbf{\hyperpage{#1}}}
     103\newcommand{\definition}[1]{\textbf{\hyperpage{#1}}}
    104104\newcommand{\see}[1]{\emph{see}~#1}
    105105
     
    114114\def\impl{\@bsphack\begingroup
    115115          \def\protect##1{\string##1\space}\@sanitize
    116           \@wrxref{|Definition}}
     116          \@wrxref{|definition}}
    117117\newcommand{\indexcode}[1]{{\lstinline$#1$}}
    118118\def\use{\@bsphack\begingroup
     
    124124    \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}
    125125%\newcommand{\use}[1]{\index{#1@{\lstinline$#1$}}}
    126 %\newcommand{\impl}[1]{\index{\protect#1@{\lstinline$\protect#1$}|Definition}}
     126%\newcommand{\impl}[1]{\index{\protect#1@{\lstinline$\protect#1$}|definition}}
    127127
    128128% inline text and lowercase index: \Index{inline and lowercase index text}
     
    148148% Latin abbreviation
    149149\newcommand{\abbrevFont}{\textit}                       % set empty for no italics
    150 \@ifundefined{eg}{
    151150\newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
    152151\newcommand*{\eg}{%
     
    154153                {\@ifnextchar{:}{\EG}%
    155154                        {\EG,\xspace}}%
    156 }}{}%
    157 \@ifundefined{ie}{
     155}%
    158156\newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
    159157\newcommand*{\ie}{%
     
    161159                {\@ifnextchar{:}{\IE}%
    162160                        {\IE,\xspace}}%
    163 }}{}%
    164 \@ifundefined{etc}{
     161}%
    165162\newcommand{\ETC}{\abbrevFont{etc}}
    166163\newcommand*{\etc}{%
    167164        \@ifnextchar{.}{\ETC}%
    168165        {\ETC.\xspace}%
    169 }}{}%
    170 \@ifundefined{etal}{
     166}%
    171167\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
    172168\newcommand*{\etal}{%
    173169        \@ifnextchar{.}{\protect\ETAL}%
    174170                {\protect\ETAL.\xspace}%
    175 }}{}%
    176 \@ifundefined{viz}{
     171}%
    177172\newcommand{\VIZ}{\abbrevFont{viz}}
    178173\newcommand*{\viz}{%
    179174        \@ifnextchar{.}{\VIZ}%
    180175                {\VIZ.\xspace}%
    181 }}{}%
     176}%
    182177\makeatother
    183178
  • doc/LaTeXmacros/lstlang.sty

    r32cab5b rb2fe1c9  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Fri Apr  6 23:44:50 2018
    11 %% Update Count     : 20
     10%% Last Modified On : Wed Aug 30 22:11:14 2017
     11%% Update Count     : 14
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    3131\lstdefinelanguage{sml} {
    3232        morekeywords= {
    33                 EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before,
    34                 bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor,
    35                 handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op,
    36                 open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature,
    37                 string, struct, structure, substring, then, true, type, unit, val, vector, where, while,
    38                 with, withtype, word
    39     },
    40     morestring=[b]",
    41     morecomment=[s]{(*}{*)},
     33                EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before, bool,
     34                case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor, handle,
     35                if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op, open,
     36                option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature, string, struct,
     37                structure, substring, then, true, type, unit, val, vector, where, while, with, withtype, word
     38        },
     39        morestring=[b]",
     40        morecomment=[s]{(*}{*)},
    4241}
    4342
     
    8382
    8483\lstdefinelanguage{rust}{
    85         % Keywords
    8684        morekeywords=[1]{
    8785                abstract, alignof, as, become, box, break, const, continue, crate, do, else, enum, extern,
    88                 false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
    89                 override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
    90                 trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
     86        false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
     87        override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
     88        trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
    9189        },
    92         % Strings
    9390        morestring=[b]{"},
    94         % Comments
    9591        comment=[l]{//},
    9692        morecomment=[s]{/*}{*/},
    97         % Options
    9893        sensitive=true
    9994}
    10095
    101 \lstdefinelanguage{pseudo}{
     96\lstdefinelanguage{Pseudo}{
    10297        morekeywords={string,uint,int,bool,float},
    10398        sensitive=true,
     
    112107\lstdefinelanguage{CFA}[ANSI]{C}{
    113108        morekeywords={
    114                 _Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, __attribute, __attribute__,
    115                 auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__, __const, __const__,
    116                 coroutine, disable, dtype, enable, __extension__, exception, fallthrough, fallthru, finally,
    117                 __float80, float80, __float128, float128, forall, ftype, _Generic, _Imaginary, __imag, __imag__,
    118                 inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
    119                 otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, thread,
    120                 _Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,
    121                 virtual, __volatile, __volatile__, waitfor, when, with, zero_t,
    122     },
     109                _Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, _At, __attribute,
     110                __attribute__, auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__,
     111                __const, __const__, disable, dtype, enable, __extension__, fallthrough, fallthru,
     112                finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t,
     113                otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof,
     114                __typeof__, virtual, with, zero_t},
     115        morekeywords=[2]{
     116                _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex, or,
     117                resume, suspend, thread, _Thread_local, waitfor, when, yield},
    123118        moredirectives={defined,include_next}%
    124119}
  • doc/bibliography/pl.bib

    r32cab5b rb2fe1c9  
    780780    title       = {Boost Coroutine Library},
    781781    year        = 2015,
    782     howpublished= {\href{http://www.boost.org/doc/libs/1_61_0/libs/coroutine/doc/html/index.html}
    783                   {{http://www.boost.org/\-doc/\-libs/1\_61\_0/\-libs/\-coroutine/\-doc/\-html/\-index.html}}},
    784     note        = {Accessed: 2016-09},
     782    note        = {\href{http://www.boost.org/doc/libs/1_61_0/libs/coroutine/doc/html/index.html}
     783                  {{http://www.boost.org/\-doc/\-libs/1\_61\_0/\-libs/\-coroutine/\-doc/\-html/\-index.html}} [Accessed September 2016]},
    785784}
    786785
     
    866865    keywords    = {ISO/IEC C 11},
    867866    contributer = {pabuhr@plg},
    868     key         = {C11},
    869     title       = {C Programming Language {ISO/IEC} 9889:2011-12},
     867    author      = {C11},
     868    title       = {Programming Languages -- {C} {ISO/IEC} 9889:2011-12},
    870869    edition     = {3rd},
    871870    publisher   = {International Standard Organization},
     
    874873}
    875874
    876 @manual{C++Concepts,
     875@techreport{C++Concepts,
     876    type        = {International Standard},
    877877    keywords    = {ISO/IEC TS 19217:2015},
    878878    contributer = {a3moss@uwaterloo.ca},
    879879    key         = {Concepts},
    880     title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming language -- Extensions for concepts {ISO/IEC} {TS} 19217:2015},
     880    title       = {Information technology -- Programming languages -- {C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Extensions for concepts {ISO/IEC} {TS} 19217:2015},
    881881    publisher   = {International Standard Organization},
    882882    address     = {\href{https://www.iso.org/standard/64031.html}{https://\-www.iso.org/\-standard/\-64031.html}},
    883     year        = 2015,
     883    year        = 2015
    884884}
    885885
    886886@misc{Cforall,
    887887    key         = {Cforall},
    888     title       = {\textsf{C}{$\mathbf{\forall}$} Features},
     888    title       = {C$\forall$ Features},
    889889    howpublished= {\url{https://plg.uwaterloo.ca/~cforall/features}},
    890890    note        = {Accessed: 2018-01-01},
     
    895895    contributer = {pabuhr@plg},
    896896    author      = {Rodolfo Gabriel Esteves},
    897     title       = {\textsf{C}$\mathbf{\forall}$, a Study in Evolutionary Design in Programming Languages},
     897    title       = {C$\forall$, a Study in Evolutionary Design in Programming Languages},
    898898    school      = {School of Computer Science, University of Waterloo},
    899899    year        = 2004,
     
    10221022}
    10231023
    1024 @inproceedings{Necula02,
    1025     author      = {Necula, George C. and McPeak, Scott and Weimer, Westley},
    1026     title       = {{CCured}: Type-safe Retrofitting of Legacy Code},
    1027     booktitle   = {Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
    1028     series      = {POPL '02},
    1029     year        = {2002},
    1030     location    = {Portland, Oregon},
    1031     pages       = {128-139},
    1032     publisher   = {ACM},
    1033     address     = {New York, NY, USA},
    1034 }
    1035 
    10361024@techreport{cforall-ug,
    10371025    keywords    = {cforall, user guide},
    10381026    contributer = {pabuhr@plg},
    10391027    author      = {Peter A. Buhr and Glen Ditchfield and David Till and Charles R. Zarnke},
    1040     title       = {\textsf{C}$\mathbf{\forall}$ Users Guide, Version 0.1},
     1028    title       = {{\mbox{\mdseries\sffamily C{$\mathbf{\forall}$}}}\ Users Guide, Version 0.1},
    10411029    institution = {Department of Computer Science, University of Waterloo},
    10421030    address     = {Waterloo, Ontario, Canada, N2L 3G1},
     
    11171105    title       = {Programming Languages -- {Cobol} ISO/IEC 1989:2014},
    11181106    edition     = {2nd},
    1119     institution = {International Standard Organization},
     1107    institution = {International Standard Organization},
    11201108    address     = {\href{https://www.iso.org/standard/51416.html}{https://\-www.iso.org/\-standard/\-51416.html}},
    11211109    year        = 2014,
     
    11291117    journal     = sigplan,
    11301118    year        = 1984,
    1131     month       = jun,
    1132     volume      = 19,
    1133     number      = 6,
    1134     pages       = {1-12},
     1119    month       = jun, volume = 19, number = 6, pages = {1-12},
    11351120    note        = {Proceedings of the ACM SIGPLAN '84 Symposium on Compiler Construction},
    11361121    abstract    = {
     
    15511536@mastersthesis{Delisle18,
    15521537    author      = {Thierry Delisle },
    1553     title       = {Concurrency in \textsf{C}$\mathbf{\forall}$},
     1538    title       = {Concurrency in {C}$\mathbf{\forall}$},
    15541539    school      = {School of Computer Science, University of Waterloo},
    15551540    year        = 2018,
     
    17171702    contributer = {a3moss@uwaterloo.ca},
    17181703    author      = {Glen Ditchfield},
    1719     title       = {Conversions for \textsf{C}$\mathbf{\forall}$},
     1704    title       = {Conversions for {Cforall}},
    17201705    note        = {\href{http://plg.uwaterloo.ca/~cforall/Conversions/index.html}{http://\-plg.uwaterloo.ca/\-\textasciitilde cforall/\-Conversions/\-index.html}},
    17211706    month       = {Nov},
     
    20041989
    20051990@book{Stroustrup94,
    2006     keywords    = {C++},
    2007     contributor = {wyrmok@plg},
    2008     author      = {Bjarne Stroustrup},
    2009     title       = {The Design and Evolution of {C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}}},
    2010     publisher   = {Addison-Wesley},
     1991    keywords    = {C++},
     1992    contributor = {wyrmok@plg},
     1993    author      = {Bjarne Stroustrup},
     1994    title       = {The Design and Evolution of {C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}}},
     1995    publisher   = {Addison-Wesley},
    20111996    address     = {Boston},
    2012     year        = 1994
     1997    year        = 1994
    20131998}
    20141999
     
    27532738}
    27542739
    2755 @misc{GCCExtensions,
     2740@online{GCCExtensions,
    27562741    contributer = {a3moss@uwaterloo.ca},
    27572742    key         = {{GNU}},
     
    27592744    title       = {Extensions to the {C} Language Family},
    27602745    year        = 2014,
    2761     howpublished= {\href{https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/C-Extensions.html}{https://\-gcc.gnu.org/\-onlinedocs/\-gcc-4.7.2/\-gcc/\-C\-Extensions.html}},
    2762     note        = {Accessed: 2017-04-02},
     2746    note        = {\href{https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/C-Extensions.html}{https://\-gcc.gnu.org/\-onlinedocs/\-gcc-4.7.2/\-gcc/\-C\-Extensions.html}},
     2747    urldate     = {2017-04-02}
    27632748}
    27642749
     
    30983083    keywords    = {GMP arbitrary-precision library},
    30993084    contributer = {pabuhr@plg},
    3100     key         = {GMP},
    31013085    title       = {{GNU} Multiple Precision Arithmetic Library},
    3102     address     = {GNU},
     3086    author      = {GMP},
     3087    organization= {GNU},
    31033088    year        = 2016,
    31043089    note        = {\href{https://gmplib.org}{https://\-gmplib.org}},
     
    31293114}
    31303115
    3131 @misc{GObject,
     3116@online{GObject,
    31323117    keywords    = {GObject},
    31333118    contributor = {a3moss@uwaterloo.ca},
    3134     key         = {GObject},
    3135     organization= {The {GNOME} Project},
    3136     title       = {{GO}bject Reference Manual},
     3119    author      = {{GObject}},
     3120    organization= {The GNOME Project},
     3121    title       = {{GObject} Reference Manual},
    31373122    year        = 2014,
    3138     howpublished= {https://developer.gnome.org/gobject/stable/},
    3139     note        = {Accessed: 2017-04},
     3123    url         = {https://developer.gnome.org/gobject/stable/},
     3124    urldate     = {2017-04-04}
    31403125}
    31413126
     
    33953380    contributer = {pabuhr@plg},
    33963381    author      = {Richard C. Bilson},
    3397     title       = {Implementing Overloading and Polymorphism in \textsf{C}$\mathbf{\forall}$},
     3382    title       = {Implementing Overloading and Polymorphism in Cforall},
    33983383    school      = {School of Computer Science, University of Waterloo},
    33993384    year        = 2003,
     
    36613646}
    36623647
    3663 @inproceedings{Pharr12,
    3664     title       = {ispc: A {SPMD} compiler for high-performance CPU programming},
    3665     author      = {Pharr, Matt and Mark, William R},
    3666     booktitle   = {Innovative Parallel Computing (InPar), 2012},
    3667     pages       = {1--13},
    3668     year        = {2012},
    3669     month       = may,
    3670     address     = {San Jose, CA, USA},
    3671     publisher   = {IEEE},
    3672 }
    3673 
    3674 @inproceedings{DeLozier13,
    3675     keywords    = {C++, local pointers, memory safety, type-safety},
    3676     author      = {DeLozier, Christian and Eisenberg, Richard and Nagarakatte, Santosh and Osera, Peter-Michael and Martin, Milo M.K. and Zdancewic, Steve},
    3677     title       = {{I}ronclad {C++}: A Library-augmented Type-safe Subset of {C++}},
    3678     booktitle   = {Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages \& Applications},
    3679     series      = {OOPSLA'13},
    3680     year        = {2013},
    3681     address     = {Indianapolis, Indiana, USA},
    3682     pages       = {287-304},
    3683     publisher   = {ACM},
    3684 }
    3685 
    36863648@inproceedings{Hibbard77,
    36873649    keywords    = {algol-68, concurrency},
     
    37253687                 
    37263688@book{Java,
    3727     keywords    = {Java},
    3728     contributer = {pabuhr@plg},
    3729     author      = {James Gosling and Bill Joy and Guy Steele and Gilad Bracha},
    3730     title       = {The {Java} Language Specification},
     3689    keywords    = {Java},
     3690    contributer = {pabuhr@plg},
     3691    author      = {James Gosling and Bill Joy and Guy Steele and Gilad Bracha},
     3692    title       = {The {Java} Language Specification},
    37313693    publisher   = {Addison-Wesley},
    37323694    address     = {Reading},
    3733     year        = 2000,
     3695    year        = 2000,
    37343696    edition     = {2nd},
    37353697}
    37363698
    37373699@manual{Java8,
    3738     keywords    = {Java SE 8},
    3739     contributer = {pabuhr@plg},
    3740     author      = {James Gosling and Bill Joy and Guy Steele and Gilad Bracha and Alex Buckley},
    3741     title       = {{Java} Language Specification},
     3700    keywords    = {Java SE 8},
     3701    contributer = {pabuhr@plg},
     3702    author      = {James Gosling and Bill Joy and Guy Steele and Gilad Bracha and Alex Buckley},
     3703    title       = {{Java} Language Specification},
    37423704    publisher   = {Oracle},
    3743     year        = 2015,
    3744     edition     = {{J}ava {SE} 8},
     3705    year        = 2015,
     3706    edition     = {Java SE 8},
    37453707}
    37463708
     
    46774639}
    46784640
    4679 @misc{obj-c-book,
     4641@manual{obj-c-book,
    46804642    keywords    = {objective-c},
    46814643    contributor = {a3moss@uwaterloo.ca},
    4682     key         = {Objective-C},
    4683     title       = {Objective-C},
    4684     publisher   = {Apple Inc.},
    4685     year        = 2015,
    4686     howpublished= {\href{https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/ObjectiveC.html}{https://developer.apple.com/\-library/\-content/\-documentation/\-General/\-Conceptual/\-DevPedia-\-CocoaCore/\-ObjectiveC.html}},
    4687     note        = {Accessed: 2018-03}
    4688 }
    4689 
    4690 @misc{xcode7,
     4644    author      = {{Objective-C}},
     4645    title       = {The {Objective-C} Programming Language},
     4646    organization= {Apple Computer Inc.},
     4647    address     = {Cupertino, CA},
     4648    year        = 2003
     4649}
     4650
     4651@online{xcode7,
    46914652    keywords    = {objective-c},
    46924653    contributor = {a3moss@uwaterloo.ca},
    4693     key         = {Xcode},
    4694     title       = {{X}code 7 Release Notes},
     4654    author      = {{Xcode}},
     4655    title       = {{Xcode} 7 Release Notes},
    46954656    year        = 2015,
    4696     howpublished= {\href{https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html}{https://developer.apple.com/\-library/\-content/\-documentation/\-Xcode/\-Conceptual/\-RN-Xcode-Archive/\-Chapters/\-xc7\_release\_notes.html}},
    4697     note        = {Accessed: 2017-04}
     4657    note        = {\href{https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html}{https://developer.apple.com/\-library/\-content/\-documentation/\-Xcode/\-Conceptual/\-RN-Xcode-Archive/\-Chapters/\-xc7\_release\_notes.html}},
     4658    urldate     = {2017-04-04}
    46984659}
    46994660
     
    52355196    year        = 1984,
    52365197    series      = {Computers and their Applications},
    5237     address     = {Market Cross House, Cooper Street, Chichester, West Sussex, PO19 1EB, England},
     5198    address     = {Market Cross House, Cooper Street, Chichester, West Sussex,
     5199        PO19 1EB, England},
    52385200    summary     = {
    52395201        The principles of Procedural Abstraction, Data Type Completeness,
     
    52875249}
    52885250
    5289 @inproceedings{Rafkind09,
    5290     keywords    = {accurate, C programming language, conservative, garbage collection, precise},
    5291     contributer = {pabuhr@plg},
    5292     author      = {Rafkind, Jon and Wick, Adam and Regehr, John and Flatt, Matthew},
    5293     title       = {Precise Garbage Collection for C},
    5294     booktitle   = {Proceedings of the 2009 International Symposium on Memory Management},
    5295     series      = {ISMM '09},
    5296     year        = {2009},
    5297     location    = {Dublin, Ireland},
    5298     pages       = {39-48},
    5299     publisher   = {ACM},
    5300     address     = {New York, NY, USA},
     5251@book{PowerPC,
     5252    key         = {PowerPC processor},
     5253    title       = {Programming Environments Manual for 32-Bit Implementations of the PowerPC ArchitectureARM Architecture},
     5254    publisher   = {Freescale Semiconductor},
     5255    volume      = {MPCFPE32B},
     5256    edition     = {Rev. 3},
     5257    month       = 9,
     5258    year        = 2005,
    53015259}
    53025260
     
    53715329
    53725330@article{psa:persistence,
    5373     keywords    = {persistence, first-class procedures, closure, PS-Algol, Abstract Data Types},
     5331    keywords    = {persistence, first-class procedures, closure, PS-Algol,
     5332        Abstract Data Types},
    53745333    contributer = {gjditchfield@plg},
    53755334    author      = {Malcolm P. Atkinson and Ronald Morrison},
     
    54025361
    54035362@article{Procol89,
    5404     keywords    = {active objects, object-oriented languages, object-based languages, explicit per-object protocol},
     5363    keywords    = {active objects, object-oriented languages,
     5364        object-based languages, explicit per-object protocol},
    54055365    contributer = {akgoel@plg},
    54065366    author      = {Jan van den Bos and Chris Laffra},
     
    54165376}
    54175377
    5418 @book{PowerPC,
    5419     key         = {PowerPC processor},
    5420     title       = {Programming Environments Manual for 32-Bit Implementations of the PowerPC ArchitectureARM Architecture},
    5421     publisher   = {Freescale Semiconductor},
    5422     volume      = {MPCFPE32B},
    5423     edition     = {Rev. 3},
    5424     month       = 9,
    5425     year        = 2005,
    5426 }
    5427 
    54285378@book{Butenhof97,
    54295379    keywords    = {PThreads, concurrency},
     
    54725422    contributer = {pabuhr@plg},
    54735423    key         = {C++98},
    5474     title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:1998},
    5475     edition     = {1st},
    5476     publisher   = {International Standard Organization},
    5477     address     = {\href{https://www.iso.org/standard/25845.html}{https://\-www.iso.org/\-standard/\-25845.html}},
     5424    title       = {Programming Languages -- {C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}}},
     5425    organization= {International Standard ISO/IEC 14882:1998 (E)},
     5426    publisher   = {American National Standards Institute},
     5427    address     = {www.ansi.org},
    54785428    year        = 1998,
    54795429}
     
    54825432    keywords    = {ISO/IEC C++ 14},
    54835433    contributer = {pabuhr@plg},
    5484     key         = {C++14},
    5485     title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:2014},
     5434    author      = {C++14},
     5435    title       = {Programming Languages -- {C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} ISO/IEC 14882:2014},
    54865436    edition     = {4th},
    54875437    publisher   = {International Standard Organization},
     
    59285878
    59295879@mastersthesis{Schluntz17,
    5930     keywords    = {constructors, destructors, tuples},
    59315880    author      = {Robert Schluntz},
    5932     title       = {Resource Management and Tuples in \textsf{C}$\mathbf{\forall}$},
     5881    title       = {Resource Management and Tuples in {C}$\mathbf{\forall}$},
    59335882    school      = {School of Computer Science, University of Waterloo},
    59345883    year        = 2017,
     
    60075956    keywords    = {Rust programming language},
    60085957    contributer = {pabuhr@plg},
    6009     key         = {Rust},
    6010     title       = {The {R}ust Programming Language},
    6011     address     = {The Rust Project Developers},
     5958    author      = {{Rust}},
     5959    title       = {The {Rust} Programming Language},
     5960    organization= {The Rust Project Developers},
    60125961    year        = 2015,
    60135962    note        = {\href{https://doc.rust-lang.org/reference.html}{https://\-doc.rust-lang\-.org/\-reference.html}},
     
    60195968    keywords    = {Scala programming language},
    60205969    contributer = {pabuhr@plg},
    6021     key         = {Scala},
    6022     title       = {{S}cala Language Specification, Version 2.11},
    6023     address     = {\'{E}cole Polytechnique F\'{e}d\'{e}rale de Lausanne},
     5970    author      = {{Scala}},
     5971    title       = {{Scala} Language Specification, Version 2.11},
     5972    organization= {\'{E}cole Polytechnique F\'{e}d\'{e}rale de Lausanne},
    60245973    year        = 2016,
    60255974    note        = {\href{http://www.scala-lang.org/files/archive/spec/2.11}{http://\-www.scala-lang.org/\-files/\-archive/\-spec/\-2.11}},
     
    61016050    number      = 12,
    61026051    pages       = {66-76},
    6103 }
    6104 
    6105 @article{Nickolls08,
    6106     author      = {Nickolls, John and Buck, Ian and Garland, Michael and Skadron, Kevin},
    6107     title       = {Scalable Parallel Programming with CUDA},
    6108     journal     = {Queue},
    6109     volume      = {6},
    6110     number      = {2},
    6111     month       = mar,
    6112     year        = 2008,
    6113     pages       = {40-53},
    6114     publisher   = {ACM},
    6115     address     = {New York, NY, USA},
    6116 }
    6117 
    6118 @inproceedings{Leissa14,
    6119     title       = {{S}ierra: a {SIMD} extension for {C}++},
    6120     author      = {Lei{\ss}a, Roland and Haffner, Immanuel and Hack, Sebastian},
    6121     booktitle   = {Proceedings of the 2014 Workshop on Workshop on programming models for SIMD/Vector processing},
    6122     pages       = {17-24},
    6123     year        = {2014},
    6124     organization= {ACM}
    61256052}
    61266053
     
    63656292@article{Smith98,
    63666293    keywords    = {Polymorphic C},
    6367     contributor = {a3moss@uwaterloo.ca},
    6368     title       = {A sound polymorphic type system for a dialect of {C}},
     6294    contributor = {a3moss@uwaterloo.ca},
     6295    title       = {A sound polymorphic type system for a dialect of C},
    63696296    author      = {Smith, Geoffrey and Volpano, Dennis},
    63706297    journal     = {Science of computer programming},
     
    64746401}
    64756402
    6476 @misc{Sutter15,
     6403@online{Sutter15,
    64776404    contributer = {pabuhr@plg},
    64786405    author      = {Herb Sutter and Bjarne Stroustrup and Gabriel Dos Reis},
     
    64816408    month       = oct,
    64826409    year        = 2015,
    6483     pages       = {1-6},
     6410    pages       = {1--6},
    64846411    numpages    = {6},
    6485     howpublished= {\href{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0144r0.pdf}{http://\-www.open-std.org/\-jtc1/\-sc22/\-wg21/\-docs/\-papers/\-2015/\-p0144r0.pdf}},
     6412    note        = {\href{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0144r0.pdf}{http://\-www.open-std.org/\-jtc1/\-sc22/\-wg21/\-docs/\-papers/\-2015/\-p0144r0.pdf}},
    64866413}
    64876414
     
    67576684}
    67586685
    6759 @misc{TIOBE,
    6760     contributer = {pabuhr@plg},
    6761     key         = {TIOBE Index},
    6762     title       = {{TIOBE} Index},
    6763     howpublished= {\href{http://www.tiobe.com/tiobe_index}{http://\-www.tiobe.com/\-tiobe\_index}},
    6764     note        = {Accessed: 2018-09},
     6686@online{TIOBE,
     6687    contributer = {pabuhr@plg},
     6688    author      = {{TIOBE Index}},
     6689    year        = {February 2018},
     6690    url         = {http://www.tiobe.com/tiobe_index},
    67656691}
    67666692
     
    67736699    month       = sep,
    67746700    year        = 1990,
     6701    note        = {}
    67756702}
    67766703
     
    70797006}
    70807007
    7081 @misc{Vala,
     7008@online{Vala,
    70827009    keywords    = {GObject, Vala},
    70837010    contributor = {a3moss@uwaterloo.ca},
    7084     key         = {Vala},
    7085     organization= {The {GNOME} Project},
    7086     title       = {{V}ala Reference Manual},
     7011    author      = {{Vala}},
     7012    organization= {The GNOME Project},
     7013    title       = {Vala Reference Manual},
    70877014    year        = 2017,
    7088     howpublished= {\url{https://wiki.gnome.org/Projects/Vala/Manual}},
    7089     note        = {Accessed: 2017-04}
     7015    url         = {https://wiki.gnome.org/Projects/Vala/Manual},
     7016    urldate     = {2017-04-04}
    70907017}
    70917018
  • doc/papers/concurrency/.gitignore

    r32cab5b rb2fe1c9  
    33*.pdf
    44*.ps
    5 
    6 Paper.out.ps
    7 WileyNJD-AMA.bst
  • doc/papers/concurrency/Makefile

    r32cab5b rb2fe1c9  
    33Build = build
    44Figures = figures
    5 Macros = AMA/AMA-stix/ama
    6 TeXLIB = .:annex:../../LaTeXmacros:${Macros}:${Build}:../../bibliography:
     5Macros = ../../LaTeXmacros
     6TeXLIB = .:style:annex:${Macros}:${Build}:../../bibliography:
    77LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
    88BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
    99
    10 MAKEFLAGS = --no-print-directory # --silent
     10MAKEFLAGS = --no-print-directory --silent #
    1111VPATH = ${Build} ${Figures}
    1212
     
    4040
    4141DOCUMENT = Paper.pdf
    42 BASE = ${basename ${DOCUMENT}}
    4342
    4443# Directives #
     
    4948
    5049clean :
    51         @rm -frv ${DOCUMENT} ${BASE}.ps WileyNJD-AMA.bst ${BASE}.out.ps ${Build}
     50        @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build}
    5251
    5352# File Dependencies #
    5453
    55 ${DOCUMENT} : ${BASE}.ps
     54${DOCUMENT} : ${basename ${DOCUMENT}}.ps
    5655        ps2pdf $<
    5756
    58 ${BASE}.ps : ${BASE}.dvi
     57${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi
    5958        dvips ${Build}/$< -o $@
    6059
    61 ${BASE}.dvi : Makefile ${Build} ${BASE}.out.ps WileyNJD-AMA.bst ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
    62                 annex/local.bib ../../bibliography/pl.bib
     60${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     61                ${Macros}/common.tex ${Macros}/indexstyle annex/local.bib ../../bibliography/pl.bib
    6362        # Must have *.aux file containing citations for bibtex
    6463        if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi
    65         ${BibTeX} ${Build}/${basename $@}
     64        -${BibTeX} ${Build}/${basename $@}
    6665        # Some citations reference others so run again to resolve these citations
    6766        ${LaTeX} ${basename $@}.tex
    68         ${BibTeX} ${Build}/${basename $@}
     67        -${BibTeX} ${Build}/${basename $@}
    6968        # Run again to finish citations
    7069        ${LaTeX} ${basename $@}.tex
     
    7473${Build}:
    7574        mkdir -p ${Build}
    76 
    77 ${BASE}.out.ps:
    78         ln -fs build/Paper.out.ps .
    79 
    80 WileyNJD-AMA.bst:
    81         ln -fs AMA/AMA-stix/ama/WileyNJD-AMA.bst .
    8275
    8376%.tex : %.fig
  • doc/papers/concurrency/Paper.tex

    r32cab5b rb2fe1c9  
    1 \documentclass[AMA,STIX1COL]{WileyNJD-v2}
    2 
    3 \articletype{RESEARCH ARTICLE}%
    4 
    5 \received{26 April 2016}
    6 \revised{6 June 2016}
    7 \accepted{6 June 2016}
    8 
    9 \raggedbottom
     1% inline code ©...© (copyright symbol) emacs: C-q M-)
     2% red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
     3% blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
     4% green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
     5% LaTex escape §...§ (section symbol) emacs: C-q M-'
     6% keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
     7% math escape $...$ (dollar symbol)
     8
     9\documentclass[10pt]{article}
    1010
    1111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1212
    1313% Latex packages used in the document.
     14\usepackage[T1]{fontenc}                                        % allow Latin1 (extended ASCII) characters
     15\usepackage{textcomp}
     16\usepackage[latin1]{inputenc}
     17\usepackage{fullpage,times,comment}
    1418\usepackage{epic,eepic}
     19\usepackage{upquote}                                            % switch curled `'" to straight
     20\usepackage{calc}
    1521\usepackage{xspace}
    16 \usepackage{comment}
    17 \usepackage{upquote}                                            % switch curled `'" to straight
     22\usepackage[labelformat=simple]{subfig}
     23\renewcommand{\thesubfigure}{(\alph{subfigure})}
     24\usepackage{graphicx}
     25\usepackage{tabularx}
     26\usepackage{multicol}
     27\usepackage{varioref}
    1828\usepackage{listings}                                           % format program code
    19 \usepackage[labelformat=simple,aboveskip=0pt,farskip=0pt]{subfig}
    20 \renewcommand{\thesubfigure}{(\alph{subfigure})}
     29\usepackage[flushmargin]{footmisc}                              % support label/reference in footnote
     30\usepackage{latexsym}                                           % \Box glyph
     31\usepackage{mathptmx}                                           % better math font with "times"
     32\usepackage[usenames]{color}
     33\usepackage[pagewise]{lineno}
     34\renewcommand{\linenumberfont}{\scriptsize\sffamily}
     35\usepackage{fancyhdr}
     36\usepackage{float}
    2137\usepackage{siunitx}
    2238\sisetup{ binary-units=true }
    23 %\input{style}                                                          % bespoke macros used in the document
    24 
    25 \hypersetup{breaklinks=true}
    26 \definecolor{OliveGreen}{cmyk}{0.64 0 0.95 0.40}
    27 \definecolor{Mahogany}{cmyk}{0 0.85 0.87 0.35}
    28 \definecolor{Plum}{cmyk}{0.50 1 0 0}
    29 
    30 \usepackage[pagewise]{lineno}
    31 \renewcommand{\linenumberfont}{\scriptsize\sffamily}
    32 
    33 \lefthyphenmin=4                                                        % hyphen only after 4 characters
    34 \righthyphenmin=4
     39\input{style}                                                   % bespoke macros used in the document
     40\usepackage{url}
     41\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
     42\usepackage{breakurl}
     43\urlstyle{rm}
     44
     45\setlength{\topmargin}{-0.45in}                         % move running title into header
     46\setlength{\headsep}{0.25in}
    3547
    3648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    3850% Names used in the document.
    3951
    40 \newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name
    41 \newcommand{\CFA}{\protect\CFAIcon}             % safe for section/caption
    42 \newcommand{\CFL}{\textrm{Cforall}\xspace}      % Cforall symbolic name
    43 \newcommand{\Celeven}{\textrm{C11}\xspace}      % C11 symbolic name
    44 \newcommand{\CC}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name
    45 \newcommand{\CCeleven}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name
    46 \newcommand{\CCfourteen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}14\xspace} % C++14 symbolic name
    47 \newcommand{\CCseventeen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name
    48 \newcommand{\CCtwenty}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name
    49 \newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name
    50 
    51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     52\newcommand{\Version}{1.0.0}
     53\newcommand{\CS}{C\raisebox{-0.9ex}{\large$^\sharp$}\xspace}
    5254
    5355\newcommand{\Textbf}[2][red]{{\color{#1}{\textbf{#2}}}}
     
    6062\newcommand{\TODO}{{\Textbf{TODO}}}
    6163
     64
     65\newsavebox{\LstBox}
     66
    6267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    6368
    64 % Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
    65 % removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR
    66 % AFTER HYPERREF.
    67 %\DeclareTextCommandDefault{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}
    68 \renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
    69 
    70 \makeatletter
    71 % parindent is relative, i.e., toggled on/off in environments like itemize, so store the value for
    72 % use rather than use \parident directly.
    73 \newlength{\parindentlnth}
    74 \setlength{\parindentlnth}{\parindent}
    75 
    76 \newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{\lst@basicstyle{#1}}}}
    77 \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}}
    78 \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}}
    79 
    80 \newlength{\gcolumnposn}                                        % temporary hack because lstlisting does not handle tabs correctly
    81 \newlength{\columnposn}
    82 \setlength{\gcolumnposn}{3.5in}
    83 \setlength{\columnposn}{\gcolumnposn}
    84 \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}}}}
    85 \newcommand{\CRT}{\global\columnposn=\gcolumnposn}
    86 
    87 % Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}.
    88 % The option parameter provides an index term different from the new term, e.g., \newterm[\texttt{abc}]{abc}
    89 % The star version does not lowercase the index information, e.g., \newterm*{IBM}.
    90 \newcommand{\newtermFontInline}{\emph}
    91 \newcommand{\newterm}{\@ifstar\@snewterm\@newterm}
    92 \newcommand{\@newterm}[2][\@empty]{\lowercase{\def\temp{#2}}{\newtermFontInline{#2}}\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi}
    93 \newcommand{\@snewterm}[2][\@empty]{{\newtermFontInline{#2}}\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
    94 
    95 % Latin abbreviation
    96 \newcommand{\abbrevFont}{\textit}                       % set empty for no italics
    97 \@ifundefined{eg}{
    98 \newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
    99 \newcommand*{\eg}{%
    100         \@ifnextchar{,}{\EG}%
    101                 {\@ifnextchar{:}{\EG}%
    102                         {\EG,\xspace}}%
    103 }}{}%
    104 \@ifundefined{ie}{
    105 \newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
    106 \newcommand*{\ie}{%
    107         \@ifnextchar{,}{\IE}%
    108                 {\@ifnextchar{:}{\IE}%
    109                         {\IE,\xspace}}%
    110 }}{}%
    111 \@ifundefined{etc}{
    112 \newcommand{\ETC}{\abbrevFont{etc}}
    113 \newcommand*{\etc}{%
    114         \@ifnextchar{.}{\ETC}%
    115         {\ETC.\xspace}%
    116 }}{}%
    117 \@ifundefined{etal}{
    118 \newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
    119 \newcommand*{\etal}{%
    120         \@ifnextchar{.}{\protect\ETAL}%
    121                 {\protect\ETAL.\xspace}%
    122 }}{}%
    123 \@ifundefined{viz}{
    124 \newcommand{\VIZ}{\abbrevFont{viz}}
    125 \newcommand*{\viz}{%
    126         \@ifnextchar{.}{\VIZ}%
    127                 {\VIZ.\xspace}%
    128 }}{}%
    129 \makeatother
    130 
    131 \newenvironment{cquote}{%
    132         \list{}{\lstset{resetmargins=true,aboveskip=0pt,belowskip=0pt}\topsep=3pt\parsep=0pt\leftmargin=\parindentlnth\rightmargin\leftmargin}%
    133         \item\relax
    134 }{%
    135         \endlist
    136 }% cquote
    137 
    138 % CFA programming language, based on ANSI C (with some gcc additions)
    139 \lstdefinelanguage{CFA}[ANSI]{C}{
    140         morekeywords={
    141                 _Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, __attribute, __attribute__,
    142                 auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__, __const, __const__,
    143                 coroutine, disable, dtype, enable, __extension__, exception, fallthrough, fallthru, finally,
    144                 __float80, float80, __float128, float128, forall, ftype, _Generic, _Imaginary, __imag, __imag__,
    145                 inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
    146                 otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, thread,
    147                 _Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,
    148                 virtual, __volatile, __volatile__, waitfor, when, with, zero_t},
    149         moredirectives={defined,include_next}%
    150 }
    151 
    152 \lstset{
    153 language=CFA,
    154 columns=fullflexible,
    155 basicstyle=\linespread{0.9}\sf,                                                 % reduce line spacing and use sanserif font
    156 stringstyle=\tt,                                                                                % use typewriter font
    157 tabsize=5,                                                                                              % N space tabbing
    158 xleftmargin=\parindentlnth,                                                             % indent code to paragraph indentation
    159 %mathescape=true,                                                                               % LaTeX math escape in CFA code $...$
    160 escapechar=\$,                                                                                  % LaTeX escape in CFA code
    161 keepspaces=true,                                                                                %
    162 showstringspaces=false,                                                                 % do not show spaces with cup
    163 showlines=true,                                                                                 % show blank lines at end of code
    164 aboveskip=4pt,                                                                                  % spacing above/below code block
    165 belowskip=3pt,
    166 % replace/adjust listing characters that look bad in sanserif
    167 literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
    168         {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    169         {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.5ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex{\textgreater}}2,
    170 moredelim=**[is][\color{red}]{`}{`},
    171 }% lstset
    172 
    173 % uC++ programming language, based on ANSI C++
    174 \lstdefinelanguage{uC++}[ANSI]{C++}{
    175         morekeywords={
    176                 _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _CatchResume, _Cormonitor, _Coroutine, _Disable,
    177                 _Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
    178                 _Resume, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
    179 }
    180 \lstdefinelanguage{Golang}{
    181         morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},
    182         morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64,
    183                 bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},
    184         morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},
    185         morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},
    186         morekeywords=[5]{Println,Printf,Error,},
    187         sensitive=true,
    188         morecomment=[l]{//},
    189         morecomment=[s]{/*}{*/},
    190         morestring=[b]',
    191         morestring=[b]",
    192         morestring=[s]{`}{`},
    193 }
    194 
    195 \lstnewenvironment{cfa}[1][]
    196 {\lstset{#1}}
    197 {}
    198 \lstnewenvironment{C++}[1][]                            % use C++ style
    199 {\lstset{language=C++,moredelim=**[is][\protect\color{red}]{`}{`},#1}\lstset{#1}}
    200 {}
    201 \lstnewenvironment{uC++}[1][]
    202 {\lstset{#1}}
    203 {}
    204 \lstnewenvironment{Go}[1][]
    205 {\lstset{#1}}
    206 {}
    207 
    208 % inline code @...@
    209 \lstMakeShortInline@%
    210 
    211 
    212 \title{\texorpdfstring{Concurrency in \protect\CFA}{Concurrency in Cforall}}
    213 
    214 \author[1]{Thierry Delisle}
    215 \author[1]{Peter A. Buhr*}
    216 \authormark{Thierry Delisle \textsc{et al}}
    217 
    218 \address[1]{\orgdiv{Cheriton School of Computer Science}, \orgname{University of Waterloo}, \orgaddress{\state{Ontario}, \country{Canada}}}
    219 
    220 \corres{*Peter A. Buhr, \email{pabuhr{\char`\@}uwaterloo.ca}}
    221 \presentaddress{Cheriton School of Computer Science, University of Waterloo, Waterloo, ON, N2L 3G1, Canada}
    222 
    223 
    224 \abstract[Summary]{
    225 \CFA is a modern, polymorphic, \emph{non-object-oriented} extension of the C programming language.
    226 This paper discusses the design of the concurrency and parallelism features in \CFA, and the concurrent runtime-system.
    227 These features are created from scratch as ISO C lacks concurrency, relying largely on pthreads.
    228 Coroutines and lightweight (user) threads are introduced into the language.
    229 In addition, monitors are added as a high-level mechanism for mutual exclusion and synchronization.
    230 A unique contribution is allowing multiple monitors to be safely acquired simultaneously.
    231 All features respect the expectations of C programmers, while being fully integrate with the \CFA polymorphic type-system and other language features.
    232 Finally, experimental results are presented to compare the performance of the new features with similar mechanisms in other concurrent programming-languages.
    233 }%
    234 
    235 \keywords{concurrency, parallelism, coroutines, threads, monitors, runtime, C, Cforall}
     69\setcounter{secnumdepth}{2}                           % number subsubsections
     70\setcounter{tocdepth}{2}                              % subsubsections in table of contents
     71% \linenumbers                                          % comment out to turn off line numbering
     72
     73\title{Concurrency in \CFA}
     74\author{Thierry Delisle and Peter A. Buhr, Waterloo, Ontario, Canada}
    23675
    23776
    23877\begin{document}
    239 \linenumbers                                            % comment out to turn off line numbering
    240 
    24178\maketitle
    24279
    243 % ======================================================================
     80\begin{abstract}
     81\CFA is a modern, \emph{non-object-oriented} extension of the C programming language.
     82This paper serves as a definition and an implementation for the concurrency and parallelism \CFA offers. These features are created from scratch due to the lack of concurrency in ISO C. Lightweight threads are introduced into the language. In addition, monitors are introduced as a high-level tool for control-flow based synchronization and mutual-exclusion. The main contributions of this paper are two-fold: it extends the existing semantics of monitors introduce by~\cite{Hoare74} to handle monitors in groups and also details the engineering effort needed to introduce these features as core language features. Indeed, these features are added with respect to expectations of C programmers, and integrate with the \CFA type-system and other language features.
     83\end{abstract}
     84
     85%----------------------------------------------------------------------
     86% MAIN BODY
     87%----------------------------------------------------------------------
     88
    24489% ======================================================================
    24590\section{Introduction}
    24691% ======================================================================
    247 % ======================================================================
    248 
    249 This paper provides a minimal concurrency \newterm{Abstract Program Interface} (API) that is simple, efficient and can be used to build other concurrency features.
    250 While the simplest concurrency system is a thread and a lock, this low-level approach is hard to master.
    251 An easier approach for programmers is to support higher-level constructs as the basis of concurrency.
    252 Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{Hochstein05}.
    253 Examples of high-level approaches are task based~\cite{TBB}, message passing~\cite{Erlang,MPI}, and implicit threading~\cite{OpenMP}.
    254 
    255 This paper used the following terminology.
    256 A \newterm{thread} is a fundamental unit of execution that runs a sequence of code and requires a stack to maintain state.
    257 Multiple simultaneous threads gives rise to \newterm{concurrency}, which requires locking to ensure safe communication and access to shared data.
    258 % Correspondingly, concurrency is defined as the concepts and challenges that occur when multiple independent (sharing memory, timing dependencies, \etc) concurrent threads are introduced.
    259 \newterm{Locking}, and by extension locks, are defined as a mechanism to prevent progress of threads to provide safety.
    260 \newterm{Parallelism} is running multiple threads simultaneously.
    261 Parallelism implies \emph{actual} simultaneous execution, where concurrency only requires \emph{apparent} simultaneous execution.
    262 As such, parallelism is only observable in differences in performance, which is observed through differences in timing.
    263 
    264 Hence, there are two problems to be solved in the design of concurrency for a programming language: concurrency and parallelism.
    265 While these two concepts are often combined, they are in fact distinct, requiring different tools~\cite[\S~2]{Buhr05a}.
    266 Concurrency tools handle synchronization and mutual exclusion, while parallelism tools handle performance, cost and resource utilization.
    267 
    268 The proposed concurrency API is implemented in a dialect of C, called \CFA.
    269 The paper discusses how the language features are added to the \CFA translator with respect to parsing, semantic, and type checking, and the corresponding high-perforamnce runtime-library to implement the concurrency features.
     92
     93This paper provides a minimal concurrency \textbf{api} that is simple, efficient and can be reused to build higher-level features. The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master. An easier approach for users is to support higher-level constructs as the basis of concurrency. Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{HPP:Study}. Examples are task based, message passing and implicit threading. The high-level approach and its minimal \textbf{api} are tested in a dialect of C, called \CFA. Furthermore, the proposed \textbf{api} doubles as an early definition of the \CFA language and library. This paper also provides an implementation of the concurrency library for \CFA as well as all the required language features added to the source-to-source translator.
     94
     95There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the programmer. While these two concepts are often combined, they are in fact distinct, requiring different tools~\cite{Buhr05a}. Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization.
     96
     97In the context of this paper, a \textbf{thread} is a fundamental unit of execution that runs a sequence of code, generally on a program stack. Having multiple simultaneous threads gives rise to concurrency and generally requires some kind of locking mechanism to ensure proper execution. Correspondingly, \textbf{concurrency} is defined as the concepts and challenges that occur when multiple independent (sharing memory, timing dependencies, etc.) concurrent threads are introduced. Accordingly, \textbf{locking} (and by extension locks) are defined as a mechanism that prevents the progress of certain threads in order to avoid problems due to concurrency. Finally, in this paper \textbf{parallelism} is distinct from concurrency and is defined as running multiple threads simultaneously. More precisely, parallelism implies \emph{actual} simultaneous execution as opposed to concurrency which only requires \emph{apparent} simultaneous execution. As such, parallelism is only observable in the differences in performance or, more generally, differences in timing.
    27098
    27199% ======================================================================
     
    277105The following is a quick introduction to the \CFA language, specifically tailored to the features needed to support concurrency.
    278106
    279 \CFA is an extension of ISO-C and therefore supports all of the same paradigms as C.
    280 It is a non-object-oriented system-language, meaning most of the major abstractions have either no runtime overhead or can be opted out easily.
    281 Like C, the basics of \CFA revolve around structures and routines, which are thin abstractions over machine code.
    282 The vast majority of the code produced by the \CFA translator respects memory layouts and calling conventions laid out by C.
    283 Interestingly, while \CFA is not an object-oriented language, lacking the concept of a receiver (\eg {\tt this}), it does have some notion of objects\footnote{C defines the term objects as : ``region of data storage in the execution environment, the contents of which can represent
    284 values''~\cite[3.15]{C11}}, most importantly construction and destruction of objects.
    285 Most of the following code examples can be found on the \CFA website~\cite{Cforall}.
    286 
    287 
     107\CFA is an extension of ISO-C and therefore supports all of the same paradigms as C. It is a non-object-oriented system-language, meaning most of the major abstractions have either no runtime overhead or can be opted out easily. Like C, the basics of \CFA revolve around structures and routines, which are thin abstractions over machine code. The vast majority of the code produced by the \CFA translator respects memory layouts and calling conventions laid out by C. Interestingly, while \CFA is not an object-oriented language, lacking the concept of a receiver (e.g., {\tt this}), it does have some notion of objects\footnote{C defines the term objects as : ``region of data storage in the execution environment, the contents of which can represent
     108values''~\cite[3.15]{C11}}, most importantly construction and destruction of objects. Most of the following code examples can be found on the \CFA website~\cite{www-cfa}.
     109
     110% ======================================================================
    288111\subsection{References}
    289112
    290 Like \CC, \CFA introduces rebind-able references providing multiple dereferencing as an alternative to pointers.
    291 In regards to concurrency, the semantic difference between pointers and references are not particularly relevant, but since this document uses mostly references, here is a quick overview of the semantics:
    292 \begin{cfa}
     113Like \CC, \CFA introduces rebind-able references providing multiple dereferencing as an alternative to pointers. In regards to concurrency, the semantic difference between pointers and references are not particularly relevant, but since this document uses mostly references, here is a quick overview of the semantics:
     114\begin{cfacode}
    293115int x, *p1 = &x, **p2 = &p1, ***p3 = &p2,
    294116        &r1 = x,    &&r2 = r1,   &&&r3 = r2;
    295 ***p3 = 3;                                                      $\C{// change x}$
    296 r3    = 3;                                                      $\C{// change x, ***r3}$
    297 **p3  = ...;                                            $\C{// change p1}$
    298 *p3   = ...;                                            $\C{// change p2}$
    299 int y, z, & ar[3] = {x, y, z};          $\C{// initialize array of references}$
    300 typeof( ar[1]) p;                                       $\C{// is int, referenced object type}$
    301 typeof(&ar[1]) q;                                       $\C{// is int \&, reference type}$
    302 sizeof( ar[1]) == sizeof(int);          $\C{// is true, referenced object size}$
    303 sizeof(&ar[1]) == sizeof(int *);        $\C{// is true, reference size}$
    304 \end{cfa}
     117***p3 = 3;                                                      //change x
     118r3    = 3;                                                      //change x, ***r3
     119**p3  = ...;                                            //change p1
     120*p3   = ...;                                            //change p2
     121int y, z, & ar[3] = {x, y, z};          //initialize array of references
     122typeof( ar[1]) p;                                       //is int, referenced object type
     123typeof(&ar[1]) q;                                       //is int &, reference type
     124sizeof( ar[1]) == sizeof(int);          //is true, referenced object size
     125sizeof(&ar[1]) == sizeof(int *);        //is true, reference size
     126\end{cfacode}
    305127The important take away from this code example is that a reference offers a handle to an object, much like a pointer, but which is automatically dereferenced for convenience.
    306128
     
    308130\subsection{Overloading}
    309131
    310 Another important feature of \CFA is function overloading as in Java and \CC, where routines with the same name are selected based on the number and type of the arguments.
    311 As well, \CFA uses the return type as part of the selection criteria, as in Ada~\cite{Ada}.
    312 For routines with multiple parameters and returns, the selection is complex.
    313 \begin{cfa}
    314 // selection based on type and number of parameters
    315 void f(void);                   $\C{// (1)}$
    316 void f(char);                   $\C{// (2)}$
    317 void f(int, double);    $\C{// (3)}$
    318 f();                                    $\C{// select (1)}$
    319 f('a');                                 $\C{// select (2)}$
    320 f(3, 5.2);                              $\C{// select (3)}$
    321 
    322 // selection based on  type and number of returns
    323 char   f(int);                  $\C{// (1)}$
    324 double f(int);                  $\C{// (2)}$
    325 char   c = f(3);                $\C{// select (1)}$
    326 double d = f(4);                $\C{// select (2)}$
    327 \end{cfa}
    328 This feature is particularly important for concurrency since the runtime system relies on creating different types to represent concurrency objects.
    329 Therefore, overloading is necessary to prevent the need for long prefixes and other naming conventions that prevent name clashes.
    330 As seen in section \ref{basics}, routine @main@ is an example that benefits from overloading.
     132Another important feature of \CFA is function overloading as in Java and \CC, where routines with the same name are selected based on the number and type of the arguments. As well, \CFA uses the return type as part of the selection criteria, as in Ada~\cite{Ada}. For routines with multiple parameters and returns, the selection is complex.
     133\begin{cfacode}
     134//selection based on type and number of parameters
     135void f(void);                   //(1)
     136void f(char);                   //(2)
     137void f(int, double);    //(3)
     138f();                                    //select (1)
     139f('a');                                 //select (2)
     140f(3, 5.2);                              //select (3)
     141
     142//selection based on  type and number of returns
     143char   f(int);                  //(1)
     144double f(int);                  //(2)
     145char   c = f(3);                //select (1)
     146double d = f(4);                //select (2)
     147\end{cfacode}
     148This feature is particularly important for concurrency since the runtime system relies on creating different types to represent concurrency objects. Therefore, overloading is necessary to prevent the need for long prefixes and other naming conventions that prevent name clashes. As seen in section \ref{basics}, routine \code{main} is an example that benefits from overloading.
    331149
    332150% ======================================================================
    333151\subsection{Operators}
    334 Overloading also extends to operators.
    335 The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation appear, \eg:
    336 \begin{cfa}
    337 int ++? (int op);                       $\C{// unary prefix increment}$
    338 int ?++ (int op);                       $\C{// unary postfix increment}$
    339 int ?+? (int op1, int op2);             $\C{// binary plus}$
    340 int ?<=?(int op1, int op2);             $\C{// binary less than}$
    341 int ?=? (int & op1, int op2);           $\C{// binary assignment}$
    342 int ?+=?(int & op1, int op2);           $\C{// binary plus-assignment}$
     152Overloading also extends to operators. The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation appear, e.g.:
     153\begin{cfacode}
     154int ++? (int op);                       //unary prefix increment
     155int ?++ (int op);                       //unary postfix increment
     156int ?+? (int op1, int op2);             //binary plus
     157int ?<=?(int op1, int op2);             //binary less than
     158int ?=? (int & op1, int op2);           //binary assignment
     159int ?+=?(int & op1, int op2);           //binary plus-assignment
    343160
    344161struct S {int i, j;};
    345 S ?+?(S op1, S op2) {                           $\C{// add two structures}$
     162S ?+?(S op1, S op2) {                           //add two structures
    346163        return (S){op1.i + op2.i, op1.j + op2.j};
    347164}
    348165S s1 = {1, 2}, s2 = {2, 3}, s3;
    349 s3 = s1 + s2;                                           $\C{// compute sum: s3 == {2, 5}}$
    350 \end{cfa}
     166s3 = s1 + s2;                                           //compute sum: s3 == {2, 5}
     167\end{cfacode}
    351168While concurrency does not use operator overloading directly, this feature is more important as an introduction for the syntax of constructors.
    352169
    353170% ======================================================================
    354171\subsection{Constructors/Destructors}
    355 Object lifetime is often a challenge in concurrency. \CFA uses the approach of giving concurrent meaning to object lifetime as a means of synchronization and/or mutual exclusion.
    356 Since \CFA relies heavily on the lifetime of objects, constructors and destructors is a core feature required for concurrency and parallelism. \CFA uses the following syntax for constructors and destructors:
    357 \begin{cfa}
     172Object lifetime is often a challenge in concurrency. \CFA uses the approach of giving concurrent meaning to object lifetime as a means of synchronization and/or mutual exclusion. Since \CFA relies heavily on the lifetime of objects, constructors and destructors is a core feature required for concurrency and parallelism. \CFA uses the following syntax for constructors and destructors:
     173\begin{cfacode}
    358174struct S {
    359175        size_t size;
    360176        int * ia;
    361177};
    362 void ?{}(S & s, int asize) {    $\C{// constructor operator}$
    363         s.size = asize;                         $\C{// initialize fields}$
     178void ?{}(S & s, int asize) {    //constructor operator
     179        s.size = asize;                         //initialize fields
    364180        s.ia = calloc(size, sizeof(S));
    365181}
    366 void ^?{}(S & s) {                              $\C{// destructor operator}$
    367         free(ia);                                       $\C{// de-initialization fields}$
     182void ^?{}(S & s) {                              //destructor operator
     183        free(ia);                                       //de-initialization fields
    368184}
    369185int main() {
    370         S x = {10}, y = {100};          $\C{// implicit calls: ?\{\}(x, 10), ?\{\}(y, 100)}$
    371         ...                                                     $\C{// use x and y}$
    372         ^x{};  ^y{};                            $\C{// explicit calls to de-initialize}$
    373         x{20};  y{200};                         $\C{// explicit calls to reinitialize}$
    374         ...                                                     $\C{// reuse x and y}$
    375 }                                                               $\C{// implicit calls: \^?\{\}(y), \^?\{\}(x)}$
    376 \end{cfa}
    377 The language guarantees that every object and all their fields are constructed.
    378 Like \CC, construction of an object is automatically done on allocation and destruction of the object is done on deallocation.
    379 Allocation and deallocation can occur on the stack or on the heap.
    380 \begin{cfa}
     186        S x = {10}, y = {100};          //implicit calls: ?{}(x, 10), ?{}(y, 100)
     187        ...                                                     //use x and y
     188        ^x{};  ^y{};                            //explicit calls to de-initialize
     189        x{20};  y{200};                         //explicit calls to reinitialize
     190        ...                                                     //reuse x and y
     191}                                                               //implicit calls: ^?{}(y), ^?{}(x)
     192\end{cfacode}
     193The language guarantees that every object and all their fields are constructed. Like \CC, construction of an object is automatically done on allocation and destruction of the object is done on deallocation. Allocation and deallocation can occur on the stack or on the heap.
     194\begin{cfacode}
    381195{
    382         struct S s = {10};      $\C{// allocation, call constructor}$
     196        struct S s = {10};      //allocation, call constructor
    383197        ...
    384 }                                               $\C{// deallocation, call destructor}$
    385 struct S * s = new();   $\C{// allocation, call constructor}$
     198}                                               //deallocation, call destructor
     199struct S * s = new();   //allocation, call constructor
    386200...
    387 delete(s);                              $\C{// deallocation, call destructor}$
    388 \end{cfa}
    389 Note that like \CC, \CFA introduces @new@ and @delete@, which behave like @malloc@ and @free@ in addition to constructing and destructing objects, after calling @malloc@ and before calling @free@, respectively.
     201delete(s);                              //deallocation, call destructor
     202\end{cfacode}
     203Note that like \CC, \CFA introduces \code{new} and \code{delete}, which behave like \code{malloc} and \code{free} in addition to constructing and destructing objects, after calling \code{malloc} and before calling \code{free}, respectively.
    390204
    391205% ======================================================================
    392206\subsection{Parametric Polymorphism}
    393207\label{s:ParametricPolymorphism}
    394 Routines in \CFA can also be reused for multiple types.
    395 This capability is done using the @forall@ clauses, which allow separately compiled routines to support generic usage over multiple types.
    396 For example, the following sum function works for any type that supports construction from 0 and addition:
    397 \begin{cfa}
    398 // constraint type, 0 and +
     208Routines in \CFA can also be reused for multiple types. This capability is done using the \code{forall} clauses, which allow separately compiled routines to support generic usage over multiple types. For example, the following sum function works for any type that supports construction from 0 and addition:
     209\begin{cfacode}
     210//constraint type, 0 and +
    399211forall(otype T | { void ?{}(T *, zero_t); T ?+?(T, T); })
    400212T sum(T a[ ], size_t size) {
    401         T total = 0;                            $\C{// construct T from 0}$
     213        T total = 0;                            //construct T from 0
    402214        for(size_t i = 0; i < size; i++)
    403                 total = total + a[i];   $\C{// select appropriate +}$
     215                total = total + a[i];   //select appropriate +
    404216        return total;
    405217}
    406218
    407219S sa[5];
    408 int i = sum(sa, 5);                             $\C{// use S's 0 construction and +}$
    409 \end{cfa}
    410 
    411 Since writing constraints on types can become cumbersome for more constrained functions, \CFA also has the concept of traits.
    412 Traits are named collection of constraints that can be used both instead and in addition to regular constraints:
    413 \begin{cfa}
     220int i = sum(sa, 5);                             //use S's 0 construction and +
     221\end{cfacode}
     222
     223Since writing constraints on types can become cumbersome for more constrained functions, \CFA also has the concept of traits. Traits are named collection of constraints that can be used both instead and in addition to regular constraints:
     224\begin{cfacode}
    414225trait summable( otype T ) {
    415         void ?{}(T *, zero_t);          $\C{// constructor from 0 literal}$
    416         T ?+?(T, T);                            $\C{// assortment of additions}$
     226        void ?{}(T *, zero_t);          //constructor from 0 literal
     227        T ?+?(T, T);                            //assortment of additions
    417228        T ?+=?(T *, T);
    418229        T ++?(T *);
    419230        T ?++(T *);
    420231};
    421 forall( otype T | summable(T) ) $\C{// use trait}$
     232forall( otype T | summable(T) ) //use trait
    422233T sum(T a[], size_t size);
    423 \end{cfa}
    424 
    425 Note that the type use for assertions can be either an @otype@ or a @dtype@.
    426 Types declared as @otype@ refer to ``complete'' objects, \ie objects with a size, a default constructor, a copy constructor, a destructor and an assignment operator.
    427 Using @dtype@, on the other hand, has none of these assumptions but is extremely restrictive, it only guarantees the object is addressable.
     234\end{cfacode}
     235
     236Note that the type use for assertions can be either an \code{otype} or a \code{dtype}. Types declared as \code{otype} refer to ``complete'' objects, i.e., objects with a size, a default constructor, a copy constructor, a destructor and an assignment operator. Using \code{dtype,} on the other hand, has none of these assumptions but is extremely restrictive, it only guarantees the object is addressable.
    428237
    429238% ======================================================================
    430239\subsection{with Clause/Statement}
    431 Since \CFA lacks the concept of a receiver, certain functions end up needing to repeat variable names often.
    432 To remove this inconvenience, \CFA provides the @with@ statement, which opens an aggregate scope making its fields directly accessible (like Pascal).
    433 \begin{cfa}
     240Since \CFA lacks the concept of a receiver, certain functions end up needing to repeat variable names often. To remove this inconvenience, \CFA provides the \code{with} statement, which opens an aggregate scope making its fields directly accessible (like Pascal).
     241\begin{cfacode}
    434242struct S { int i, j; };
    435 int mem(S & this) with (this)           $\C{// with clause}$
    436         i = 1;                                                  $\C{// this->i}$
    437         j = 2;                                                  $\C{// this->j}$
     243int mem(S & this) with (this)           //with clause
     244        i = 1;                                                  //this->i
     245        j = 2;                                                  //this->j
    438246}
    439247int foo() {
    440248        struct S1 { ... } s1;
    441249        struct S2 { ... } s2;
    442         with (s1)                                               $\C{// with statement}$
     250        with (s1)                                               //with statement
    443251        {
    444                 // access fields of s1 without qualification
    445                 with (s2)                                       $\C{// nesting}$
     252                //access fields of s1 without qualification
     253                with (s2)                                       //nesting
    446254                {
    447                         // access fields of s1 and s2 without qualification
     255                        //access fields of s1 and s2 without qualification
    448256                }
    449257        }
    450         with (s1, s2)                                   $\C{// scopes open in parallel}$
     258        with (s1, s2)                                   //scopes open in parallel
    451259        {
    452                 // access fields of s1 and s2 without qualification
    453         }
    454 }
    455 \end{cfa}
    456 
    457 For more information on \CFA see \cite{cforall-ug,Schluntz17,www-cfa}.
     260                //access fields of s1 and s2 without qualification
     261        }
     262}
     263\end{cfacode}
     264
     265For more information on \CFA see \cite{cforall-ug,rob-thesis,www-cfa}.
    458266
    459267% ======================================================================
     
    462270% ======================================================================
    463271% ======================================================================
    464 
    465 At its core, concurrency is based on having multiple call-stacks and scheduling among threads of execution executing on these stacks.
    466 Multiple call stacks (or contexts) and a single thread of execution does \emph{not} imply concurrency.
    467 Execution with a single thread and multiple stacks where the thread is deterministically self-scheduling across the stacks is called \newterm{coroutining};
    468 execution with a single thread and multiple stacks but where the thread is scheduled by an oracle (non-deterministic from the thread's perspective) across the stacks is called concurrency~\cite[\S~3]{Buhr05a}.
    469 Therefore, a minimal concurrency system can be achieved using coroutines (see Section \ref{coroutine}), which instead of context-switching among each other, always defer to an oracle for where to context-switch next.
    470 
    471 While coroutines can execute on the caller's stack-frame, stack-full coroutines allow full generality and are sufficient as the basis for concurrency.
    472 The aforementioned oracle is a scheduler and the whole system now follows a cooperative threading-model (a.k.a., non-preemptive scheduling).
    473 The oracle/scheduler can either be a stack-less or stack-full entity and correspondingly require one or two context-switches to run a different coroutine.
    474 In any case, a subset of concurrency related challenges start to appear.
    475 For the complete set of concurrency challenges to occur, the only feature missing is preemption.
    476 
    477 A scheduler introduces order of execution uncertainty, while preemption introduces uncertainty about where context switches occur.
    478 Mutual exclusion and synchronization are ways of limiting non-determinism in a concurrent system.
    479 Now it is important to understand that uncertainty is desirable; uncertainty can be used by runtime systems to significantly increase performance and is often the basis of giving a user the illusion that tasks are running in parallel.
    480 Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
    481 
    482 
    483 \subsection{\protect\CFA's Thread Building Blocks}
    484 
    485 One of the important features that are missing in C is threading\footnote{While the C11 standard defines a ``threads.h'' header, it is minimal and defined as optional.
    486 As such, library support for threading is far from widespread.
    487 At the time of writing the paper, neither \protect\lstinline|gcc| nor \protect\lstinline|clang| support ``threads.h'' in their standard libraries.}.
    488 On modern architectures, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore modern programming languages must have the proper tools to allow users to write efficient concurrent programs to take advantage of parallelism.
    489 As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages.
    490 And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay.
    491 
    492 
    493 \subsection{Coroutines: A Stepping Stone}\label{coroutine}
    494 
    495 While the focus of this proposal is concurrency and parallelism, it is important to address coroutines, which are a significant building block of a concurrency system.
    496 \newterm{Coroutine}s are generalized routines with points where execution is suspended and resumed at a later time.
    497 Suspend/resume is a context switche and coroutines have other context-management operations.
    498 Many design challenges of threads are partially present in designing coroutines, which makes the design effort relevant.
    499 The core \textbf{api} of coroutines has two features: independent call-stacks and @suspend@/@resume@.
    500 
    501 A coroutine handles the class of problems that need to retain state between calls (\eg plugin, device driver, finite-state machine).
    502 For example, a problem made easier with coroutines is unbounded generators, \eg generating an infinite sequence of Fibonacci numbers:
    503 \begin{displaymath}
    504 f(n) = \left \{
    505 \begin{array}{ll}
    506 0                               & n = 0         \\
    507 1                               & n = 1         \\
    508 f(n-1) + f(n-2) & n \ge 2       \\
    509 \end{array}
    510 \right.
    511 \end{displaymath}
    512 Figure~\ref{f:C-fibonacci} shows conventional approaches for writing a Fibonacci generator in C.
    513 
    514 Figure~\ref{f:GlobalVariables} illustrates the following problems:
    515 unencapsulated global variables necessary to retain state between calls;
    516 only one fibonacci generator can run at a time;
    517 execution state must be explicitly retained.
    518 Figure~\ref{f:ExternalState} addresses these issues:
    519 unencapsulated program global variables become encapsulated structure variables;
    520 multiple fibonacci generators can run at a time by declaring multiple fibonacci objects;
    521 explicit execution state is removed by precomputing the first two Fibonacci numbers and returning $f(n-2)$.
     272Before any detailed discussion of the concurrency and parallelism in \CFA, it is important to describe the basics of concurrency and how they are expressed in \CFA user code.
     273
     274\section{Basics of concurrency}
     275At its core, concurrency is based on having multiple call-stacks and scheduling among threads of execution executing on these stacks. Concurrency without parallelism only requires having multiple call stacks (or contexts) for a single thread of execution.
     276
     277Execution with a single thread and multiple stacks where the thread is self-scheduling deterministically across the stacks is called coroutining. Execution with a single and multiple stacks but where the thread is scheduled by an oracle (non-deterministic from the thread's perspective) across the stacks is called concurrency.
     278
     279Therefore, a minimal concurrency system can be achieved by creating coroutines (see Section \ref{coroutine}), which instead of context-switching among each other, always ask an oracle where to context-switch next. While coroutines can execute on the caller's stack-frame, stack-full coroutines allow full generality and are sufficient as the basis for concurrency. The aforementioned oracle is a scheduler and the whole system now follows a cooperative threading-model (a.k.a., non-preemptive scheduling). The oracle/scheduler can either be a stack-less or stack-full entity and correspondingly require one or two context-switches to run a different coroutine. In any case, a subset of concurrency related challenges start to appear. For the complete set of concurrency challenges to occur, the only feature missing is preemption.
     280
     281A scheduler introduces order of execution uncertainty, while preemption introduces uncertainty about where context switches occur. Mutual exclusion and synchronization are ways of limiting non-determinism in a concurrent system. Now it is important to understand that uncertainty is desirable; uncertainty can be used by runtime systems to significantly increase performance and is often the basis of giving a user the illusion that tasks are running in parallel. Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
     282
     283\section{\protect\CFA's Thread Building Blocks}
     284One of the important features that are missing in C is threading\footnote{While the C11 standard defines a ``threads.h'' header, it is minimal and defined as optional. As such, library support for threading is far from widespread. At the time of writing the paper, neither \texttt{gcc} nor \texttt{clang} support ``threads.h'' in their respective standard libraries.}. On modern architectures, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore modern programming languages must have the proper tools to allow users to write efficient concurrent programs to take advantage of parallelism. As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages. And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay.
     285
     286\section{Coroutines: A Stepping Stone}\label{coroutine}
     287While the main focus of this proposal is concurrency and parallelism, it is important to address coroutines, which are actually a significant building block of a concurrency system. \textbf{Coroutine}s are generalized routines which have predefined points where execution is suspended and can be resumed at a later time. Therefore, they need to deal with context switches and other context-management operations. This proposal includes coroutines both as an intermediate step for the implementation of threads, and a first-class feature of \CFA. Furthermore, many design challenges of threads are at least partially present in designing coroutines, which makes the design effort that much more relevant. The core \textbf{api} of coroutines revolves around two features: independent call-stacks and \code{suspend}/\code{resume}.
     288
     289\begin{table}
     290\begin{center}
     291\begin{tabular}{c @{\hskip 0.025in}|@{\hskip 0.025in} c @{\hskip 0.025in}|@{\hskip 0.025in} c}
     292\begin{ccode}[tabsize=2]
     293//Using callbacks
     294void fibonacci_func(
     295        int n,
     296        void (*callback)(int)
     297) {
     298        int first = 0;
     299        int second = 1;
     300        int next, i;
     301        for(i = 0; i < n; i++)
     302        {
     303                if(i <= 1)
     304                        next = i;
     305                else {
     306                        next = f1 + f2;
     307                        f1 = f2;
     308                        f2 = next;
     309                }
     310                callback(next);
     311        }
     312}
     313
     314int main() {
     315        void print_fib(int n) {
     316                printf("%d\n", n);
     317        }
     318
     319        fibonacci_func(
     320                10, print_fib
     321        );
     322
     323
     324
     325}
     326\end{ccode}&\begin{ccode}[tabsize=2]
     327//Using output array
     328void fibonacci_array(
     329        int n,
     330        int* array
     331) {
     332        int f1 = 0; int f2 = 1;
     333        int next, i;
     334        for(i = 0; i < n; i++)
     335        {
     336                if(i <= 1)
     337                        next = i;
     338                else {
     339                        next = f1 + f2;
     340                        f1 = f2;
     341                        f2 = next;
     342                }
     343                array[i] = next;
     344        }
     345}
     346
     347
     348int main() {
     349        int a[10];
     350
     351        fibonacci_func(
     352                10, a
     353        );
     354
     355        for(int i=0;i<10;i++){
     356                printf("%d\n", a[i]);
     357        }
     358
     359}
     360\end{ccode}&\begin{ccode}[tabsize=2]
     361//Using external state
     362typedef struct {
     363        int f1, f2;
     364} Iterator_t;
     365
     366int fibonacci_state(
     367        Iterator_t* it
     368) {
     369        int f;
     370        f = it->f1 + it->f2;
     371        it->f2 = it->f1;
     372        it->f1 = max(f,1);
     373        return f;
     374}
     375
     376
     377
     378
     379
     380
     381
     382int main() {
     383        Iterator_t it={0,0};
     384
     385        for(int i=0;i<10;i++){
     386                printf("%d\n",
     387                        fibonacci_state(
     388                                &it
     389                        );
     390                );
     391        }
     392
     393}
     394\end{ccode}
     395\end{tabular}
     396\end{center}
     397\caption{Different implementations of a Fibonacci sequence generator in C.}
     398\label{lst:fibonacci-c}
     399\end{table}
     400
     401A good example of a problem made easier with coroutines is generators, e.g., generating the Fibonacci sequence. This problem comes with the challenge of decoupling how a sequence is generated and how it is used. Listing \ref{lst:fibonacci-c} shows conventional approaches to writing generators in C. All three of these approach suffer from strong coupling. The left and centre approaches require that the generator have knowledge of how the sequence is used, while the rightmost approach requires holding internal state between calls on behalf of the generator and makes it much harder to handle corner cases like the Fibonacci seed.
     402
     403Listing \ref{lst:fibonacci-cfa} is an example of a solution to the Fibonacci problem using \CFA coroutines, where the coroutine stack holds sufficient state for the next generation. This solution has the advantage of having very strong decoupling between how the sequence is generated and how it is used. Indeed, this version is as easy to use as the \code{fibonacci_state} solution, while the implementation is very similar to the \code{fibonacci_func} example.
    522404
    523405\begin{figure}
    524 \centering
    525 \newbox\myboxA
    526 \begin{lrbox}{\myboxA}
    527 \begin{lstlisting}[aboveskip=0pt,belowskip=0pt]
    528 `int f1, f2, state = 1;`   // single global variables
    529 int fib() {
    530         int fn;
    531         `switch ( state )` {  // explicit execution state
    532           case 1: fn = 0;  f1 = fn;  state = 2;  break;
    533           case 2: fn = 1;  f2 = f1;  f1 = fn;  state = 3;  break;
    534           case 3: fn = f1 + f2;  f2 = f1;  f1 = fn;  break;
    535         }
    536         return fn;
    537 }
    538 int main() {
    539 
    540         for ( int i = 0; i < 10; i += 1 ) {
    541                 printf( "%d\n", fib() );
    542         }
    543 }
    544 \end{lstlisting}
    545 \end{lrbox}
    546 
    547 \newbox\myboxB
    548 \begin{lrbox}{\myboxB}
    549 \begin{lstlisting}[aboveskip=0pt,belowskip=0pt]
    550 #define FIB_INIT `{ 0, 1 }`
    551 typedef struct { int f2, f1; } Fib;
    552 int fib( Fib * f ) {
    553 
    554         int ret = f->f2;
    555         int fn = f->f1 + f->f2;
    556         f->f2 = f->f1; f->f1 = fn;
    557 
    558         return ret;
    559 }
    560 int main() {
    561         Fib f1 = FIB_INIT, f2 = FIB_INIT;
    562         for ( int i = 0; i < 10; i += 1 ) {
    563                 printf( "%d %d\n", fib( &f1 ), fib( &f2 ) );
    564         }
    565 }
    566 \end{lstlisting}
    567 \end{lrbox}
    568 
    569 \subfloat[3 States: global variables]{\label{f:GlobalVariables}\usebox\myboxA}
    570 \qquad
    571 \subfloat[1 State: external variables]{\label{f:ExternalState}\usebox\myboxB}
    572 \caption{C Fibonacci Implementations}
    573 \label{f:C-fibonacci}
    574 
    575 \bigskip
    576 
    577 \newbox\myboxA
    578 \begin{lrbox}{\myboxA}
    579 \begin{lstlisting}[aboveskip=0pt,belowskip=0pt]
    580 `coroutine` Fib { int fn; };
    581 void main( Fib & f ) with( f ) {
    582         int f1, f2;
    583         fn = 0;  f1 = fn;  `suspend()`;
    584         fn = 1;  f2 = f1;  f1 = fn;  `suspend()`;
     406\begin{cfacode}[caption={Implementation of Fibonacci using coroutines},label={lst:fibonacci-cfa}]
     407coroutine Fibonacci {
     408        int fn; //used for communication
     409};
     410
     411void ?{}(Fibonacci& this) { //constructor
     412        this.fn = 0;
     413}
     414
     415//main automatically called on first resume
     416void main(Fibonacci& this) with (this) {
     417        int fn1, fn2;           //retained between resumes
     418        fn  = 0;
     419        fn1 = fn;
     420        suspend(this);          //return to last resume
     421
     422        fn  = 1;
     423        fn2 = fn1;
     424        fn1 = fn;
     425        suspend(this);          //return to last resume
     426
    585427        for ( ;; ) {
    586                 fn = f1 + f2;  f2 = f1;  f1 = fn;  `suspend()`;
    587         }
    588 }
    589 int next( Fib & fib ) with( fib ) {
    590         `resume( fib );`
    591         return fn;
    592 }
    593 int main() {
    594         Fib f1, f2;
     428                fn  = fn1 + fn2;
     429                fn2 = fn1;
     430                fn1 = fn;
     431                suspend(this);  //return to last resume
     432        }
     433}
     434
     435int next(Fibonacci& this) {
     436        resume(this); //transfer to last suspend
     437        return this.fn;
     438}
     439
     440void main() { //regular program main
     441        Fibonacci f1, f2;
    595442        for ( int i = 1; i <= 10; i += 1 ) {
    596443                sout | next( f1 ) | next( f2 ) | endl;
    597444        }
    598445}
    599 \end{lstlisting}
    600 \end{lrbox}
    601 \newbox\myboxB
    602 \begin{lrbox}{\myboxB}
    603 \begin{lstlisting}[aboveskip=0pt,belowskip=0pt]
    604 `coroutine` Fib { int ret; };
    605 void main( Fib & f ) with( f ) {
    606         int fn, f1 = 1, f2 = 0;
    607         for ( ;; ) {
    608                 ret = f2;
    609 
    610                 fn = f1 + f2;  f2 = f1;  f1 = fn; `suspend();`
    611         }
    612 }
    613 int next( Fib & fib ) with( fib ) {
    614         `resume( fib );`
    615         return ret;
    616 }
    617 
    618 
    619 
    620 
    621 
    622 
    623 \end{lstlisting}
    624 \end{lrbox}
    625 \subfloat[3 States, internal variables]{\label{f:Coroutine3States}\usebox\myboxA}
    626 \qquad
    627 \subfloat[1 State, internal variables]{\label{f:Coroutine1State}\usebox\myboxB}
    628 \caption{\CFA Coroutine Fibonacci Implementations}
    629 \label{f:fibonacci-cfa}
     446\end{cfacode}
    630447\end{figure}
    631448
    632 Figure~\ref{f:Coroutine3States} creates a @coroutine@ type, which provides communication for multiple interface functions, and the \newterm{coroutine main}, which runs on the coroutine stack.
    633 \begin{cfa}
    634 `coroutine C { char c; int i; _Bool s; };`      $\C{// used for communication}$
    635 void ?{}( C & c ) { s = false; }                        $\C{// constructor}$
    636 void main( C & cor ) with( cor ) {                      $\C{// actual coroutine}$
    637         while ( ! s ) // process c
    638         if ( v == ... ) s = false;
    639 }
    640 // interface functions
    641 char cont( C & cor, char ch ) { c = ch; resume( cor ); return c; }
    642 _Bool stop( C & cor, int v ) { s = true; i = v; resume( cor ); return s; }
    643 \end{cfa}
    644 
    645 encapsulates the Fibonacci state in the  shows is an example of a solution to the Fibonacci problem using \CFA coroutines, where the coroutine stack holds sufficient state for the next generation.
    646 This solution has the advantage of having very strong decoupling between how the sequence is generated and how it is used.
    647 Indeed, this version is as easy to use as the @fibonacci_state@ solution, while the implementation is very similar to the @fibonacci_func@ example.
    648 
    649 Figure~\ref{f:fmt-line} shows the @Format@ coroutine for restructuring text into groups of character blocks of fixed size.
    650 The example takes advantage of resuming coroutines in the constructor to simplify the code and highlights the idea that interesting control flow can occur in the constructor.
     449Listing \ref{lst:fmt-line} shows the \code{Format} coroutine for restructuring text into groups of character blocks of fixed size. The example takes advantage of resuming coroutines in the constructor to simplify the code and highlights the idea that interesting control flow can occur in the constructor.
    651450
    652451\begin{figure}
    653 \centering
    654 \begin{cfa}
    655 `coroutine` Format {
    656         char ch;                                                                $\C{// used for communication}$
    657         int g, b;                                                               $\C{// global because used in destructor}$
     452\begin{cfacode}[tabsize=3,caption={Formatting text into lines of 5 blocks of 4 characters.},label={lst:fmt-line}]
     453//format characters into blocks of 4 and groups of 5 blocks per line
     454coroutine Format {
     455        char ch;                                                                        //used for communication
     456        int g, b;                                                               //global because used in destructor
    658457};
    659 void ?{}( Format & fmt ) { `resume( fmt );` } $\C{// prime (start) coroutine}$
    660 void ^?{}( Format & fmt ) with( fmt ) { if ( g != 0 || b != 0 ) sout | endl; }
    661 void main( Format & fmt ) with( fmt ) {
    662         for ( ;; ) {                                                    $\C{// for as many characters}$
    663                 for ( g = 0; g < 5; g += 1 ) {          $\C{// groups of 5 blocks}$
    664                         for ( b = 0; b < 4; b += 1 ) {  $\C{// blocks of 4 characters}$
    665                                 `suspend();`
    666                                 sout | ch;                                      $\C{// print character}$
     458
     459void  ?{}(Format& fmt) {
     460        resume( fmt );                                                  //prime (start) coroutine
     461}
     462
     463void ^?{}(Format& fmt) with fmt {
     464        if ( fmt.g != 0 || fmt.b != 0 )
     465        sout | endl;
     466}
     467
     468void main(Format& fmt) with fmt {
     469        for ( ;; ) {                                                    //for as many characters
     470                for(g = 0; g < 5; g++) {                //groups of 5 blocks
     471                        for(b = 0; b < 4; fb++) {       //blocks of 4 characters
     472                                suspend();
     473                                sout | ch;                                      //print character
    667474                        }
    668                         sout | "  ";                                    $\C{// print block separator}$
     475                        sout | "  ";                                    //print block separator
    669476                }
    670                 sout | endl;                                            $\C{// print group separator}$
    671         }
    672 }
    673 void prt( Format & fmt, char ch ) {
     477                sout | endl;                                            //print group separator
     478        }
     479}
     480
     481void prt(Format & fmt, char ch) {
    674482        fmt.ch = ch;
    675         `resume( fmt );`
    676 }
     483        resume(fmt);
     484}
     485
    677486int main() {
    678487        Format fmt;
    679488        char ch;
    680         for ( ;; ) {                                                    $\C{// read until end of file}$
    681                 sin | ch;                                                       $\C{// read one character}$
    682           if ( eof( sin ) ) break;                              $\C{// eof ?}$
    683                 prt( fmt, ch );                                         $\C{// push character for formatting}$
    684         }
    685 }
    686 \end{cfa}
    687 \caption{Formatting text into lines of 5 blocks of 4 characters.}
    688 \label{f:fmt-line}
     489        Eof: for ( ;; ) {                                               //read until end of file
     490                sin | ch;                                                       //read one character
     491                if(eof(sin)) break Eof;                 //eof ?
     492                prt(fmt, ch);                                           //push character for formatting
     493        }
     494}
     495\end{cfacode}
    689496\end{figure}
    690497
    691 \begin{figure}
    692 \centering
    693 \lstset{language=CFA,escapechar={},moredelim=**[is][\protect\color{red}]{`}{`}}
    694 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    695 \begin{cfa}
    696 `coroutine` Prod {
    697         Cons & c;
    698         int N, money, receipt;
    699 };
    700 void main( Prod & prod ) with( prod ) {
    701         // 1st resume starts here
    702         for ( int i = 0; i < N; i += 1 ) {
    703                 int p1 = random( 100 ), p2 = random( 100 );
    704                 sout | p1 | " " | p2 | endl;
    705                 int status = delivery( c, p1, p2 );
    706                 sout | " $" | money | endl | status | endl;
    707                 receipt += 1;
    708         }
    709         stop( c );
    710         sout | "prod stops" | endl;
    711 }
    712 int payment( Prod & prod, int money ) {
    713         prod.money = money;
    714         `resume( prod );`
    715         return prod.receipt;
    716 }
    717 void start( Prod & prod, int N, Cons &c ) {
    718         &prod.c = &c;
    719         prod.[N, receipt] = [N, 0];
    720         `resume( prod );`
    721 }
    722 int main() {
    723         Prod prod;
    724         Cons cons = { prod };
    725         srandom( getpid() );
    726         start( prod, 5, cons );
    727 }
    728 \end{cfa}
    729 &
    730 \begin{cfa}
    731 `coroutine` Cons {
    732         Prod & p;
    733         int p1, p2, status;
    734         _Bool done;
    735 };
    736 void ?{}( Cons & cons, Prod & p ) {
    737         &cons.p = &p;
    738         cons.[status, done ] = [0, false];
    739 }
    740 void ^?{}( Cons & cons ) {}
    741 void main( Cons & cons ) with( cons ) {
    742         // 1st resume starts here
    743         int money = 1, receipt;
    744         for ( ; ! done; ) {
    745                 sout | p1 | " " | p2 | endl | " $" | money | endl;
    746                 status += 1;
    747                 receipt = payment( p, money );
    748                 sout | " #" | receipt | endl;
    749                 money += 1;
    750         }
    751         sout | "cons stops" | endl;
    752 }
    753 int delivery( Cons & cons, int p1, int p2 ) {
    754         cons.[p1, p2] = [p1, p2];
    755         `resume( cons );`
    756         return cons.status;
    757 }
    758 void stop( Cons & cons ) {
    759         cons.done = true;
    760         `resume( cons );`
    761 }
    762 
    763 \end{cfa}
    764 \end{tabular}
    765 \caption{Producer / consumer: resume-resume cycle, bi-directional communication}
    766 \label{f:ProdCons}
    767 \end{figure}
    768 
    769 
    770 \subsubsection{Construction}
    771 
    772 One important design challenge for implementing coroutines and threads (shown in section \ref{threads}) is that the runtime system needs to run code after the user-constructor runs to connect the fully constructed object into the system.
    773 In the case of coroutines, this challenge is simpler since there is no non-determinism from preemption or scheduling.
    774 However, the underlying challenge remains the same for coroutines and threads.
    775 
    776 The runtime system needs to create the coroutine's stack and, more importantly, prepare it for the first resumption.
    777 The timing of the creation is non-trivial since users expect both to have fully constructed objects once execution enters the coroutine main and to be able to resume the coroutine from the constructor.
    778 There are several solutions to this problem but the chosen option effectively forces the design of the coroutine.
    779 
    780 Furthermore, \CFA faces an extra challenge as polymorphic routines create invisible thunks when cast to non-polymorphic routines and these thunks have function scope.
    781 For example, the following code, while looking benign, can run into undefined behaviour because of thunks:
    782 
    783 \begin{cfa}
    784 // async: Runs function asynchronously on another thread
     498\subsection{Construction}
     499One important design challenge for implementing coroutines and threads (shown in section \ref{threads}) is that the runtime system needs to run code after the user-constructor runs to connect the fully constructed object into the system. In the case of coroutines, this challenge is simpler since there is no non-determinism from preemption or scheduling. However, the underlying challenge remains the same for coroutines and threads.
     500
     501The runtime system needs to create the coroutine's stack and, more importantly, prepare it for the first resumption. The timing of the creation is non-trivial since users expect both to have fully constructed objects once execution enters the coroutine main and to be able to resume the coroutine from the constructor. There are several solutions to this problem but the chosen option effectively forces the design of the coroutine.
     502
     503Furthermore, \CFA faces an extra challenge as polymorphic routines create invisible thunks when cast to non-polymorphic routines and these thunks have function scope. For example, the following code, while looking benign, can run into undefined behaviour because of thunks:
     504
     505\begin{cfacode}
     506//async: Runs function asynchronously on another thread
    785507forall(otype T)
    786508extern void async(void (*func)(T*), T* obj);
     
    791513void bar() {
    792514        int a;
    793         async(noop, &a); // start thread running noop with argument a
    794 }
    795 \end{cfa}
     515        async(noop, &a); //start thread running noop with argument a
     516}
     517\end{cfacode}
    796518
    797519The generated C code\footnote{Code trimmed down for brevity} creates a local thunk to hold type information:
    798520
    799 \begin{cfa}
     521\begin{ccode}
    800522extern void async(/* omitted */, void (*func)(void*), void* obj);
    801523
     
    811533        async(/* omitted */, ((void (*)(void*))(&_thunk0)), (&a));
    812534}
    813 \end{cfa}
    814 The problem in this example is a storage management issue, the function pointer @_thunk0@ is only valid until the end of the block, which limits the viable solutions because storing the function pointer for too long causes undefined behaviour; \ie the stack-based thunk being destroyed before it can be used.
    815 This challenge is an extension of challenges that come with second-class routines.
    816 Indeed, GCC nested routines also have the limitation that nested routine cannot be passed outside of the declaration scope.
    817 The case of coroutines and threads is simply an extension of this problem to multiple call stacks.
    818 
    819 
    820 \subsubsection{Alternative: Composition}
    821 
     535\end{ccode}
     536The problem in this example is a storage management issue, the function pointer \code{_thunk0} is only valid until the end of the block, which limits the viable solutions because storing the function pointer for too long causes undefined behaviour; i.e., the stack-based thunk being destroyed before it can be used. This challenge is an extension of challenges that come with second-class routines. Indeed, GCC nested routines also have the limitation that nested routine cannot be passed outside of the declaration scope. The case of coroutines and threads is simply an extension of this problem to multiple call stacks.
     537
     538\subsection{Alternative: Composition}
    822539One solution to this challenge is to use composition/containment, where coroutine fields are added to manage the coroutine.
    823540
    824 \begin{cfa}
     541\begin{cfacode}
    825542struct Fibonacci {
    826         int fn; // used for communication
    827         coroutine c; // composition
     543        int fn; //used for communication
     544        coroutine c; //composition
    828545};
    829546
     
    834551void ?{}(Fibonacci& this) {
    835552        this.fn = 0;
    836         // Call constructor to initialize coroutine
     553        //Call constructor to initialize coroutine
    837554        (this.c){myMain};
    838555}
    839 \end{cfa}
    840 The downside of this approach is that users need to correctly construct the coroutine handle before using it.
    841 Like any other objects, the user must carefully choose construction order to prevent usage of objects not yet constructed.
    842 However, in the case of coroutines, users must also pass to the coroutine information about the coroutine main, like in the previous example.
    843 This opens the door for user errors and requires extra runtime storage to pass at runtime information that can be known statically.
    844 
    845 
    846 \subsubsection{Alternative: Reserved keyword}
    847 
     556\end{cfacode}
     557The downside of this approach is that users need to correctly construct the coroutine handle before using it. Like any other objects, the user must carefully choose construction order to prevent usage of objects not yet constructed. However, in the case of coroutines, users must also pass to the coroutine information about the coroutine main, like in the previous example. This opens the door for user errors and requires extra runtime storage to pass at runtime information that can be known statically.
     558
     559\subsection{Alternative: Reserved keyword}
    848560The next alternative is to use language support to annotate coroutines as follows:
    849 \begin{cfa}
     561
     562\begin{cfacode}
    850563coroutine Fibonacci {
    851         int fn; // used for communication
     564        int fn; //used for communication
    852565};
    853 \end{cfa}
    854 The @coroutine@ keyword means the compiler can find and inject code where needed.
    855 The downside of this approach is that it makes coroutine a special case in the language.
    856 Users wanting to extend coroutines or build their own for various reasons can only do so in ways offered by the language.
    857 Furthermore, implementing coroutines without language supports also displays the power of the programming language used.
    858 While this is ultimately the option used for idiomatic \CFA code, coroutines and threads can still be constructed by users without using the language support.
    859 The reserved keywords are only present to improve ease of use for the common cases.
    860 
    861 
    862 \subsubsection{Alternative: Lambda Objects}
    863 
    864 For coroutines as for threads, many implementations are based on routine pointers or function objects~\cite{Butenhof97, C++14, MS:VisualC++, BoostCoroutines15}.
    865 For example, Boost implements coroutines in terms of four functor object types:
    866 \begin{cfa}
     566\end{cfacode}
     567The \code{coroutine} keyword means the compiler can find and inject code where needed. The downside of this approach is that it makes coroutine a special case in the language. Users wanting to extend coroutines or build their own for various reasons can only do so in ways offered by the language. Furthermore, implementing coroutines without language supports also displays the power of the programming language used. While this is ultimately the option used for idiomatic \CFA code, coroutines and threads can still be constructed by users without using the language support. The reserved keywords are only present to improve ease of use for the common cases.
     568
     569\subsection{Alternative: Lambda Objects}
     570
     571For coroutines as for threads, many implementations are based on routine pointers or function objects~\cite{Butenhof97, C++14, MS:VisualC++, BoostCoroutines15}. For example, Boost implements coroutines in terms of four functor object types:
     572\begin{cfacode}
    867573asymmetric_coroutine<>::pull_type
    868574asymmetric_coroutine<>::push_type
    869575symmetric_coroutine<>::call_type
    870576symmetric_coroutine<>::yield_type
    871 \end{cfa}
    872 Often, the canonical threading paradigm in languages is based on function pointers, @pthread@ being one of the most well-known examples.
    873 The main problem of this approach is that the thread usage is limited to a generic handle that must otherwise be wrapped in a custom type.
    874 Since the custom type is simple to write in \CFA and solves several issues, added support for routine/lambda based coroutines adds very little.
    875 
    876 A variation of this would be to use a simple function pointer in the same way @pthread@ does for threads:
    877 \begin{cfa}
     577\end{cfacode}
     578Often, the canonical threading paradigm in languages is based on function pointers, \texttt{pthread} being one of the most well-known examples. The main problem of this approach is that the thread usage is limited to a generic handle that must otherwise be wrapped in a custom type. Since the custom type is simple to write in \CFA and solves several issues, added support for routine/lambda based coroutines adds very little.
     579
     580A variation of this would be to use a simple function pointer in the same way \texttt{pthread} does for threads:
     581\begin{cfacode}
    878582void foo( coroutine_t cid, void* arg ) {
    879583        int* value = (int*)arg;
    880         // Coroutine body
     584        //Coroutine body
    881585}
    882586
     
    886590        coroutine_resume( &cid );
    887591}
    888 \end{cfa}
    889 This semantics is more common for thread interfaces but coroutines work equally well.
    890 As discussed in section \ref{threads}, this approach is superseded by static approaches in terms of expressivity.
    891 
    892 
    893 \subsubsection{Alternative: Trait-Based Coroutines}
    894 
    895 Finally, the underlying approach, which is the one closest to \CFA idioms, is to use trait-based lazy coroutines.
    896 This approach defines a coroutine as anything that satisfies the trait @is_coroutine@ (as defined below) and is used as a coroutine.
    897 
    898 \begin{cfa}
     592\end{cfacode}
     593This semantics is more common for thread interfaces but coroutines work equally well. As discussed in section \ref{threads}, this approach is superseded by static approaches in terms of expressivity.
     594
     595\subsection{Alternative: Trait-Based Coroutines}
     596
     597Finally, the underlying approach, which is the one closest to \CFA idioms, is to use trait-based lazy coroutines. This approach defines a coroutine as anything that satisfies the trait \code{is_coroutine} (as defined below) and is used as a coroutine.
     598
     599\begin{cfacode}
    899600trait is_coroutine(dtype T) {
    900601      void main(T& this);
     
    904605forall( dtype T | is_coroutine(T) ) void suspend(T&);
    905606forall( dtype T | is_coroutine(T) ) void resume (T&);
    906 \end{cfa}
    907 This ensures that an object is not a coroutine until @resume@ is called on the object.
    908 Correspondingly, any object that is passed to @resume@ is a coroutine since it must satisfy the @is_coroutine@ trait to compile.
    909 The advantage of this approach is that users can easily create different types of coroutines, for example, changing the memory layout of a coroutine is trivial when implementing the @get_coroutine@ routine.
    910 The \CFA keyword @coroutine@ simply has the effect of implementing the getter and forward declarations required for users to implement the main routine.
     607\end{cfacode}
     608This ensures that an object is not a coroutine until \code{resume} is called on the object. Correspondingly, any object that is passed to \code{resume} is a coroutine since it must satisfy the \code{is_coroutine} trait to compile. The advantage of this approach is that users can easily create different types of coroutines, for example, changing the memory layout of a coroutine is trivial when implementing the \code{get_coroutine} routine. The \CFA keyword \code{coroutine} simply has the effect of implementing the getter and forward declarations required for users to implement the main routine.
    911609
    912610\begin{center}
    913611\begin{tabular}{c c c}
    914 \begin{cfa}[tabsize=3]
     612\begin{cfacode}[tabsize=3]
    915613coroutine MyCoroutine {
    916614        int someValue;
    917615};
    918 \end{cfa} & == & \begin{cfa}[tabsize=3]
     616\end{cfacode} & == & \begin{cfacode}[tabsize=3]
    919617struct MyCoroutine {
    920618        int someValue;
     
    930628
    931629void main(struct MyCoroutine* this);
    932 \end{cfa}
     630\end{cfacode}
    933631\end{tabular}
    934632\end{center}
     
    936634The combination of these two approaches allows users new to coroutining and concurrency to have an easy and concise specification, while more advanced users have tighter control on memory layout and initialization.
    937635
    938 \subsection{Thread Interface}\label{threads}
    939 The basic building blocks of multithreading in \CFA are \textbf{cfathread}.
    940 Both user and kernel threads are supported, where user threads are the concurrency mechanism and kernel threads are the parallel mechanism.
    941 User threads offer a flexible and lightweight interface.
    942 A thread can be declared using a struct declaration @thread@ as follows:
    943 
    944 \begin{cfa}
     636\section{Thread Interface}\label{threads}
     637The basic building blocks of multithreading in \CFA are \textbf{cfathread}. Both user and kernel threads are supported, where user threads are the concurrency mechanism and kernel threads are the parallel mechanism. User threads offer a flexible and lightweight interface. A thread can be declared using a struct declaration \code{thread} as follows:
     638
     639\begin{cfacode}
    945640thread foo {};
    946 \end{cfa}
     641\end{cfacode}
    947642
    948643As for coroutines, the keyword is a thin wrapper around a \CFA trait:
    949644
    950 \begin{cfa}
     645\begin{cfacode}
    951646trait is_thread(dtype T) {
    952647      void ^?{}(T & mutex this);
     
    954649      thread_desc* get_thread(T & this);
    955650};
    956 \end{cfa}
    957 
    958 Obviously, for this thread implementation to be useful it must run some user code.
    959 Several other threading interfaces use a function-pointer representation as the interface of threads (for example \Csharp~\cite{Csharp} and Scala~\cite{Scala}).
    960 However, this proposal considers that statically tying a @main@ routine to a thread supersedes this approach.
    961 Since the @main@ routine is already a special routine in \CFA (where the program begins), it is a natural extension of the semantics to use overloading to declare mains for different threads (the normal main being the main of the initial thread).
    962 As such the @main@ routine of a thread can be defined as
    963 \begin{cfa}
     651\end{cfacode}
     652
     653Obviously, for this thread implementation to be useful it must run some user code. Several other threading interfaces use a function-pointer representation as the interface of threads (for example \Csharp~\cite{Csharp} and Scala~\cite{Scala}). However, this proposal considers that statically tying a \code{main} routine to a thread supersedes this approach. Since the \code{main} routine is already a special routine in \CFA (where the program begins), it is a natural extension of the semantics to use overloading to declare mains for different threads (the normal main being the main of the initial thread). As such the \code{main} routine of a thread can be defined as
     654\begin{cfacode}
    964655thread foo {};
    965656
     
    967658        sout | "Hello World!" | endl;
    968659}
    969 \end{cfa}
    970 
    971 In this example, threads of type @foo@ start execution in the @void main(foo &)@ routine, which prints @"Hello World!".@ While this paper encourages this approach to enforce strongly typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity.
    972 With the static semantics it is trivial to write a thread type that takes a function pointer as a parameter and executes it on its stack asynchronously.
    973 \begin{cfa}
     660\end{cfacode}
     661
     662In this example, threads of type \code{foo} start execution in the \code{void main(foo &)} routine, which prints \code{"Hello World!".} While this paper encourages this approach to enforce strongly typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity. With the static semantics it is trivial to write a thread type that takes a function pointer as a parameter and executes it on its stack asynchronously.
     663\begin{cfacode}
    974664typedef void (*voidFunc)(int);
    975665
     
    985675
    986676void main(FuncRunner & this) {
    987         // thread starts here and runs the function
     677        //thread starts here and runs the function
    988678        this.func( this.arg );
    989679}
     
    997687        return 0?
    998688}
    999 \end{cfa}
     689\end{cfacode}
    1000690
    1001691A consequence of the strongly typed approach to main is that memory layout of parameters and return values to/from a thread are now explicitly specified in the \textbf{api}.
    1002692
    1003 Of course, for threads to be useful, it must be possible to start and stop threads and wait for them to complete execution.
    1004 While using an \textbf{api} such as @fork@ and @join@ is relatively common in the literature, such an interface is unnecessary.
    1005 Indeed, the simplest approach is to use \textbf{raii} principles and have threads @fork@ after the constructor has completed and @join@ before the destructor runs.
    1006 \begin{cfa}
     693Of course, for threads to be useful, it must be possible to start and stop threads and wait for them to complete execution. While using an \textbf{api} such as \code{fork} and \code{join} is relatively common in the literature, such an interface is unnecessary. Indeed, the simplest approach is to use \textbf{raii} principles and have threads \code{fork} after the constructor has completed and \code{join} before the destructor runs.
     694\begin{cfacode}
    1007695thread World;
    1008696
     
    1013701void main() {
    1014702        World w;
    1015         // Thread forks here
    1016 
    1017         // Printing "Hello " and "World!" are run concurrently
     703        //Thread forks here
     704
     705        //Printing "Hello " and "World!" are run concurrently
    1018706        sout | "Hello " | endl;
    1019707
    1020         // Implicit join at end of scope
    1021 }
    1022 \end{cfa}
     708        //Implicit join at end of scope
     709}
     710\end{cfacode}
    1023711
    1024712This semantic has several advantages over explicit semantics: a thread is always started and stopped exactly once, users cannot make any programming errors, and it naturally scales to multiple threads meaning basic synchronization is very simple.
    1025713
    1026 \begin{cfa}
     714\begin{cfacode}
    1027715thread MyThread {
    1028716        //...
    1029717};
    1030718
    1031 // main
     719//main
    1032720void main(MyThread& this) {
    1033721        //...
     
    1036724void foo() {
    1037725        MyThread thrds[10];
    1038         // Start 10 threads at the beginning of the scope
     726        //Start 10 threads at the beginning of the scope
    1039727
    1040728        DoStuff();
    1041729
    1042         // Wait for the 10 threads to finish
    1043 }
    1044 \end{cfa}
    1045 
    1046 However, one of the drawbacks of this approach is that threads always form a tree where nodes must always outlive their children, \ie they are always destroyed in the opposite order of construction because of C scoping rules.
    1047 This restriction is relaxed by using dynamic allocation, so threads can outlive the scope in which they are created, much like dynamically allocating memory lets objects outlive the scope in which they are created.
    1048 
    1049 \begin{cfa}
     730        //Wait for the 10 threads to finish
     731}
     732\end{cfacode}
     733
     734However, one of the drawbacks of this approach is that threads always form a tree where nodes must always outlive their children, i.e., they are always destroyed in the opposite order of construction because of C scoping rules. This restriction is relaxed by using dynamic allocation, so threads can outlive the scope in which they are created, much like dynamically allocating memory lets objects outlive the scope in which they are created.
     735
     736\begin{cfacode}
    1050737thread MyThread {
    1051738        //...
     
    1059746        MyThread* long_lived;
    1060747        {
    1061                 // Start a thread at the beginning of the scope
     748                //Start a thread at the beginning of the scope
    1062749                MyThread short_lived;
    1063750
    1064                 // create another thread that will outlive the thread in this scope
     751                //create another thread that will outlive the thread in this scope
    1065752                long_lived = new MyThread;
    1066753
    1067754                DoStuff();
    1068755
    1069                 // Wait for the thread short_lived to finish
     756                //Wait for the thread short_lived to finish
    1070757        }
    1071758        DoMoreStuff();
    1072759
    1073         // Now wait for the long_lived to finish
     760        //Now wait for the long_lived to finish
    1074761        delete long_lived;
    1075762}
    1076 \end{cfa}
     763\end{cfacode}
    1077764
    1078765
     
    1082769% ======================================================================
    1083770% ======================================================================
    1084 Several tools can be used to solve concurrency challenges.
    1085 Since many of these challenges appear with the use of mutable shared state, some languages and libraries simply disallow mutable shared state (Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, Akka (Scala)~\cite{Akka}).
    1086 In these paradigms, interaction among concurrent objects relies on message passing~\cite{Thoth,Harmony,V-Kernel} or other paradigms closely relate to networking concepts (channels~\cite{CSP,Go} for example).
    1087 However, in languages that use routine calls as their core abstraction mechanism, these approaches force a clear distinction between concurrent and non-concurrent paradigms (\ie message passing versus routine calls).
    1088 This distinction in turn means that, in order to be effective, programmers need to learn two sets of design patterns.
    1089 While this distinction can be hidden away in library code, effective use of the library still has to take both paradigms into account.
    1090 
    1091 Approaches based on shared memory are more closely related to non-concurrent paradigms since they often rely on basic constructs like routine calls and shared objects.
    1092 At the lowest level, concurrent paradigms are implemented as atomic operations and locks.
    1093 Many such mechanisms have been proposed, including semaphores~\cite{Dijkstra68b} and path expressions~\cite{Campbell74}.
    1094 However, for productivity reasons it is desirable to have a higher-level construct be the core concurrency paradigm~\cite{Hochstein05}.
    1095 
    1096 An approach that is worth mentioning because it is gaining in popularity is transactional memory~\cite{Herlihy93}.
    1097 While this approach is even pursued by system languages like \CC~\cite{Cpp-Transactions}, the performance and feature set is currently too restrictive to be the main concurrency paradigm for system languages, which is why it was rejected as the core paradigm for concurrency in \CFA.
    1098 
    1099 One of the most natural, elegant, and efficient mechanisms for synchronization and communication, especially for shared-memory systems, is the \emph{monitor}.
    1100 Monitors were first proposed by Brinch Hansen~\cite{Hansen73} and later described and extended by C.A.R.~Hoare~\cite{Hoare74}.
    1101 Many programming languages---\eg Concurrent Pascal~\cite{ConcurrentPascal}, Mesa~\cite{Mesa}, Modula~\cite{Modula-2}, Turing~\cite{Turing:old}, Modula-3~\cite{Modula-3}, NeWS~\cite{NeWS}, Emerald~\cite{Emerald}, \uC~\cite{Buhr92a} and Java~\cite{Java}---provide monitors as explicit language constructs.
    1102 In addition, operating-system kernels and device drivers have a monitor-like structure, although they often use lower-level primitives such as semaphores or locks to simulate monitors.
    1103 For these reasons, this project proposes monitors as the core concurrency construct.
    1104 
    1105 
    1106 \subsection{Basics}
    1107 
    1108 Non-determinism requires concurrent systems to offer support for mutual-exclusion and synchronization.
    1109 Mutual-exclusion is the concept that only a fixed number of threads can access a critical section at any given time, where a critical section is a group of instructions on an associated portion of data that requires the restricted access.
    1110 On the other hand, synchronization enforces relative ordering of execution and synchronization tools provide numerous mechanisms to establish timing relationships among threads.
    1111 
    1112 
    1113 \subsubsection{Mutual-Exclusion}
    1114 
    1115 As mentioned above, mutual-exclusion is the guarantee that only a fix number of threads can enter a critical section at once.
    1116 However, many solutions exist for mutual exclusion, which vary in terms of performance, flexibility and ease of use.
    1117 Methods range from low-level locks, which are fast and flexible but require significant attention to be correct, to  higher-level concurrency techniques, which sacrifice some performance in order to improve ease of use.
    1118 Ease of use comes by either guaranteeing some problems cannot occur (\eg being deadlock free) or by offering a more explicit coupling between data and corresponding critical section.
    1119 For example, the \CC @std::atomic<T>@ offers an easy way to express mutual-exclusion on a restricted set of operations (\eg reading/writing large types atomically).
    1120 Another challenge with low-level locks is composability.
    1121 Locks have restricted composability because it takes careful organizing for multiple locks to be used while preventing deadlocks.
    1122 Easing composability is another feature higher-level mutual-exclusion mechanisms often offer.
    1123 
    1124 
    1125 \subsubsection{Synchronization}
    1126 
    1127 As with mutual-exclusion, low-level synchronization primitives often offer good performance and good flexibility at the cost of ease of use.
    1128 Again, higher-level mechanisms often simplify usage by adding either better coupling between synchronization and data (\eg message passing) or offering a simpler solution to otherwise involved challenges.
    1129 As mentioned above, synchronization can be expressed as guaranteeing that event \textit{X} always happens before \textit{Y}.
    1130 Most of the time, synchronization happens within a critical section, where threads must acquire mutual-exclusion in a certain order.
    1131 However, it may also be desirable to guarantee that event \textit{Z} does not occur between \textit{X} and \textit{Y}.
    1132 Not satisfying this property is called \textbf{barging}.
    1133 For example, where event \textit{X} tries to effect event \textit{Y} but another thread acquires the critical section and emits \textit{Z} before \textit{Y}.
    1134 The classic example is the thread that finishes using a resource and unblocks a thread waiting to use the resource, but the unblocked thread must compete to acquire the resource.
    1135 Preventing or detecting barging is an involved challenge with low-level locks, which can be made much easier by higher-level constructs.
    1136 This challenge is often split into two different methods, barging avoidance and barging prevention.
    1137 Algorithms that use flag variables to detect barging threads are said to be using barging avoidance, while algorithms that baton-pass locks~\cite{Andrews89} between threads instead of releasing the locks are said to be using barging prevention.
    1138 
     771Several tools can be used to solve concurrency challenges. Since many of these challenges appear with the use of mutable shared state, some languages and libraries simply disallow mutable shared state (Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, Akka (Scala)~\cite{Akka}). In these paradigms, interaction among concurrent objects relies on message passing~\cite{Thoth,Harmony,V-Kernel} or other paradigms closely relate to networking concepts (channels~\cite{CSP,Go} for example). However, in languages that use routine calls as their core abstraction mechanism, these approaches force a clear distinction between concurrent and non-concurrent paradigms (i.e., message passing versus routine calls). This distinction in turn means that, in order to be effective, programmers need to learn two sets of design patterns. While this distinction can be hidden away in library code, effective use of the library still has to take both paradigms into account.
     772
     773Approaches based on shared memory are more closely related to non-concurrent paradigms since they often rely on basic constructs like routine calls and shared objects. At the lowest level, concurrent paradigms are implemented as atomic operations and locks. Many such mechanisms have been proposed, including semaphores~\cite{Dijkstra68b} and path expressions~\cite{Campbell74}. However, for productivity reasons it is desirable to have a higher-level construct be the core concurrency paradigm~\cite{HPP:Study}.
     774
     775An approach that is worth mentioning because it is gaining in popularity is transactional memory~\cite{Herlihy93}. While this approach is even pursued by system languages like \CC~\cite{Cpp-Transactions}, the performance and feature set is currently too restrictive to be the main concurrency paradigm for system languages, which is why it was rejected as the core paradigm for concurrency in \CFA.
     776
     777One of the most natural, elegant, and efficient mechanisms for synchronization and communication, especially for shared-memory systems, is the \emph{monitor}. Monitors were first proposed by Brinch Hansen~\cite{Hansen73} and later described and extended by C.A.R.~Hoare~\cite{Hoare74}. Many programming languages---e.g., Concurrent Pascal~\cite{ConcurrentPascal}, Mesa~\cite{Mesa}, Modula~\cite{Modula-2}, Turing~\cite{Turing:old}, Modula-3~\cite{Modula-3}, NeWS~\cite{NeWS}, Emerald~\cite{Emerald}, \uC~\cite{Buhr92a} and Java~\cite{Java}---provide monitors as explicit language constructs. In addition, operating-system kernels and device drivers have a monitor-like structure, although they often use lower-level primitives such as semaphores or locks to simulate monitors. For these reasons, this project proposes monitors as the core concurrency construct.
     778
     779\section{Basics}
     780Non-determinism requires concurrent systems to offer support for mutual-exclusion and synchronization. Mutual-exclusion is the concept that only a fixed number of threads can access a critical section at any given time, where a critical section is a group of instructions on an associated portion of data that requires the restricted access. On the other hand, synchronization enforces relative ordering of execution and synchronization tools provide numerous mechanisms to establish timing relationships among threads.
     781
     782\subsection{Mutual-Exclusion}
     783As mentioned above, mutual-exclusion is the guarantee that only a fix number of threads can enter a critical section at once. However, many solutions exist for mutual exclusion, which vary in terms of performance, flexibility and ease of use. Methods range from low-level locks, which are fast and flexible but require significant attention to be correct, to  higher-level concurrency techniques, which sacrifice some performance in order to improve ease of use. Ease of use comes by either guaranteeing some problems cannot occur (e.g., being deadlock free) or by offering a more explicit coupling between data and corresponding critical section. For example, the \CC \code{std::atomic<T>} offers an easy way to express mutual-exclusion on a restricted set of operations (e.g., reading/writing large types atomically). Another challenge with low-level locks is composability. Locks have restricted composability because it takes careful organizing for multiple locks to be used while preventing deadlocks. Easing composability is another feature higher-level mutual-exclusion mechanisms often offer.
     784
     785\subsection{Synchronization}
     786As with mutual-exclusion, low-level synchronization primitives often offer good performance and good flexibility at the cost of ease of use. Again, higher-level mechanisms often simplify usage by adding either better coupling between synchronization and data (e.g., message passing) or offering a simpler solution to otherwise involved challenges. As mentioned above, synchronization can be expressed as guaranteeing that event \textit{X} always happens before \textit{Y}. Most of the time, synchronization happens within a critical section, where threads must acquire mutual-exclusion in a certain order. However, it may also be desirable to guarantee that event \textit{Z} does not occur between \textit{X} and \textit{Y}. Not satisfying this property is called \textbf{barging}. For example, where event \textit{X} tries to effect event \textit{Y} but another thread acquires the critical section and emits \textit{Z} before \textit{Y}. The classic example is the thread that finishes using a resource and unblocks a thread waiting to use the resource, but the unblocked thread must compete to acquire the resource. Preventing or detecting barging is an involved challenge with low-level locks, which can be made much easier by higher-level constructs. This challenge is often split into two different methods, barging avoidance and barging prevention. Algorithms that use flag variables to detect barging threads are said to be using barging avoidance, while algorithms that baton-pass locks~\cite{Andrews89} between threads instead of releasing the locks are said to be using barging prevention.
    1139787
    1140788% ======================================================================
     
    1143791% ======================================================================
    1144792% ======================================================================
    1145 A \textbf{monitor} is a set of routines that ensure mutual-exclusion when accessing shared state.
    1146 More precisely, a monitor is a programming technique that associates mutual-exclusion to routine scopes, as opposed to mutex locks, where mutual-exclusion is defined by lock/release calls independently of any scoping of the calling routine.
    1147 This strong association eases readability and maintainability, at the cost of flexibility.
    1148 Note that both monitors and mutex locks, require an abstract handle to identify them.
    1149 This concept is generally associated with object-oriented languages like Java~\cite{Java} or \uC~\cite{uC++book} but does not strictly require OO semantics.
    1150 The only requirement is the ability to declare a handle to a shared object and a set of routines that act on it:
    1151 \begin{cfa}
     793A \textbf{monitor} is a set of routines that ensure mutual-exclusion when accessing shared state. More precisely, a monitor is a programming technique that associates mutual-exclusion to routine scopes, as opposed to mutex locks, where mutual-exclusion is defined by lock/release calls independently of any scoping of the calling routine. This strong association eases readability and maintainability, at the cost of flexibility. Note that both monitors and mutex locks, require an abstract handle to identify them. This concept is generally associated with object-oriented languages like Java~\cite{Java} or \uC~\cite{uC++book} but does not strictly require OO semantics. The only requirement is the ability to declare a handle to a shared object and a set of routines that act on it:
     794\begin{cfacode}
    1152795typedef /*some monitor type*/ monitor;
    1153796int f(monitor & m);
    1154797
    1155798int main() {
    1156         monitor m;  // Handle m
    1157         f(m);       // Routine using handle
    1158 }
    1159 \end{cfa}
     799        monitor m;  //Handle m
     800        f(m);       //Routine using handle
     801}
     802\end{cfacode}
    1160803
    1161804% ======================================================================
     
    1164807% ======================================================================
    1165808% ======================================================================
    1166 The above monitor example displays some of the intrinsic characteristics.
    1167 First, it is necessary to use pass-by-reference over pass-by-value for monitor routines.
    1168 This semantics is important, because at their core, monitors are implicit mutual-exclusion objects (locks), and these objects cannot be copied.
    1169 Therefore, monitors are non-copy-able objects (@dtype@).
    1170 
    1171 Another aspect to consider is when a monitor acquires its mutual exclusion.
    1172 For example, a monitor may need to be passed through multiple helper routines that do not acquire the monitor mutual-exclusion on entry.
    1173 Passthrough can occur for generic helper routines (@swap@, @sort@, \etc) or specific helper routines like the following to implement an atomic counter:
    1174 
    1175 \begin{cfa}
     809The above monitor example displays some of the intrinsic characteristics. First, it is necessary to use pass-by-reference over pass-by-value for monitor routines. This semantics is important, because at their core, monitors are implicit mutual-exclusion objects (locks), and these objects cannot be copied. Therefore, monitors are non-copy-able objects (\code{dtype}).
     810
     811Another aspect to consider is when a monitor acquires its mutual exclusion. For example, a monitor may need to be passed through multiple helper routines that do not acquire the monitor mutual-exclusion on entry. Passthrough can occur for generic helper routines (\code{swap}, \code{sort}, etc.) or specific helper routines like the following to implement an atomic counter:
     812
     813\begin{cfacode}
    1176814monitor counter_t { /*...see section $\ref{data}$...*/ };
    1177815
    1178 void ?{}(counter_t & nomutex this); // constructor
    1179 size_t ++?(counter_t & mutex this); // increment
    1180 
    1181 // need for mutex is platform dependent
    1182 void ?{}(size_t * this, counter_t & mutex cnt); // conversion
    1183 \end{cfa}
     816void ?{}(counter_t & nomutex this); //constructor
     817size_t ++?(counter_t & mutex this); //increment
     818
     819//need for mutex is platform dependent
     820void ?{}(size_t * this, counter_t & mutex cnt); //conversion
     821\end{cfacode}
    1184822This counter is used as follows:
    1185823\begin{center}
    1186824\begin{tabular}{c @{\hskip 0.35in} c @{\hskip 0.35in} c}
    1187 \begin{cfa}
    1188 // shared counter
     825\begin{cfacode}
     826//shared counter
    1189827counter_t cnt1, cnt2;
    1190828
    1191 // multiple threads access counter
     829//multiple threads access counter
    1192830thread 1 : cnt1++; cnt2++;
    1193831thread 2 : cnt1++; cnt2++;
     
    1195833        ...
    1196834thread N : cnt1++; cnt2++;
    1197 \end{cfa}
     835\end{cfacode}
    1198836\end{tabular}
    1199837\end{center}
    1200 Notice how the counter is used without any explicit synchronization and yet supports thread-safe semantics for both reading and writing, which is similar in usage to the \CC template @std::atomic@.
    1201 
    1202 Here, the constructor (@?{}@) uses the @nomutex@ keyword to signify that it does not acquire the monitor mutual-exclusion when constructing.
    1203 This semantics is because an object not yet constructed should never be shared and therefore does not require mutual exclusion.
    1204 Furthermore, it allows the implementation greater freedom when it initializes the monitor locking.
    1205 The prefix increment operator uses @mutex@ to protect the incrementing process from race conditions.
    1206 Finally, there is a conversion operator from @counter_t@ to @size_t@.
    1207 This conversion may or may not require the @mutex@ keyword depending on whether or not reading a @size_t@ is an atomic operation.
    1208 
    1209 For maximum usability, monitors use \textbf{multi-acq} semantics, which means a single thread can acquire the same monitor multiple times without deadlock.
    1210 For example, listing \ref{fig:search} uses recursion and \textbf{multi-acq} to print values inside a binary tree.
     838Notice how the counter is used without any explicit synchronization and yet supports thread-safe semantics for both reading and writing, which is similar in usage to the \CC template \code{std::atomic}.
     839
     840Here, the constructor (\code{?\{\}}) uses the \code{nomutex} keyword to signify that it does not acquire the monitor mutual-exclusion when constructing. This semantics is because an object not yet con\-structed should never be shared and therefore does not require mutual exclusion. Furthermore, it allows the implementation greater freedom when it initializes the monitor locking. The prefix increment operator uses \code{mutex} to protect the incrementing process from race conditions. Finally, there is a conversion operator from \code{counter_t} to \code{size_t}. This conversion may or may not require the \code{mutex} keyword depending on whether or not reading a \code{size_t} is an atomic operation.
     841
     842For maximum usability, monitors use \textbf{multi-acq} semantics, which means a single thread can acquire the same monitor multiple times without deadlock. For example, listing \ref{fig:search} uses recursion and \textbf{multi-acq} to print values inside a binary tree.
    1211843\begin{figure}
    1212 \begin{cfa}[caption={Recursive printing algorithm using \textbf{multi-acq}.},label={fig:search}]
     844\begin{cfacode}[caption={Recursive printing algorithm using \textbf{multi-acq}.},label={fig:search}]
    1213845monitor printer { ... };
    1214846struct tree {
     
    1223855        print(p, t->right);
    1224856}
    1225 \end{cfa}
     857\end{cfacode}
    1226858\end{figure}
    1227859
    1228 Having both @mutex@ and @nomutex@ keywords can be redundant, depending on the meaning of a routine having neither of these keywords.
    1229 For example, it is reasonable that it should default to the safest option (@mutex@) when given a routine without qualifiers @void foo(counter_t & this)@, whereas assuming @nomutex@ is unsafe and may cause subtle errors.
    1230 On the other hand, @nomutex@ is the ``normal'' parameter behaviour, it effectively states explicitly that ``this routine is not special''.
    1231 Another alternative is making exactly one of these keywords mandatory, which provides the same semantics but without the ambiguity of supporting routines with neither keyword.
    1232 Mandatory keywords would also have the added benefit of being self-documented but at the cost of extra typing.
    1233 While there are several benefits to mandatory keywords, they do bring a few challenges.
    1234 Mandatory keywords in \CFA would imply that the compiler must know without doubt whether or not a parameter is a monitor or not.
    1235 Since \CFA relies heavily on traits as an abstraction mechanism, the distinction between a type that is a monitor and a type that looks like a monitor can become blurred.
    1236 For this reason, \CFA only has the @mutex@ keyword and uses no keyword to mean @nomutex@.
    1237 
    1238 The next semantic decision is to establish when @mutex@ may be used as a type qualifier.
    1239 Consider the following declarations:
    1240 \begin{cfa}
     860Having both \code{mutex} and \code{nomutex} keywords can be redundant, depending on the meaning of a routine having neither of these keywords. For example, it is reasonable that it should default to the safest option (\code{mutex}) when given a routine without qualifiers \code{void foo(counter_t & this)}, whereas assuming \code{nomutex} is unsafe and may cause subtle errors. On the other hand, \code{nomutex} is the ``normal'' parameter behaviour, it effectively states explicitly that ``this routine is not special''. Another alternative is making exactly one of these keywords mandatory, which provides the same semantics but without the ambiguity of supporting routines with neither keyword. Mandatory keywords would also have the added benefit of being self-documented but at the cost of extra typing. While there are several benefits to mandatory keywords, they do bring a few challenges. Mandatory keywords in \CFA would imply that the compiler must know without doubt whether or not a parameter is a monitor or not. Since \CFA relies heavily on traits as an abstraction mechanism, the distinction between a type that is a monitor and a type that looks like a monitor can become blurred. For this reason, \CFA only has the \code{mutex} keyword and uses no keyword to mean \code{nomutex}.
     861
     862The next semantic decision is to establish when \code{mutex} may be used as a type qualifier. Consider the following declarations:
     863\begin{cfacode}
    1241864int f1(monitor & mutex m);
    1242865int f2(const monitor & mutex m);
     
    1244867int f4(monitor * mutex m []);
    1245868int f5(graph(monitor *) & mutex m);
    1246 \end{cfa}
    1247 The problem is to identify which object(s) should be acquired.
    1248 Furthermore, each object needs to be acquired only once.
    1249 In the case of simple routines like @f1@ and @f2@ it is easy to identify an exhaustive list of objects to acquire on entry.
    1250 Adding indirections (@f3@) still allows the compiler and programmer to identify which object is acquired.
    1251 However, adding in arrays (@f4@) makes it much harder.
    1252 Array lengths are not necessarily known in C, and even then, making sure objects are only acquired once becomes none-trivial.
    1253 This problem can be extended to absurd limits like @f5@, which uses a graph of monitors.
    1254 To make the issue tractable, this project imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with at most one level of indirection (ignoring potential qualifiers).
    1255 Also note that while routine @f3@ can be supported, meaning that monitor @**m@ is acquired, passing an array to this routine would be type-safe and yet result in undefined behaviour because only the first element of the array is acquired.
    1256 However, this ambiguity is part of the C type-system with respects to arrays.
    1257 For this reason, @mutex@ is disallowed in the context where arrays may be passed:
    1258 \begin{cfa}
    1259 int f1(monitor & mutex m);    // Okay : recommended case
    1260 int f2(monitor * mutex m);    // Not Okay : Could be an array
    1261 int f3(monitor mutex m []);  // Not Okay : Array of unknown length
    1262 int f4(monitor ** mutex m);   // Not Okay : Could be an array
    1263 int f5(monitor * mutex m []); // Not Okay : Array of unknown length
    1264 \end{cfa}
    1265 Note that not all array functions are actually distinct in the type system.
    1266 However, even if the code generation could tell the difference, the extra information is still not sufficient to extend meaningfully the monitor call semantic.
    1267 
    1268 Unlike object-oriented monitors, where calling a mutex member \emph{implicitly} acquires mutual-exclusion of the receiver object, \CFA uses an explicit mechanism to specify the object that acquires mutual-exclusion.
    1269 A consequence of this approach is that it extends naturally to multi-monitor calls.
    1270 \begin{cfa}
     869\end{cfacode}
     870The problem is to identify which object(s) should be acquired. Furthermore, each object needs to be acquired only once. In the case of simple routines like \code{f1} and \code{f2} it is easy to identify an exhaustive list of objects to acquire on entry. Adding indirections (\code{f3}) still allows the compiler and programmer to identify which object is acquired. However, adding in arrays (\code{f4}) makes it much harder. Array lengths are not necessarily known in C, and even then, making sure objects are only acquired once becomes none-trivial. This problem can be extended to absurd limits like \code{f5}, which uses a graph of monitors. To make the issue tractable, this project imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with at most one level of indirection (ignoring potential qualifiers). Also note that while routine \code{f3} can be supported, meaning that monitor \code{**m} is acquired, passing an array to this routine would be type-safe and yet result in undefined behaviour because only the first element of the array is acquired. However, this ambiguity is part of the C type-system with respects to arrays. For this reason, \code{mutex} is disallowed in the context where arrays may be passed:
     871\begin{cfacode}
     872int f1(monitor & mutex m);    //Okay : recommended case
     873int f2(monitor * mutex m);    //Not Okay : Could be an array
     874int f3(monitor mutex m []);  //Not Okay : Array of unknown length
     875int f4(monitor ** mutex m);   //Not Okay : Could be an array
     876int f5(monitor * mutex m []); //Not Okay : Array of unknown length
     877\end{cfacode}
     878Note that not all array functions are actually distinct in the type system. However, even if the code generation could tell the difference, the extra information is still not sufficient to extend meaningfully the monitor call semantic.
     879
     880Unlike object-oriented monitors, where calling a mutex member \emph{implicitly} acquires mutual-exclusion of the receiver object, \CFA uses an explicit mechanism to specify the object that acquires mutual-exclusion. A consequence of this approach is that it extends naturally to multi-monitor calls.
     881\begin{cfacode}
    1271882int f(MonitorA & mutex a, MonitorB & mutex b);
    1272883
     
    1274885MonitorB b;
    1275886f(a,b);
    1276 \end{cfa}
    1277 While OO monitors could be extended with a mutex qualifier for multiple-monitor calls, no example of this feature could be found.
    1278 The capability to acquire multiple locks before entering a critical section is called \emph{\textbf{bulk-acq}}.
    1279 In practice, writing multi-locking routines that do not lead to deadlocks is tricky.
    1280 Having language support for such a feature is therefore a significant asset for \CFA.
    1281 In the case presented above, \CFA guarantees that the order of acquisition is consistent across calls to different routines using the same monitors as arguments.
    1282 This consistent ordering means acquiring multiple monitors is safe from deadlock when using \textbf{bulk-acq}.
    1283 However, users can still force the acquiring order.
    1284 For example, notice which routines use @mutex@/@nomutex@ and how this affects acquiring order:
    1285 \begin{cfa}
    1286 void foo(A& mutex a, B& mutex b) { // acquire a & b
     887\end{cfacode}
     888While OO monitors could be extended with a mutex qualifier for multiple-monitor calls, no example of this feature could be found. The capability to acquire multiple locks before entering a critical section is called \emph{\textbf{bulk-acq}}. In practice, writing multi-locking routines that do not lead to deadlocks is tricky. Having language support for such a feature is therefore a significant asset for \CFA. In the case presented above, \CFA guarantees that the order of acquisition is consistent across calls to different routines using the same monitors as arguments. This consistent ordering means acquiring multiple monitors is safe from deadlock when using \textbf{bulk-acq}. However, users can still force the acquiring order. For example, notice which routines use \code{mutex}/\code{nomutex} and how this affects acquiring order:
     889\begin{cfacode}
     890void foo(A& mutex a, B& mutex b) { //acquire a & b
    1287891        ...
    1288892}
    1289893
    1290 void bar(A& mutex a, B& /*nomutex*/ b) { // acquire a
    1291         ... foo(a, b); ... // acquire b
    1292 }
    1293 
    1294 void baz(A& /*nomutex*/ a, B& mutex b) { // acquire b
    1295         ... foo(a, b); ... // acquire a
    1296 }
    1297 \end{cfa}
    1298 The \textbf{multi-acq} monitor lock allows a monitor lock to be acquired by both @bar@ or @baz@ and acquired again in @foo@.
    1299 In the calls to @bar@ and @baz@ the monitors are acquired in opposite order.
    1300 
    1301 However, such use leads to lock acquiring order problems.
    1302 In the example above, the user uses implicit ordering in the case of function @foo@ but explicit ordering in the case of @bar@ and @baz@.
    1303 This subtle difference means that calling these routines concurrently may lead to deadlock and is therefore undefined behaviour.
    1304 As shown~\cite{Lister77}, solving this problem requires:
     894void bar(A& mutex a, B& /*nomutex*/ b) { //acquire a
     895        ... foo(a, b); ... //acquire b
     896}
     897
     898void baz(A& /*nomutex*/ a, B& mutex b) { //acquire b
     899        ... foo(a, b); ... //acquire a
     900}
     901\end{cfacode}
     902The \textbf{multi-acq} monitor lock allows a monitor lock to be acquired by both \code{bar} or \code{baz} and acquired again in \code{foo}. In the calls to \code{bar} and \code{baz} the monitors are acquired in opposite order.
     903
     904However, such use leads to lock acquiring order problems. In the example above, the user uses implicit ordering in the case of function \code{foo} but explicit ordering in the case of \code{bar} and \code{baz}. This subtle difference means that calling these routines concurrently may lead to deadlock and is therefore undefined behaviour. As shown~\cite{Lister77}, solving this problem requires:
    1305905\begin{enumerate}
    1306906        \item Dynamically tracking the monitor-call order.
    1307907        \item Implement rollback semantics.
    1308908\end{enumerate}
    1309 While the first requirement is already a significant constraint on the system, implementing a general rollback semantics in a C-like language is still prohibitively complex~\cite{Dice10}.
    1310 In \CFA, users simply need to be careful when acquiring multiple monitors at the same time or only use \textbf{bulk-acq} of all the monitors.
    1311 While \CFA provides only a partial solution, most systems provide no solution and the \CFA partial solution handles many useful cases.
     909While the first requirement is already a significant constraint on the system, implementing a general rollback semantics in a C-like language is still prohibitively complex~\cite{Dice10}. In \CFA, users simply need to be careful when acquiring multiple monitors at the same time or only use \textbf{bulk-acq} of all the monitors. While \CFA provides only a partial solution, most systems provide no solution and the \CFA partial solution handles many useful cases.
    1312910
    1313911For example, \textbf{multi-acq} and \textbf{bulk-acq} can be used together in interesting ways:
    1314 \begin{cfa}
     912\begin{cfacode}
    1315913monitor bank { ... };
    1316914
     
    1321919        deposit( yourbank, me2you );
    1322920}
    1323 \end{cfa}
    1324 This example shows a trivial solution to the bank-account transfer problem~\cite{BankTransfer}.
    1325 Without \textbf{multi-acq} and \textbf{bulk-acq}, the solution to this problem is much more involved and requires careful engineering.
    1326 
    1327 
    1328 \subsection{\protect\lstinline|mutex| statement} \label{mutex-stmt}
    1329 
    1330 The call semantics discussed above have one software engineering issue: only a routine can acquire the mutual-exclusion of a set of monitor. \CFA offers the @mutex@ statement to work around the need for unnecessary names, avoiding a major software engineering problem~\cite{2FTwoHardThings}.
    1331 Table \ref{f:mutex-stmt} shows an example of the @mutex@ statement, which introduces a new scope in which the mutual-exclusion of a set of monitor is acquired.
    1332 Beyond naming, the @mutex@ statement has no semantic difference from a routine call with @mutex@ parameters.
     921\end{cfacode}
     922This example shows a trivial solution to the bank-account transfer problem~\cite{BankTransfer}. Without \textbf{multi-acq} and \textbf{bulk-acq}, the solution to this problem is much more involved and requires careful engineering.
     923
     924\subsection{\code{mutex} statement} \label{mutex-stmt}
     925
     926The call semantics discussed above have one software engineering issue: only a routine can acquire the mutual-exclusion of a set of monitor. \CFA offers the \code{mutex} statement to work around the need for unnecessary names, avoiding a major software engineering problem~\cite{2FTwoHardThings}. Table \ref{lst:mutex-stmt} shows an example of the \code{mutex} statement, which introduces a new scope in which the mutual-exclusion of a set of monitor is acquired. Beyond naming, the \code{mutex} statement has no semantic difference from a routine call with \code{mutex} parameters.
    1333927
    1334928\begin{table}
    1335929\begin{center}
    1336930\begin{tabular}{|c|c|}
    1337 function call & @mutex@ statement \\
     931function call & \code{mutex} statement \\
    1338932\hline
    1339 \begin{cfa}[tabsize=3]
     933\begin{cfacode}[tabsize=3]
    1340934monitor M {};
    1341935void foo( M & mutex m1, M & mutex m2 ) {
    1342         // critical section
     936        //critical section
    1343937}
    1344938
     
    1346940        foo( m1, m2 );
    1347941}
    1348 \end{cfa}&\begin{cfa}[tabsize=3]
     942\end{cfacode}&\begin{cfacode}[tabsize=3]
    1349943monitor M {};
    1350944void bar( M & m1, M & m2 ) {
    1351945        mutex(m1, m2) {
    1352                 // critical section
    1353         }
    1354 }
    1355 
    1356 
    1357 \end{cfa}
     946                //critical section
     947        }
     948}
     949
     950
     951\end{cfacode}
    1358952\end{tabular}
    1359953\end{center}
    1360 \caption{Regular call semantics vs. \protect\lstinline|mutex| statement}
    1361 \label{f:mutex-stmt}
     954\caption{Regular call semantics vs. \code{mutex} statement}
     955\label{lst:mutex-stmt}
    1362956\end{table}
    1363957
     
    1367961% ======================================================================
    1368962% ======================================================================
    1369 Once the call semantics are established, the next step is to establish data semantics.
    1370 Indeed, until now a monitor is used simply as a generic handle but in most cases monitors contain shared data.
    1371 This data should be intrinsic to the monitor declaration to prevent any accidental use of data without its appropriate protection.
    1372 For example, here is a complete version of the counter shown in section \ref{call}:
    1373 \begin{cfa}
     963Once the call semantics are established, the next step is to establish data semantics. Indeed, until now a monitor is used simply as a generic handle but in most cases monitors contain shared data. This data should be intrinsic to the monitor declaration to prevent any accidental use of data without its appropriate protection. For example, here is a complete version of the counter shown in section \ref{call}:
     964\begin{cfacode}
    1374965monitor counter_t {
    1375966        int value;
     
    1384975}
    1385976
    1386 // need for mutex is platform dependent here
     977//need for mutex is platform dependent here
    1387978void ?{}(int * this, counter_t & mutex cnt) {
    1388979        *this = (int)cnt;
    1389980}
    1390 \end{cfa}
    1391 
    1392 Like threads and coroutines, monitors are defined in terms of traits with some additional language support in the form of the @monitor@ keyword.
    1393 The monitor trait is:
    1394 \begin{cfa}
     981\end{cfacode}
     982
     983Like threads and coroutines, monitors are defined in terms of traits with some additional language support in the form of the \code{monitor} keyword. The monitor trait is:
     984\begin{cfacode}
    1395985trait is_monitor(dtype T) {
    1396986        monitor_desc * get_monitor( T & );
    1397987        void ^?{}( T & mutex );
    1398988};
    1399 \end{cfa}
    1400 Note that the destructor of a monitor must be a @mutex@ routine to prevent deallocation while a thread is accessing the monitor.
    1401 As with any object, calls to a monitor, using @mutex@ or otherwise, is undefined behaviour after the destructor has run.
     989\end{cfacode}
     990Note that the destructor of a monitor must be a \code{mutex} routine to prevent deallocation while a thread is accessing the monitor. As with any object, calls to a monitor, using \code{mutex} or otherwise, is undefined behaviour after the destructor has run.
    1402991
    1403992% ======================================================================
     
    1406995% ======================================================================
    1407996% ======================================================================
    1408 In addition to mutual exclusion, the monitors at the core of \CFA's concurrency can also be used to achieve synchronization.
    1409 With monitors, this capability is generally achieved with internal or external scheduling as in~\cite{Hoare74}.
    1410 With \textbf{scheduling} loosely defined as deciding which thread acquires the critical section next, \textbf{internal scheduling} means making the decision from inside the critical section (\ie with access to the shared state), while \textbf{external scheduling} means making the decision when entering the critical section (\ie without access to the shared state).
    1411 Since internal scheduling within a single monitor is mostly a solved problem, this paper concentrates on extending internal scheduling to multiple monitors.
    1412 Indeed, like the \textbf{bulk-acq} semantics, internal scheduling extends to multiple monitors in a way that is natural to the user but requires additional complexity on the implementation side.
     997In addition to mutual exclusion, the monitors at the core of \CFA's concurrency can also be used to achieve synchronization. With monitors, this capability is generally achieved with internal or external scheduling as in~\cite{Hoare74}. With \textbf{scheduling} loosely defined as deciding which thread acquires the critical section next, \textbf{internal scheduling} means making the decision from inside the critical section (i.e., with access to the shared state), while \textbf{external scheduling} means making the decision when entering the critical section (i.e., without access to the shared state). Since internal scheduling within a single monitor is mostly a solved problem, this paper concentrates on extending internal scheduling to multiple monitors. Indeed, like the \textbf{bulk-acq} semantics, internal scheduling extends to multiple monitors in a way that is natural to the user but requires additional complexity on the implementation side.
    1413998
    1414999First, here is a simple example of internal scheduling:
    14151000
    1416 \begin{cfa}
     1001\begin{cfacode}
    14171002monitor A {
    14181003        condition e;
     
    14211006void foo(A& mutex a1, A& mutex a2) {
    14221007        ...
    1423         // Wait for cooperation from bar()
     1008        //Wait for cooperation from bar()
    14241009        wait(a1.e);
    14251010        ...
     
    14271012
    14281013void bar(A& mutex a1, A& mutex a2) {
    1429         // Provide cooperation for foo()
     1014        //Provide cooperation for foo()
    14301015        ...
    1431         // Unblock foo
     1016        //Unblock foo
    14321017        signal(a1.e);
    14331018}
    1434 \end{cfa}
    1435 There are two details to note here.
    1436 First, @signal@ is a delayed operation; it only unblocks the waiting thread when it reaches the end of the critical section.
    1437 This semantics is needed to respect mutual-exclusion, \ie the signaller and signalled thread cannot be in the monitor simultaneously.
    1438 The alternative is to return immediately after the call to @signal@, which is significantly more restrictive.
    1439 Second, in \CFA, while it is common to store a @condition@ as a field of the monitor, a @condition@ variable can be stored/created independently of a monitor.
    1440 Here routine @foo@ waits for the @signal@ from @bar@ before making further progress, ensuring a basic ordering.
    1441 
    1442 An important aspect of the implementation is that \CFA does not allow barging, which means that once function @bar@ releases the monitor, @foo@ is guaranteed to be the next thread to acquire the monitor (unless some other thread waited on the same condition).
    1443 This guarantee offers the benefit of not having to loop around waits to recheck that a condition is met.
    1444 The main reason \CFA offers this guarantee is that users can easily introduce barging if it becomes a necessity but adding barging prevention or barging avoidance is more involved without language support.
    1445 Supporting barging prevention as well as extending internal scheduling to multiple monitors is the main source of complexity in the design and implementation of \CFA concurrency.
     1019\end{cfacode}
     1020There are two details to note here. First, \code{signal} is a delayed operation; it only unblocks the waiting thread when it reaches the end of the critical section. This semantics is needed to respect mutual-exclusion, i.e., the signaller and signalled thread cannot be in the monitor simultaneously. The alternative is to return immediately after the call to \code{signal}, which is significantly more restrictive. Second, in \CFA, while it is common to store a \code{condition} as a field of the monitor, a \code{condition} variable can be stored/created independently of a monitor. Here routine \code{foo} waits for the \code{signal} from \code{bar} before making further progress, ensuring a basic ordering.
     1021
     1022An important aspect of the implementation is that \CFA does not allow barging, which means that once function \code{bar} releases the monitor, \code{foo} is guaranteed to be the next thread to acquire the monitor (unless some other thread waited on the same condition). This guarantee offers the benefit of not having to loop around waits to recheck that a condition is met. The main reason \CFA offers this guarantee is that users can easily introduce barging if it becomes a necessity but adding barging prevention or barging avoidance is more involved without language support. Supporting barging prevention as well as extending internal scheduling to multiple monitors is the main source of complexity in the design and implementation of \CFA concurrency.
    14461023
    14471024% ======================================================================
     
    14501027% ======================================================================
    14511028% ======================================================================
    1452 It is easy to understand the problem of multi-monitor scheduling using a series of pseudo-code examples.
    1453 Note that for simplicity in the following snippets of pseudo-code, waiting and signalling is done using an implicit condition variable, like Java built-in monitors.
    1454 Indeed, @wait@ statements always use the implicit condition variable as parameters and explicitly name the monitors (A and B) associated with the condition.
    1455 Note that in \CFA, condition variables are tied to a \emph{group} of monitors on first use (called branding), which means that using internal scheduling with distinct sets of monitors requires one condition variable per set of monitors.
    1456 The example below shows the simple case of having two threads (one for each column) and a single monitor A.
     1029It is easy to understand the problem of multi-monitor scheduling using a series of pseudo-code examples. Note that for simplicity in the following snippets of pseudo-code, waiting and signalling is done using an implicit condition variable, like Java built-in monitors. Indeed, \code{wait} statements always use the implicit condition variable as parameters and explicitly name the monitors (A and B) associated with the condition. Note that in \CFA, condition variables are tied to a \emph{group} of monitors on first use (called branding), which means that using internal scheduling with distinct sets of monitors requires one condition variable per set of monitors. The example below shows the simple case of having two threads (one for each column) and a single monitor A.
    14571030
    14581031\begin{multicols}{2}
    14591032thread 1
    1460 \begin{cfa}
     1033\begin{pseudo}
    14611034acquire A
    14621035        wait A
    14631036release A
    1464 \end{cfa}
     1037\end{pseudo}
    14651038
    14661039\columnbreak
    14671040
    14681041thread 2
    1469 \begin{cfa}
     1042\begin{pseudo}
    14701043acquire A
    14711044        signal A
    14721045release A
    1473 \end{cfa}
     1046\end{pseudo}
    14741047\end{multicols}
    1475 One thread acquires before waiting (atomically blocking and releasing A) and the other acquires before signalling.
    1476 It is important to note here that both @wait@ and @signal@ must be called with the proper monitor(s) already acquired.
    1477 This semantic is a logical requirement for barging prevention.
     1048One thread acquires before waiting (atomically blocking and releasing A) and the other acquires before signalling. It is important to note here that both \code{wait} and \code{signal} must be called with the proper monitor(s) already acquired. This semantic is a logical requirement for barging prevention.
    14781049
    14791050A direct extension of the previous example is a \textbf{bulk-acq} version:
    14801051\begin{multicols}{2}
    1481 \begin{cfa}
     1052\begin{pseudo}
    14821053acquire A & B
    14831054        wait A & B
    14841055release A & B
    1485 \end{cfa}
     1056\end{pseudo}
    14861057\columnbreak
    1487 \begin{cfa}
     1058\begin{pseudo}
    14881059acquire A & B
    14891060        signal A & B
    14901061release A & B
    1491 \end{cfa}
     1062\end{pseudo}
    14921063\end{multicols}
    1493 \noindent This version uses \textbf{bulk-acq} (denoted using the {\sf\&} symbol), but the presence of multiple monitors does not add a particularly new meaning.
    1494 Synchronization happens between the two threads in exactly the same way and order.
    1495 The only difference is that mutual exclusion covers a group of monitors.
    1496 On the implementation side, handling multiple monitors does add a degree of complexity as the next few examples demonstrate.
    1497 
    1498 While deadlock issues can occur when nesting monitors, these issues are only a symptom of the fact that locks, and by extension monitors, are not perfectly composable.
    1499 For monitors, a well-known deadlock problem is the Nested Monitor Problem~\cite{Lister77}, which occurs when a @wait@ is made by a thread that holds more than one monitor.
    1500 For example, the following cfa-code runs into the nested-monitor problem:
     1064\noindent This version uses \textbf{bulk-acq} (denoted using the {\sf\&} symbol), but the presence of multiple monitors does not add a particularly new meaning. Synchronization happens between the two threads in exactly the same way and order. The only difference is that mutual exclusion covers a group of monitors. On the implementation side, handling multiple monitors does add a degree of complexity as the next few examples demonstrate.
     1065
     1066While deadlock issues can occur when nesting monitors, these issues are only a symptom of the fact that locks, and by extension monitors, are not perfectly composable. For monitors, a well-known deadlock problem is the Nested Monitor Problem~\cite{Lister77}, which occurs when a \code{wait} is made by a thread that holds more than one monitor. For example, the following pseudo-code runs into the nested-monitor problem:
    15011067\begin{multicols}{2}
    1502 \begin{cfa}
     1068\begin{pseudo}
    15031069acquire A
    15041070        acquire B
     
    15061072        release B
    15071073release A
    1508 \end{cfa}
     1074\end{pseudo}
    15091075
    15101076\columnbreak
    15111077
    1512 \begin{cfa}
     1078\begin{pseudo}
    15131079acquire A
    15141080        acquire B
     
    15161082        release B
    15171083release A
    1518 \end{cfa}
     1084\end{pseudo}
    15191085\end{multicols}
    1520 \noindent The @wait@ only releases monitor @B@ so the signalling thread cannot acquire monitor @A@ to get to the @signal@.
    1521 Attempting release of all acquired monitors at the @wait@ introduces a different set of problems, such as releasing monitor @C@, which has nothing to do with the @signal@.
    1522 
    1523 However, for monitors as for locks, it is possible to write a program using nesting without encountering any problems if nesting is done correctly.
    1524 For example, the next cfa-code snippet acquires monitors {\sf A} then {\sf B} before waiting, while only acquiring {\sf B} when signalling, effectively avoiding the Nested Monitor Problem~\cite{Lister77}.
     1086\noindent The \code{wait} only releases monitor \code{B} so the signalling thread cannot acquire monitor \code{A} to get to the \code{signal}. Attempting release of all acquired monitors at the \code{wait} introduces a different set of problems, such as releasing monitor \code{C}, which has nothing to do with the \code{signal}.
     1087
     1088However, for monitors as for locks, it is possible to write a program using nesting without encountering any problems if nesting is done correctly. For example, the next pseudo-code snippet acquires monitors {\sf A} then {\sf B} before waiting, while only acquiring {\sf B} when signalling, effectively avoiding the Nested Monitor Problem~\cite{Lister77}.
    15251089
    15261090\begin{multicols}{2}
    1527 \begin{cfa}
     1091\begin{pseudo}
    15281092acquire A
    15291093        acquire B
     
    15311095        release B
    15321096release A
    1533 \end{cfa}
     1097\end{pseudo}
    15341098
    15351099\columnbreak
    15361100
    1537 \begin{cfa}
     1101\begin{pseudo}
    15381102
    15391103acquire B
     
    15411105release B
    15421106
    1543 \end{cfa}
     1107\end{pseudo}
    15441108\end{multicols}
    15451109
     
    15521116% ======================================================================
    15531117
    1554 A larger example is presented to show complex issues for \textbf{bulk-acq} and its implementation options are analyzed.
    1555 Figure~\ref{f:int-bulk-cfa} shows an example where \textbf{bulk-acq} adds a significant layer of complexity to the internal signalling semantics, and listing \ref{f:int-bulk-cfa} shows the corresponding \CFA code to implement the cfa-code in listing \ref{f:int-bulk-cfa}.
    1556 For the purpose of translating the given cfa-code into \CFA-code, any method of introducing a monitor is acceptable, \eg @mutex@ parameters, global variables, pointer parameters, or using locals with the @mutex@ statement.
    1557 
    1558 \begin{figure}
     1118A larger example is presented to show complex issues for \textbf{bulk-acq} and its implementation options are analyzed. Listing \ref{lst:int-bulk-pseudo} shows an example where \textbf{bulk-acq} adds a significant layer of complexity to the internal signalling semantics, and listing \ref{lst:int-bulk-cfa} shows the corresponding \CFA code to implement the pseudo-code in listing \ref{lst:int-bulk-pseudo}. For the purpose of translating the given pseudo-code into \CFA-code, any method of introducing a monitor is acceptable, e.g., \code{mutex} parameters, global variables, pointer parameters, or using locals with the \code{mutex} statement.
     1119
     1120\begin{figure}[!t]
    15591121\begin{multicols}{2}
    15601122Waiting thread
    1561 \begin{cfa}[numbers=left]
     1123\begin{pseudo}[numbers=left]
    15621124acquire A
    1563         // Code Section 1
     1125        //Code Section 1
    15641126        acquire A & B
    1565                 // Code Section 2
     1127                //Code Section 2
    15661128                wait A & B
    1567                 // Code Section 3
     1129                //Code Section 3
    15681130        release A & B
    1569         // Code Section 4
     1131        //Code Section 4
    15701132release A
    1571 \end{cfa}
     1133\end{pseudo}
    15721134\columnbreak
    15731135Signalling thread
    1574 \begin{cfa}[numbers=left, firstnumber=10,escapechar=|]
     1136\begin{pseudo}[numbers=left, firstnumber=10,escapechar=|]
    15751137acquire A
    1576         // Code Section 5
     1138        //Code Section 5
    15771139        acquire A & B
    1578                 // Code Section 6
     1140                //Code Section 6
    15791141                |\label{line:signal1}|signal A & B
    1580                 // Code Section 7
     1142                //Code Section 7
    15811143        |\label{line:releaseFirst}|release A & B
    1582         // Code Section 8
     1144        //Code Section 8
    15831145|\label{line:lastRelease}|release A
    1584 \end{cfa}
     1146\end{pseudo}
    15851147\end{multicols}
    1586 \begin{cfa}[caption={Internal scheduling with \textbf{bulk-acq}},label={f:int-bulk-cfa}]
    1587 \end{cfa}
     1148\begin{cfacode}[caption={Internal scheduling with \textbf{bulk-acq}},label={lst:int-bulk-pseudo}]
     1149\end{cfacode}
    15881150\begin{center}
    1589 \begin{cfa}[xleftmargin=.4\textwidth]
     1151\begin{cfacode}[xleftmargin=.4\textwidth]
    15901152monitor A a;
    15911153monitor B b;
    15921154condition c;
    1593 \end{cfa}
     1155\end{cfacode}
    15941156\end{center}
    15951157\begin{multicols}{2}
    15961158Waiting thread
    1597 \begin{cfa}
     1159\begin{cfacode}
    15981160mutex(a) {
    1599         // Code Section 1
     1161        //Code Section 1
    16001162        mutex(a, b) {
    1601                 // Code Section 2
     1163                //Code Section 2
    16021164                wait(c);
    1603                 // Code Section 3
    1604         }
    1605         // Code Section 4
    1606 }
    1607 \end{cfa}
     1165                //Code Section 3
     1166        }
     1167        //Code Section 4
     1168}
     1169\end{cfacode}
    16081170\columnbreak
    16091171Signalling thread
    1610 \begin{cfa}
     1172\begin{cfacode}
    16111173mutex(a) {
    1612         // Code Section 5
     1174        //Code Section 5
    16131175        mutex(a, b) {
    1614                 // Code Section 6
     1176                //Code Section 6
    16151177                signal(c);
    1616                 // Code Section 7
    1617         }
    1618         // Code Section 8
    1619 }
    1620 \end{cfa}
     1178                //Code Section 7
     1179        }
     1180        //Code Section 8
     1181}
     1182\end{cfacode}
    16211183\end{multicols}
    1622 \begin{cfa}[caption={Equivalent \CFA code for listing \ref{f:int-bulk-cfa}},label={f:int-bulk-cfa}]
    1623 \end{cfa}
     1184\begin{cfacode}[caption={Equivalent \CFA code for listing \ref{lst:int-bulk-pseudo}},label={lst:int-bulk-cfa}]
     1185\end{cfacode}
    16241186\begin{multicols}{2}
    16251187Waiter
    1626 \begin{cfa}[numbers=left]
     1188\begin{pseudo}[numbers=left]
    16271189acquire A
    16281190        acquire A & B
     
    16301192        release A & B
    16311193release A
    1632 \end{cfa}
     1194\end{pseudo}
    16331195
    16341196\columnbreak
    16351197
    16361198Signaller
    1637 \begin{cfa}[numbers=left, firstnumber=6,escapechar=|]
     1199\begin{pseudo}[numbers=left, firstnumber=6,escapechar=|]
    16381200acquire A
    16391201        acquire A & B
    16401202                signal A & B
    16411203        release A & B
    1642         |\label{line:secret}|// Secretly keep B here
     1204        |\label{line:secret}|//Secretly keep B here
    16431205release A
    1644 // Wakeup waiter and transfer A & B
    1645 \end{cfa}
     1206//Wakeup waiter and transfer A & B
     1207\end{pseudo}
    16461208\end{multicols}
    1647 \begin{cfa}[caption={Figure~\ref{f:int-bulk-cfa}, with delayed signalling comments},label={f:int-secret}]
    1648 \end{cfa}
     1209\begin{cfacode}[caption={Listing \ref{lst:int-bulk-pseudo}, with delayed signalling comments},label={lst:int-secret}]
     1210\end{cfacode}
    16491211\end{figure}
    16501212
    1651 The complexity begins at code sections 4 and 8 in listing \ref{f:int-bulk-cfa}, which are where the existing semantics of internal scheduling needs to be extended for multiple monitors.
    1652 The root of the problem is that \textbf{bulk-acq} is used in a context where one of the monitors is already acquired, which is why it is important to define the behaviour of the previous cfa-code.
    1653 When the signaller thread reaches the location where it should ``release @A & B@'' (listing \ref{f:int-bulk-cfa} line \ref{line:releaseFirst}), it must actually transfer ownership of monitor @B@ to the waiting thread.
    1654 This ownership transfer is required in order to prevent barging into @B@ by another thread, since both the signalling and signalled threads still need monitor @A@.
    1655 There are three options:
     1213The complexity begins at code sections 4 and 8 in listing \ref{lst:int-bulk-pseudo}, which are where the existing semantics of internal scheduling needs to be extended for multiple monitors. The root of the problem is that \textbf{bulk-acq} is used in a context where one of the monitors is already acquired, which is why it is important to define the behaviour of the previous pseudo-code. When the signaller thread reaches the location where it should ``release \code{A & B}'' (listing \ref{lst:int-bulk-pseudo} line \ref{line:releaseFirst}), it must actually transfer ownership of monitor \code{B} to the waiting thread. This ownership transfer is required in order to prevent barging into \code{B} by another thread, since both the signalling and signalled threads still need monitor \code{A}. There are three options:
    16561214
    16571215\subsubsection{Delaying Signals}
    1658 The obvious solution to the problem of multi-monitor scheduling is to keep ownership of all locks until the last lock is ready to be transferred.
    1659 It can be argued that that moment is when the last lock is no longer needed, because this semantics fits most closely to the behaviour of single-monitor scheduling.
    1660 This solution has the main benefit of transferring ownership of groups of monitors, which simplifies the semantics from multiple objects to a single group of objects, effectively making the existing single-monitor semantic viable by simply changing monitors to monitor groups.
    1661 This solution releases the monitors once every monitor in a group can be released.
    1662 However, since some monitors are never released (\eg the monitor of a thread), this interpretation means a group might never be released.
    1663 A more interesting interpretation is to transfer the group until all its monitors are released, which means the group is not passed further and a thread can retain its locks.
    1664 
    1665 However, listing \ref{f:int-secret} shows this solution can become much more complicated depending on what is executed while secretly holding B at line \ref{line:secret}, while avoiding the need to transfer ownership of a subset of the condition monitors.
    1666 Figure~\ref{f:dependency} shows a slightly different example where a third thread is waiting on monitor @A@, using a different condition variable.
    1667 Because the third thread is signalled when secretly holding @B@, the goal  becomes unreachable.
    1668 Depending on the order of signals (listing \ref{f:dependency} line \ref{line:signal-ab} and \ref{line:signal-a}) two cases can happen:
    1669 
    1670 \paragraph{Case 1: thread $\alpha$ goes first.} In this case, the problem is that monitor @A@ needs to be passed to thread $\beta$ when thread $\alpha$ is done with it.
    1671 \paragraph{Case 2: thread $\beta$ goes first.} In this case, the problem is that monitor @B@ needs to be retained and passed to thread $\alpha$ along with monitor @A@, which can be done directly or possibly using thread $\beta$ as an intermediate.
     1216The obvious solution to the problem of multi-monitor scheduling is to keep ownership of all locks until the last lock is ready to be transferred. It can be argued that that moment is when the last lock is no longer needed, because this semantics fits most closely to the behaviour of single-monitor scheduling. This solution has the main benefit of transferring ownership of groups of monitors, which simplifies the semantics from multiple objects to a single group of objects, effectively making the existing single-monitor semantic viable by simply changing monitors to monitor groups. This solution releases the monitors once every monitor in a group can be released. However, since some monitors are never released (e.g., the monitor of a thread), this interpretation means a group might never be released. A more interesting interpretation is to transfer the group until all its monitors are released, which means the group is not passed further and a thread can retain its locks.
     1217
     1218However, listing \ref{lst:int-secret} shows this solution can become much more complicated depending on what is executed while secretly holding B at line \ref{line:secret}, while avoiding the need to transfer ownership of a subset of the condition monitors. Listing \ref{lst:dependency} shows a slightly different example where a third thread is waiting on monitor \code{A}, using a different condition variable. Because the third thread is signalled when secretly holding \code{B}, the goal  becomes unreachable. Depending on the order of signals (listing \ref{lst:dependency} line \ref{line:signal-ab} and \ref{line:signal-a}) two cases can happen:
     1219
     1220\paragraph{Case 1: thread $\alpha$ goes first.} In this case, the problem is that monitor \code{A} needs to be passed to thread $\beta$ when thread $\alpha$ is done with it.
     1221\paragraph{Case 2: thread $\beta$ goes first.} In this case, the problem is that monitor \code{B} needs to be retained and passed to thread $\alpha$ along with monitor \code{A}, which can be done directly or possibly using thread $\beta$ as an intermediate.
    16721222\\
    16731223
    1674 Note that ordering is not determined by a race condition but by whether signalled threads are enqueued in FIFO or FILO order.
    1675 However, regardless of the answer, users can move line \ref{line:signal-a} before line \ref{line:signal-ab} and get the reverse effect for listing \ref{f:dependency}.
     1224Note that ordering is not determined by a race condition but by whether signalled threads are enqueued in FIFO or FILO order. However, regardless of the answer, users can move line \ref{line:signal-a} before line \ref{line:signal-ab} and get the reverse effect for listing \ref{lst:dependency}.
    16761225
    16771226In both cases, the threads need to be able to distinguish, on a per monitor basis, which ones need to be released and which ones need to be transferred, which means knowing when to release a group becomes complex and inefficient (see next section) and therefore effectively precludes this approach.
     
    16831232\begin{multicols}{3}
    16841233Thread $\alpha$
    1685 \begin{cfa}[numbers=left, firstnumber=1]
     1234\begin{pseudo}[numbers=left, firstnumber=1]
    16861235acquire A
    16871236        acquire A & B
     
    16891238        release A & B
    16901239release A
    1691 \end{cfa}
     1240\end{pseudo}
    16921241\columnbreak
    16931242Thread $\gamma$
    1694 \begin{cfa}[numbers=left, firstnumber=6, escapechar=|]
     1243\begin{pseudo}[numbers=left, firstnumber=6, escapechar=|]
    16951244acquire A
    16961245        acquire A & B
     
    16991248        |\label{line:signal-a}|signal A
    17001249|\label{line:release-a}|release A
    1701 \end{cfa}
     1250\end{pseudo}
    17021251\columnbreak
    17031252Thread $\beta$
    1704 \begin{cfa}[numbers=left, firstnumber=12, escapechar=|]
     1253\begin{pseudo}[numbers=left, firstnumber=12, escapechar=|]
    17051254acquire A
    17061255        wait A
    17071256|\label{line:release-aa}|release A
    1708 \end{cfa}
     1257\end{pseudo}
    17091258\end{multicols}
    1710 \begin{cfa}[caption={Pseudo-code for the three thread example.},label={f:dependency}]
    1711 \end{cfa}
     1259\begin{cfacode}[caption={Pseudo-code for the three thread example.},label={lst:dependency}]
     1260\end{cfacode}
    17121261\begin{center}
    17131262\input{dependency}
    17141263\end{center}
    1715 \caption{Dependency graph of the statements in listing \ref{f:dependency}}
     1264\caption{Dependency graph of the statements in listing \ref{lst:dependency}}
    17161265\label{fig:dependency}
    17171266\end{figure}
    17181267
    1719 In listing \ref{f:int-bulk-cfa}, there is a solution that satisfies both barging prevention and mutual exclusion.
    1720 If ownership of both monitors is transferred to the waiter when the signaller releases @A & B@ and then the waiter transfers back ownership of @A@ back to the signaller when it releases it, then the problem is solved (@B@ is no longer in use at this point).
    1721 Dynamically finding the correct order is therefore the second possible solution.
    1722 The problem is effectively resolving a dependency graph of ownership requirements.
    1723 Here even the simplest of code snippets requires two transfers and has a super-linear complexity.
    1724 This complexity can be seen in listing \ref{f:explosion}, which is just a direct extension to three monitors, requires at least three ownership transfer and has multiple solutions.
    1725 Furthermore, the presence of multiple solutions for ownership transfer can cause deadlock problems if a specific solution is not consistently picked; In the same way that multiple lock acquiring order can cause deadlocks.
     1268In listing \ref{lst:int-bulk-pseudo}, there is a solution that satisfies both barging prevention and mutual exclusion. If ownership of both monitors is transferred to the waiter when the signaller releases \code{A & B} and then the waiter transfers back ownership of \code{A} back to the signaller when it releases it, then the problem is solved (\code{B} is no longer in use at this point). Dynamically finding the correct order is therefore the second possible solution. The problem is effectively resolving a dependency graph of ownership requirements. Here even the simplest of code snippets requires two transfers and has a super-linear complexity. This complexity can be seen in listing \ref{lst:explosion}, which is just a direct extension to three monitors, requires at least three ownership transfer and has multiple solutions. Furthermore, the presence of multiple solutions for ownership transfer can cause deadlock problems if a specific solution is not consistently picked; In the same way that multiple lock acquiring order can cause deadlocks.
    17261269\begin{figure}
    17271270\begin{multicols}{2}
    1728 \begin{cfa}
     1271\begin{pseudo}
    17291272acquire A
    17301273        acquire B
     
    17341277        release B
    17351278release A
    1736 \end{cfa}
     1279\end{pseudo}
    17371280
    17381281\columnbreak
    17391282
    1740 \begin{cfa}
     1283\begin{pseudo}
    17411284acquire A
    17421285        acquire B
     
    17461289        release B
    17471290release A
    1748 \end{cfa}
     1291\end{pseudo}
    17491292\end{multicols}
    1750 \begin{cfa}[caption={Extension to three monitors of listing \ref{f:int-bulk-cfa}},label={f:explosion}]
    1751 \end{cfa}
     1293\begin{cfacode}[caption={Extension to three monitors of listing \ref{lst:int-bulk-pseudo}},label={lst:explosion}]
     1294\end{cfacode}
    17521295\end{figure}
    17531296
    1754 Given the three threads example in listing \ref{f:dependency}, figure \ref{fig:dependency} shows the corresponding dependency graph that results, where every node is a statement of one of the three threads, and the arrows the dependency of that statement (\eg $\alpha1$ must happen before $\alpha2$).
    1755 The extra challenge is that this dependency graph is effectively post-mortem, but the runtime system needs to be able to build and solve these graphs as the dependencies unfold.
    1756 Resolving dependency graphs being a complex and expensive endeavour, this solution is not the preferred one.
     1297Given the three threads example in listing \ref{lst:dependency}, figure \ref{fig:dependency} shows the corresponding dependency graph that results, where every node is a statement of one of the three threads, and the arrows the dependency of that statement (e.g., $\alpha1$ must happen before $\alpha2$). The extra challenge is that this dependency graph is effectively post-mortem, but the runtime system needs to be able to build and solve these graphs as the dependencies unfold. Resolving dependency graphs being a complex and expensive endeavour, this solution is not the preferred one.
    17571298
    17581299\subsubsection{Partial Signalling} \label{partial-sig}
    1759 Finally, the solution that is chosen for \CFA is to use partial signalling.
    1760 Again using listing \ref{f:int-bulk-cfa}, the partial signalling solution transfers ownership of monitor @B@ at lines \ref{line:signal1} to the waiter but does not wake the waiting thread since it is still using monitor @A@.
    1761 Only when it reaches line \ref{line:lastRelease} does it actually wake up the waiting thread.
    1762 This solution has the benefit that complexity is encapsulated into only two actions: passing monitors to the next owner when they should be released and conditionally waking threads if all conditions are met.
    1763 This solution has a much simpler implementation than a dependency graph solving algorithms, which is why it was chosen.
    1764 Furthermore, after being fully implemented, this solution does not appear to have any significant downsides.
    1765 
    1766 Using partial signalling, listing \ref{f:dependency} can be solved easily:
     1300Finally, the solution that is chosen for \CFA is to use partial signalling. Again using listing \ref{lst:int-bulk-pseudo}, the partial signalling solution transfers ownership of monitor \code{B} at lines \ref{line:signal1} to the waiter but does not wake the waiting thread since it is still using monitor \code{A}. Only when it reaches line \ref{line:lastRelease} does it actually wake up the waiting thread. This solution has the benefit that complexity is encapsulated into only two actions: passing monitors to the next owner when they should be released and conditionally waking threads if all conditions are met. This solution has a much simpler implementation than a dependency graph solving algorithms, which is why it was chosen. Furthermore, after being fully implemented, this solution does not appear to have any significant downsides.
     1301
     1302Using partial signalling, listing \ref{lst:dependency} can be solved easily:
    17671303\begin{itemize}
    1768         \item When thread $\gamma$ reaches line \ref{line:release-ab} it transfers monitor @B@ to thread $\alpha$ and continues to hold monitor @A@.
    1769         \item When thread $\gamma$ reaches line \ref{line:release-a}  it transfers monitor @A@ to thread $\beta$  and wakes it up.
    1770         \item When thread $\beta$  reaches line \ref{line:release-aa} it transfers monitor @A@ to thread $\alpha$ and wakes it up.
     1304        \item When thread $\gamma$ reaches line \ref{line:release-ab} it transfers monitor \code{B} to thread $\alpha$ and continues to hold monitor \code{A}.
     1305        \item When thread $\gamma$ reaches line \ref{line:release-a}  it transfers monitor \code{A} to thread $\beta$  and wakes it up.
     1306        \item When thread $\beta$  reaches line \ref{line:release-aa} it transfers monitor \code{A} to thread $\alpha$ and wakes it up.
    17711307\end{itemize}
    17721308
     
    17781314\begin{table}
    17791315\begin{tabular}{|c|c|}
    1780 @signal@ & @signal_block@ \\
     1316\code{signal} & \code{signal_block} \\
    17811317\hline
    1782 \begin{cfa}[tabsize=3]
    1783 monitor DatingService {
    1784         // compatibility codes
     1318\begin{cfacode}[tabsize=3]
     1319monitor DatingService
     1320{
     1321        //compatibility codes
    17851322        enum{ CCodes = 20 };
    17861323
     
    17931330condition exchange;
    17941331
    1795 int girl(int phoneNo, int cfa) {
    1796         // no compatible boy ?
    1797         if(empty(boys[cfa])) {
    1798                 wait(girls[cfa]);               // wait for boy
    1799                 girlPhoneNo = phoneNo;          // make phone number available
    1800                 signal(exchange);               // wake boy from chair
    1801         } else {
    1802                 girlPhoneNo = phoneNo;          // make phone number available
    1803                 signal(boys[cfa]);              // wake boy
    1804                 wait(exchange);         // sit in chair
     1332int girl(int phoneNo, int ccode)
     1333{
     1334        //no compatible boy ?
     1335        if(empty(boys[ccode]))
     1336        {
     1337                //wait for boy
     1338                wait(girls[ccode]);
     1339
     1340                //make phone number available
     1341                girlPhoneNo = phoneNo;
     1342
     1343                //wake boy from chair
     1344                signal(exchange);
     1345        }
     1346        else
     1347        {
     1348                //make phone number available
     1349                girlPhoneNo = phoneNo;
     1350
     1351                //wake boy
     1352                signal(boys[ccode]);
     1353
     1354                //sit in chair
     1355                wait(exchange);
    18051356        }
    18061357        return boyPhoneNo;
    18071358}
    1808 int boy(int phoneNo, int cfa) {
    1809         // same as above
    1810         // with boy/girl interchanged
    1811 }
    1812 \end{cfa}&\begin{cfa}[tabsize=3]
    1813 monitor DatingService {
    1814 
    1815         enum{ CCodes = 20 };    // compatibility codes
     1359
     1360int boy(int phoneNo, int ccode)
     1361{
     1362        //same as above
     1363        //with boy/girl interchanged
     1364}
     1365\end{cfacode}&\begin{cfacode}[tabsize=3]
     1366monitor DatingService
     1367{
     1368        //compatibility codes
     1369        enum{ CCodes = 20 };
    18161370
    18171371        int girlPhoneNo;
     
    18211375condition girls[CCodes];
    18221376condition boys [CCodes];
    1823 // exchange is not needed
    1824 
    1825 int girl(int phoneNo, int cfa) {
    1826         // no compatible boy ?
    1827         if(empty(boys[cfa])) {
    1828                 wait(girls[cfa]);               // wait for boy
    1829                 girlPhoneNo = phoneNo;          // make phone number available
    1830                 signal(exchange);               // wake boy from chair
    1831         } else {
    1832                 girlPhoneNo = phoneNo;          // make phone number available
    1833                 signal_block(boys[cfa]);                // wake boy
    1834 
    1835                 // second handshake unnecessary
     1377//exchange is not needed
     1378
     1379int girl(int phoneNo, int ccode)
     1380{
     1381        //no compatible boy ?
     1382        if(empty(boys[ccode]))
     1383        {
     1384                //wait for boy
     1385                wait(girls[ccode]);
     1386
     1387                //make phone number available
     1388                girlPhoneNo = phoneNo;
     1389
     1390                //wake boy from chair
     1391                signal(exchange);
     1392        }
     1393        else
     1394        {
     1395                //make phone number available
     1396                girlPhoneNo = phoneNo;
     1397
     1398                //wake boy
     1399                signal_block(boys[ccode]);
     1400
     1401                //second handshake unnecessary
    18361402
    18371403        }
     
    18391405}
    18401406
    1841 int boy(int phoneNo, int cfa) {
    1842         // same as above
    1843         // with boy/girl interchanged
    1844 }
    1845 \end{cfa}
     1407int boy(int phoneNo, int ccode)
     1408{
     1409        //same as above
     1410        //with boy/girl interchanged
     1411}
     1412\end{cfacode}
    18461413\end{tabular}
    1847 \caption{Dating service example using \protect\lstinline|signal| and \protect\lstinline|signal_block|. }
     1414\caption{Dating service example using \code{signal} and \code{signal_block}. }
    18481415\label{tbl:datingservice}
    18491416\end{table}
    1850 An important note is that, until now, signalling a monitor was a delayed operation.
    1851 The ownership of the monitor is transferred only when the monitor would have otherwise been released, not at the point of the @signal@ statement.
    1852 However, in some cases, it may be more convenient for users to immediately transfer ownership to the thread that is waiting for cooperation, which is achieved using the @signal_block@ routine.
    1853 
    1854 The example in table \ref{tbl:datingservice} highlights the difference in behaviour.
    1855 As mentioned, @signal@ only transfers ownership once the current critical section exits; this behaviour requires additional synchronization when a two-way handshake is needed.
    1856 To avoid this explicit synchronization, the @condition@ type offers the @signal_block@ routine, which handles the two-way handshake as shown in the example.
    1857 This feature removes the need for a second condition variables and simplifies programming.
    1858 Like every other monitor semantic, @signal_block@ uses barging prevention, which means mutual-exclusion is baton-passed both on the front end and the back end of the call to @signal_block@, meaning no other thread can acquire the monitor either before or after the call.
     1417An important note is that, until now, signalling a monitor was a delayed operation. The ownership of the monitor is transferred only when the monitor would have otherwise been released, not at the point of the \code{signal} statement. However, in some cases, it may be more convenient for users to immediately transfer ownership to the thread that is waiting for cooperation, which is achieved using the \code{signal_block} routine.
     1418
     1419The example in table \ref{tbl:datingservice} highlights the difference in behaviour. As mentioned, \code{signal} only transfers ownership once the current critical section exits; this behaviour requires additional synchronization when a two-way handshake is needed. To avoid this explicit synchronization, the \code{condition} type offers the \code{signal_block} routine, which handles the two-way handshake as shown in the example. This feature removes the need for a second condition variables and simplifies programming. Like every other monitor semantic, \code{signal_block} uses barging prevention, which means mutual-exclusion is baton-passed both on the front end and the back end of the call to \code{signal_block}, meaning no other thread can acquire the monitor either before or after the call.
    18591420
    18601421% ======================================================================
     
    18681429Internal Scheduling & External Scheduling & Go\\
    18691430\hline
    1870 \begin{uC++}[tabsize=3]
     1431\begin{ucppcode}[tabsize=3]
    18711432_Monitor Semaphore {
    18721433        condition c;
     
    18831444        }
    18841445}
    1885 \end{uC++}&\begin{uC++}[tabsize=3]
     1446\end{ucppcode}&\begin{ucppcode}[tabsize=3]
    18861447_Monitor Semaphore {
    18871448
     
    18981459        }
    18991460}
    1900 \end{uC++}&\begin{Go}[tabsize=3]
     1461\end{ucppcode}&\begin{gocode}[tabsize=3]
    19011462type MySem struct {
    19021463        inUse bool
     
    19181479        s.inUse = false
    19191480
    1920         // This actually deadlocks
    1921         // when single thread
     1481        //This actually deadlocks
     1482        //when single thread
    19221483        s.c <- false
    19231484}
    1924 \end{Go}
     1485\end{gocode}
    19251486\end{tabular}
    19261487\caption{Different forms of scheduling.}
    19271488\label{tbl:sched}
    19281489\end{table}
    1929 This method is more constrained and explicit, which helps users reduce the non-deterministic nature of concurrency.
    1930 Indeed, as the following examples demonstrate, external scheduling allows users to wait for events from other threads without the concern of unrelated events occurring.
    1931 External scheduling can generally be done either in terms of control flow (\eg Ada with @accept@, \uC with @_Accept@) or in terms of data (\eg Go with channels).
    1932 Of course, both of these paradigms have their own strengths and weaknesses, but for this project, control-flow semantics was chosen to stay consistent with the rest of the languages semantics.
    1933 Two challenges specific to \CFA arise when trying to add external scheduling with loose object definitions and multiple-monitor routines.
    1934 The previous example shows a simple use @_Accept@ versus @wait@/@signal@ and its advantages.
    1935 Note that while other languages often use @accept@/@select@ as the core external scheduling keyword, \CFA uses @waitfor@ to prevent name collisions with existing socket \textbf{api}s.
    1936 
    1937 For the @P@ member above using internal scheduling, the call to @wait@ only guarantees that @V@ is the last routine to access the monitor, allowing a third routine, say @isInUse()@, acquire mutual exclusion several times while routine @P@ is waiting.
    1938 On the other hand, external scheduling guarantees that while routine @P@ is waiting, no other routine than @V@ can acquire the monitor.
     1490This method is more constrained and explicit, which helps users reduce the non-deterministic nature of concurrency. Indeed, as the following examples demonstrate, external scheduling allows users to wait for events from other threads without the concern of unrelated events occurring. External scheduling can generally be done either in terms of control flow (e.g., Ada with \code{accept}, \uC with \code{_Accept}) or in terms of data (e.g., Go with channels). Of course, both of these paradigms have their own strengths and weaknesses, but for this project, control-flow semantics was chosen to stay consistent with the rest of the languages semantics. Two challenges specific to \CFA arise when trying to add external scheduling with loose object definitions and multiple-monitor routines. The previous example shows a simple use \code{_Accept} versus \code{wait}/\code{signal} and its advantages. Note that while other languages often use \code{accept}/\code{select} as the core external scheduling keyword, \CFA uses \code{waitfor} to prevent name collisions with existing socket \textbf{api}s.
     1491
     1492For the \code{P} member above using internal scheduling, the call to \code{wait} only guarantees that \code{V} is the last routine to access the monitor, allowing a third routine, say \code{isInUse()}, acquire mutual exclusion several times while routine \code{P} is waiting. On the other hand, external scheduling guarantees that while routine \code{P} is waiting, no other routine than \code{V} can acquire the monitor.
    19391493
    19401494% ======================================================================
     
    19431497% ======================================================================
    19441498% ======================================================================
    1945 In \uC, a monitor class declaration includes an exhaustive list of monitor operations.
    1946 Since \CFA is not object oriented, monitors become both more difficult to implement and less clear for a user:
    1947 
    1948 \begin{cfa}
     1499In \uC, a monitor class declaration includes an exhaustive list of monitor operations. Since \CFA is not object oriented, monitors become both more difficult to implement and less clear for a user:
     1500
     1501\begin{cfacode}
    19491502monitor A {};
    19501503
    19511504void f(A & mutex a);
    19521505void g(A & mutex a) {
    1953         waitfor(f); // Obvious which f() to wait for
    1954 }
    1955 
    1956 void f(A & mutex a, int); // New different F added in scope
     1506        waitfor(f); //Obvious which f() to wait for
     1507}
     1508
     1509void f(A & mutex a, int); //New different F added in scope
    19571510void h(A & mutex a) {
    1958         waitfor(f); // Less obvious which f() to wait for
    1959 }
    1960 \end{cfa}
    1961 
    1962 Furthermore, external scheduling is an example where implementation constraints become visible from the interface.
    1963 Here is the cfa-code for the entering phase of a monitor:
     1511        waitfor(f); //Less obvious which f() to wait for
     1512}
     1513\end{cfacode}
     1514
     1515Furthermore, external scheduling is an example where implementation constraints become visible from the interface. Here is the pseudo-code for the entering phase of a monitor:
    19641516\begin{center}
    19651517\begin{tabular}{l}
    1966 \begin{cfa}
     1518\begin{pseudo}
    19671519        if monitor is free
    19681520                enter
     
    19731525        else
    19741526                block
    1975 \end{cfa}
     1527\end{pseudo}
    19761528\end{tabular}
    19771529\end{center}
    1978 For the first two conditions, it is easy to implement a check that can evaluate the condition in a few instructions.
    1979 However, a fast check for @monitor accepts me@ is much harder to implement depending on the constraints put on the monitors.
    1980 Indeed, monitors are often expressed as an entry queue and some acceptor queue as in Figure~\ref{fig:ClassicalMonitor}.
     1530For the first two conditions, it is easy to implement a check that can evaluate the condition in a few instructions. However, a fast check for \pscode{monitor accepts me} is much harder to implement depending on the constraints put on the monitors. Indeed, monitors are often expressed as an entry queue and some acceptor queue as in Figure~\ref{fig:ClassicalMonitor}.
    19811531
    19821532\begin{figure}
     
    19941544\end{figure}
    19951545
    1996 There are other alternatives to these pictures, but in the case of the left picture, implementing a fast accept check is relatively easy.
    1997 Restricted to a fixed number of mutex members, N, the accept check reduces to updating a bitmask when the acceptor queue changes, a check that executes in a single instruction even with a fairly large number (\eg 128) of mutex members.
    1998 This approach requires a unique dense ordering of routines with an upper-bound and that ordering must be consistent across translation units.
    1999 For OO languages these constraints are common, since objects only offer adding member routines consistently across translation units via inheritance.
    2000 However, in \CFA users can extend objects with mutex routines that are only visible in certain translation unit.
    2001 This means that establishing a program-wide dense-ordering among mutex routines can only be done in the program linking phase, and still could have issues when using dynamically shared objects.
     1546There are other alternatives to these pictures, but in the case of the left picture, implementing a fast accept check is relatively easy. Restricted to a fixed number of mutex members, N, the accept check reduces to updating a bitmask when the acceptor queue changes, a check that executes in a single instruction even with a fairly large number (e.g., 128) of mutex members. This approach requires a unique dense ordering of routines with an upper-bound and that ordering must be consistent across translation units. For OO languages these constraints are common, since objects only offer adding member routines consistently across translation units via inheritance. However, in \CFA users can extend objects with mutex routines that are only visible in certain translation unit. This means that establishing a program-wide dense-ordering among mutex routines can only be done in the program linking phase, and still could have issues when using dynamically shared objects.
    20021547
    20031548The alternative is to alter the implementation as in Figure~\ref{fig:BulkMonitor}.
    2004 Here, the mutex routine called is associated with a thread on the entry queue while a list of acceptable routines is kept separate.
    2005 Generating a mask dynamically means that the storage for the mask information can vary between calls to @waitfor@, allowing for more flexibility and extensions.
    2006 Storing an array of accepted function pointers replaces the single instruction bitmask comparison with dereferencing a pointer followed by a linear search.
    2007 Furthermore, supporting nested external scheduling (\eg listing \ref{f:nest-ext}) may now require additional searches for the @waitfor@ statement to check if a routine is already queued.
     1549Here, the mutex routine called is associated with a thread on the entry queue while a list of acceptable routines is kept separate. Generating a mask dynamically means that the storage for the mask information can vary between calls to \code{waitfor}, allowing for more flexibility and extensions. Storing an array of accepted function pointers replaces the single instruction bitmask comparison with dereferencing a pointer followed by a linear search. Furthermore, supporting nested external scheduling (e.g., listing \ref{lst:nest-ext}) may now require additional searches for the \code{waitfor} statement to check if a routine is already queued.
    20081550
    20091551\begin{figure}
    2010 \begin{cfa}[caption={Example of nested external scheduling},label={f:nest-ext}]
     1552\begin{cfacode}[caption={Example of nested external scheduling},label={lst:nest-ext}]
    20111553monitor M {};
    20121554void foo( M & mutex a ) {}
    20131555void bar( M & mutex b ) {
    2014         // Nested in the waitfor(bar, c) call
     1556        //Nested in the waitfor(bar, c) call
    20151557        waitfor(foo, b);
    20161558}
     
    20191561}
    20201562
    2021 \end{cfa}
     1563\end{cfacode}
    20221564\end{figure}
    20231565
    2024 Note that in the right picture, tasks need to always keep track of the monitors associated with mutex routines, and the routine mask needs to have both a function pointer and a set of monitors, as is discussed in the next section.
    2025 These details are omitted from the picture for the sake of simplicity.
    2026 
    2027 At this point, a decision must be made between flexibility and performance.
    2028 Many design decisions in \CFA achieve both flexibility and performance, for example polymorphic routines add significant flexibility but inlining them means the optimizer can easily remove any runtime cost.
    2029 Here, however, the cost of flexibility cannot be trivially removed.
    2030 In the end, the most flexible approach has been chosen since it allows users to write programs that would otherwise be  hard to write.
    2031 This decision is based on the assumption that writing fast but inflexible locks is closer to a solved problem than writing locks that are as flexible as external scheduling in \CFA.
     1566Note that in the right picture, tasks need to always keep track of the monitors associated with mutex routines, and the routine mask needs to have both a function pointer and a set of monitors, as is discussed in the next section. These details are omitted from the picture for the sake of simplicity.
     1567
     1568At this point, a decision must be made between flexibility and performance. Many design decisions in \CFA achieve both flexibility and performance, for example polymorphic routines add significant flexibility but inlining them means the optimizer can easily remove any runtime cost. Here, however, the cost of flexibility cannot be trivially removed. In the end, the most flexible approach has been chosen since it allows users to write programs that would otherwise be  hard to write. This decision is based on the assumption that writing fast but inflexible locks is closer to a solved problem than writing locks that are as flexible as external scheduling in \CFA.
    20321569
    20331570% ======================================================================
     
    20371574% ======================================================================
    20381575
    2039 External scheduling, like internal scheduling, becomes significantly more complex when introducing multi-monitor syntax.
    2040 Even in the simplest possible case, some new semantics needs to be established:
    2041 \begin{cfa}
     1576External scheduling, like internal scheduling, becomes significantly more complex when introducing multi-monitor syntax. Even in the simplest possible case, some new semantics needs to be established:
     1577\begin{cfacode}
    20421578monitor M {};
    20431579
     
    20451581
    20461582void g(M & mutex b, M & mutex c) {
    2047         waitfor(f); // two monitors M => unknown which to pass to f(M & mutex)
    2048 }
    2049 \end{cfa}
     1583        waitfor(f); //two monitors M => unknown which to pass to f(M & mutex)
     1584}
     1585\end{cfacode}
    20501586The obvious solution is to specify the correct monitor as follows:
    20511587
    2052 \begin{cfa}
     1588\begin{cfacode}
    20531589monitor M {};
    20541590
     
    20561592
    20571593void g(M & mutex a, M & mutex b) {
    2058         // wait for call to f with argument b
     1594        //wait for call to f with argument b
    20591595        waitfor(f, b);
    20601596}
    2061 \end{cfa}
    2062 This syntax is unambiguous.
    2063 Both locks are acquired and kept by @g@.
    2064 When routine @f@ is called, the lock for monitor @b@ is temporarily transferred from @g@ to @f@ (while @g@ still holds lock @a@).
    2065 This behaviour can be extended to the multi-monitor @waitfor@ statement as follows.
    2066 
    2067 \begin{cfa}
     1597\end{cfacode}
     1598This syntax is unambiguous. Both locks are acquired and kept by \code{g}. When routine \code{f} is called, the lock for monitor \code{b} is temporarily transferred from \code{g} to \code{f} (while \code{g} still holds lock \code{a}). This behaviour can be extended to the multi-monitor \code{waitfor} statement as follows.
     1599
     1600\begin{cfacode}
    20681601monitor M {};
    20691602
     
    20711604
    20721605void g(M & mutex a, M & mutex b) {
    2073         // wait for call to f with arguments a and b
     1606        //wait for call to f with arguments a and b
    20741607        waitfor(f, a, b);
    20751608}
    2076 \end{cfa}
    2077 
    2078 Note that the set of monitors passed to the @waitfor@ statement must be entirely contained in the set of monitors already acquired in the routine. @waitfor@ used in any other context is undefined behaviour.
     1609\end{cfacode}
     1610
     1611Note that the set of monitors passed to the \code{waitfor} statement must be entirely contained in the set of monitors already acquired in the routine. \code{waitfor} used in any other context is undefined behaviour.
    20791612
    20801613An important behaviour to note is when a set of monitors only match partially:
    20811614
    2082 \begin{cfa}
     1615\begin{cfacode}
    20831616mutex struct A {};
    20841617
     
    20931626
    20941627void foo() {
    2095         g(a1, b); // block on accept
     1628        g(a1, b); //block on accept
    20961629}
    20971630
    20981631void bar() {
    2099         f(a2, b); // fulfill cooperation
    2100 }
    2101 \end{cfa}
    2102 While the equivalent can happen when using internal scheduling, the fact that conditions are specific to a set of monitors means that users have to use two different condition variables.
    2103 In both cases, partially matching monitor sets does not wakeup the waiting thread.
    2104 It is also important to note that in the case of external scheduling the order of parameters is irrelevant; @waitfor(f,a,b)@ and @waitfor(f,b,a)@ are indistinguishable waiting condition.
    2105 
    2106 % ======================================================================
    2107 % ======================================================================
    2108 \subsection{\protect\lstinline|waitfor| Semantics}
    2109 % ======================================================================
    2110 % ======================================================================
    2111 
    2112 Syntactically, the @waitfor@ statement takes a function identifier and a set of monitors.
    2113 While the set of monitors can be any list of expressions, the function name is more restricted because the compiler validates at compile time the validity of the function type and the parameters used with the @waitfor@ statement.
    2114 It checks that the set of monitors passed in matches the requirements for a function call.
    2115 Figure~\ref{f:waitfor} shows various usages of the waitfor statement and which are acceptable.
    2116 The choice of the function type is made ignoring any non-@mutex@ parameter.
    2117 One limitation of the current implementation is that it does not handle overloading, but overloading is possible.
     1632        f(a2, b); //fulfill cooperation
     1633}
     1634\end{cfacode}
     1635While the equivalent can happen when using internal scheduling, the fact that conditions are specific to a set of monitors means that users have to use two different condition variables. In both cases, partially matching monitor sets does not wakeup the waiting thread. It is also important to note that in the case of external scheduling the order of parameters is irrelevant; \code{waitfor(f,a,b)} and \code{waitfor(f,b,a)} are indistinguishable waiting condition.
     1636
     1637% ======================================================================
     1638% ======================================================================
     1639\subsection{\code{waitfor} Semantics}
     1640% ======================================================================
     1641% ======================================================================
     1642
     1643Syntactically, the \code{waitfor} statement takes a function identifier and a set of monitors. While the set of monitors can be any list of expressions, the function name is more restricted because the compiler validates at compile time the validity of the function type and the parameters used with the \code{waitfor} statement. It checks that the set of monitors passed in matches the requirements for a function call. Listing \ref{lst:waitfor} shows various usages of the waitfor statement and which are acceptable. The choice of the function type is made ignoring any non-\code{mutex} parameter. One limitation of the current implementation is that it does not handle overloading, but overloading is possible.
    21181644\begin{figure}
    2119 \begin{cfa}[caption={Various correct and incorrect uses of the waitfor statement},label={f:waitfor}]
     1645\begin{cfacode}[caption={Various correct and incorrect uses of the waitfor statement},label={lst:waitfor}]
    21201646monitor A{};
    21211647monitor B{};
     
    21311657        void (*fp)( A & mutex ) = f1;
    21321658
    2133         waitfor(f1, a1);     // Correct : 1 monitor case
    2134         waitfor(f2, a1, b1); // Correct : 2 monitor case
    2135         waitfor(f3, a1);     // Correct : non-mutex arguments are ignored
    2136         waitfor(f1, *ap);    // Correct : expression as argument
    2137 
    2138         waitfor(f1, a1, b1); // Incorrect : Too many mutex arguments
    2139         waitfor(f2, a1);     // Incorrect : Too few mutex arguments
    2140         waitfor(f2, a1, a2); // Incorrect : Mutex arguments don't match
    2141         waitfor(f1, 1);      // Incorrect : 1 not a mutex argument
    2142         waitfor(f9, a1);     // Incorrect : f9 function does not exist
    2143         waitfor(*fp, a1 );   // Incorrect : fp not an identifier
    2144         waitfor(f4, a1);     // Incorrect : f4 ambiguous
    2145 
    2146         waitfor(f2, a1, b2); // Undefined behaviour : b2 not mutex
    2147 }
    2148 \end{cfa}
     1659        waitfor(f1, a1);     //Correct : 1 monitor case
     1660        waitfor(f2, a1, b1); //Correct : 2 monitor case
     1661        waitfor(f3, a1);     //Correct : non-mutex arguments are ignored
     1662        waitfor(f1, *ap);    //Correct : expression as argument
     1663
     1664        waitfor(f1, a1, b1); //Incorrect : Too many mutex arguments
     1665        waitfor(f2, a1);     //Incorrect : Too few mutex arguments
     1666        waitfor(f2, a1, a2); //Incorrect : Mutex arguments don't match
     1667        waitfor(f1, 1);      //Incorrect : 1 not a mutex argument
     1668        waitfor(f9, a1);     //Incorrect : f9 function does not exist
     1669        waitfor(*fp, a1 );   //Incorrect : fp not an identifier
     1670        waitfor(f4, a1);     //Incorrect : f4 ambiguous
     1671
     1672        waitfor(f2, a1, b2); //Undefined behaviour : b2 not mutex
     1673}
     1674\end{cfacode}
    21491675\end{figure}
    21501676
    2151 Finally, for added flexibility, \CFA supports constructing a complex @waitfor@ statement using the @or@, @timeout@ and @else@.
    2152 Indeed, multiple @waitfor@ clauses can be chained together using @or@; this chain forms a single statement that uses baton pass to any function that fits one of the function+monitor set passed in.
    2153 To enable users to tell which accepted function executed, @waitfor@s are followed by a statement (including the null statement @;@) or a compound statement, which is executed after the clause is triggered.
    2154 A @waitfor@ chain can also be followed by a @timeout@, to signify an upper bound on the wait, or an @else@, to signify that the call should be non-blocking, which checks for a matching function call already arrived and otherwise continues.
    2155 Any and all of these clauses can be preceded by a @when@ condition to dynamically toggle the accept clauses on or off based on some current state.
    2156 Figure~\ref{f:waitfor2} demonstrates several complex masks and some incorrect ones.
     1677Finally, for added flexibility, \CFA supports constructing a complex \code{waitfor} statement using the \code{or}, \code{timeout} and \code{else}. Indeed, multiple \code{waitfor} clauses can be chained together using \code{or}; this chain forms a single statement that uses baton pass to any function that fits one of the function+monitor set passed in. To enable users to tell which accepted function executed, \code{waitfor}s are followed by a statement (including the null statement \code{;}) or a compound statement, which is executed after the clause is triggered. A \code{waitfor} chain can also be followed by a \code{timeout}, to signify an upper bound on the wait, or an \code{else}, to signify that the call should be non-blocking, which checks for a matching function call already arrived and otherwise continues. Any and all of these clauses can be preceded by a \code{when} condition to dynamically toggle the accept clauses on or off based on some current state. Listing \ref{lst:waitfor2} demonstrates several complex masks and some incorrect ones.
    21571678
    21581679\begin{figure}
    2159 \lstset{language=CFA,deletedelim=**[is][]{`}{`}}
    2160 \begin{cfa}
     1680\begin{cfacode}[caption={Various correct and incorrect uses of the or, else, and timeout clause around a waitfor statement},label={lst:waitfor2}]
    21611681monitor A{};
    21621682
     
    21651685
    21661686void foo( A & mutex a, bool b, int t ) {
    2167         waitfor(f1, a);                                                 $\C{// Correct : blocking case}$
    2168 
    2169         waitfor(f1, a) {                                                $\C{// Correct : block with statement}$
     1687        //Correct : blocking case
     1688        waitfor(f1, a);
     1689
     1690        //Correct : block with statement
     1691        waitfor(f1, a) {
    21701692                sout | "f1" | endl;
    21711693        }
    2172         waitfor(f1, a) {                                                $\C{// Correct : block waiting for f1 or f2}$
     1694
     1695        //Correct : block waiting for f1 or f2
     1696        waitfor(f1, a) {
    21731697                sout | "f1" | endl;
    21741698        } or waitfor(f2, a) {
    21751699                sout | "f2" | endl;
    21761700        }
    2177         waitfor(f1, a); or else;                                $\C{// Correct : non-blocking case}$
    2178 
    2179         waitfor(f1, a) {                                                $\C{// Correct : non-blocking case}$
     1701
     1702        //Correct : non-blocking case
     1703        waitfor(f1, a); or else;
     1704
     1705        //Correct : non-blocking case
     1706        waitfor(f1, a) {
    21801707                sout | "blocked" | endl;
    21811708        } or else {
    21821709                sout | "didn't block" | endl;
    21831710        }
    2184         waitfor(f1, a) {                                                $\C{// Correct : block at most 10 seconds}$
     1711
     1712        //Correct : block at most 10 seconds
     1713        waitfor(f1, a) {
    21851714                sout | "blocked" | endl;
    21861715        } or timeout( 10`s) {
    21871716                sout | "didn't block" | endl;
    21881717        }
    2189         // Correct : block only if b == true if b == false, don't even make the call
     1718
     1719        //Correct : block only if b == true
     1720        //if b == false, don't even make the call
    21901721        when(b) waitfor(f1, a);
    21911722
    2192         // Correct : block only if b == true if b == false, make non-blocking call
     1723        //Correct : block only if b == true
     1724        //if b == false, make non-blocking call
    21931725        waitfor(f1, a); or when(!b) else;
    21941726
    2195         // Correct : block only of t > 1
     1727        //Correct : block only of t > 1
    21961728        waitfor(f1, a); or when(t > 1) timeout(t); or else;
    21971729
    2198         // Incorrect : timeout clause is dead code
     1730        //Incorrect : timeout clause is dead code
    21991731        waitfor(f1, a); or timeout(t); or else;
    22001732
    2201         // Incorrect : order must be waitfor [or waitfor... [or timeout] [or else]]
     1733        //Incorrect : order must be
     1734        //waitfor [or waitfor... [or timeout] [or else]]
    22021735        timeout(t); or waitfor(f1, a); or else;
    22031736}
    2204 \end{cfa}
    2205 \caption{Correct and incorrect uses of the or, else, and timeout clause around a waitfor statement}
    2206 \label{f:waitfor2}
     1737\end{cfacode}
    22071738\end{figure}
    22081739
     
    22121743% ======================================================================
    22131744% ======================================================================
    2214 An interesting use for the @waitfor@ statement is destructor semantics.
    2215 Indeed, the @waitfor@ statement can accept any @mutex@ routine, which includes the destructor (see section \ref{data}).
    2216 However, with the semantics discussed until now, waiting for the destructor does not make any sense, since using an object after its destructor is called is undefined behaviour.
    2217 The simplest approach is to disallow @waitfor@ on a destructor.
    2218 However, a more expressive approach is to flip ordering of execution when waiting for the destructor, meaning that waiting for the destructor allows the destructor to run after the current @mutex@ routine, similarly to how a condition is signalled.
     1745An interesting use for the \code{waitfor} statement is destructor semantics. Indeed, the \code{waitfor} statement can accept any \code{mutex} routine, which includes the destructor (see section \ref{data}). However, with the semantics discussed until now, waiting for the destructor does not make any sense, since using an object after its destructor is called is undefined behaviour. The simplest approach is to disallow \code{waitfor} on a destructor. However, a more expressive approach is to flip ordering of execution when waiting for the destructor, meaning that waiting for the destructor allows the destructor to run after the current \code{mutex} routine, similarly to how a condition is signalled.
    22191746\begin{figure}
    2220 \begin{cfa}[caption={Example of an executor which executes action in series until the destructor is called.},label={f:dtor-order}]
     1747\begin{cfacode}[caption={Example of an executor which executes action in series until the destructor is called.},label={lst:dtor-order}]
    22211748monitor Executer {};
    22221749struct  Action;
     
    22321759        }
    22331760}
    2234 \end{cfa}
     1761\end{cfacode}
    22351762\end{figure}
    2236 For example, listing \ref{f:dtor-order} shows an example of an executor with an infinite loop, which waits for the destructor to break out of this loop.
    2237 Switching the semantic meaning introduces an idiomatic way to terminate a task and/or wait for its termination via destruction.
     1763For example, listing \ref{lst:dtor-order} shows an example of an executor with an infinite loop, which waits for the destructor to break out of this loop. Switching the semantic meaning introduces an idiomatic way to terminate a task and/or wait for its termination via destruction.
    22381764
    22391765
     
    22461772% #       #     # #     # #     # ####### ####### ####### ####### ###  #####  #     #
    22471773\section{Parallelism}
    2248 Historically, computer performance was about processor speeds and instruction counts.
    2249 However, with heat dissipation being a direct consequence of speed increase, parallelism has become the new source for increased performance~\cite{Sutter05, Sutter05b}.
    2250 In this decade, it is no longer reasonable to create a high-performance application without caring about parallelism.
    2251 Indeed, parallelism is an important aspect of performance and more specifically throughput and hardware utilization.
    2252 The lowest-level approach of parallelism is to use \textbf{kthread} in combination with semantics like @fork@, @join@, \etc.
    2253 However, since these have significant costs and limitations, \textbf{kthread} are now mostly used as an implementation tool rather than a user oriented one.
    2254 There are several alternatives to solve these issues that all have strengths and weaknesses.
    2255 While there are many variations of the presented paradigms, most of these variations do not actually change the guarantees or the semantics, they simply move costs in order to achieve better performance for certain workloads.
     1774Historically, computer performance was about processor speeds and instruction counts. However, with heat dissipation being a direct consequence of speed increase, parallelism has become the new source for increased performance~\cite{Sutter05, Sutter05b}. In this decade, it is no longer reasonable to create a high-performance application without caring about parallelism. Indeed, parallelism is an important aspect of performance and more specifically throughput and hardware utilization. The lowest-level approach of parallelism is to use \textbf{kthread} in combination with semantics like \code{fork}, \code{join}, etc. However, since these have significant costs and limitations, \textbf{kthread} are now mostly used as an implementation tool rather than a user oriented one. There are several alternatives to solve these issues that all have strengths and weaknesses. While there are many variations of the presented paradigms, most of these variations do not actually change the guarantees or the semantics, they simply move costs in order to achieve better performance for certain workloads.
    22561775
    22571776\section{Paradigms}
    22581777\subsection{User-Level Threads}
    2259 A direct improvement on the \textbf{kthread} approach is to use \textbf{uthread}.
    2260 These threads offer most of the same features that the operating system already provides but can be used on a much larger scale.
    2261 This approach is the most powerful solution as it allows all the features of multithreading, while removing several of the more expensive costs of kernel threads.
    2262 The downside is that almost none of the low-level threading problems are hidden; users still have to think about data races, deadlocks and synchronization issues.
    2263 These issues can be somewhat alleviated by a concurrency toolkit with strong guarantees, but the parallelism toolkit offers very little to reduce complexity in itself.
     1778A direct improvement on the \textbf{kthread} approach is to use \textbf{uthread}. These threads offer most of the same features that the operating system already provides but can be used on a much larger scale. This approach is the most powerful solution as it allows all the features of multithreading, while removing several of the more expensive costs of kernel threads. The downside is that almost none of the low-level threading problems are hidden; users still have to think about data races, deadlocks and synchronization issues. These issues can be somewhat alleviated by a concurrency toolkit with strong guarantees, but the parallelism toolkit offers very little to reduce complexity in itself.
    22641779
    22651780Examples of languages that support \textbf{uthread} are Erlang~\cite{Erlang} and \uC~\cite{uC++book}.
    22661781
    22671782\subsection{Fibers : User-Level Threads Without Preemption} \label{fibers}
    2268 A popular variant of \textbf{uthread} is what is often referred to as \textbf{fiber}.
    2269 However, \textbf{fiber} do not present meaningful semantic differences with \textbf{uthread}.
    2270 The significant difference between \textbf{uthread} and \textbf{fiber} is the lack of \textbf{preemption} in the latter.
    2271 Advocates of \textbf{fiber} list their high performance and ease of implementation as major strengths, but the performance difference between \textbf{uthread} and \textbf{fiber} is controversial, and the ease of implementation, while true, is a weak argument in the context of language design.
    2272 Therefore this proposal largely ignores fibers.
     1783A popular variant of \textbf{uthread} is what is often referred to as \textbf{fiber}. However, \textbf{fiber} do not present meaningful semantic differences with \textbf{uthread}. The significant difference between \textbf{uthread} and \textbf{fiber} is the lack of \textbf{preemption} in the latter. Advocates of \textbf{fiber} list their high performance and ease of implementation as major strengths, but the performance difference between \textbf{uthread} and \textbf{fiber} is controversial, and the ease of implementation, while true, is a weak argument in the context of language design. Therefore this proposal largely ignores fibers.
    22731784
    22741785An example of a language that uses fibers is Go~\cite{Go}
    22751786
    22761787\subsection{Jobs and Thread Pools}
    2277 An approach on the opposite end of the spectrum is to base parallelism on \textbf{pool}.
    2278 Indeed, \textbf{pool} offer limited flexibility but at the benefit of a simpler user interface.
    2279 In \textbf{pool} based systems, users express parallelism as units of work, called jobs, and a dependency graph (either explicit or implicit) that ties them together.
    2280 This approach means users need not worry about concurrency but significantly limit the interaction that can occur among jobs.
    2281 Indeed, any \textbf{job} that blocks also block the underlying worker, which effectively means the CPU utilization, and therefore throughput, suffers noticeably.
    2282 It can be argued that a solution to this problem is to use more workers than available cores.
    2283 However, unless the number of jobs and the number of workers are comparable, having a significant number of blocked jobs always results in idles cores.
     1788An approach on the opposite end of the spectrum is to base parallelism on \textbf{pool}. Indeed, \textbf{pool} offer limited flexibility but at the benefit of a simpler user interface. In \textbf{pool} based systems, users express parallelism as units of work, called jobs, and a dependency graph (either explicit or implicit) that ties them together. This approach means users need not worry about concurrency but significantly limit the interaction that can occur among jobs. Indeed, any \textbf{job} that blocks also block the underlying worker, which effectively means the CPU utilization, and therefore throughput, suffers noticeably. It can be argued that a solution to this problem is to use more workers than available cores. However, unless the number of jobs and the number of workers are comparable, having a significant number of blocked jobs always results in idles cores.
    22841789
    22851790The gold standard of this implementation is Intel's TBB library~\cite{TBB}.
    22861791
    22871792\subsection{Paradigm Performance}
    2288 While the choice between the three paradigms listed above may have significant performance implications, it is difficult to pin down the performance implications of choosing a model at the language level.
    2289 Indeed, in many situations one of these paradigms may show better performance but it all strongly depends on the workload.
    2290 Having a large amount of mostly independent units of work to execute almost guarantees equivalent performance across paradigms and that the \textbf{pool}-based system has the best efficiency thanks to the lower memory overhead (\ie no thread stack per job).
    2291 However, interactions among jobs can easily exacerbate contention.
    2292 User-level threads allow fine-grain context switching, which results in better resource utilization, but a context switch is more expensive and the extra control means users need to tweak more variables to get the desired performance.
    2293 Finally, if the units of uninterrupted work are large, enough the paradigm choice is largely amortized by the actual work done.
     1793While the choice between the three paradigms listed above may have significant performance implications, it is difficult to pin down the performance implications of choosing a model at the language level. Indeed, in many situations one of these paradigms may show better performance but it all strongly depends on the workload. Having a large amount of mostly independent units of work to execute almost guarantees equivalent performance across paradigms and that the \textbf{pool}-based system has the best efficiency thanks to the lower memory overhead (i.e., no thread stack per job). However, interactions among jobs can easily exacerbate contention. User-level threads allow fine-grain context switching, which results in better resource utilization, but a context switch is more expensive and the extra control means users need to tweak more variables to get the desired performance. Finally, if the units of uninterrupted work are large, enough the paradigm choice is largely amortized by the actual work done.
    22941794
    22951795\section{The \protect\CFA\ Kernel : Processors, Clusters and Threads}\label{kernel}
    2296 A \textbf{cfacluster} is a group of \textbf{kthread} executed in isolation. \textbf{uthread} are scheduled on the \textbf{kthread} of a given \textbf{cfacluster}, allowing organization between \textbf{uthread} and \textbf{kthread}.
    2297 It is important that \textbf{kthread} belonging to a same \textbf{cfacluster} have homogeneous settings, otherwise migrating a \textbf{uthread} from one \textbf{kthread} to the other can cause issues.
    2298 A \textbf{cfacluster} also offers a pluggable scheduler that can optimize the workload generated by the \textbf{uthread}.
    2299 
    2300 \textbf{cfacluster} have not been fully implemented in the context of this paper.
    2301 Currently \CFA only supports one \textbf{cfacluster}, the initial one.
     1796A \textbf{cfacluster} is a group of \textbf{kthread} executed in isolation. \textbf{uthread} are scheduled on the \textbf{kthread} of a given \textbf{cfacluster}, allowing organization between \textbf{uthread} and \textbf{kthread}. It is important that \textbf{kthread} belonging to a same \textbf{cfacluster} have homogeneous settings, otherwise migrating a \textbf{uthread} from one \textbf{kthread} to the other can cause issues. A \textbf{cfacluster} also offers a pluggable scheduler that can optimize the workload generated by the \textbf{uthread}.
     1797
     1798\textbf{cfacluster} have not been fully implemented in the context of this paper. Currently \CFA only supports one \textbf{cfacluster}, the initial one.
    23021799
    23031800\subsection{Future Work: Machine Setup}\label{machine}
    2304 While this was not done in the context of this paper, another important aspect of clusters is affinity.
    2305 While many common desktop and laptop PCs have homogeneous CPUs, other devices often have more heterogeneous setups.
    2306 For example, a system using \textbf{numa} configurations may benefit from users being able to tie clusters and/or kernel threads to certain CPU cores.
    2307 OS support for CPU affinity is now common~\cite{affinityLinux, affinityWindows, affinityFreebsd, affinityNetbsd, affinityMacosx}, which means it is both possible and desirable for \CFA to offer an abstraction mechanism for portable CPU affinity.
     1801While this was not done in the context of this paper, another important aspect of clusters is affinity. While many common desktop and laptop PCs have homogeneous CPUs, other devices often have more heterogeneous setups. For example, a system using \textbf{numa} configurations may benefit from users being able to tie clusters and/or kernel threads to certain CPU cores. OS support for CPU affinity is now common~\cite{affinityLinux, affinityWindows, affinityFreebsd, affinityNetbsd, affinityMacosx}, which means it is both possible and desirable for \CFA to offer an abstraction mechanism for portable CPU affinity.
    23081802
    23091803\subsection{Paradigms}\label{cfaparadigms}
    2310 Given these building blocks, it is possible to reproduce all three of the popular paradigms.
    2311 Indeed, \textbf{uthread} is the default paradigm in \CFA.
    2312 However, disabling \textbf{preemption} on the \textbf{cfacluster} means \textbf{cfathread} effectively become \textbf{fiber}.
    2313 Since several \textbf{cfacluster} with different scheduling policy can coexist in the same application, this allows \textbf{fiber} and \textbf{uthread} to coexist in the runtime of an application.
    2314 Finally, it is possible to build executors for thread pools from \textbf{uthread} or \textbf{fiber}, which includes specialized jobs like actors~\cite{Actors}.
     1804Given these building blocks, it is possible to reproduce all three of the popular paradigms. Indeed, \textbf{uthread} is the default paradigm in \CFA. However, disabling \textbf{preemption} on the \textbf{cfacluster} means \textbf{cfathread} effectively become \textbf{fiber}. Since several \textbf{cfacluster} with different scheduling policy can coexist in the same application, this allows \textbf{fiber} and \textbf{uthread} to coexist in the runtime of an application. Finally, it is possible to build executors for thread pools from \textbf{uthread} or \textbf{fiber}, which includes specialized jobs like actors~\cite{Actors}.
    23151805
    23161806
    23171807
    23181808\section{Behind the Scenes}
    2319 There are several challenges specific to \CFA when implementing concurrency.
    2320 These challenges are a direct result of \textbf{bulk-acq} and loose object definitions.
    2321 These two constraints are the root cause of most design decisions in the implementation.
    2322 Furthermore, to avoid contention from dynamically allocating memory in a concurrent environment, the internal-scheduling design is (almost) entirely free of mallocs.
    2323 This approach avoids the chicken and egg problem~\cite{Chicken} of having a memory allocator that relies on the threading system and a threading system that relies on the runtime.
    2324 This extra goal means that memory management is a constant concern in the design of the system.
    2325 
    2326 The main memory concern for concurrency is queues.
    2327 All blocking operations are made by parking threads onto queues and all queues are designed with intrusive nodes, where each node has pre-allocated link fields for chaining, to avoid the need for memory allocation.
    2328 Since several concurrency operations can use an unbound amount of memory (depending on \textbf{bulk-acq}), statically defining information in the intrusive fields of threads is insufficient.The only way to use a variable amount of memory without requiring memory allocation is to pre-allocate large buffers of memory eagerly and store the information in these buffers.
    2329 Conveniently, the call stack fits that description and is easy to use, which is why it is used heavily in the implementation of internal scheduling, particularly variable-length arrays.
    2330 Since stack allocation is based on scopes, the first step of the implementation is to identify the scopes that are available to store the information, and which of these can have a variable-length array.
    2331 The threads and the condition both have a fixed amount of memory, while @mutex@ routines and blocking calls allow for an unbound amount, within the stack size.
     1809There are several challenges specific to \CFA when implementing concurrency. These challenges are a direct result of \textbf{bulk-acq} and loose object definitions. These two constraints are the root cause of most design decisions in the implementation. Furthermore, to avoid contention from dynamically allocating memory in a concurrent environment, the internal-scheduling design is (almost) entirely free of mallocs. This approach avoids the chicken and egg problem~\cite{Chicken} of having a memory allocator that relies on the threading system and a threading system that relies on the runtime. This extra goal means that memory management is a constant concern in the design of the system.
     1810
     1811The main memory concern for concurrency is queues. All blocking operations are made by parking threads onto queues and all queues are designed with intrusive nodes, where each node has pre-allocated link fields for chaining, to avoid the need for memory allocation. Since several concurrency operations can use an unbound amount of memory (depending on \textbf{bulk-acq}), statically defining information in the intrusive fields of threads is insufficient.The only way to use a variable amount of memory without requiring memory allocation is to pre-allocate large buffers of memory eagerly and store the information in these buffers. Conveniently, the call stack fits that description and is easy to use, which is why it is used heavily in the implementation of internal scheduling, particularly variable-length arrays. Since stack allocation is based on scopes, the first step of the implementation is to identify the scopes that are available to store the information, and which of these can have a variable-length array. The threads and the condition both have a fixed amount of memory, while \code{mutex} routines and blocking calls allow for an unbound amount, within the stack size.
    23321812
    23331813Note that since the major contributions of this paper are extending monitor semantics to \textbf{bulk-acq} and loose object definitions, any challenges that are not resulting of these characteristics of \CFA are considered as solved problems and therefore not discussed.
     
    23391819% ======================================================================
    23401820
    2341 The first step towards the monitor implementation is simple @mutex@ routines.
    2342 In the single monitor case, mutual-exclusion is done using the entry/exit procedure in listing \ref{f:entry1}.
    2343 The entry/exit procedures do not have to be extended to support multiple monitors.
    2344 Indeed it is sufficient to enter/leave monitors one-by-one as long as the order is correct to prevent deadlock~\cite{Havender68}.
    2345 In \CFA, ordering of monitor acquisition relies on memory ordering.
    2346 This approach is sufficient because all objects are guaranteed to have distinct non-overlapping memory layouts and mutual-exclusion for a monitor is only defined for its lifetime, meaning that destroying a monitor while it is acquired is undefined behaviour.
    2347 When a mutex call is made, the concerned monitors are aggregated into a variable-length pointer array and sorted based on pointer values.
    2348 This array persists for the entire duration of the mutual-exclusion and its ordering reused extensively.
     1821The first step towards the monitor implementation is simple \code{mutex} routines. In the single monitor case, mutual-exclusion is done using the entry/exit procedure in listing \ref{lst:entry1}. The entry/exit procedures do not have to be extended to support multiple monitors. Indeed it is sufficient to enter/leave monitors one-by-one as long as the order is correct to prevent deadlock~\cite{Havender68}. In \CFA, ordering of monitor acquisition relies on memory ordering. This approach is sufficient because all objects are guaranteed to have distinct non-overlapping memory layouts and mutual-exclusion for a monitor is only defined for its lifetime, meaning that destroying a monitor while it is acquired is undefined behaviour. When a mutex call is made, the concerned monitors are aggregated into a variable-length pointer array and sorted based on pointer values. This array persists for the entire duration of the mutual-exclusion and its ordering reused extensively.
    23491822\begin{figure}
    23501823\begin{multicols}{2}
    23511824Entry
    2352 \begin{cfa}
     1825\begin{pseudo}
    23531826if monitor is free
    23541827        enter
     
    23581831        block
    23591832increment recursions
    2360 \end{cfa}
     1833\end{pseudo}
    23611834\columnbreak
    23621835Exit
    2363 \begin{cfa}
     1836\begin{pseudo}
    23641837decrement recursion
    23651838if recursion == 0
    23661839        if entry queue not empty
    23671840                wake-up thread
    2368 \end{cfa}
     1841\end{pseudo}
    23691842\end{multicols}
    2370 \begin{cfa}[caption={Initial entry and exit routine for monitors},label={f:entry1}]
    2371 \end{cfa}
     1843\begin{pseudo}[caption={Initial entry and exit routine for monitors},label={lst:entry1}]
     1844\end{pseudo}
    23721845\end{figure}
    23731846
    23741847\subsection{Details: Interaction with polymorphism}
    2375 Depending on the choice of semantics for when monitor locks are acquired, interaction between monitors and \CFA's concept of polymorphism can be more complex to support.
    2376 However, it is shown that entry-point locking solves most of the issues.
    2377 
    2378 First of all, interaction between @otype@ polymorphism (see Section~\ref{s:ParametricPolymorphism}) and monitors is impossible since monitors do not support copying.
    2379 Therefore, the main question is how to support @dtype@ polymorphism.
    2380 It is important to present the difference between the two acquiring options: \textbf{callsite-locking} and entry-point locking, \ie acquiring the monitors before making a mutex routine-call or as the first operation of the mutex routine-call.
    2381 For example:
    2382 \begin{table}
     1848Depending on the choice of semantics for when monitor locks are acquired, interaction between monitors and \CFA's concept of polymorphism can be more complex to support. However, it is shown that entry-point locking solves most of the issues.
     1849
     1850First of all, interaction between \code{otype} polymorphism (see Section~\ref{s:ParametricPolymorphism}) and monitors is impossible since monitors do not support copying. Therefore, the main question is how to support \code{dtype} polymorphism. It is important to present the difference between the two acquiring options: \textbf{callsite-locking} and entry-point locking, i.e., acquiring the monitors before making a mutex routine-call or as the first operation of the mutex routine-call. For example:
     1851\begin{table}[H]
    23831852\begin{center}
    23841853\begin{tabular}{|c|c|c|}
    23851854Mutex & \textbf{callsite-locking} & \textbf{entry-point-locking} \\
    2386 call & cfa-code & cfa-code \\
     1855call & pseudo-code & pseudo-code \\
    23871856\hline
    2388 \begin{cfa}[tabsize=3]
     1857\begin{cfacode}[tabsize=3]
    23891858void foo(monitor& mutex a){
    23901859
    2391         // Do Work
     1860        //Do Work
    23921861        //...
    23931862
     
    24001869
    24011870}
    2402 \end{cfa} & \begin{cfa}[tabsize=3]
     1871\end{cfacode} & \begin{pseudo}[tabsize=3]
    24031872foo(& a) {
    24041873
    2405         // Do Work
     1874        //Do Work
    24061875        //...
    24071876
     
    24141883        release(a);
    24151884}
    2416 \end{cfa} & \begin{cfa}[tabsize=3]
     1885\end{pseudo} & \begin{pseudo}[tabsize=3]
    24171886foo(& a) {
    24181887        acquire(a);
    2419         // Do Work
     1888        //Do Work
    24201889        //...
    24211890        release(a);
     
    24281897
    24291898}
    2430 \end{cfa}
     1899\end{pseudo}
    24311900\end{tabular}
    24321901\end{center}
     
    24351904\end{table}
    24361905
    2437 Note the @mutex@ keyword relies on the type system, which means that in cases where a generic monitor-routine is desired, writing the mutex routine is possible with the proper trait, \eg:
    2438 \begin{cfa}
    2439 // Incorrect: T may not be monitor
     1906Note the \code{mutex} keyword relies on the type system, which means that in cases where a generic monitor-routine is desired, writing the mutex routine is possible with the proper trait, e.g.:
     1907\begin{cfacode}
     1908//Incorrect: T may not be monitor
    24401909forall(dtype T)
    24411910void foo(T * mutex t);
    24421911
    2443 // Correct: this function only works on monitors (any monitor)
     1912//Correct: this function only works on monitors (any monitor)
    24441913forall(dtype T | is_monitor(T))
    24451914void bar(T * mutex t));
    2446 \end{cfa}
    2447 
    2448 Both entry point and \textbf{callsite-locking} are feasible implementations.
    2449 The current \CFA implementation uses entry-point locking because it requires less work when using \textbf{raii}, effectively transferring the burden of implementation to object construction/destruction.
    2450 It is harder to use \textbf{raii} for call-site locking, as it does not necessarily have an existing scope that matches exactly the scope of the mutual exclusion, \ie the function body.
    2451 For example, the monitor call can appear in the middle of an expression.
    2452 Furthermore, entry-point locking requires less code generation since any useful routine is called multiple times but there is only one entry point for many call sites.
     1915\end{cfacode}
     1916
     1917Both entry point and \textbf{callsite-locking} are feasible implementations. The current \CFA implementation uses entry-point locking because it requires less work when using \textbf{raii}, effectively transferring the burden of implementation to object construction/destruction. It is harder to use \textbf{raii} for call-site locking, as it does not necessarily have an existing scope that matches exactly the scope of the mutual exclusion, i.e., the function body. For example, the monitor call can appear in the middle of an expression. Furthermore, entry-point locking requires less code generation since any useful routine is called multiple times but there is only one entry point for many call sites.
    24531918
    24541919% ======================================================================
     
    24581923% ======================================================================
    24591924
    2460 Figure \ref{fig:system1} shows a high-level picture if the \CFA runtime system in regards to concurrency.
    2461 Each component of the picture is explained in detail in the flowing sections.
     1925Figure \ref{fig:system1} shows a high-level picture if the \CFA runtime system in regards to concurrency. Each component of the picture is explained in detail in the flowing sections.
    24621926
    24631927\begin{figure}
     
    24701934
    24711935\subsection{Processors}
    2472 Parallelism in \CFA is built around using processors to specify how much parallelism is desired. \CFA processors are object wrappers around kernel threads, specifically @pthread@s in the current implementation of \CFA.
    2473 Indeed, any parallelism must go through operating-system libraries.
    2474 However, \textbf{uthread} are still the main source of concurrency, processors are simply the underlying source of parallelism.
    2475 Indeed, processor \textbf{kthread} simply fetch a \textbf{uthread} from the scheduler and run it; they are effectively executers for user-threads.
    2476 The main benefit of this approach is that it offers a well-defined boundary between kernel code and user code, for example, kernel thread quiescing, scheduling and interrupt handling.
    2477 Processors internally use coroutines to take advantage of the existing context-switching semantics.
     1936Parallelism in \CFA is built around using processors to specify how much parallelism is desired. \CFA processors are object wrappers around kernel threads, specifically \texttt{pthread}s in the current implementation of \CFA. Indeed, any parallelism must go through operating-system libraries. However, \textbf{uthread} are still the main source of concurrency, processors are simply the underlying source of parallelism. Indeed, processor \textbf{kthread} simply fetch a \textbf{uthread} from the scheduler and run it; they are effectively executers for user-threads. The main benefit of this approach is that it offers a well-defined boundary between kernel code and user code, for example, kernel thread quiescing, scheduling and interrupt handling. Processors internally use coroutines to take advantage of the existing context-switching semantics.
    24781937
    24791938\subsection{Stack Management}
    2480 One of the challenges of this system is to reduce the footprint as much as possible.
    2481 Specifically, all @pthread@s created also have a stack created with them, which should be used as much as possible.
    2482 Normally, coroutines also create their own stack to run on, however, in the case of the coroutines used for processors, these coroutines run directly on the \textbf{kthread} stack, effectively stealing the processor stack.
    2483 The exception to this rule is the Main Processor, \ie the initial \textbf{kthread} that is given to any program.
    2484 In order to respect C user expectations, the stack of the initial kernel thread, the main stack of the program, is used by the main user thread rather than the main processor, which can grow very large.
     1939One of the challenges of this system is to reduce the footprint as much as possible. Specifically, all \texttt{pthread}s created also have a stack created with them, which should be used as much as possible. Normally, coroutines also create their own stack to run on, however, in the case of the coroutines used for processors, these coroutines run directly on the \textbf{kthread} stack, effectively stealing the processor stack. The exception to this rule is the Main Processor, i.e., the initial \textbf{kthread} that is given to any program. In order to respect C user expectations, the stack of the initial kernel thread, the main stack of the program, is used by the main user thread rather than the main processor, which can grow very large.
    24851940
    24861941\subsection{Context Switching}
    2487 As mentioned in section \ref{coroutine}, coroutines are a stepping stone for implementing threading, because they share the same mechanism for context-switching between different stacks.
    2488 To improve performance and simplicity, context-switching is implemented using the following assumption: all context-switches happen inside a specific function call.
    2489 This assumption means that the context-switch only has to copy the callee-saved registers onto the stack and then switch the stack registers with the ones of the target coroutine/thread.
    2490 Note that the instruction pointer can be left untouched since the context-switch is always inside the same function.
    2491 Threads, however, do not context-switch between each other directly.
    2492 They context-switch to the scheduler.
    2493 This method is called a 2-step context-switch and has the advantage of having a clear distinction between user code and the kernel where scheduling and other system operations happen.
    2494 Obviously, this doubles the context-switch cost because threads must context-switch to an intermediate stack.
    2495 The alternative 1-step context-switch uses the stack of the ``from'' thread to schedule and then context-switches directly to the ``to'' thread.
    2496 However, the performance of the 2-step context-switch is still superior to a @pthread_yield@ (see section \ref{results}).
    2497 Additionally, for users in need for optimal performance, it is important to note that having a 2-step context-switch as the default does not prevent \CFA from offering a 1-step context-switch (akin to the Microsoft @SwitchToFiber@~\cite{switchToWindows} routine).
    2498 This option is not currently present in \CFA, but the changes required to add it are strictly additive.
     1942As mentioned in section \ref{coroutine}, coroutines are a stepping stone for implementing threading, because they share the same mechanism for context-switching between different stacks. To improve performance and simplicity, context-switching is implemented using the following assumption: all context-switches happen inside a specific function call. This assumption means that the context-switch only has to copy the callee-saved registers onto the stack and then switch the stack registers with the ones of the target coroutine/thread. Note that the instruction pointer can be left untouched since the context-switch is always inside the same function. Threads, however, do not context-switch between each other directly. They context-switch to the scheduler. This method is called a 2-step context-switch and has the advantage of having a clear distinction between user code and the kernel where scheduling and other system operations happen. Obviously, this doubles the context-switch cost because threads must context-switch to an intermediate stack. The alternative 1-step context-switch uses the stack of the ``from'' thread to schedule and then context-switches directly to the ``to'' thread. However, the performance of the 2-step context-switch is still superior to a \code{pthread_yield} (see section \ref{results}). Additionally, for users in need for optimal performance, it is important to note that having a 2-step context-switch as the default does not prevent \CFA from offering a 1-step context-switch (akin to the Microsoft \code{SwitchToFiber}~\cite{switchToWindows} routine). This option is not currently present in \CFA, but the changes required to add it are strictly additive.
    24991943
    25001944\subsection{Preemption} \label{preemption}
    2501 Finally, an important aspect for any complete threading system is preemption.
    2502 As mentioned in section \ref{basics}, preemption introduces an extra degree of uncertainty, which enables users to have multiple threads interleave transparently, rather than having to cooperate among threads for proper scheduling and CPU distribution.
    2503 Indeed, preemption is desirable because it adds a degree of isolation among threads.
    2504 In a fully cooperative system, any thread that runs a long loop can starve other threads, while in a preemptive system, starvation can still occur but it does not rely on every thread having to yield or block on a regular basis, which reduces significantly a programmer burden.
    2505 Obviously, preemption is not optimal for every workload.
    2506 However any preemptive system can become a cooperative system by making the time slices extremely large.
    2507 Therefore, \CFA uses a preemptive threading system.
    2508 
    2509 Preemption in \CFA\footnote{Note that the implementation of preemption is strongly tied with the underlying threading system.
    2510 For this reason, only the Linux implementation is cover, \CFA does not run on Windows at the time of writting} is based on kernel timers, which are used to run a discrete-event simulation.
    2511 Every processor keeps track of the current time and registers an expiration time with the preemption system.
    2512 When the preemption system receives a change in preemption, it inserts the time in a sorted order and sets a kernel timer for the closest one, effectively stepping through preemption events on each signal sent by the timer.
    2513 These timers use the Linux signal {\tt SIGALRM}, which is delivered to the process rather than the kernel-thread.
    2514 This results in an implementation problem, because when delivering signals to a process, the kernel can deliver the signal to any kernel thread for which the signal is not blocked, \ie:
     1945Finally, an important aspect for any complete threading system is preemption. As mentioned in section \ref{basics}, preemption introduces an extra degree of uncertainty, which enables users to have multiple threads interleave transparently, rather than having to cooperate among threads for proper scheduling and CPU distribution. Indeed, preemption is desirable because it adds a degree of isolation among threads. In a fully cooperative system, any thread that runs a long loop can starve other threads, while in a preemptive system, starvation can still occur but it does not rely on every thread having to yield or block on a regular basis, which reduces significantly a programmer burden. Obviously, preemption is not optimal for every workload. However any preemptive system can become a cooperative system by making the time slices extremely large. Therefore, \CFA uses a preemptive threading system.
     1946
     1947Preemption in \CFA\footnote{Note that the implementation of preemption is strongly tied with the underlying threading system. For this reason, only the Linux implementation is cover, \CFA does not run on Windows at the time of writting} is based on kernel timers, which are used to run a discrete-event simulation. Every processor keeps track of the current time and registers an expiration time with the preemption system. When the preemption system receives a change in preemption, it inserts the time in a sorted order and sets a kernel timer for the closest one, effectively stepping through preemption events on each signal sent by the timer. These timers use the Linux signal {\tt SIGALRM}, which is delivered to the process rather than the kernel-thread. This results in an implementation problem, because when delivering signals to a process, the kernel can deliver the signal to any kernel thread for which the signal is not blocked, i.e.:
    25151948\begin{quote}
    2516 A process-directed signal may be delivered to any one of the threads that does not currently have the signal blocked.
    2517 If more than one of the threads has the signal unblocked, then the kernel chooses an arbitrary thread to which to deliver the signal.
     1949A process-directed signal may be delivered to any one of the threads that does not currently have the signal blocked. If more than one of the threads has the signal unblocked, then the kernel chooses an arbitrary thread to which to deliver the signal.
    25181950SIGNAL(7) - Linux Programmer's Manual
    25191951\end{quote}
    25201952For the sake of simplicity, and in order to prevent the case of having two threads receiving alarms simultaneously, \CFA programs block the {\tt SIGALRM} signal on every kernel thread except one.
    25211953
    2522 Now because of how involuntary context-switches are handled, the kernel thread handling {\tt SIGALRM} cannot also be a processor thread.
    2523 Hence, involuntary context-switching is done by sending signal {\tt SIGUSR1} to the corresponding proces\-sor and having the thread yield from inside the signal handler.
    2524 This approach effectively context-switches away from the signal handler back to the kernel and the signal handler frame is eventually unwound when the thread is scheduled again.
    2525 As a result, a signal handler can start on one kernel thread and terminate on a second kernel thread (but the same user thread).
    2526 It is important to note that signal handlers save and restore signal masks because user-thread migration can cause a signal mask to migrate from one kernel thread to another.
    2527 This behaviour is only a problem if all kernel threads, among which a user thread can migrate, differ in terms of signal masks\footnote{Sadly, official POSIX documentation is silent on what distinguishes ``async-signal-safe'' functions from other functions.}.
    2528 However, since the kernel thread handling preemption requires a different signal mask, executing user threads on the kernel-alarm thread can cause deadlocks.
    2529 For this reason, the alarm thread is in a tight loop around a system call to @sigwaitinfo@, requiring very little CPU time for preemption.
    2530 One final detail about the alarm thread is how to wake it when additional communication is required (\eg on thread termination).
    2531 This unblocking is also done using {\tt SIGALRM}, but sent through the @pthread_sigqueue@.
    2532 Indeed, @sigwait@ can differentiate signals sent from @pthread_sigqueue@ from signals sent from alarms or the kernel.
     1954Now because of how involuntary context-switches are handled, the kernel thread handling {\tt SIGALRM} cannot also be a processor thread. Hence, involuntary context-switching is done by sending signal {\tt SIGUSR1} to the corresponding proces\-sor and having the thread yield from inside the signal handler. This approach effectively context-switches away from the signal handler back to the kernel and the signal handler frame is eventually unwound when the thread is scheduled again. As a result, a signal handler can start on one kernel thread and terminate on a second kernel thread (but the same user thread). It is important to note that signal handlers save and restore signal masks because user-thread migration can cause a signal mask to migrate from one kernel thread to another. This behaviour is only a problem if all kernel threads, among which a user thread can migrate, differ in terms of signal masks\footnote{Sadly, official POSIX documentation is silent on what distinguishes ``async-signal-safe'' functions from other functions.}. However, since the kernel thread handling preemption requires a different signal mask, executing user threads on the kernel-alarm thread can cause deadlocks. For this reason, the alarm thread is in a tight loop around a system call to \code{sigwaitinfo}, requiring very little CPU time for preemption. One final detail about the alarm thread is how to wake it when additional communication is required (e.g., on thread termination). This unblocking is also done using {\tt SIGALRM}, but sent through the \code{pthread_sigqueue}. Indeed, \code{sigwait} can differentiate signals sent from \code{pthread_sigqueue} from signals sent from alarms or the kernel.
    25331955
    25341956\subsection{Scheduler}
    2535 Finally, an aspect that was not mentioned yet is the scheduling algorithm.
    2536 Currently, the \CFA scheduler uses a single ready queue for all processors, which is the simplest approach to scheduling.
    2537 Further discussion on scheduling is present in section \ref{futur:sched}.
     1957Finally, an aspect that was not mentioned yet is the scheduling algorithm. Currently, the \CFA scheduler uses a single ready queue for all processors, which is the simplest approach to scheduling. Further discussion on scheduling is present in section \ref{futur:sched}.
    25381958
    25391959% ======================================================================
     
    25441964The following figure is the traditional illustration of a monitor (repeated from page~\pageref{fig:ClassicalMonitor} for convenience):
    25451965
    2546 \begin{figure}
     1966\begin{figure}[H]
    25471967\begin{center}
    25481968{\resizebox{0.4\textwidth}{!}{\input{monitor}}}
     
    25511971\end{figure}
    25521972
    2553 This picture has several components, the two most important being the entry queue and the AS-stack.
    2554 The entry queue is an (almost) FIFO list where threads waiting to enter are parked, while the acceptor/signaller (AS) stack is a FILO list used for threads that have been signalled or otherwise marked as running next.
    2555 
    2556 For \CFA, this picture does not have support for blocking multiple monitors on a single condition.
    2557 To support \textbf{bulk-acq} two changes to this picture are required.
    2558 First, it is no longer helpful to attach the condition to \emph{a single} monitor.
    2559 Secondly, the thread waiting on the condition has to be separated across multiple monitors, seen in figure \ref{fig:monitor_cfa}.
    2560 
    2561 \begin{figure}
     1973This picture has several components, the two most important being the entry queue and the AS-stack. The entry queue is an (almost) FIFO list where threads waiting to enter are parked, while the acceptor/signaller (AS) stack is a FILO list used for threads that have been signalled or otherwise marked as running next.
     1974
     1975For \CFA, this picture does not have support for blocking multiple monitors on a single condition. To support \textbf{bulk-acq} two changes to this picture are required. First, it is no longer helpful to attach the condition to \emph{a single} monitor. Secondly, the thread waiting on the condition has to be separated across multiple monitors, seen in figure \ref{fig:monitor_cfa}.
     1976
     1977\begin{figure}[H]
    25621978\begin{center}
    25631979{\resizebox{0.8\textwidth}{!}{\input{int_monitor}}}
     
    25671983\end{figure}
    25681984
    2569 This picture and the proper entry and leave algorithms (see listing \ref{f:entry2}) is the fundamental implementation of internal scheduling.
    2570 Note that when a thread is moved from the condition to the AS-stack, it is conceptually split into N pieces, where N is the number of monitors specified in the parameter list.
    2571 The thread is woken up when all the pieces have popped from the AS-stacks and made active.
    2572 In this picture, the threads are split into halves but this is only because there are two monitors.
    2573 For a specific signalling operation every monitor needs a piece of thread on its AS-stack.
    2574 
    2575 \begin{figure}
     1985This picture and the proper entry and leave algorithms (see listing \ref{lst:entry2}) is the fundamental implementation of internal scheduling. Note that when a thread is moved from the condition to the AS-stack, it is conceptually split into N pieces, where N is the number of monitors specified in the parameter list. The thread is woken up when all the pieces have popped from the AS-stacks and made active. In this picture, the threads are split into halves but this is only because there are two monitors. For a specific signalling operation every monitor needs a piece of thread on its AS-stack.
     1986
     1987\begin{figure}[b]
    25761988\begin{multicols}{2}
    25771989Entry
    2578 \begin{cfa}
     1990\begin{pseudo}
    25791991if monitor is free
    25801992        enter
     
    25851997increment recursion
    25861998
    2587 \end{cfa}
     1999\end{pseudo}
    25882000\columnbreak
    25892001Exit
    2590 \begin{cfa}
     2002\begin{pseudo}
    25912003decrement recursion
    25922004if recursion == 0
     
    25982010        if entry queue not empty
    25992011                wake-up thread
    2600 \end{cfa}
     2012\end{pseudo}
    26012013\end{multicols}
    2602 \begin{cfa}[caption={Entry and exit routine for monitors with internal scheduling},label={f:entry2}]
    2603 \end{cfa}
     2014\begin{pseudo}[caption={Entry and exit routine for monitors with internal scheduling},label={lst:entry2}]
     2015\end{pseudo}
    26042016\end{figure}
    26052017
    2606 The solution discussed in \ref{intsched} can be seen in the exit routine of listing \ref{f:entry2}.
    2607 Basically, the solution boils down to having a separate data structure for the condition queue and the AS-stack, and unconditionally transferring ownership of the monitors but only unblocking the thread when the last monitor has transferred ownership.
    2608 This solution is deadlock safe as well as preventing any potential barging.
    2609 The data structures used for the AS-stack are reused extensively for external scheduling, but in the case of internal scheduling, the data is allocated using variable-length arrays on the call stack of the @wait@ and @signal_block@ routines.
    2610 
    2611 \begin{figure}
     2018The solution discussed in \ref{intsched} can be seen in the exit routine of listing \ref{lst:entry2}. Basically, the solution boils down to having a separate data structure for the condition queue and the AS-stack, and unconditionally transferring ownership of the monitors but only unblocking the thread when the last monitor has transferred ownership. This solution is deadlock safe as well as preventing any potential barging. The data structures used for the AS-stack are reused extensively for external scheduling, but in the case of internal scheduling, the data is allocated using variable-length arrays on the call stack of the \code{wait} and \code{signal_block} routines.
     2019
     2020\begin{figure}[H]
    26122021\begin{center}
    26132022{\resizebox{0.8\textwidth}{!}{\input{monitor_structs.pstex_t}}}
     
    26172026\end{figure}
    26182027
    2619 Figure \ref{fig:structs} shows a high-level representation of these data structures.
    2620 The main idea behind them is that, a thread cannot contain an arbitrary number of intrusive ``next'' pointers for linking onto monitors.
    2621 The @condition node@ is the data structure that is queued onto a condition variable and, when signalled, the condition queue is popped and each @condition criterion@ is moved to the AS-stack.
    2622 Once all the criteria have been popped from their respective AS-stacks, the thread is woken up, which is what is shown in listing \ref{f:entry2}.
     2028Figure \ref{fig:structs} shows a high-level representation of these data structures. The main idea behind them is that, a thread cannot contain an arbitrary number of intrusive ``next'' pointers for linking onto monitors. The \code{condition node} is the data structure that is queued onto a condition variable and, when signalled, the condition queue is popped and each \code{condition criterion} is moved to the AS-stack. Once all the criteria have been popped from their respective AS-stacks, the thread is woken up, which is what is shown in listing \ref{lst:entry2}.
    26232029
    26242030% ======================================================================
     
    26272033% ======================================================================
    26282034% ======================================================================
    2629 Similarly to internal scheduling, external scheduling for multiple monitors relies on the idea that waiting-thread queues are no longer specific to a single monitor, as mentioned in section \ref{extsched}.
    2630 For internal scheduling, these queues are part of condition variables, which are still unique for a given scheduling operation (\ie no signal statement uses multiple conditions).
    2631 However, in the case of external scheduling, there is no equivalent object which is associated with @waitfor@ statements.
    2632 This absence means the queues holding the waiting threads must be stored inside at least one of the monitors that is acquired.
    2633 These monitors being the only objects that have sufficient lifetime and are available on both sides of the @waitfor@ statement.
    2634 This requires an algorithm to choose which monitor holds the relevant queue.
    2635 It is also important that said algorithm be independent of the order in which users list parameters.
    2636 The proposed algorithm is to fall back on monitor lock ordering (sorting by address) and specify that the monitor that is acquired first is the one with the relevant waiting queue.
    2637 This assumes that the lock acquiring order is static for the lifetime of all concerned objects but that is a reasonable constraint.
     2035Similarly to internal scheduling, external scheduling for multiple monitors relies on the idea that waiting-thread queues are no longer specific to a single monitor, as mentioned in section \ref{extsched}. For internal scheduling, these queues are part of condition variables, which are still unique for a given scheduling operation (i.e., no signal statement uses multiple conditions). However, in the case of external scheduling, there is no equivalent object which is associated with \code{waitfor} statements. This absence means the queues holding the waiting threads must be stored inside at least one of the monitors that is acquired. These monitors being the only objects that have sufficient lifetime and are available on both sides of the \code{waitfor} statement. This requires an algorithm to choose which monitor holds the relevant queue. It is also important that said algorithm be independent of the order in which users list parameters. The proposed algorithm is to fall back on monitor lock ordering (sorting by address) and specify that the monitor that is acquired first is the one with the relevant waiting queue. This assumes that the lock acquiring order is static for the lifetime of all concerned objects but that is a reasonable constraint.
    26382036
    26392037This algorithm choice has two consequences:
    26402038\begin{itemize}
    2641         \item The queue of the monitor with the lowest address is no longer a true FIFO queue because threads can be moved to the front of the queue.
    2642 These queues need to contain a set of monitors for each of the waiting threads.
    2643 Therefore, another thread whose set contains the same lowest address monitor but different lower priority monitors may arrive first but enter the critical section after a thread with the correct pairing.
    2644         \item The queue of the lowest priority monitor is both required and potentially unused.
    2645 Indeed, since it is not known at compile time which monitor is the monitor which has the lowest address, every monitor needs to have the correct queues even though it is possible that some queues go unused for the entire duration of the program, for example if a monitor is only used in a specific pair.
     2039        \item The queue of the monitor with the lowest address is no longer a true FIFO queue because threads can be moved to the front of the queue. These queues need to contain a set of monitors for each of the waiting threads. Therefore, another thread whose set contains the same lowest address monitor but different lower priority monitors may arrive first but enter the critical section after a thread with the correct pairing.
     2040        \item The queue of the lowest priority monitor is both required and potentially unused. Indeed, since it is not known at compile time which monitor is the monitor which has the lowest address, every monitor needs to have the correct queues even though it is possible that some queues go unused for the entire duration of the program, for example if a monitor is only used in a specific pair.
    26462041\end{itemize}
    26472042Therefore, the following modifications need to be made to support external scheduling:
    26482043\begin{itemize}
    2649         \item The threads waiting on the entry queue need to keep track of which routine they are trying to enter, and using which set of monitors.
    2650 The @mutex@ routine already has all the required information on its stack, so the thread only needs to keep a pointer to that information.
    2651         \item The monitors need to keep a mask of acceptable routines.
    2652 This mask contains for each acceptable routine, a routine pointer and an array of monitors to go with it.
    2653 It also needs storage to keep track of which routine was accepted.
    2654 Since this information is not specific to any monitor, the monitors actually contain a pointer to an integer on the stack of the waiting thread.
    2655 Note that if a thread has acquired two monitors but executes a @waitfor@ with only one monitor as a parameter, setting the mask of acceptable routines to both monitors will not cause any problems since the extra monitor will not change ownership regardless.
    2656 This becomes relevant when @when@ clauses affect the number of monitors passed to a @waitfor@ statement.
    2657         \item The entry/exit routines need to be updated as shown in listing \ref{f:entry3}.
     2044        \item The threads waiting on the entry queue need to keep track of which routine they are trying to enter, and using which set of monitors. The \code{mutex} routine already has all the required information on its stack, so the thread only needs to keep a pointer to that information.
     2045        \item The monitors need to keep a mask of acceptable routines. This mask contains for each acceptable routine, a routine pointer and an array of monitors to go with it. It also needs storage to keep track of which routine was accepted. Since this information is not specific to any monitor, the monitors actually contain a pointer to an integer on the stack of the waiting thread. Note that if a thread has acquired two monitors but executes a \code{waitfor} with only one monitor as a parameter, setting the mask of acceptable routines to both monitors will not cause any problems since the extra monitor will not change ownership regardless. This becomes relevant when \code{when} clauses affect the number of monitors passed to a \code{waitfor} statement.
     2046        \item The entry/exit routines need to be updated as shown in listing \ref{lst:entry3}.
    26582047\end{itemize}
    26592048
    26602049\subsection{External Scheduling - Destructors}
    2661 Finally, to support the ordering inversion of destructors, the code generation needs to be modified to use a special entry routine.
    2662 This routine is needed because of the storage requirements of the call order inversion.
    2663 Indeed, when waiting for the destructors, storage is needed for the waiting context and the lifetime of said storage needs to outlive the waiting operation it is needed for.
    2664 For regular @waitfor@ statements, the call stack of the routine itself matches this requirement but it is no longer the case when waiting for the destructor since it is pushed on to the AS-stack for later.
    2665 The @waitfor@ semantics can then be adjusted correspondingly, as seen in listing \ref{f:entry-dtor}
     2050Finally, to support the ordering inversion of destructors, the code generation needs to be modified to use a special entry routine. This routine is needed because of the storage requirements of the call order inversion. Indeed, when waiting for the destructors, storage is needed for the waiting context and the lifetime of said storage needs to outlive the waiting operation it is needed for. For regular \code{waitfor} statements, the call stack of the routine itself matches this requirement but it is no longer the case when waiting for the destructor since it is pushed on to the AS-stack for later. The \code{waitfor} semantics can then be adjusted correspondingly, as seen in listing \ref{lst:entry-dtor}
    26662051
    26672052\begin{figure}
    26682053\begin{multicols}{2}
    26692054Entry
    2670 \begin{cfa}
     2055\begin{pseudo}
    26712056if monitor is free
    26722057        enter
     
    26792064        block
    26802065increment recursion
    2681 \end{cfa}
     2066\end{pseudo}
    26822067\columnbreak
    26832068Exit
    2684 \begin{cfa}
     2069\begin{pseudo}
    26852070decrement recursion
    26862071if recursion == 0
     
    26952080                wake-up thread
    26962081        endif
    2697 \end{cfa}
     2082\end{pseudo}
    26982083\end{multicols}
    2699 \begin{cfa}[caption={Entry and exit routine for monitors with internal scheduling and external scheduling},label={f:entry3}]
    2700 \end{cfa}
     2084\begin{pseudo}[caption={Entry and exit routine for monitors with internal scheduling and external scheduling},label={lst:entry3}]
     2085\end{pseudo}
    27012086\end{figure}
    27022087
     
    27042089\begin{multicols}{2}
    27052090Destructor Entry
    2706 \begin{cfa}
     2091\begin{pseudo}
    27072092if monitor is free
    27082093        enter
     
    27182103        wait
    27192104increment recursion
    2720 \end{cfa}
     2105\end{pseudo}
    27212106\columnbreak
    27222107Waitfor
    2723 \begin{cfa}
     2108\begin{pseudo}
    27242109if matching thread is already there
    27252110        if found destructor
     
    27412126block
    27422127return
    2743 \end{cfa}
     2128\end{pseudo}
    27442129\end{multicols}
    2745 \begin{cfa}[caption={Pseudo code for the \protect\lstinline|waitfor| routine and the \protect\lstinline|mutex| entry routine for destructors},label={f:entry-dtor}]
    2746 \end{cfa}
     2130\begin{pseudo}[caption={Pseudo code for the \code{waitfor} routine and the \code{mutex} entry routine for destructors},label={lst:entry-dtor}]
     2131\end{pseudo}
    27472132\end{figure}
    27482133
     
    27562141
    27572142\section{Threads As Monitors}
    2758 As it was subtly alluded in section \ref{threads}, @thread@s in \CFA are in fact monitors, which means that all monitor features are available when using threads.
    2759 For example, here is a very simple two thread pipeline that could be used for a simulator of a game engine:
    2760 \begin{figure}
    2761 \begin{cfa}[caption={Toy simulator using \protect\lstinline|thread|s and \protect\lstinline|monitor|s.},label={f:engine-v1}]
     2143As it was subtly alluded in section \ref{threads}, \code{thread}s in \CFA are in fact monitors, which means that all monitor features are available when using threads. For example, here is a very simple two thread pipeline that could be used for a simulator of a game engine:
     2144\begin{figure}[H]
     2145\begin{cfacode}[caption={Toy simulator using \code{thread}s and \code{monitor}s.},label={lst:engine-v1}]
    27622146// Visualization declaration
    27632147thread Renderer {} renderer;
     
    27862170        }
    27872171}
    2788 \end{cfa}
     2172\end{cfacode}
    27892173\end{figure}
    2790 One of the obvious complaints of the previous code snippet (other than its toy-like simplicity) is that it does not handle exit conditions and just goes on forever.
    2791 Luckily, the monitor semantics can also be used to clearly enforce a shutdown order in a concise manner:
    2792 \begin{figure}
    2793 \begin{cfa}[caption={Same toy simulator with proper termination condition.},label={f:engine-v2}]
     2174One of the obvious complaints of the previous code snippet (other than its toy-like simplicity) is that it does not handle exit conditions and just goes on forever. Luckily, the monitor semantics can also be used to clearly enforce a shutdown order in a concise manner:
     2175\begin{figure}[H]
     2176\begin{cfacode}[caption={Same toy simulator with proper termination condition.},label={lst:engine-v2}]
    27942177// Visualization declaration
    27952178thread Renderer {} renderer;
     
    28292212// Call destructor for simulator once simulator finishes
    28302213// Call destructor for renderer to signify shutdown
    2831 \end{cfa}
     2214\end{cfacode}
    28322215\end{figure}
    28332216
    28342217\section{Fibers \& Threads}
    2835 As mentioned in section \ref{preemption}, \CFA uses preemptive threads by default but can use fibers on demand.
    2836 Currently, using fibers is done by adding the following line of code to the program~:
    2837 \begin{cfa}
     2218As mentioned in section \ref{preemption}, \CFA uses preemptive threads by default but can use fibers on demand. Currently, using fibers is done by adding the following line of code to the program~:
     2219\begin{cfacode}
    28382220unsigned int default_preemption() {
    28392221        return 0;
    28402222}
    2841 \end{cfa}
    2842 This function is called by the kernel to fetch the default preemption rate, where 0 signifies an infinite time-slice, \ie no preemption.
    2843 However, once clusters are fully implemented, it will be possible to create fibers and \textbf{uthread} in the same system, as in listing \ref{f:fiber-uthread}
     2223\end{cfacode}
     2224This function is called by the kernel to fetch the default preemption rate, where 0 signifies an infinite time-slice, i.e., no preemption. However, once clusters are fully implemented, it will be possible to create fibers and \textbf{uthread} in the same system, as in listing \ref{lst:fiber-uthread}
    28442225\begin{figure}
    2845 \lstset{language=CFA,deletedelim=**[is][]{`}{`}}
    2846 \begin{cfa}[caption={Using fibers and \textbf{uthread} side-by-side in \CFA},label={f:fiber-uthread}]
    2847 // Cluster forward declaration
     2226\begin{cfacode}[caption={Using fibers and \textbf{uthread} side-by-side in \CFA},label={lst:fiber-uthread}]
     2227//Cluster forward declaration
    28482228struct cluster;
    28492229
    2850 // Processor forward declaration
     2230//Processor forward declaration
    28512231struct processor;
    28522232
    2853 // Construct clusters with a preemption rate
     2233//Construct clusters with a preemption rate
    28542234void ?{}(cluster& this, unsigned int rate);
    2855 // Construct processor and add it to cluster
     2235//Construct processor and add it to cluster
    28562236void ?{}(processor& this, cluster& cluster);
    2857 // Construct thread and schedule it on cluster
     2237//Construct thread and schedule it on cluster
    28582238void ?{}(thread& this, cluster& cluster);
    28592239
    2860 // Declare two clusters
    2861 cluster thread_cluster = { 10`ms };                     // Preempt every 10 ms
    2862 cluster fibers_cluster = { 0 };                         // Never preempt
    2863 
    2864 // Construct 4 processors
     2240//Declare two clusters
     2241cluster thread_cluster = { 10`ms };                     //Preempt every 10 ms
     2242cluster fibers_cluster = { 0 };                         //Never preempt
     2243
     2244//Construct 4 processors
    28652245processor processors[4] = {
    28662246        //2 for the thread cluster
     
    28722252};
    28732253
    2874 // Declares thread
     2254//Declares thread
    28752255thread UThread {};
    28762256void ?{}(UThread& this) {
    2877         // Construct underlying thread to automatically
    2878         // be scheduled on the thread cluster
     2257        //Construct underlying thread to automatically
     2258        //be scheduled on the thread cluster
    28792259        (this){ thread_cluster }
    28802260}
     
    28822262void main(UThread & this);
    28832263
    2884 // Declares fibers
     2264//Declares fibers
    28852265thread Fiber {};
    28862266void ?{}(Fiber& this) {
    2887         // Construct underlying thread to automatically
    2888         // be scheduled on the fiber cluster
     2267        //Construct underlying thread to automatically
     2268        //be scheduled on the fiber cluster
    28892269        (this.__thread){ fibers_cluster }
    28902270}
    28912271
    28922272void main(Fiber & this);
    2893 \end{cfa}
     2273\end{cfacode}
    28942274\end{figure}
    28952275
     
    29012281% ======================================================================
    29022282\section{Machine Setup}
    2903 Table \ref{tab:machine} shows the characteristics of the machine used to run the benchmarks.
    2904 All tests were made on this machine.
    2905 \begin{table}
     2283Table \ref{tab:machine} shows the characteristics of the machine used to run the benchmarks. All tests were made on this machine.
     2284\begin{table}[H]
    29062285\begin{center}
    29072286\begin{tabular}{| l | r | l | r |}
     
    29352314
    29362315\section{Micro Benchmarks}
    2937 All benchmarks are run using the same harness to produce the results, seen as the @BENCH()@ macro in the following examples.
    2938 This macro uses the following logic to benchmark the code:
    2939 \begin{cfa}
     2316All benchmarks are run using the same harness to produce the results, seen as the \code{BENCH()} macro in the following examples. This macro uses the following logic to benchmark the code:
     2317\begin{pseudo}
    29402318#define BENCH(run, result) \
    29412319        before = gettime(); \
     
    29432321        after  = gettime(); \
    29442322        result = (after - before) / N;
    2945 \end{cfa}
    2946 The method used to get time is @clock_gettime(CLOCK_THREAD_CPUTIME_ID);@.
    2947 Each benchmark is using many iterations of a simple call to measure the cost of the call.
    2948 The specific number of iterations depends on the specific benchmark.
     2323\end{pseudo}
     2324The method used to get time is \code{clock_gettime(CLOCK_THREAD_CPUTIME_ID);}. Each benchmark is using many iterations of a simple call to measure the cost of the call. The specific number of iterations depends on the specific benchmark.
    29492325
    29502326\subsection{Context-Switching}
    2951 The first interesting benchmark is to measure how long context-switches take.
    2952 The simplest approach to do this is to yield on a thread, which executes a 2-step context switch.
    2953 Yielding causes the thread to context-switch to the scheduler and back, more precisely: from the \textbf{uthread} to the \textbf{kthread} then from the \textbf{kthread} back to the same \textbf{uthread} (or a different one in the general case).
    2954 In order to make the comparison fair, coroutines also execute a 2-step context-switch by resuming another coroutine which does nothing but suspending in a tight loop, which is a resume/suspend cycle instead of a yield.
    2955 Figure~\ref{f:ctx-switch} shows the code for coroutines and threads with the results in table \ref{tab:ctx-switch}.
    2956 All omitted tests are functionally identical to one of these tests.
    2957 The difference between coroutines and threads can be attributed to the cost of scheduling.
     2327The first interesting benchmark is to measure how long context-switches take. The simplest approach to do this is to yield on a thread, which executes a 2-step context switch. Yielding causes the thread to context-switch to the scheduler and back, more precisely: from the \textbf{uthread} to the \textbf{kthread} then from the \textbf{kthread} back to the same \textbf{uthread} (or a different one in the general case). In order to make the comparison fair, coroutines also execute a 2-step context-switch by resuming another coroutine which does nothing but suspending in a tight loop, which is a resume/suspend cycle instead of a yield. Listing \ref{lst:ctx-switch} shows the code for coroutines and threads with the results in table \ref{tab:ctx-switch}. All omitted tests are functionally identical to one of these tests. The difference between coroutines and threads can be attributed to the cost of scheduling.
    29582328\begin{figure}
    29592329\begin{multicols}{2}
    29602330\CFA Coroutines
    2961 \begin{cfa}
     2331\begin{cfacode}
    29622332coroutine GreatSuspender {};
    29632333void main(GreatSuspender& this) {
     
    29752345        printf("%llu\n", result);
    29762346}
    2977 \end{cfa}
     2347\end{cfacode}
    29782348\columnbreak
    29792349\CFA Threads
    2980 \begin{cfa}
     2350\begin{cfacode}
    29812351
    29822352
     
    29942364        printf("%llu\n", result);
    29952365}
    2996 \end{cfa}
     2366\end{cfacode}
    29972367\end{multicols}
    2998 \begin{cfa}[caption={\CFA benchmark code used to measure context-switches for coroutines and threads.},label={f:ctx-switch}]
    2999 \end{cfa}
     2368\begin{cfacode}[caption={\CFA benchmark code used to measure context-switches for coroutines and threads.},label={lst:ctx-switch}]
     2369\end{cfacode}
    30002370\end{figure}
    30012371
     
    30162386\end{tabular}
    30172387\end{center}
    3018 \caption{Context Switch comparison.
    3019 All numbers are in nanoseconds(\si{\nano\second})}
     2388\caption{Context Switch comparison. All numbers are in nanoseconds(\si{\nano\second})}
    30202389\label{tab:ctx-switch}
    30212390\end{table}
    30222391
    30232392\subsection{Mutual-Exclusion}
    3024 The next interesting benchmark is to measure the overhead to enter/leave a critical-section.
    3025 For monitors, the simplest approach is to measure how long it takes to enter and leave a monitor routine.
    3026 Figure~\ref{f:mutex} shows the code for \CFA.
    3027 To put the results in context, the cost of entering a non-inline function and the cost of acquiring and releasing a @pthread_mutex@ lock is also measured.
    3028 The results can be shown in table \ref{tab:mutex}.
     2393The next interesting benchmark is to measure the overhead to enter/leave a critical-section. For monitors, the simplest approach is to measure how long it takes to enter and leave a monitor routine. Listing \ref{lst:mutex} shows the code for \CFA. To put the results in context, the cost of entering a non-inline function and the cost of acquiring and releasing a \code{pthread_mutex} lock is also measured. The results can be shown in table \ref{tab:mutex}.
    30292394
    30302395\begin{figure}
    3031 \begin{cfa}[caption={\CFA benchmark code used to measure mutex routines.},label={f:mutex}]
     2396\begin{cfacode}[caption={\CFA benchmark code used to measure mutex routines.},label={lst:mutex}]
    30322397monitor M {};
    30332398void __attribute__((noinline)) call( M & mutex m /*, m2, m3, m4*/ ) {}
     
    30432408        printf("%llu\n", result);
    30442409}
    3045 \end{cfa}
     2410\end{cfacode}
    30462411\end{figure}
    30472412
     
    30552420FetchAdd + FetchSub                             & 26            & 26            & 0    \\
    30562421Pthreads Mutex Lock                             & 31            & 31.86 & 0.99 \\
    3057 \uC @monitor@ member routine            & 30            & 30            & 0    \\
    3058 \CFA @mutex@ routine, 1 argument        & 41            & 41.57 & 0.9  \\
    3059 \CFA @mutex@ routine, 2 argument        & 76            & 76.96 & 1.57 \\
    3060 \CFA @mutex@ routine, 4 argument        & 145           & 146.68        & 3.85 \\
     2422\uC \code{monitor} member routine               & 30            & 30            & 0    \\
     2423\CFA \code{mutex} routine, 1 argument   & 41            & 41.57 & 0.9  \\
     2424\CFA \code{mutex} routine, 2 argument   & 76            & 76.96 & 1.57 \\
     2425\CFA \code{mutex} routine, 4 argument   & 145           & 146.68        & 3.85 \\
    30612426Java synchronized routine                       & 27            & 28.57 & 2.6  \\
    30622427\hline
    30632428\end{tabular}
    30642429\end{center}
    3065 \caption{Mutex routine comparison.
    3066 All numbers are in nanoseconds(\si{\nano\second})}
     2430\caption{Mutex routine comparison. All numbers are in nanoseconds(\si{\nano\second})}
    30672431\label{tab:mutex}
    30682432\end{table}
    30692433
    30702434\subsection{Internal Scheduling}
    3071 The internal-scheduling benchmark measures the cost of waiting on and signalling a condition variable.
    3072 Figure~\ref{f:int-sched} shows the code for \CFA, with results table \ref{tab:int-sched}.
    3073 As with all other benchmarks, all omitted tests are functionally identical to one of these tests.
     2435The internal-scheduling benchmark measures the cost of waiting on and signalling a condition variable. Listing \ref{lst:int-sched} shows the code for \CFA, with results table \ref{tab:int-sched}. As with all other benchmarks, all omitted tests are functionally identical to one of these tests.
    30742436
    30752437\begin{figure}
    3076 \begin{cfa}[caption={Benchmark code for internal scheduling},label={f:int-sched}]
     2438\begin{cfacode}[caption={Benchmark code for internal scheduling},label={lst:int-sched}]
    30772439volatile int go = 0;
    30782440condition c;
     
    31042466        return do_wait(m1);
    31052467}
    3106 \end{cfa}
     2468\end{cfacode}
    31072469\end{figure}
    31082470
     
    31142476\hline
    31152477Pthreads Condition Variable                     & 5902.5        & 6093.29       & 714.78 \\
    3116 \uC @signal@                                    & 322           & 323   & 3.36   \\
    3117 \CFA @signal@, 1 @monitor@      & 352.5 & 353.11        & 3.66   \\
    3118 \CFA @signal@, 2 @monitor@      & 430           & 430.29        & 8.97   \\
    3119 \CFA @signal@, 4 @monitor@      & 594.5 & 606.57        & 18.33  \\
    3120 Java @notify@                           & 13831.5       & 15698.21      & 4782.3 \\
     2478\uC \code{signal}                                       & 322           & 323   & 3.36   \\
     2479\CFA \code{signal}, 1 \code{monitor}    & 352.5 & 353.11        & 3.66   \\
     2480\CFA \code{signal}, 2 \code{monitor}    & 430           & 430.29        & 8.97   \\
     2481\CFA \code{signal}, 4 \code{monitor}    & 594.5 & 606.57        & 18.33  \\
     2482Java \code{notify}                              & 13831.5       & 15698.21      & 4782.3 \\
    31212483\hline
    31222484\end{tabular}
    31232485\end{center}
    3124 \caption{Internal scheduling comparison.
    3125 All numbers are in nanoseconds(\si{\nano\second})}
     2486\caption{Internal scheduling comparison. All numbers are in nanoseconds(\si{\nano\second})}
    31262487\label{tab:int-sched}
    31272488\end{table}
    31282489
    31292490\subsection{External Scheduling}
    3130 The Internal scheduling benchmark measures the cost of the @waitfor@ statement (@_Accept@ in \uC).
    3131 Figure~\ref{f:ext-sched} shows the code for \CFA, with results in table \ref{tab:ext-sched}.
    3132 As with all other benchmarks, all omitted tests are functionally identical to one of these tests.
     2491The Internal scheduling benchmark measures the cost of the \code{waitfor} statement (\code{_Accept} in \uC). Listing \ref{lst:ext-sched} shows the code for \CFA, with results in table \ref{tab:ext-sched}. As with all other benchmarks, all omitted tests are functionally identical to one of these tests.
    31332492
    31342493\begin{figure}
    3135 \begin{cfa}[caption={Benchmark code for external scheduling},label={f:ext-sched}]
     2494\begin{cfacode}[caption={Benchmark code for external scheduling},label={lst:ext-sched}]
    31362495volatile int go = 0;
    31372496monitor M {};
     
    31622521        return do_wait(m1);
    31632522}
    3164 \end{cfa}
     2523\end{cfacode}
    31652524\end{figure}
    31662525
     
    31712530\multicolumn{1}{c |}{} & \multicolumn{1}{c |}{ Median } &\multicolumn{1}{c |}{ Average } & \multicolumn{1}{c |}{ Standard Deviation} \\
    31722531\hline
    3173 \uC @Accept@                                    & 350           & 350.61        & 3.11  \\
    3174 \CFA @waitfor@, 1 @monitor@     & 358.5 & 358.36        & 3.82  \\
    3175 \CFA @waitfor@, 2 @monitor@     & 422           & 426.79        & 7.95  \\
    3176 \CFA @waitfor@, 4 @monitor@     & 579.5 & 585.46        & 11.25 \\
     2532\uC \code{Accept}                                       & 350           & 350.61        & 3.11  \\
     2533\CFA \code{waitfor}, 1 \code{monitor}   & 358.5 & 358.36        & 3.82  \\
     2534\CFA \code{waitfor}, 2 \code{monitor}   & 422           & 426.79        & 7.95  \\
     2535\CFA \code{waitfor}, 4 \code{monitor}   & 579.5 & 585.46        & 11.25 \\
    31772536\hline
    31782537\end{tabular}
    31792538\end{center}
    3180 \caption{External scheduling comparison.
    3181 All numbers are in nanoseconds(\si{\nano\second})}
     2539\caption{External scheduling comparison. All numbers are in nanoseconds(\si{\nano\second})}
    31822540\label{tab:ext-sched}
    31832541\end{table}
    31842542
    3185 
    31862543\subsection{Object Creation}
    3187 Finally, the last benchmark measures the cost of creation for concurrent objects.
    3188 Figure~\ref{f:creation} shows the code for @pthread@s and \CFA threads, with results shown in table \ref{tab:creation}.
    3189 As with all other benchmarks, all omitted tests are functionally identical to one of these tests.
    3190 The only note here is that the call stacks of \CFA coroutines are lazily created, therefore without priming the coroutine, the creation cost is very low.
     2544Finally, the last benchmark measures the cost of creation for concurrent objects. Listing \ref{lst:creation} shows the code for \texttt{pthread}s and \CFA threads, with results shown in table \ref{tab:creation}. As with all other benchmarks, all omitted tests are functionally identical to one of these tests. The only note here is that the call stacks of \CFA coroutines are lazily created, therefore without priming the coroutine, the creation cost is very low.
    31912545
    31922546\begin{figure}
    31932547\begin{center}
    3194 @pthread@
    3195 \begin{cfa}
     2548\texttt{pthread}
     2549\begin{ccode}
    31962550int main() {
    31972551        BENCH(
     
    32122566        printf("%llu\n", result);
    32132567}
    3214 \end{cfa}
     2568\end{ccode}
    32152569
    32162570
    32172571
    32182572\CFA Threads
    3219 \begin{cfa}
     2573\begin{cfacode}
    32202574int main() {
    32212575        BENCH(
     
    32272581        printf("%llu\n", result);
    32282582}
    3229 \end{cfa}
     2583\end{cfacode}
    32302584\end{center}
    3231 \caption{Benchmark code for \protect\lstinline|pthread|s and \CFA to measure object creation}
    3232 \label{f:creation}
     2585\begin{cfacode}[caption={Benchmark code for \texttt{pthread}s and \CFA to measure object creation},label={lst:creation}]
     2586\end{cfacode}
    32332587\end{figure}
    32342588
     
    32502604\end{tabular}
    32512605\end{center}
    3252 \caption{Creation comparison.
    3253 All numbers are in nanoseconds(\si{\nano\second}).}
     2606\caption{Creation comparison. All numbers are in nanoseconds(\si{\nano\second}).}
    32542607\label{tab:creation}
    32552608\end{table}
     
    32582611
    32592612\section{Conclusion}
    3260 This paper has achieved a minimal concurrency \textbf{api} that is simple, efficient and usable as the basis for higher-level features.
    3261 The approach presented is based on a lightweight thread-system for parallelism, which sits on top of clusters of processors.
    3262 This M:N model is judged to be both more efficient and allow more flexibility for users.
    3263 Furthermore, this document introduces monitors as the main concurrency tool for users.
    3264 This paper also offers a novel approach allowing multiple monitors to be accessed simultaneously without running into the Nested Monitor Problem~\cite{Lister77}.
    3265 It also offers a full implementation of the concurrency runtime written entirely in \CFA, effectively the largest \CFA code base to date.
     2613This paper has achieved a minimal concurrency \textbf{api} that is simple, efficient and usable as the basis for higher-level features. The approach presented is based on a lightweight thread-system for parallelism, which sits on top of clusters of processors. This M:N model is judged to be both more efficient and allow more flexibility for users. Furthermore, this document introduces monitors as the main concurrency tool for users. This paper also offers a novel approach allowing multiple monitors to be accessed simultaneously without running into the Nested Monitor Problem~\cite{Lister77}. It also offers a full implementation of the concurrency runtime written entirely in \CFA, effectively the largest \CFA code base to date.
    32662614
    32672615
     
    32732621
    32742622\subsection{Performance} \label{futur:perf}
    3275 This paper presents a first implementation of the \CFA concurrency runtime.
    3276 Therefore, there is still significant work to improve performance.
    3277 Many of the data structures and algorithms may change in the future to more efficient versions.
    3278 For example, the number of monitors in a single \textbf{bulk-acq} is only bound by the stack size, this is probably unnecessarily generous.
    3279 It may be possible that limiting the number helps increase performance.
    3280 However, it is not obvious that the benefit would be significant.
     2623This paper presents a first implementation of the \CFA concurrency runtime. Therefore, there is still significant work to improve performance. Many of the data structures and algorithms may change in the future to more efficient versions. For example, the number of monitors in a single \textbf{bulk-acq} is only bound by the stack size, this is probably unnecessarily generous. It may be possible that limiting the number helps increase performance. However, it is not obvious that the benefit would be significant.
    32812624
    32822625\subsection{Flexible Scheduling} \label{futur:sched}
    3283 An important part of concurrency is scheduling.
    3284 Different scheduling algorithms can affect performance (both in terms of average and variation).
    3285 However, no single scheduler is optimal for all workloads and therefore there is value in being able to change the scheduler for given programs.
    3286 One solution is to offer various tweaking options to users, allowing the scheduler to be adjusted to the requirements of the workload.
    3287 However, in order to be truly flexible, it would be interesting to allow users to add arbitrary data and arbitrary scheduling algorithms.
    3288 For example, a web server could attach Type-of-Service information to threads and have a ``ToS aware'' scheduling algorithm tailored to this specific web server.
    3289 This path of flexible schedulers will be explored for \CFA.
     2626An important part of concurrency is scheduling. Different scheduling algorithms can affect performance (both in terms of average and variation). However, no single scheduler is optimal for all workloads and therefore there is value in being able to change the scheduler for given programs. One solution is to offer various tweaking options to users, allowing the scheduler to be adjusted to the requirements of the workload. However, in order to be truly flexible, it would be interesting to allow users to add arbitrary data and arbitrary scheduling algorithms. For example, a web server could attach Type-of-Service information to threads and have a ``ToS aware'' scheduling algorithm tailored to this specific web server. This path of flexible schedulers will be explored for \CFA.
    32902627
    32912628\subsection{Non-Blocking I/O} \label{futur:nbio}
    3292 While most of the parallelism tools are aimed at data parallelism and control-flow parallelism, many modern workloads are not bound on computation but on IO operations, a common case being web servers and XaaS (anything as a service).
    3293 These types of workloads often require significant engineering around amortizing costs of blocking IO operations.
    3294 At its core, non-blocking I/O is an operating system level feature that allows queuing IO operations (\eg network operations) and registering for notifications instead of waiting for requests to complete.
    3295 In this context, the role of the language makes Non-Blocking IO easily available and with low overhead.
    3296 The current trend is to use asynchronous programming using tools like callbacks and/or futures and promises, which can be seen in frameworks like Node.js~\cite{NodeJs} for JavaScript, Spring MVC~\cite{SpringMVC} for Java and Django~\cite{Django} for Python.
    3297 However, while these are valid solutions, they lead to code that is harder to read and maintain because it is much less linear.
     2629While most of the parallelism tools are aimed at data parallelism and control-flow parallelism, many modern workloads are not bound on computation but on IO operations, a common case being web servers and XaaS (anything as a service). These types of workloads often require significant engineering around amortizing costs of blocking IO operations. At its core, non-blocking I/O is an operating system level feature that allows queuing IO operations (e.g., network operations) and registering for notifications instead of waiting for requests to complete. In this context, the role of the language makes Non-Blocking IO easily available and with low overhead. The current trend is to use asynchronous programming using tools like callbacks and/or futures and promises, which can be seen in frameworks like Node.js~\cite{NodeJs} for JavaScript, Spring MVC~\cite{SpringMVC} for Java and Django~\cite{Django} for Python. However, while these are valid solutions, they lead to code that is harder to read and maintain because it is much less linear.
    32982630
    32992631\subsection{Other Concurrency Tools} \label{futur:tools}
    3300 While monitors offer a flexible and powerful concurrent core for \CFA, other concurrency tools are also necessary for a complete multi-paradigm concurrency package.
    3301 Examples of such tools can include simple locks and condition variables, futures and promises~\cite{promises}, executors and actors.
    3302 These additional features are useful when monitors offer a level of abstraction that is inadequate for certain tasks.
     2632While monitors offer a flexible and powerful concurrent core for \CFA, other concurrency tools are also necessary for a complete multi-paradigm concurrency package. Examples of such tools can include simple locks and condition variables, futures and promises~\cite{promises}, executors and actors. These additional features are useful when monitors offer a level of abstraction that is inadequate for certain tasks.
    33032633
    33042634\subsection{Implicit Threading} \label{futur:implcit}
    3305 Simpler applications can benefit greatly from having implicit parallelism.
    3306 That is, parallelism that does not rely on the user to write concurrency.
    3307 This type of parallelism can be achieved both at the language level and at the library level.
    3308 The canonical example of implicit parallelism is parallel for loops, which are the simplest example of a divide and conquer algorithms~\cite{uC++book}.
    3309 Table \ref{f:parfor} shows three different code examples that accomplish point-wise sums of large arrays.
    3310 Note that none of these examples explicitly declare any concurrency or parallelism objects.
     2635Simpler applications can benefit greatly from having implicit parallelism. That is, parallelism that does not rely on the user to write concurrency. This type of parallelism can be achieved both at the language level and at the library level. The canonical example of implicit parallelism is parallel for loops, which are the simplest example of a divide and conquer algorithms~\cite{uC++book}. Table \ref{lst:parfor} shows three different code examples that accomplish point-wise sums of large arrays. Note that none of these examples explicitly declare any concurrency or parallelism objects.
    33112636
    33122637\begin{table}
     
    33142639\begin{tabular}[t]{|c|c|c|}
    33152640Sequential & Library Parallel & Language Parallel \\
    3316 \begin{cfa}[tabsize=3]
     2641\begin{cfacode}[tabsize=3]
    33172642void big_sum(
    33182643        int* a, int* b,
     
    33382663//... fill in a & b
    33392664big_sum(a,b,c,10000);
    3340 \end{cfa} &\begin{cfa}[tabsize=3]
     2665\end{cfacode} &\begin{cfacode}[tabsize=3]
    33412666void big_sum(
    33422667        int* a, int* b,
     
    33622687//... fill in a & b
    33632688big_sum(a,b,c,10000);
    3364 \end{cfa}&\begin{cfa}[tabsize=3]
     2689\end{cfacode}&\begin{cfacode}[tabsize=3]
    33652690void big_sum(
    33662691        int* a, int* b,
     
    33862711//... fill in a & b
    33872712big_sum(a,b,c,10000);
    3388 \end{cfa}
     2713\end{cfacode}
    33892714\end{tabular}
    33902715\end{center}
    33912716\caption{For loop to sum numbers: Sequential, using library parallelism and language parallelism.}
    3392 \label{f:parfor}
     2717\label{lst:parfor}
    33932718\end{table}
    33942719
    3395 Implicit parallelism is a restrictive solution and therefore has its limitations.
    3396 However, it is a quick and simple approach to parallelism, which may very well be sufficient for smaller applications and reduces the amount of boilerplate needed to start benefiting from parallelism in modern CPUs.
     2720Implicit parallelism is a restrictive solution and therefore has its limitations. However, it is a quick and simple approach to parallelism, which may very well be sufficient for smaller applications and reduces the amount of boilerplate needed to start benefiting from parallelism in modern CPUs.
    33972721
    33982722
     
    34072731% B I B L I O G R A P H Y
    34082732% -----------------------------
    3409 %\bibliographystyle{plain}
     2733\bibliographystyle{plain}
    34102734\bibliography{pl,local}
    34112735
  • doc/papers/concurrency/annex/local.bib

    r32cab5b rb2fe1c9  
    2121@string{pldi="Programming Language Design and Implementation"}
    2222
    23 @inproceedings{Hochstein05,
    24     keywords    = {Application software; Computer aided software engineering; Concurrent computing; Educational
    25                   institutions; High performance computing; Humans; Instruments; Productivity; Programming profession;
    26                   Software engineering},
    27     author      = {Lorin Hochstein and Jeff Carver and Forrest Shull and Sima Asgari and Victor Basili and Jeffrey K. Hollingsworth and Marvin V. Zelkowitz},
    28     title       = {Parallel Programmer Productivity: A Case Study of Novice Parallel Programmers},
    29     booktitle   = {Supercomputing, 2005. Proceedings of the ACM/IEEE SC 2005 Conference},
    30     publisher   = {IEEE},
    31     year        = {2005},
    32     pages       = {35-35},
    33     month       = nov,
     23
     24@article{HPP:Study,
     25        keywords        = {Parallel, Productivity},
     26        author  = {Lorin Hochstein and Jeff Carver and Forrest Shull and Sima Asgari and Victor Basili and Jeffrey K. Hollingsworth and Marvin V. Zelkowitz },
     27        title   = {Parallel Programmer Productivity: A Case Study of Novice Parallel Programmers},
    3428}
    3529
     
    4135}
    4236
    43 @misc{TBB,
    44     keywords    = {Intel, TBB},
    45     key         = {TBB},
    46     title       = {Thread Building Blocks},
    47     howpublished= {Intel, \url{https://www.threadingbuildingblocks.org}},
    48     note        = {Accessed: 2018-3},
     37@article{TBB,
     38        key     = {TBB},
     39        keywords        = {Intel, TBB},
     40        title   = {Intel Thread Building Blocks},
     41        note            = "\url{https://www.threadingbuildingblocks.org/}"
    4942}
    5043
     
    5548        title   = {C$\forall$ Programmming Language},
    5649        note    = {\url{https://plg.uwaterloo.ca/~cforall}},
     50}
     51
     52@mastersthesis{rob-thesis,
     53        keywords        = {Constructors, Destructors, Tuples},
     54        author  = {Rob Schluntz},
     55        title   = {Resource Management and Tuples in Cforall},
     56        year            = 2017,
     57        school  = {University of Waterloo},
     58        note    = {\url{https://uwspace.uwaterloo.ca/handle/10012/11830}},
    5759}
    5860
  • doc/papers/concurrency/style/cfa-format.tex

    r32cab5b rb2fe1c9  
    1 %\usepackage[usenames,dvipsnames]{xcolor}
     1\usepackage[usenames,dvipsnames]{xcolor}
    22\usepackage{listings}
    33\usepackage{inconsolata}
     
    1111% from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
    1212\lstdefinelanguage{sml} {
    13         morekeywords= {
    14                 EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before,
    15                 bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor,
    16                 handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op,
    17                 open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature,
    18                 string, struct, structure, substring, then, true, type, unit, val, vector, where, while,
    19                 with, withtype, word
    20     },
    21     morestring=[b]",
    22     morecomment=[s]{(*}{*)},
     13  morekeywords= {
     14    EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before, bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor, handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op, open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature, string, struct, structure, substring, then, true, type, unit, val, vector, where, while, with, withtype, word
     15  },
     16  morestring=[b]",
     17  morecomment=[s]{(*}{*)},
    2318}
    2419
    2520\lstdefinelanguage{D}{
    26         % Keywords
    27         morekeywords=[1]{
    28                 abstract, alias, align, auto, body, break, cast, catch, class, const, continue, debug,
    29                 delegate, delete, deprecated, do, else, enum, export, false, final, finally, for, foreach,
    30                 foreach_reverse, function, goto, if, immutable, import, in, inout, interface, invariant, is,
    31                 lazy, macro, mixin, module, new, nothrow, null, out, override, package, pragma, private,
    32                 protected, public, pure, ref, return, shared, static, struct, super, switch, synchronized,
    33                 template, this, throw, true, try, typedef, typeid, typeof, union, unittest, volatile, while,
    34                 with
    35         },
    36         % Special identifiers, common functions
    37         morekeywords=[2]{enforce},
    38         % Ugly identifiers
    39         morekeywords=[3]{
    40                 __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
    41                 __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
    42                 _arguments, _ctor, _dtor
    43         },
    44         % Basic types
    45         morekeywords=[4]{
    46                 byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void, bool, bit, float,
    47                 double, real, ushort, int, uint, long, ulong, float, char, wchar, dchar, string, wstring,
    48                 dstring, ireal, ifloat, idouble, creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t,
    49                 equals_t, hash_t
    50         },
    51         % Strings
    52         morestring=[b]{"},
    53         morestring=[b]{'},
    54         morestring=[b]{`},
    55         % Comments
    56         comment=[l]{//},
    57         morecomment=[s]{/*}{*/},
    58         morecomment=[s][\color{blue}]{/**}{*/},
    59         morecomment=[n]{/+}{+/},
    60         morecomment=[n][\color{blue}]{/++}{+/},
    61         % Options
    62         sensitive=true
     21  % Keywords
     22  morekeywords=[1]{
     23    abstract, alias, align, auto, body, break, cast, catch, class, const,
     24    continue, debug, delegate, delete, deprecated, do, else, enum, export,
     25    false, final, finally, for, foreach, foreach_reverse, function, goto, if,
     26    immutable, import, in, inout, interface, invariant, is, lazy, macro, mixin,
     27    module, new, nothrow, null, out, override, package, pragma, private,
     28    protected, public, pure, ref, return, shared, static, struct, super,
     29    switch, synchronized, template, this, throw, true, try, typedef, typeid,
     30    typeof, union, unittest, volatile, while, with
     31  },
     32  % Special identifiers, common functions
     33  morekeywords=[2]{enforce},
     34  % Ugly identifiers
     35  morekeywords=[3]{
     36    __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
     37    __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
     38    _arguments, _ctor, _dtor
     39  },
     40  % Basic types
     41  morekeywords=[4]{
     42     byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void,
     43     bool, bit, float, double, real, ushort, int, uint, long, ulong, float,
     44     char, wchar, dchar, string, wstring, dstring, ireal, ifloat, idouble,
     45     creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t, equals_t, hash_t
     46  },
     47  % Strings
     48  morestring=[b]{"},
     49  morestring=[b]{'},
     50  morestring=[b]{`},
     51  % Comments
     52  comment=[l]{//},
     53  morecomment=[s]{/*}{*/},
     54  morecomment=[s][\color{blue}]{/**}{*/},
     55  morecomment=[n]{/+}{+/},
     56  morecomment=[n][\color{blue}]{/++}{+/},
     57  % Options
     58  sensitive=true
    6359}
    6460
    6561\lstdefinelanguage{rust}{
    66         % Keywords
    67         morekeywords=[1]{
    68                 abstract, alignof, as, become, box, break, const, continue, crate, do, else, enum, extern,
    69                 false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
    70                 override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
    71                 trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
    72         },
    73         % Strings
    74         morestring=[b]{"},
    75         % Comments
    76         comment=[l]{//},
    77         morecomment=[s]{/*}{*/},
    78         % Options
    79         sensitive=true
     62  % Keywords
     63  morekeywords=[1]{
     64    abstract, alignof, as, become, box,
     65    break, const, continue, crate, do,
     66    else, enum, extern, false, final,
     67    fn, for, if, impl, in,
     68    let, loop, macro, match, mod,
     69    move, mut, offsetof, override, priv,
     70    proc, pub, pure, ref, return,
     71    Self, self, sizeof, static, struct,
     72    super, trait, true,  type, typeof,
     73    unsafe, unsized, use, virtual, where,
     74    while, yield
     75  },
     76  % Strings
     77  morestring=[b]{"},
     78  % Comments
     79  comment=[l]{//},
     80  morecomment=[s]{/*}{*/},
     81  % Options
     82  sensitive=true
    8083}
    8184
    8285\lstdefinelanguage{pseudo}{
    83         morekeywords={string,uint,int,bool,float},
    84         sensitive=true,
    85         morecomment=[l]{//},
    86         morecomment=[s]{/*}{*/},
    87         morestring=[b]',
    88         morestring=[b]",
    89         morestring=[s]{`}{`},
    90 }
     86        morekeywords={string,uint,int,bool,float},%
     87        sensitive=true,%
     88        morecomment=[l]{//},%
     89        morecomment=[s]{/*}{*/},%
     90        morestring=[b]',%
     91        morestring=[b]",%
     92        morestring=[s]{`}{`},%
     93}%
    9194
    9295\newcommand{\KWC}{K-W C\xspace}
    9396
    9497\lstdefinestyle{pseudoStyle}{
    95         escapeinside={@@},
    96         basicstyle=\linespread{0.9}\sf\footnotesize,            % reduce line spacing and use typewriter font
    97         keywordstyle=\bfseries\color{blue},
    98         keywordstyle=[2]\bfseries\color{Plum},
    99         commentstyle=\itshape\color{OliveGreen},                    % green and italic comments
    100         identifierstyle=\color{identifierCol},
    101         stringstyle=\sf\color{Mahogany},                                          % use sanserif font
    102         mathescape=true,
    103         columns=fixed,
    104         aboveskip=4pt,                                                            % spacing above/below code block
    105         belowskip=3pt,
    106         keepspaces=true,
    107         tabsize=4,
    108         % frame=lines,
    109         literate=,
    110         showlines=true,                                                          % show blank lines at end of code
    111         showspaces=false,
    112         showstringspaces=false,
    113         escapechar=\$,
    114         xleftmargin=\parindentlnth,                                  % indent code to paragraph indentation
    115         moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
    116         % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
    117         % moredelim=** allows cumulative application
     98  escapeinside={@@},
     99  basicstyle=\linespread{0.9}\sf\footnotesize,          % reduce line spacing and use typewriter font
     100  keywordstyle=\bfseries\color{blue},
     101  keywordstyle=[2]\bfseries\color{Plum},
     102  commentstyle=\itshape\color{OliveGreen},                  % green and italic comments
     103  identifierstyle=\color{identifierCol},
     104  stringstyle=\sf\color{Mahogany},                                % use sanserif font
     105  mathescape=true,
     106  columns=fixed,
     107  aboveskip=4pt,                                  % spacing above/below code block
     108  belowskip=3pt,
     109  keepspaces=true,
     110  tabsize=4,
     111  % frame=lines,
     112  literate=,
     113  showlines=true,                                % show blank lines at end of code
     114  showspaces=false,
     115  showstringspaces=false,
     116  escapechar=\$,
     117  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
     118  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
     119  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
     120  % moredelim=** allows cumulative application
    118121}
    119122
    120123\lstdefinestyle{defaultStyle}{
    121         escapeinside={@@},
    122         basicstyle=\linespread{0.9}\tt\footnotesize,            % reduce line spacing and use typewriter font
    123         keywordstyle=\bfseries\color{blue},
    124         keywordstyle=[2]\bfseries\color{Plum},
    125         commentstyle=\itshape\color{OliveGreen},                    % green and italic comments
    126         identifierstyle=\color{identifierCol},
    127         stringstyle=\sf\color{Mahogany},                                          % use sanserif font
    128         mathescape=true,
    129         columns=fixed,
    130         aboveskip=4pt,                                                            % spacing above/below code block
    131         belowskip=3pt,
    132         keepspaces=true,
    133         tabsize=4,
    134         % frame=lines,
    135         literate=,
    136         showlines=true,                                                          % show blank lines at end of code
    137         showspaces=false,
    138         showstringspaces=false,
    139         escapechar=\$,
    140         xleftmargin=\parindentlnth,                                  % indent code to paragraph indentation
    141         moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
    142         % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
    143         % moredelim=** allows cumulative application
     124  escapeinside={@@},
     125  basicstyle=\linespread{0.9}\tt\footnotesize,          % reduce line spacing and use typewriter font
     126  keywordstyle=\bfseries\color{blue},
     127  keywordstyle=[2]\bfseries\color{Plum},
     128  commentstyle=\itshape\color{OliveGreen},                  % green and italic comments
     129  identifierstyle=\color{identifierCol},
     130  stringstyle=\sf\color{Mahogany},                                % use sanserif font
     131  mathescape=true,
     132  columns=fixed,
     133  aboveskip=4pt,                                  % spacing above/below code block
     134  belowskip=3pt,
     135  keepspaces=true,
     136  tabsize=4,
     137  % frame=lines,
     138  literate=,
     139  showlines=true,                                % show blank lines at end of code
     140  showspaces=false,
     141  showstringspaces=false,
     142  escapechar=\$,
     143  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
     144  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
     145  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
     146  % moredelim=** allows cumulative application
    144147}
    145148
    146149\lstdefinestyle{cfaStyle}{
    147         escapeinside={@@},
    148         basicstyle=\linespread{0.9}\sf,         % reduce line spacing and use typewriter font
    149 %  keywordstyle=\bfseries\color{blue},
    150         keywordstyle=[2]\bfseries\color{red},
    151 %  commentstyle=\sf\itshape\color{OliveGreen},            % green and italic comments
    152         identifierstyle=\color{identifierCol},
    153 %  stringstyle=\sf\color{Mahogany},                                       % use sanserif font
    154         stringstyle=\tt,                                                                                % use typewriter font
    155         mathescape=true,
    156         columns=fixed,
    157         aboveskip=4pt,                                                            % spacing above/below code block
    158         belowskip=3pt,
    159         keepspaces=true,
    160         tabsize=4,
    161         % frame=lines,
    162         literate=,
    163         showlines=true,                                                          % show blank lines at end of code
    164         showspaces=false,
    165         showstringspaces=false,
    166         escapechar=\$,
    167         xleftmargin=\parindentlnth,                                  % indent code to paragraph indentation
    168         moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
    169         morekeywords=[2]{accept, signal, signal_block, wait, waitfor},
     150  escapeinside={@@},
     151  basicstyle=\linespread{0.9}\tt\footnotesize,          % reduce line spacing and use typewriter font
     152  keywordstyle=\bfseries\color{blue},
     153  keywordstyle=[2]\bfseries\color{Plum},
     154  commentstyle=\sf\itshape\color{OliveGreen},             % green and italic comments
     155  identifierstyle=\color{identifierCol},
     156  stringstyle=\sf\color{Mahogany},                                % use sanserif font
     157  mathescape=true,
     158  columns=fixed,
     159  aboveskip=4pt,                                  % spacing above/below code block
     160  belowskip=3pt,
     161  keepspaces=true,
     162  tabsize=4,
     163  % frame=lines,
     164  literate=,
     165  showlines=true,                                 % show blank lines at end of code
     166  showspaces=false,
     167  showstringspaces=false,
     168  escapechar=\$,
     169  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
     170  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
     171  morekeywords=[2]{accept, signal, signal_block, wait, waitfor},
    170172}
    171173
     
    173175
    174176\lstnewenvironment{ccode}[1][]{
    175         \lstset{
    176                 language = C,
    177                 style=defaultStyle,
    178                 captionpos=b,
    179                 #1
    180         }
     177  \lstset{
     178    language = C,
     179    style=defaultStyle,
     180    captionpos=b,
     181    #1
     182  }
    181183}{}
    182184
    183185\lstnewenvironment{cfacode}[1][]{
    184         \lstset{
    185                 language = CFA,
    186                 style=cfaStyle,
    187                 captionpos=b,
    188                 #1
    189         }
     186  \lstset{
     187    language = CFA,
     188    style=cfaStyle,
     189    captionpos=b,
     190    #1
     191  }
    190192}{}
    191193
    192194\lstnewenvironment{pseudo}[1][]{
    193         \lstset{
    194                 language = pseudo,
    195                 style=pseudoStyle,
    196                 captionpos=b,
    197                 #1
    198         }
     195  \lstset{
     196    language = pseudo,
     197    style=pseudoStyle,
     198    captionpos=b,
     199    #1
     200  }
    199201}{}
    200202
    201203\lstnewenvironment{cppcode}[1][]{
    202         \lstset{
    203                 language = c++,
    204                 style=defaultStyle,
    205                 captionpos=b,
    206                 #1
    207         }
     204  \lstset{
     205    language = c++,
     206    style=defaultStyle,
     207    captionpos=b,
     208    #1
     209  }
    208210}{}
    209211
    210212\lstnewenvironment{ucppcode}[1][]{
    211         \lstset{
    212                 language = c++,
    213                 style=defaultStyle,
    214                 captionpos=b,
    215                 #1
    216         }
     213  \lstset{
     214    language = c++,
     215    style=defaultStyle,
     216    captionpos=b,
     217    #1
     218  }
    217219}{}
    218220
    219221\lstnewenvironment{javacode}[1][]{
    220         \lstset{
    221                 language = java,
    222                 style=defaultStyle,
    223                 captionpos=b,
    224                 #1
    225         }
     222  \lstset{
     223    language = java,
     224    style=defaultStyle,
     225    captionpos=b,
     226    #1
     227  }
    226228}{}
    227229
    228230\lstnewenvironment{scalacode}[1][]{
    229         \lstset{
    230                 language = scala,
    231                 style=defaultStyle,
    232                 captionpos=b,
    233                 #1
    234         }
     231  \lstset{
     232    language = scala,
     233    style=defaultStyle,
     234    captionpos=b,
     235    #1
     236  }
    235237}{}
    236238
    237239\lstnewenvironment{smlcode}[1][]{
    238         \lstset{
    239                 language = sml,
    240                 style=defaultStyle,
    241                 captionpos=b,
    242                 #1
    243         }
     240  \lstset{
     241    language = sml,
     242    style=defaultStyle,
     243    captionpos=b,
     244    #1
     245  }
    244246}{}
    245247
    246248\lstnewenvironment{dcode}[1][]{
    247         \lstset{
    248                 language = D,
    249                 style=defaultStyle,
    250                 captionpos=b,
    251                 #1
    252         }
     249  \lstset{
     250    language = D,
     251    style=defaultStyle,
     252    captionpos=b,
     253    #1
     254  }
    253255}{}
    254256
    255257\lstnewenvironment{rustcode}[1][]{
    256         \lstset{
    257                 language = rust,
    258                 style=defaultStyle,
    259                 captionpos=b,
    260                 #1
    261         }
     258  \lstset{
     259    language = rust,
     260    style=defaultStyle,
     261    captionpos=b,
     262    #1
     263  }
    262264}{}
    263265
    264266\lstnewenvironment{gocode}[1][]{
    265         \lstset{
    266                 language = Golang,
    267                 style=defaultStyle,
    268                 captionpos=b,
    269                 #1
    270         }
     267  \lstset{
     268    language = Golang,
     269    style=defaultStyle,
     270    captionpos=b,
     271    #1
     272  }
    271273}{}
    272274
     
    276278\newcommand{\code}[1]{\lstinline[language=CFA,style=cfaStyle]{#1}}
    277279\newcommand{\pscode}[1]{\lstinline[language=pseudo,style=pseudoStyle]{#1}}
    278 
    279 % Local Variables: %
    280 % tab-width: 4 %
    281 % fill-column: 100 %
    282 % End: %
  • doc/papers/general/.gitignore

    r32cab5b rb2fe1c9  
    33*.pdf
    44*.ps
    5 
    6 Paper.tex.plain
    7 mail
    8 Paper.out.ps
    9 WileyNJD-AMA.bst
  • doc/papers/general/Makefile

    r32cab5b rb2fe1c9  
    33Build = build
    44Figures = figures
    5 Macros = AMA/AMA-stix/ama
     5Macros = ../../LaTeXmacros
    66TeXLIB = .:${Macros}:${Build}:../../bibliography:
    77LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
    88BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
    99
    10 MAKEFLAGS = --no-print-directory # --silent
     10MAKEFLAGS = --no-print-directory --silent #
    1111VPATH = ${Build} ${Figures} evaluation
    1212
     
    3434
    3535DOCUMENT = Paper.pdf
    36 BASE = ${basename ${DOCUMENT}}
    3736
    3837# Directives #
     
    4342
    4443clean :
    45         @rm -frv ${DOCUMENT} ${BASE}.ps WileyNJD-AMA.bst ${BASE}.out.ps ${Build}
     44        @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build}
    4645
    4746# File Dependencies #
    4847
    49 ${DOCUMENT} : ${BASE}.ps
     48${DOCUMENT} : ${basename ${DOCUMENT}}.ps
    5049        ps2pdf $<
    5150
    52 ${BASE}.ps : ${BASE}.dvi
     51${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi
    5352        dvips ${Build}/$< -o $@
    5453
    55 ${BASE}.dvi : Makefile ${Build} ${BASE}.out.ps WileyNJD-AMA.bst ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
    56                 ../../bibliography/pl.bib
     54${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     55                ${Macros}/common.tex ${Macros}/indexstyle ../../bibliography/pl.bib
    5756        # Must have *.aux file containing citations for bibtex
    5857        if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi
    59         ${BibTeX} ${Build}/${basename $@}
     58        -${BibTeX} ${Build}/${basename $@}
    6059        # Some citations reference others so run again to resolve these citations
    6160        ${LaTeX} ${basename $@}.tex
    62         ${BibTeX} ${Build}/${basename $@}
     61        -${BibTeX} ${Build}/${basename $@}
    6362        # Run again to finish citations
    6463        ${LaTeX} ${basename $@}.tex
     
    6867${Build}:
    6968        mkdir -p ${Build}
    70 
    71 ${BASE}.out.ps:
    72         ln -fs build/Paper.out.ps .
    73 
    74 WileyNJD-AMA.bst:
    75         ln -fs AMA/AMA-stix/ama/WileyNJD-AMA.bst .
    7669
    7770${GRAPHS} : timing.gp timing.dat
  • doc/papers/general/Paper.tex

    r32cab5b rb2fe1c9  
    1 \documentclass[AMA,STIX1COL]{WileyNJD-v2}
    2 
    3 \articletype{RESEARCH ARTICLE}%
    4 
    5 \received{26 April 2016}
    6 \revised{6 June 2016}
    7 \accepted{6 June 2016}
    8 
    9 \raggedbottom
    10 
    11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    12 
    13 % Latex packages used in the document.
    14 
     1\documentclass{article}
     2
     3\usepackage{fullpage}
    154\usepackage{epic,eepic}
    16 \usepackage{xspace}
    17 \usepackage{comment}
     5\usepackage{xspace,calc,comment}
    186\usepackage{upquote}                                            % switch curled `'" to straight
    197\usepackage{listings}                                           % format program code
    20 %\usepackage{enumitem}
    21 %\setlist[itemize]{topsep=3pt,itemsep=2pt,parsep=0pt}% global
    22 %\usepackage{rotating}
    23 
    24 \hypersetup{breaklinks=true}
    25 \definecolor{ForestGreen}{cmyk}{1, 0, 0.99995, 0}
    26 
    27 \usepackage[pagewise]{lineno}
    28 \renewcommand{\linenumberfont}{\scriptsize\sffamily}
     8\usepackage{enumitem}
     9\setlist[itemize]{topsep=3pt,itemsep=2pt,parsep=0pt}% global
     10\usepackage[flushmargin]{footmisc}                      % support label/reference in footnote
     11\usepackage{rotating}
     12\usepackage[usenames]{color}
     13\usepackage{pslatex}                                            % reduce size of san serif font
     14\usepackage[plainpages=false,pdfpagelabels,pdfpagemode=UseNone,pagebackref=true,breaklinks=true,colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
     15\urlstyle{sf}
     16\usepackage{breakurl}
     17
     18\setlength{\textheight}{9in}
     19%\oddsidemargin 0.0in
     20\renewcommand{\topfraction}{0.8}                        % float must be greater than X of the page before it is forced onto its own page
     21\renewcommand{\bottomfraction}{0.8}                     % float must be greater than X of the page before it is forced onto its own page
     22\renewcommand{\floatpagefraction}{0.8}          % float must be greater than X of the page before it is forced onto its own page
     23\renewcommand{\textfraction}{0.0}                       % the entire page maybe devoted to floats with no text on the page at all
    2924
    3025\lefthyphenmin=4                                                        % hyphen only after 4 characters
    3126\righthyphenmin=4
    32 
    33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    3427
    3528% Names used in the document.
     
    7164\newlength{\gcolumnposn}                                        % temporary hack because lstlisting does not handle tabs correctly
    7265\newlength{\columnposn}
    73 \setlength{\gcolumnposn}{3.5in}
     66\setlength{\gcolumnposn}{2.75in}
    7467\setlength{\columnposn}{\gcolumnposn}
    7568\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}}}}
     
    10497}%
    10598\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
    106 \renewcommand*{\etal}{%
     99\newcommand*{\etal}{%
    107100        \@ifnextchar{.}{\protect\ETAL}%
    108101                {\protect\ETAL.\xspace}%
     
    152145belowskip=3pt,
    153146% replace/adjust listing characters that look bad in sanserif
    154 literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
    155         {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    156         {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.5ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex{\textgreater}}2,
     147literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     148        {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {@}{\small{@}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
     149        {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
    157150moredelim=**[is][\color{red}]{`}{`},
    158151}% lstset
     152
     153% inline code @...@
     154\lstMakeShortInline@%
    159155
    160156\lstnewenvironment{cfa}[1][]
     
    165161{}
    166162
    167 % inline code @...@
    168 \lstMakeShortInline@%
    169 
    170 
    171 \title{\texorpdfstring{\protect\CFA : Adding Modern Programming Language Features to C}{Cforall : Adding Modern Programming Language Features to C}}
    172 
    173 \author[1]{Aaron Moss}
    174 \author[1]{Robert Schluntz}
    175 \author[1]{Peter A. Buhr*}
    176 \authormark{Aaron Moss \textsc{et al}}
    177 
    178 \address[1]{\orgdiv{David R. Cheriton School of Computer Science}, \orgname{University of Waterloo}, \orgaddress{\state{Ontario}, \country{Canada}}}
    179 
    180 \corres{*Peter A. Buhr, \email{pabuhr{\char`\@}uwaterloo.ca}}
    181 \presentaddress{David R. Cheriton School of Computer Science, University of Waterloo, Waterloo, ON, N2L 3G1, Canada}
    182 
    183 
    184 \abstract[Summary]{
     163
     164\title{\protect\CFA : Adding Modern Programming Language Features to C}
     165
     166\author{Aaron Moss, Robert Schluntz, Peter Buhr}
     167% \email{a3moss@uwaterloo.ca}
     168% \email{rschlunt@uwaterloo.ca}
     169% \email{pabuhr@uwaterloo.ca}
     170% \affiliation{%
     171%       \institution{University of Waterloo}
     172%       \department{David R. Cheriton School of Computer Science}
     173%       \streetaddress{Davis Centre, University of Waterloo}
     174%       \city{Waterloo}
     175%       \state{ON}
     176%       \postcode{N2L 3G1}
     177%       \country{Canada}
     178% }
     179
     180%\terms{generic, tuple, variadic, types}
     181%\keywords{generic types, tuple types, variadic types, polymorphic functions, C, Cforall}
     182
     183\begin{document}
     184\maketitle
     185
     186
     187\begin{abstract}
    185188The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from commercial operating-systems to hobby projects.
    186189This installation base and the programmers producing it represent a massive software-engineering investment spanning decades and likely to continue for decades more.
     
    192195This paper presents a quick tour of \CFA features showing how their design avoids shortcomings of similar features in C and other C-like languages.
    193196Finally, experimental results are presented to validate several of the new features.
    194 }%
    195 
    196 \keywords{generic types, tuple types, variadic types, polymorphic functions, C, Cforall}
    197 
    198 
    199 \begin{document}
    200 \linenumbers                                            % comment out to turn off line numbering
    201 
    202 \maketitle
     197\end{abstract}
    203198
    204199
     
    222217Love it or hate it, C is extremely popular, highly used, and one of the few systems languages.
    223218In many cases, \CC is often used solely as a better C.
    224 Nevertheless, C, first standardized over thirty years ago, lacks many features that make programming in more modern languages safer and more productive.
     219Nonetheless, C, first standardized over thirty years ago, lacks many features that make programming in more modern languages safer and more productive.
    225220
    226221\CFA (pronounced ``C-for-all'', and written \CFA or Cforall) is an evolutionary extension of the C programming language that aims to add modern language features to C while maintaining both source compatibility with C and a familiar programming model for programmers.
     
    235230\CFA is currently implemented as a source-to-source translator from \CFA to the gcc-dialect of C~\cite{GCCExtensions}, allowing it to leverage the portability and code optimizations provided by gcc, meeting goals (1)--(3).
    236231Ultimately, a compiler is necessary for advanced features and optimal performance.
    237 All features discussed in this paper are working, unless otherwise stated as under construction.
     232All of the features discussed in this paper are working, unless a feature states it is a future feature for completion.
    238233
    239234Finally, it is impossible to describe a programming language without usages before definitions.
     
    263258
    264259\begin{cfa}
    265 int max = 2147483647;                                   $\C[4in]{// (1)}$
     260int max = 2147483647;                                           $\C[3.75in]{// (1)}$
    266261double max = 1.7976931348623157E+308;   $\C{// (2)}$
    267262int max( int a, int b ) { return a < b ? b : a; }  $\C{// (3)}$
    268263double max( double a, double b ) { return a < b ? b : a; }  $\C{// (4)}\CRT$
    269 max( 7, -max );                                         $\C[2.75in]{// uses (3) and (1), by matching int from constant 7}$
    270 max( max, 3.14 );                                       $\C{// uses (4) and (2), by matching double from constant 3.14}$
    271 max( max, -max );                                       $\C{// ERROR: ambiguous}$
    272 int m = max( max, -max );                       $\C{// uses (3) and (1) twice, by matching return type}\CRT$
     264max( 7, -max );                                                         $\C{// uses (3) and (1), by matching int from constant 7}$
     265max( max, 3.14 );                                                       $\C{// uses (4) and (2), by matching double from constant 3.14}$
     266max( max, -max );                                                       $\C{// ERROR: ambiguous}$
     267int m = max( max, -max );                                       $\C{// uses (3) and (1) twice, by matching return type}$
    273268\end{cfa}
    274269
     
    297292\begin{cfa}
    298293`forall( otype T )` T identity( T val ) { return val; }
    299 int forty_two = identity( 42 );         $\C{// T is bound to int, forty\_two == 42}$
     294int forty_two = identity( 42 );                         $\C{// T is bound to int, forty\_two == 42}$
    300295\end{cfa}
    301296This @identity@ function can be applied to any complete \newterm{object type} (or @otype@).
     
    311306For example, the function @twice@ can be defined using the \CFA syntax for operator overloading:
    312307\begin{cfa}
    313 forall( otype T `| { T ?+?(T, T); }` ) T twice( T x ) { return x `+` x; }  $\C{// ? denotes operands}$
     308forall( otype T `| { T ?+?(T, T); }` ) T twice( T x ) { return x `+` x; }       $\C{// ? denotes operands}$
    314309int val = twice( twice( 3.7 ) );
    315310\end{cfa}
     
    330325}
    331326double key = 5.0, vals[10] = { /* 10 sorted float values */ };
    332 double * val = (double *)bsearch( &key, vals, 10, sizeof(vals[0]), comp ); $\C{// search sorted array}$
     327double * val = (double *)bsearch( &key, vals, 10, sizeof(vals[0]), comp );      $\C{// search sorted array}$
    333328\end{cfa}
    334329which can be augmented simply with a generalized, type-safe, \CFA-overloaded wrappers:
     
    340335forall( otype T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) {
    341336        T * result = bsearch( key, arr, size ); $\C{// call first version}$
    342         return result ? result - arr : size; $\C{// pointer subtraction includes sizeof(T)}$
    343 }
    344 double * val = bsearch( 5.0, vals, 10 ); $\C{// selection based on return type}$
     337        return result ? result - arr : size;    $\C{// pointer subtraction includes sizeof(T)}$
     338}
     339double * val = bsearch( 5.0, vals, 10 );        $\C{// selection based on return type}$
    345340int posn = bsearch( 5.0, vals, 10 );
    346341\end{cfa}
     
    366361forall( otype T | { int ?<?( T, T ); } ) void qsort( const T * arr, size_t size ) { /* use C qsort */ }
    367362{
    368         int ?<?( double x, double y ) { return x `>` y; } $\C{// locally override behaviour}$
     363        int ?<?( double x, double y ) { return x `>` y; }       $\C{// locally override behaviour}$
    369364        qsort( vals, size );                                    $\C{// descending sort}$
    370365}
     
    372367Within the block, the nested version of @?<?@ performs @?>?@ and this local version overrides the built-in @?<?@ so it is passed to @qsort@.
    373368Hence, programmers can easily form local environments, adding and modifying appropriate functions, to maximize reuse of other existing functions and types.
    374 
    375 Under construction is a mechanism to distribute @forall@ over routines/types, where each block declaration is prefixed with the initial @forall@ clause significantly reducing duplication (see @stack@ examples in Section~\ref{sec:eval}):
    376 \begin{cfa}
    377 forall( otype `T` ) {                                                   $\C{// forall block}$
    378         struct stack { stack_node(`T`) * head; };       $\C{// generic type}$
    379         void push( stack(`T`) & s, `T` value ) ...      $\C{// generic operations}$
    380         T pop( stack(`T`) & s ) ...
    381 }
    382 \end{cfa}
    383369
    384370
     
    392378        T ?+=?( T *, T );
    393379        T ++?( T * );
    394         T ?++( T * );
    395 };
     380        T ?++( T * ); };
     381
    396382forall( otype T `| summable( T )` ) T sum( T a[$\,$], size_t size ) {  // use trait
    397383        `T` total = { `0` };                                    $\C{// instantiate T from 0 by calling its constructor}$
    398384        for ( unsigned int i = 0; i < size; i += 1 ) total `+=` a[i]; $\C{// select appropriate +}$
    399         return total;
    400 }
     385        return total; }
    401386\end{cfa}
    402387
     
    407392        void ?{}( T &, T );                                             $\C{// copy constructor}$
    408393        void ?=?( T &, T );                                             $\C{// assignment operator}$
    409         void ^?{}( T & );                                               $\C{// destructor}$
    410 };
     394        void ^?{}( T & ); };                                    $\C{// destructor}$
    411395\end{cfa}
    412396Given the information provided for an @otype@, variables of polymorphic type can be treated as if they were a complete type: stack-allocatable, default or copy-initialized, assigned, and deleted.
     
    452436One approach is to write bespoke data-structures for each context in which they are needed.
    453437While this approach is flexible and supports integration with the C type-checker and tooling, it is also tedious and error-prone, especially for more complex data structures.
    454 A second approach is to use @void *@-based polymorphism, \eg the C standard-library functions @bsearch@ and @qsort@, which allow reuse of code with common functionality.
     438A second approach is to use @void *@ based polymorphism, \eg the C standard-library functions @bsearch@ and @qsort@, which allow reuse of code with common functionality.
    455439However, basing all polymorphism on @void *@ eliminates the type-checker's ability to ensure that argument types are properly matched, often requiring a number of extra function parameters, pointer indirection, and dynamic allocation that is not otherwise needed.
    456440A third approach to generic code is to use preprocessor macros, which does allow the generated code to be both generic and type-checked, but errors may be difficult to interpret.
     
    542526Results of these layout functions are cached so that they are only computed once per type per function. %, as in the example below for @pair@.
    543527Layout functions also allow generic types to be used in a function definition without reflecting them in the function signature.
    544 For instance, a function that strips duplicate values from an unsorted @vector(T)@ likely has a pointer to the vector as its only explicit parameter, but uses some sort of @set(T)@ internally to test for duplicate values.
     528For instance, a function that strips duplicate values from an unsorted @vector(T)@ would likely have a pointer to the vector as its only explicit parameter, but use some sort of @set(T)@ internally to test for duplicate values.
    545529This function could acquire the layout for @set(T)@ by calling its layout function with the layout of @T@ implicitly passed into the function.
    546530
     
    569553struct litres {};
    570554
    571 forall( dtype U ) scalar(U) ?+?( scalar(U) a, scalar(U) b ) {
     555forall( dtype U) scalar(U) ?+?( scalar(U) a, scalar(U) b ) {
    572556        return (scalar(U)){ a.value + b.value };
    573557}
     
    608592[ q, r ] = div( 13.5, 5.2 );                            $\C{// assign into tuple}$
    609593\end{cfa}
    610 This approach is straightforward to understand and use;
     594Clearly, this approach is straightforward to understand and use;
    611595therefore, why do few programming languages support this obvious feature or provide it awkwardly?
    612 To answer, there are complex consequences that cascade through multiple aspects of the language, especially the type-system.
     596The answer is that there are complex consequences that cascade through multiple aspects of the language, especially the type-system.
    613597This section show these consequences and how \CFA handles them.
    614598
     
    660644p`->0` = 5;                                                                     $\C{// change quotient}$
    661645bar( qr`.1`, qr );                                                      $\C{// pass remainder and quotient/remainder}$
    662 rem = [div( 13, 5 ), 42]`.0.1`;                         $\C{// access 2nd component of 1st component}$
     646rem = [div( 13, 5 ), 42]`.0.1`;                         $\C{// access 2nd component of 1st component of tuple expression}$
    663647\end{cfa}
    664648
     
    669653Tuple flattening recursively expands a tuple into the list of its basic components.
    670654Tuple structuring packages a list of expressions into a value of tuple type, \eg:
     655%\lstDeleteShortInline@%
     656%\par\smallskip
     657%\begin{tabular}{@{}l@{\hspace{1.5\parindent}}||@{\hspace{1.5\parindent}}l@{}}
    671658\begin{cfa}
    672659int f( int, int );
    673 [int] g( [int, int] );
    674 [int] h( int, [int, int] );
     660int g( [int, int] );
     661int h( int, [int, int] );
    675662[int, int] x;
    676663int y;
    677 f( x );                                                                         $\C{// flatten}$
    678 g( y, 10 );                                                                     $\C{// structure}$
    679 h( x, y );                                                                      $\C{// flatten and structure}$
    680 \end{cfa}
     664f( x );                 $\C{// flatten}$
     665g( y, 10 );             $\C{// structure}$
     666h( x, y );              $\C{// flatten and structure}$
     667\end{cfa}
     668%\end{cfa}
     669%&
     670%\begin{cfa}
     671%\end{tabular}
     672%\smallskip\par\noindent
     673%\lstMakeShortInline@%
    681674In the call to @f@, @x@ is implicitly flattened so the components of @x@ are passed as the two arguments.
    682675In the call to @g@, the values @y@ and @10@ are structured into a single argument of type @[int, int]@ to match the parameter type of @g@.
     
    689682An assignment where the left side is a tuple type is called \newterm{tuple assignment}.
    690683There are two kinds of tuple assignment depending on whether the right side of the assignment operator has a tuple type or a non-tuple type, called \newterm{multiple} and \newterm{mass assignment}, respectively.
     684%\lstDeleteShortInline@%
     685%\par\smallskip
     686%\begin{tabular}{@{}l@{\hspace{1.5\parindent}}||@{\hspace{1.5\parindent}}l@{}}
    691687\begin{cfa}
    692688int x = 10;
     
    698694[y, x] = 3.14;                                                          $\C{// mass assignment}$
    699695\end{cfa}
     696%\end{cfa}
     697%&
     698%\begin{cfa}
     699%\end{tabular}
     700%\smallskip\par\noindent
     701%\lstMakeShortInline@%
    700702Both kinds of tuple assignment have parallel semantics, so that each value on the left and right side is evaluated before any assignments occur.
    701703As a result, it is possible to swap the values in two variables without explicitly creating any temporary variables or calling a function, \eg, @[x, y] = [y, x]@.
     
    706708This example shows mass, multiple, and cascading assignment used in one expression:
    707709\begin{cfa}
    708 [void] f( [int, int] );
     710void f( [int, int] );
    709711f( [x, y] = z = 1.5 );                                          $\C{// assignments in parameter list}$
    710712\end{cfa}
     
    721723Here, the mass assignment sets all members of @s@ to zero.
    722724Since tuple-index expressions are a form of member-access expression, it is possible to use tuple-index expressions in conjunction with member tuple expressions to manually restructure a tuple (\eg rearrange, drop, and duplicate components).
     725%\lstDeleteShortInline@%
     726%\par\smallskip
     727%\begin{tabular}{@{}l@{\hspace{1.5\parindent}}||@{\hspace{1.5\parindent}}l@{}}
    723728\begin{cfa}
    724729[int, int, long, double] x;
     
    728733[int, int, int] y = x.[2, 0, 2];                        $\C{// duplicate: [y.0, y.1, y.2] = [x.2, x.0.x.2]}$
    729734\end{cfa}
     735%\end{cfa}
     736%&
     737%\begin{cfa}
     738%\end{tabular}
     739%\smallskip\par\noindent
     740%\lstMakeShortInline@%
    730741It is also possible for a member access to contain other member accesses, \eg:
    731742\begin{cfa}
     
    785796Since @void@ is effectively a 0-element tuple, (3) discards the first and third return values, which is effectively equivalent to @[(int)(g().1.0), (int)(g().1.1)]@).
    786797
    787 Note that a cast is not a function call in \CFA, so flattening and structuring conversions do not occur for cast expressions\footnote{User-defined conversions have been considered, but for compatibility with C and the existing use of casts as type ascription, any future design for such conversions requires more precise matching of types than allowed for function arguments and parameters.}.
     798Note that a cast is not a function call in \CFA, so flattening and structuring conversions do not occur for cast expressions\footnote{User-defined conversions have been considered, but for compatibility with C and the existing use of casts as type ascription, any future design for such conversions would require more precise matching of types than allowed for function arguments and parameters.}.
    788799As such, (4) is invalid because the cast target type contains 4 components, while the source type contains only 3.
    789800Similarly, (5) is invalid because the cast @([int, int, int])(g().1)@ is invalid.
     
    802813where @[5, "hello"]@ is flattened, giving argument list @5, "hello"@, and @T@ binds to @int@ and @U@ binds to @const char@.
    803814Tuples, however, may contain polymorphic components.
    804 For example, a plus operator can be written to sum two triples.
     815For example, a plus operator can be written to add two triples together.
    805816\begin{cfa}
    806817forall( otype T | { T ?+?( T, T ); } ) [T, T, T] ?+?( [T, T, T] x, [T, T, T] y ) {
     
    814825Flattening and restructuring conversions are also applied to tuple types in polymorphic type assertions.
    815826\begin{cfa}
    816 [int] f( [int, double], double );
     827int f( [int, double], double );
    817828forall( otype T, otype U | { T f( T, U, U ); } ) void g( T, U );
    818829g( 5, 10.21 );
     
    825836% \end{cfa}
    826837% so the thunk provides flattening and structuring conversions to inferred functions, improving the compatibility of tuples and polymorphism.
    827 % These thunks are generated locally using gcc nested-functions, rather hoisting them to the external scope, so they can easily access local state.
     838% These thunks are generated locally using gcc nested-functions, rather hositing them to the external scope, so they can easily access local state.
    828839
    829840
     
    836847As such, @ttype@ variables are also called \newterm{argument packs}.
    837848
    838 Like variadic templates, @ttype@ polymorphic functions are primarily manipulated via recursion.
     849Like variadic templates, the main way to manipulate @ttype@ polymorphic functions is via recursion.
    839850Since nothing is known about a parameter pack by default, assertion parameters are key to doing anything meaningful.
    840851Unlike variadic templates, @ttype@ polymorphic functions can be separately compiled.
    841 For example, a generalized @sum@ function:
     852For example, a generalized @sum@ function written using @ttype@:
    842853\begin{cfa}
    843854int sum$\(_0\)$() { return 0; }
     
    10171028\begin{cquote}
    10181029\lstDeleteShortInline@%
    1019 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    1020 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     1030\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     1031\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    10211032\begin{cfa}
    10221033case 2, 10, 34, 42:
     
    10291040\lstMakeShortInline@%
    10301041\end{cquote}
    1031 for a contiguous list:\footnote{gcc has the same mechanism but awkward syntax, \lstinline@2 ...42@, as a space is required after a number, otherwise the first period is a decimal point.}
     1042for a contiguous list:\footnote{gcc has the same mechanism but awkward syntax, \lstinline@2 ...42@, because a space is required after a number, otherwise the period is a decimal point.}
    10321043\begin{cquote}
    10331044\lstDeleteShortInline@%
    1034 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    1035 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     1045\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     1046\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    10361047\begin{cfa}
    10371048case 2~42:
     
    10491060\end{cfa}
    10501061
    1051 C allows placement of @case@ clauses \emph{within} statements nested in the @switch@ body (called Duff's device~\cite{Duff83});
     1062C allows placement of @case@ clauses \emph{within} statements nested in the @switch@ body (see Duff's device~\cite{Duff83});
    10521063\begin{cfa}
    10531064switch ( i ) {
     
    10601071}
    10611072\end{cfa}
    1062 \CFA precludes this form of transfer \emph{into} a control structure because it causes undefined behaviour, especially with respect to missed initialization, and provides very limited functionality.
     1073\CFA precludes this form of transfer into a control structure because it causes undefined behaviour, especially with respect to missed initialization, and provides very limited functionality.
    10631074
    10641075C allows placement of declaration within the @switch@ body and unreachable code at the start, resulting in undefined behaviour:
     
    11251136\end{figure}
    11261137
    1127 Finally, Figure~\ref{f:FallthroughStatement} shows @fallthrough@ may appear in contexts other than terminating a @case@ clause, and have an explicit transfer label allowing separate cases but common final-code for a set of cases.
    1128 The target label must be below the @fallthrough@ and may not be nested in a control structure, \ie @fallthrough@ cannot form a loop, and the target label must be at the same or higher level as the containing @case@ clause and located at the same level as a @case@ clause;
    1129 the target label may be case @default@, but only associated with the current @switch@/@choose@ statement.
    1130 
    1131 \begin{figure}
    1132 \centering
     1138Finally, @fallthrough@ may appear in contexts other than terminating a @case@ clause, and have an explicit transfer label allowing separate cases but common final-code for a set of cases:
     1139\begin{cquote}
    11331140\lstDeleteShortInline@%
    11341141\begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
     
    11521159  case 4:
    11531160        ... `fallthrough common;`
    1154   `common`: // below fallthrough at same level as case clauses
     1161  common:
    11551162        ...      // common code for cases 3 and 4
    11561163        // implicit break
     
    11591166\end{tabular}
    11601167\lstMakeShortInline@%
    1161 \caption{\lstinline|fallthrough| Statement}
    1162 \label{f:FallthroughStatement}
    1163 \end{figure}
     1168\end{cquote}
     1169The target label may be case @default@.
     1170
     1171Collectively, these control-structure enhancements reduce programmer burden and increase readability and safety.
    11641172
    11651173
     
    12911299        R r;
    12921300        ... `resume( r );` ...
    1293         ... r.fix // control returns here after handler
     1301        ... r.fix // control does return here after handler
    12941302}
    12951303`try` {
     
    14041412
    14051413
    1406 \subsection{\texorpdfstring{\protect\lstinline{with} Statement}{with Statement}}
    1407 \label{s:WithStatement}
     1414\subsection{\texorpdfstring{\protect\lstinline{with} Clause / Statement}{with Clause / Statement}}
     1415\label{s:WithClauseStatement}
    14081416
    14091417Grouping heterogeneous data into \newterm{aggregate}s (structure/union) is a common programming practice, and an aggregate can be further organized into more complex structures, such as arrays and containers:
     
    14251433A similar situation occurs in object-oriented programming, \eg \CC:
    14261434\begin{C++}
    1427 struct S {
     1435class C {
    14281436        char c;                                                                 $\C{// fields}$
    14291437        int i;
    14301438        double d;
    1431         void f() {                                                              $\C{// implicit ``this'' aggregate}$
     1439        int f() {                                                               $\C{// implicit ``this'' aggregate}$
    14321440                `this->`c; `this->`i; `this->`d;        $\C{// access containing fields}$
    14331441        }
    14341442}
    14351443\end{C++}
    1436 Object-oriented nesting of member functions in a \lstinline[language=C++]@class/struct@ allows eliding \lstinline[language=C++]@this->@ because of lexical scoping.
     1444Object-oriented nesting of member functions in a \lstinline[language=C++]@class@ allows eliding \lstinline[language=C++]@this->@ because of lexical scoping.
    14371445However, for other aggregate parameters, qualification is necessary:
    14381446\begin{cfa}
    14391447struct T { double m, n; };
    1440 int S::f( T & t ) {                                                     $\C{// multiple aggregate parameters}$
    1441         c; i; d;                                                                $\C{\color{red}// this--{\textgreater}.c, this--{\textgreater}.i, this--{\textgreater}.d}$
     1448int C::f( T & t ) {                                                     $\C{// multiple aggregate parameters}$
     1449        c; i; d;                                                                $\C{\color{red}// this-\textgreater.c, this-\textgreater.i, this-\textgreater.d}$
    14421450        `t.`m; `t.`n;                                                   $\C{// must qualify}$
    14431451}
     
    14531461with the generality of opening multiple aggregate-parameters:
    14541462\begin{cfa}
    1455 void f( S & s, T & t ) `with ( s, t )` {                $\C{// multiple aggregate parameters}$
     1463int f( S & s, T & t ) `with ( s, t )` {         $\C{// multiple aggregate parameters}$
    14561464        c; i; d;                                                                $\C{\color{red}// s.c, s.i, s.d}$
    14571465        m; n;                                                                   $\C{\color{red}// t.m, t.n}$
     
    15191527\begin{cfa}
    15201528struct S { int i, j; } sv;
    1521 with ( sv ) {                                                           $\C{// implicit reference}$
     1529with ( sv ) {                                                           $\C{implicit reference}$
    15221530        S & sr = sv;
    1523         with ( sr ) {                                                   $\C{// explicit reference}$
     1531        with ( sr ) {                                                   $\C{explicit reference}$
    15241532                S * sp = &sv;
    1525                 with ( *sp ) {                                          $\C{// computed reference}$
    1526                         i = 3; j = 4;                                   $\C{\color{red}// sp--{\textgreater}i, sp--{\textgreater}j}$
     1533                with ( *sp ) {                                          $\C{computed reference}$
     1534                        i = 3; j = 4;                                   $\C{\color{red}// sp-{\textgreater}i, sp-{\textgreater}j}$
    15271535                }
    15281536                i = 2; j = 3;                                           $\C{\color{red}// sr.i, sr.j}$
     
    15311539}
    15321540\end{cfa}
    1533 
    1534 Collectively, these control-structure enhancements reduce programmer burden and increase readability and safety.
    15351541
    15361542
     
    15761582\begin{cquote}
    15771583\lstDeleteShortInline@%
    1578 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{}}
    1579 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     1584\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{\hspace{\parindentlnth}}l@{}}
     1585\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    15801586\begin{cfa}
    15811587`[5] *` int x1;
     
    15921598\begin{cfa}
    15931599// array of 5 pointers to int
    1594 // pointer to array of 5 int
    1595 // function returning pointer to array of 5 int and taking int
     1600// pointer to an array of 5 int
     1601// function returning pointer to an array of 5 int and taking an int
    15961602\end{cfa}
    15971603\end{tabular}
     
    16041610\begin{cquote}
    16051611\lstDeleteShortInline@%
    1606 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    1607 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     1612\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     1613\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    16081614\begin{cfa}
    16091615`*` int x, y;
     
    16241630\begin{cquote}
    16251631\lstDeleteShortInline@%
    1626 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{}}
    1627 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{C}}     \\
     1632\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{\hspace{\parindentlnth}}l@{}}
     1633\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{C}}      \\
    16281634\begin{cfa}
    16291635[ 5 ] int z;
     
    16661672\begin{cquote}
    16671673\lstDeleteShortInline@%
    1668 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{}}
    1669 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{C}}     \\
     1674\begin{tabular}{@{}l@{\hspace{1em}}l@{\hspace{1em}}l@{}}
     1675\multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} \\
    16701676\begin{cfa}
    16711677extern const * const int x;
    1672 static const * [5] const int y;
     1678static const * [ 5 ] const int y;
    16731679\end{cfa}
    16741680&
    16751681\begin{cfa}
    16761682int extern const * const x;
    1677 static const int (* const y)[5]
     1683static const int (* const y)[ 5 ]
    16781684\end{cfa}
    16791685&
     
    16911697\begin{cquote}
    16921698\lstDeleteShortInline@%
    1693 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    1694 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     1699\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     1700\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    16951701\begin{cfa}
    16961702y = (* int)x;
     
    17091715as well, parameter names are optional, \eg:
    17101716\begin{cfa}
    1711 [ int x ] f ( /* void */ );             $\C[2.5in]{// returning int with no parameters}$
    1712 [ int x ] f (...);                              $\C{// returning int with unknown parameters}$
    1713 [ * int ] g ( int y );                  $\C{// returning pointer to int with int parameter}$
    1714 [ void ] h ( int, char );               $\C{// returning no result with int and char parameters}$
    1715 [ * int, int ] j ( int );               $\C{// returning pointer to int and int with int parameter}$
     1717[ int x ] f ( /* void */ );                                     $\C{// returning int with no parameters}$
     1718[ int x ] f (...);                                                      $\C{// returning int with unknown parameters}$
     1719[ * int ] g ( int y );                                          $\C{// returning pointer to int with int parameter}$
     1720[ void ] h ( int, char );                                       $\C{// returning no result with int and char parameters}$
     1721[ * int, int ] j ( int );                                       $\C{// returning pointer to int and int, with int parameter}$
    17161722\end{cfa}
    17171723This syntax allows a prototype declaration to be created by cutting and pasting source text from the function-definition header (or vice versa).
     
    17191725\begin{cquote}
    17201726\lstDeleteShortInline@%
    1721 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    1722 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     1727\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     1728\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    17231729\begin{cfa}
    17241730[double] foo(), foo( int ), foo( double ) {...}
     
    17351741The syntax for pointers to \CFA functions specifies the pointer name on the right, \eg:
    17361742\begin{cfa}
    1737 * [ int x ] () fp;                              $\C{// pointer to function returning int with no parameters}$
    1738 * [ * int ] ( int y ) gp;               $\C{// pointer to function returning pointer to int with int parameter}$
    1739 * [ ] ( int, char ) hp;                 $\C{// pointer to function returning no result with int and char parameters}$
    1740 * [ * int, int ] ( int ) jp;    $\C{// pointer to function returning pointer to int and int with int parameter}$
     1743* [ int x ] () fp;                                                      $\C{// pointer to function returning int with no parameters}$
     1744* [ * int ] ( int y ) gp;                                       $\C{// pointer to function returning pointer to int with int parameter}$
     1745* [ ] ( int, char ) hp;                                         $\C{// pointer to function returning no result with int and char parameters}$
     1746* [ * int, int ] ( int ) jp;                            $\C{// pointer to function returning pointer to int and int, with int parameter}$
    17411747\end{cfa}
    17421748Note, a function name cannot be specified:
    17431749\begin{cfa}
    1744 * [ int x ] f () fp;                    $\C{// function name "f" is disallowed}\CRT$
     1750* [ int x ] f () fp;                                            $\C{// function name "f" is disallowed}$
    17451751\end{cfa}
    17461752
     
    18571863\begin{cfa}
    18581864struct S { double x, y; };
    1859 int x, y;
     1865int i, j;
    18601866void f( int & i, int & j, S & s, int v[] );
    1861 f( 3, x + y, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); $\C{// pass rvalue to lvalue \(\Rightarrow\) implicit temporary}$
     1867f( 3, i + j, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } );   $\C{// pass rvalue to lvalue \(\Rightarrow\) implicit temporary}$
    18621868\end{cfa}
    18631869This allows complex values to be succinctly and efficiently passed to functions, without the syntactic overhead of explicit definition of a temporary variable or the runtime cost of pass-by-value.
     
    19461952
    19471953One of the strengths (and weaknesses) of C is memory-management control, allowing resource release to be precisely specified versus unknown release with garbage-collected memory-management.
    1948 However, this manual approach is verbose, and it is useful to manage resources other than memory (\eg file handles) using the same mechanism as memory.
     1954However, this manual approach is often verbose, and it is useful to manage resources other than memory (\eg file handles) using the same mechanism as memory.
    19491955\CC addresses these issues using Resource Aquisition Is Initialization (RAII), implemented by means of \newterm{constructor} and \newterm{destructor} functions;
    19501956\CFA adopts constructors and destructors (and @finally@) to facilitate RAII.
     
    19982004{
    19992005        VLA  x,            y = { 20, 0x01 },     z = y; $\C{// z points to y}$
    2000         //    ?{}( x );   ?{}( y, 20, 0x01 );    ?{}( z, y );
     2006        //      ?{}( x );  ?{}( y, 20, 0x01 );  ?{}( z, y );
    20012007        ^x{};                                                                   $\C{// deallocate x}$
    20022008        x{};                                                                    $\C{// reallocate x}$
     
    20462052\begin{cquote}
    20472053\lstDeleteShortInline@%
    2048 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{}}
     2054\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{\hspace{\parindentlnth}}l@{}}
    20492055\begin{cfa}
    2050205620_`hh`     // signed char
     
    20992105
    21002106For readability, it is useful to associate units to scale literals, \eg weight (stone, pound, kilogram) or time (seconds, minutes, hours).
    2101 The left of Figure~\ref{f:UserLiteral} shows the \CFA alternative call-syntax (postfix: literal argument before function name), using the backquote, to convert basic literals into user literals.
     2107The left of Figure~\ref{f:UserLiteral} shows the \CFA alternative call-syntax (literal argument before function name), using the backquote, to convert basic literals into user literals.
    21022108The backquote is a small character, making the unit (function name) predominate.
    21032109For examples, the multi-precision integer-type in Section~\ref{s:MultiPrecisionIntegers} has user literals:
     
    21072113y = "12345678901234567890123456789"|`mp| + "12345678901234567890123456789"|`mp|;
    21082114\end{cfa}
    2109 Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions, where @?`@ denotes a postfix-function name and @`@ denotes a postfix-function call.
     2115Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions.
    21102116}%
    2111 \begin{cquote}
    2112 \lstset{language=CFA,moredelim=**[is][\color{red}]{|}{|},deletedelim=**[is][]{`}{`}}
    2113 \lstDeleteShortInline@%
    2114 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{\hspace{2\parindentlnth}}l@{}}
    2115 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{postfix function}}        & \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{constant}}      & \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{variable/expression}}   & \multicolumn{1}{c}{\textbf{postfix pointer}}  \\
    2116 \begin{cfa}
    2117 int ?`h( int s );
    2118 int ?`h( double s );
    2119 int ?`m( char c );
    2120 int ?`m( const char * s );
    2121 int ?`t( int a, int b, int c );
    2122 \end{cfa}
    2123 &
    2124 \begin{cfa}
    2125 0 `h;
    2126 3.5`h;
    2127 '1'`m;
    2128 "123" "456"`m;
    2129 [1,2,3]`t;
    2130 \end{cfa}
    2131 &
    2132 \begin{cfa}
    2133 int i = 7;
    2134 i`h;
    2135 (i + 3)`h;
    2136 (i + 3.5)`h;
    2137 
    2138 \end{cfa}
    2139 &
    2140 \begin{cfa}
    2141 int (* ?`p)( int i );
    2142 ?`p = ?`h;
    2143 3`p;
    2144 i`p;
    2145 (i + 3)`p;
    2146 \end{cfa}
    2147 \end{tabular}
    2148 \lstMakeShortInline@%
    2149 \end{cquote}
    21502117
    21512118The right of Figure~\ref{f:UserLiteral} shows the equivalent \CC version using the underscore for the call-syntax.
     
    21692136        return (W){ l.stones + r.stones };
    21702137}
    2171 W |?`st|(double w) { return (W){ w }; }
    2172 W |?`lb|(double w) { return (W){ w/14.0 }; }
    2173 W |?`kg|(double w) { return (W){ w*0.16 }; }
     2138W |?`st|( double w ) { return (W){ w }; }
     2139W |?`lb|( double w ) { return (W){ w / 14.0 }; }
     2140W |?`kg|( double w ) { return (W) { w * 0.16 }; }
    21742141
    21752142
     
    21872154\begin{cfa}
    21882155struct W {
    2189         double stones;
    2190         W() { stones = 0.0; }
    2191         W( double w ) { stones = w; }
     2156    double stones;
     2157    W() { stones = 0.0; }
     2158    W( double w ) { stones = w; }
    21922159};
    21932160W operator+( W l, W r ) {
    21942161        return W( l.stones + r.stones );
    21952162}
    2196 W |operator""_st|(unsigned long long int w) {return W(w); }
    2197 W |operator""_lb|(unsigned long long int w) {return W(w/14.0); }
    2198 W |operator""_kg|(unsigned long long int w) {return W(w*0.16); }
    2199 W |operator""_st|(long double w ) { return W( w ); }
    2200 W |operator""_lb|(long double w ) { return W( w / 14.0 ); }
    2201 W |operator""_kg|(long double w ) { return W( w * 0.16 ); }
     2163W |operator"" _st|( unsigned long long int w ) { return W( w ); }
     2164W |operator"" _lb|( unsigned long long int w ) { return W( w / 14.0 ); }
     2165W |operator"" _kg|( unsigned long long int w ) { return W( w * 0.16 ); }
     2166W |operator"" _st|( long double w ) { return W( w ); }
     2167W |operator"" _lb|( long double w ) { return W( w / 14.0 ); }
     2168W |operator"" _kg|( long double w ) { return W( w * 0.16 ); }
    22022169int main() {
    22032170        W w, heavy = { 20 };
     
    22322199\begin{cquote}
    22332200\lstDeleteShortInline@%
    2234 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2235 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{Definition}}      & \multicolumn{1}{c}{\textbf{Usage}}    \\
     2201\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2202\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{Definition}}       & \multicolumn{1}{c}{\textbf{Usage}}    \\
    22362203\begin{cfa}
    22372204const short int `MIN` = -32768;
     
    22512218\begin{cquote}
    22522219\lstDeleteShortInline@%
    2253 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2254 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     2220\lstset{basicstyle=\linespread{0.9}\sf\small}
     2221\begin{tabular}{@{}l@{\hspace{0.5\parindentlnth}}l@{}}
     2222\multicolumn{1}{c@{\hspace{0.5\parindentlnth}}}{\textbf{\CFA}}  & \multicolumn{1}{c}{\textbf{C}}        \\
    22552223\begin{cfa}
    22562224MIN
    2257 
    22582225MAX
    2259 
    22602226PI
    22612227E
     
    22632229&
    22642230\begin{cfa}
    2265 SCHAR_MIN, CHAR_MIN, SHRT_MIN, INT_MIN, LONG_MIN, LLONG_MIN,
    2266                 FLT_MIN, DBL_MIN, LDBL_MIN
    2267 SCHAR_MAX, UCHAR_MAX, SHRT_MAX, INT_MAX, LONG_MAX, LLONG_MAX,
    2268                 FLT_MAX, DBL_MAX, LDBL_MAX
     2231SCHAR_MIN, CHAR_MIN, SHRT_MIN, INT_MIN, LONG_MIN, LLONG_MIN, FLT_MIN, DBL_MIN, LDBL_MIN
     2232SCHAR_MAX, UCHAR_MAX, SHRT_MAX, INT_MAX, LONG_MAX, LLONG_MAX, FLT_MAX, DBL_MAX, LDBL_MAX
    22692233M_PI, M_PIl
    22702234M_E, M_El
     
    22812245\begin{cquote}
    22822246\lstDeleteShortInline@%
    2283 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2284 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{Definition}}      & \multicolumn{1}{c}{\textbf{Usage}}    \\
     2247\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2248\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{Definition}}       & \multicolumn{1}{c}{\textbf{Usage}}    \\
    22852249\begin{cfa}
    22862250float `log`( float x );
     
    23002264\begin{cquote}
    23012265\lstDeleteShortInline@%
    2302 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2303 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     2266\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2267\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    23042268\begin{cfa}
    23052269log
     
    23282292\begin{cquote}
    23292293\lstDeleteShortInline@%
    2330 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2331 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{Definition}}      & \multicolumn{1}{c}{\textbf{Usage}}    \\
     2294\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2295\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{Definition}}       & \multicolumn{1}{c}{\textbf{Usage}}    \\
    23322296\begin{cfa}
    23332297unsigned int `abs`( int );
     
    23472311\begin{cquote}
    23482312\lstDeleteShortInline@%
    2349 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2350 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     2313\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2314\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    23512315\begin{cfa}
    23522316abs
     
    23672331The following shows one example where \CFA \emph{extends} an existing standard C interface to reduce complexity and provide safety.
    23682332C/\Celeven provide a number of complex and overlapping storage-management operation to support the following capabilities:
    2369 \begin{description}%[topsep=3pt,itemsep=2pt,parsep=0pt]
     2333\begin{description}[topsep=3pt,itemsep=2pt,parsep=0pt]
    23702334\item[fill]
    23712335an allocation with a specified character.
     
    24172381\end{cfa}
    24182382\lstDeleteShortInline@%
    2419 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2420 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{C}}        \\
     2383\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2384\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{C}}        \\
    24212385\begin{cfa}
    24222386ip = alloc();
     
    24392403ip = (int *)malloc( sizeof( int ) ); memset( ip, fill, dim * sizeof( int ) );
    24402404ip = (int *)realloc( ip, 2 * dim * sizeof( int ) );
    2441 ip = (int *)realloc( ip, 4 * dim * sizeof( int ) );
    2442                         memset( ip, fill, 4 * dim * sizeof( int ) );
     2405ip = (int *)realloc( ip, 4 * dim * sizeof( int ) ); memset( ip, fill, 4 * dim * sizeof( int ) );
     2406
    24432407ip = memalign( 16, sizeof( int ) );
    24442408ip = memalign( 16, sizeof( int ) ); memset( ip, fill, sizeof( int ) );
     
    24772441\begin{cquote}
    24782442\lstDeleteShortInline@%
    2479 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    2480 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{c}{\textbf{\CC}}      \\
     2443\begin{tabular}{@{}l@{\hspace{\parindentlnth}}l@{}}
     2444\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{c}{\textbf{\CC}}      \\
    24812445\begin{cfa}
    24822446int x = 1, y = 2, z = 3;
     
    25612525The \CFA interface wraps GMP functions into operator functions to make programming with multi-precision integers identical to using fixed-sized integers.
    25622526The \CFA type name for multi-precision signed-integers is @Int@ and the header file is @gmp@.
    2563 Figure~\ref{f:GMPInterface} shows a multi-precision factorial-program contrasting the GMP interface in \CFA and C.
    2564 
    2565 \begin{figure}
    2566 \centering
     2527The following multi-precision factorial programs contrast using GMP with the \CFA and C interfaces.
     2528\begin{cquote}
    25672529\lstDeleteShortInline@%
    2568 \begin{tabular}{@{}l@{\hspace{2\parindentlnth}}@{\hspace{2\parindentlnth}}l@{}}
    2569 \multicolumn{1}{c@{\hspace{2\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{@{\hspace{2\parindentlnth}}c}{\textbf{C}}     \\
     2530\begin{tabular}{@{}l@{\hspace{\parindentlnth}}@{\hspace{\parindentlnth}}l@{}}
     2531\multicolumn{1}{c@{\hspace{\parindentlnth}}}{\textbf{\CFA}}     & \multicolumn{1}{@{\hspace{\parindentlnth}}c}{\textbf{C}}      \\
    25702532\begin{cfa}
    25712533#include <gmp>
     
    25952557\end{tabular}
    25962558\lstMakeShortInline@%
    2597 \caption{GMP Interface \CFA versus C}
    2598 \label{f:GMPInterface}
    2599 \end{figure}
     2559\end{cquote}
    26002560
    26012561
     
    26062566In fact, \CFA's features for generic programming can enable faster runtime execution than idiomatic @void *@-based C code.
    26072567This claim is demonstrated through a set of generic-code-based micro-benchmarks in C, \CFA, and \CC (see stack implementations in Appendix~\ref{sec:BenchmarkStackImplementation}).
    2608 Since all these languages share a subset essentially comprising standard C, maximal-performance benchmarks should show little runtime variance, differing only in length and clarity of source code.
    2609 A more illustrative comparison measures the costs of idiomatic usage of each language's features.
    2610 Figure~\ref{fig:BenchmarkTest} shows the \CFA benchmark tests for a generic stack based on a singly linked-list.
    2611 The benchmark test is similar for the other languages.
    2612 The experiment uses element types @int@ and @pair(short, char)@, and pushes $N=40M$ elements on a generic stack, copies the stack, clears one of the stacks, and finds the maximum value in the other stack.
     2568Since all these languages share a subset essentially comprising standard C, maximal-performance benchmarks would show little runtime variance, other than in length and clarity of source code.
     2569A more illustrative benchmark measures the costs of idiomatic usage of each language's features.
     2570Figure~\ref{fig:BenchmarkTest} shows the \CFA benchmark tests for a generic stack based on a singly linked-list, a generic pair-data-structure, and a variadic @print@ function similar to that in Section~\ref{sec:variadic-tuples}.
     2571The benchmark test is similar for C and \CC.
     2572The experiment uses element types @int@ and @pair(_Bool, char)@, and pushes $N=40M$ elements on a generic stack, copies the stack, clears one of the stacks, finds the maximum value in the other stack, and prints $N/2$ (to reduce graph height) constants.
    26132573
    26142574\begin{figure}
    26152575\begin{cfa}[xleftmargin=3\parindentlnth,aboveskip=0pt,belowskip=0pt]
    2616 int main() {
     2576int main( int argc, char * argv[] ) {
    26172577        int max = 0, val = 42;
    26182578        stack( int ) si, ti;
    26192579
    26202580        REPEAT_TIMED( "push_int", N, push( si, val ); )
    2621         TIMED( "copy_int", ti{ si }; )
     2581        TIMED( "copy_int", ti = si; )
    26222582        TIMED( "clear_int", clear( si ); )
    26232583        REPEAT_TIMED( "pop_int", N, int x = pop( ti ); if ( x > max ) max = x; )
    26242584
    2625         pair( short, char ) max = { 0h, '\0' }, val = { 42h, 'a' };
    2626         stack( pair( short, char ) ) sp, tp;
     2585        pair( _Bool, char ) max = { (_Bool)0, '\0' }, val = { (_Bool)1, 'a' };
     2586        stack( pair( _Bool, char ) ) sp, tp;
    26272587
    26282588        REPEAT_TIMED( "push_pair", N, push( sp, val ); )
    2629         TIMED( "copy_pair", tp{ sp }; )
     2589        TIMED( "copy_pair", tp = sp; )
    26302590        TIMED( "clear_pair", clear( sp ); )
    2631         REPEAT_TIMED( "pop_pair", N, pair(short, char) x = pop( tp ); if ( x > max ) max = x; )
     2591        REPEAT_TIMED( "pop_pair", N, pair(_Bool, char) x = pop( tp ); if ( x > max ) max = x; )
    26322592}
    26332593\end{cfa}
     
    26402600hence runtime checks are necessary to safely down-cast objects.
    26412601The most notable difference among the implementations is in memory layout of generic types: \CFA and \CC inline the stack and pair elements into corresponding list and pair nodes, while C and \CCV lack such a capability and instead must store generic objects via pointers to separately-allocated objects.
    2642 Note that the C benchmark uses unchecked casts as there is no runtime mechanism to perform such checks, while \CFA and \CC provide type-safety statically.
     2602For the print benchmark, idiomatic printing is used: the C and \CFA variants used @stdio.h@, while the \CC and \CCV variants used @iostream@; preliminary tests show this distinction has negligible runtime impact.
     2603Note, the C benchmark uses unchecked casts as there is no runtime mechanism to perform such checks, while \CFA and \CC provide type-safety statically.
    26432604
    26442605Figure~\ref{fig:eval} and Table~\ref{tab:eval} show the results of running the benchmark in Figure~\ref{fig:BenchmarkTest} and its C, \CC, and \CCV equivalents.
    26452606The graph plots the median of 5 consecutive runs of each program, with an initial warm-up run omitted.
    2646 All code is compiled at \texttt{-O2} by gcc or g++ 6.3.0, with all \CC code compiled as \CCfourteen.
     2607All code is compiled at \texttt{-O2} by gcc or g++ 6.2.0, with all \CC code compiled as \CCfourteen.
    26472608The benchmarks are run on an Ubuntu 16.04 workstation with 16 GB of RAM and a 6-core AMD FX-6300 CPU with 3.5 GHz maximum clock frequency.
    26482609
     
    26612622\begin{tabular}{rrrrr}
    26622623                                                                        & \CT{C}        & \CT{\CFA}     & \CT{\CC}      & \CT{\CCV}             \\ \hline
    2663 maximum memory usage (MB)                       & 10,001        & 2,502         & 2,503         & 11,253                \\
    2664 source code size (lines)                        & 196           & 186           & 125           & 290                   \\
    2665 redundant type annotations (lines)      & 27            & 0                     & 2                     & 16                    \\
    2666 binary size (KB)                                        & 14            & 257           & 14            & 37                    \\
     2624maximum memory usage (MB)                       & 10001         & 2502          & 2503          & 11253                 \\
     2625source code size (lines)                        & 247           & 222           & 165           & 339                   \\
     2626redundant type annotations (lines)      & 39            & 2                     & 2                     & 15                    \\
     2627binary size (KB)                                        & 14            & 229           & 18            & 38                    \\
    26672628\end{tabular}
    26682629\end{table}
    26692630
    26702631The C and \CCV variants are generally the slowest with the largest memory footprint, because of their less-efficient memory layout and the pointer-indirection necessary to implement generic types;
    2671 this inefficiency is exacerbated by the second level of generic types in the pair benchmarks.
    2672 By contrast, the \CFA and \CC variants run in roughly equivalent time for both the integer and pair of @short@ and @char@ because the storage layout is equivalent, with the inlined libraries (\ie no separate compilation) and greater maturity of the \CC compiler contributing to its lead.
     2632this inefficiency is exacerbated by the second level of generic types in the pair-based benchmarks.
     2633By contrast, the \CFA and \CC variants run in roughly equivalent time for both the integer and pair of @_Bool@ and @char@ because the storage layout is equivalent, with the inlined libraries (\ie no separate compilation) and greater maturity of the \CC compiler contributing to its lead.
    26732634\CCV is slower than C largely due to the cost of runtime type-checking of down-casts (implemented with @dynamic_cast@);
    2674 The outlier in the graph for \CFA, pop @pair@, results from the complexity of the generated-C polymorphic code.
    2675 The gcc compiler is unable to optimize some dead code and condense nested calls; a compiler designed for \CFA could easily perform these optimizations.
     2635There are two outliers in the graph for \CFA: all prints and pop of @pair@.
     2636Both of these cases result from the complexity of the C-generated polymorphic code, so that the gcc compiler is unable to optimize some dead code and condense nested calls.
     2637A compiler designed for \CFA could easily perform these optimizations.
    26762638Finally, the binary size for \CFA is larger because of static linking with the \CFA libraries.
    26772639
    2678 \CFA is also competitive in terms of source code size, measured as a proxy for programmer effort. The line counts in Table~\ref{tab:eval} include implementations of @pair@ and @stack@ types for all four languages for purposes of direct comparison, though it should be noted that \CFA and \CC have pre-written data structures in their standard libraries that programmers would generally use instead. Use of these standard library types has minimal impact on the performance benchmarks, but shrinks the \CFA and \CC benchmarks to 39 and 42 lines, respectively.
    2679 The difference between the \CFA and \CC line counts is primarily declaration duplication to implement separate compilation; a header-only \CFA library would be similar in length to the \CC version.
     2640\CFA is also competitive in terms of source code size, measured as a proxy for programmer effort. The line counts in Table~\ref{tab:eval} include implementations of @pair@ and @stack@ types for all four languages for purposes of direct comparison, though it should be noted that \CFA and \CC have pre-written data structures in their standard libraries that programmers would generally use instead. Use of these standard library types has minimal impact on the performance benchmarks, but shrinks the \CFA and \CC benchmarks to 73 and 54 lines, respectively.
    26802641On the other hand, C does not have a generic collections-library in its standard distribution, resulting in frequent reimplementation of such collection types by C programmers.
    2681 \CCV does not use the \CC standard template library by construction, and in fact includes the definition of @object@ and wrapper classes for @char@, @short@, and @int@ in its line count, which inflates this count somewhat, as an actual object-oriented language would include these in the standard library;
     2642\CCV does not use the \CC standard template library by construction, and in fact includes the definition of @object@ and wrapper classes for @bool@, @char@, @int@, and @const char *@ in its line count, which inflates this count somewhat, as an actual object-oriented language would include these in the standard library;
    26822643with their omission, the \CCV line count is similar to C.
    26832644We justify the given line count by noting that many object-oriented languages do not allow implementing new interfaces on library types without subclassing or wrapper types, which may be similarly verbose.
    26842645
    2685 Line-count is a fairly rough measure of code complexity;
    2686 another important factor is how much type information the programmer must specify manually, especially where that information is not compiler-checked.
    2687 Such unchecked type information produces a heavier documentation burden and increased potential for runtime bugs, and is much less common in \CFA than C, with its manually specified function pointer arguments and format codes, or \CCV, with its extensive use of untype-checked downcasts, \eg @object@ to @integer@ when popping a stack.
    2688 To quantify this manual typing, the ``redundant type annotations'' line in Table~\ref{tab:eval} counts the number of lines on which the type of a known variable is respecified, either as a format specifier, explicit downcast, type-specific function, or by name in a @sizeof@, struct literal, or @new@ expression.
     2646Raw line-count, however, is a fairly rough measure of code complexity;
     2647another important factor is how much type information the programmer must manually specify, especially where that information is not checked by the compiler.
     2648Such unchecked type information produces a heavier documentation burden and increased potential for runtime bugs, and is much less common in \CFA than C, with its manually specified function pointers arguments and format codes, or \CCV, with its extensive use of un-type-checked downcasts (\eg @object@ to @integer@ when popping a stack, or @object@ to @printable@ when printing the elements of a @pair@).
     2649To quantify this, the ``redundant type annotations'' line in Table~\ref{tab:eval} counts the number of lines on which the type of a known variable is re-specified, either as a format specifier, explicit downcast, type-specific function, or by name in a @sizeof@, struct literal, or @new@ expression.
    26892650The \CC benchmark uses two redundant type annotations to create a new stack nodes, while the C and \CCV benchmarks have several such annotations spread throughout their code.
    2690 The \CFA benchmark is able to eliminate all redundant type annotations through use of the polymorphic @alloc@ function discussed in Section~\ref{sec:libraries}.
     2651The two instances in which the \CFA benchmark still uses redundant type specifiers are to cast the result of a polymorphic @malloc@ call (the @sizeof@ argument is inferred by the compiler).
     2652These uses are similar to the @new@ expressions in \CC, though the \CFA compiler's type resolver should shortly render even these type casts superfluous.
    26912653
    26922654
     
    26962658\subsection{Polymorphism}
    26972659
    2698 \CC provides three disjoint polymorphic extensions to C: overloading, inheritance, and templates.
     2660\CC is the most similar language to \CFA;
     2661both are extensions to C with source and runtime backwards compatibility.
     2662The fundamental difference is the engineering approach to maintain C compatibility and programmer expectation.
     2663While \CC provides good compatibility with C, it has a steep learning curve for many of its extensions.
     2664For example, polymorphism is provided via three disjoint mechanisms: overloading, inheritance, and templates.
    26992665The overloading is restricted because resolution does not use the return type, inheritance requires learning object-oriented programming and coping with a restricted nominal-inheritance hierarchy, templates cannot be separately compiled resulting in compilation/code bloat and poor error messages, and determining how these mechanisms interact and which to use is confusing.
    27002666In contrast, \CFA has a single facility for polymorphic code supporting type-safe separate-compilation of polymorphic functions and generic (opaque) types, which uniformly leverage the C procedural paradigm.
     
    27512717
    27522718
    2753 \subsection{C Extensions}
    2754 
    2755 \CC is the best known C-based language, and is similar to \CFA in that both are extensions to C with source and runtime backwards compatibility.
    2756 Specific difference between \CFA and \CC have been identified in prior sections, with a final observation that \CFA has equal or fewer tokens to express the same notion in many cases.
    2757 The key difference in design philosophies is that \CFA is easier for C programmers to understand by maintaining a procedural paradigm and avoiding complex interactions among extensions.
    2758 \CC, on the other hand, has multiple overlapping features (such as the three forms of polymorphism), many of which have complex interactions with its object-oriented design.
    2759 As a result, \CC has a steep learning curve for even experienced C programmers, especially when attempting to maintain performance equivalent to C legacy-code.
    2760 
    2761 There are several other C extension-languages with less usage and even more dramatic changes than \CC.
    2762 Objective-C and Cyclone are two other extensions to C with different design goals than \CFA, as discussed above.
    2763 Other languages extend C with more focused features.
    2764 $\mu$\CC~\cite{uC++book}, CUDA~\cite{Nickolls08}, ispc~\cite{Pharr12}, and Sierra~\cite{Leissa14} add concurrent or data-parallel primitives to C or \CC;
    2765 data-parallel features have not yet been added to \CFA, but are easily incorporated within its design, while concurrency primitives similar to those in $\mu$\CC have already been added~\cite{Delisle18}.
    2766 Finally, CCured~\cite{Necula02} and Ironclad \CC~\cite{DeLozier13} attempt to provide a more memory-safe C by annotating pointer types with garbage collection information; type-checked polymorphism in \CFA covers several of C's memory-safety issues, but more aggressive approaches such as annotating all pointer types with their nullability or requiring runtime garbage collection are contradictory to \CFA's backwards compatibility goals.
    2767 
    2768 
    2769 \begin{comment}
    27702719\subsection{Control Structures / Declarations / Literals}
    27712720
     
    278527340/1 Literals \\
    27862735user defined: D, Objective-C
    2787 \end{comment}
    27882736
    27892737
     
    28002748Finally, we demonstrate that \CFA performance for some idiomatic cases is better than C and close to \CC, showing the design is practically applicable.
    28012749
    2802 There is ongoing work on a wide range of \CFA features, including arrays with size, runtime type-information, virtual functions, user-defined conversions, concurrent primitives, and modules.
    2803 While all examples in the paper compile and run, a public beta-release of \CFA will take another 8--12 months to finalize these extensions.
    2804 There are also interesting future directions for the polymorphism design.
     2750There is ongoing work on a wide range of \CFA feature extensions, including arrays with size, runtime type-information, virtual functions, user-defined conversions, concurrent primitives, and modules.
     2751(While all examples in the paper compile and run, a public beta-release of \CFA will take another 8--12 months to finalize these additional extensions.)
     2752In addition, there are interesting future directions for the polymorphism design.
    28052753Notably, \CC template functions trade compile time and code bloat for optimal runtime of individual instantiations of polymorphic functions.
    28062754\CFA polymorphic functions use dynamic virtual-dispatch;
     
    28132761\section{Acknowledgments}
    28142762
    2815 The authors would like to recognize the design assistance of Glen Ditchfield, Richard Bilson, Thierry Delisle, Andrew Beach and Brice Dobry on the features described in this paper, and thank Magnus Madsen for feedback on the writing.
    2816 This work is supported by a corporate partnership with Huawei Ltd.\ (\url{http://www.huawei.com}), and Aaron Moss and Peter Buhr are partially funded by the Natural Sciences and Engineering Research Council of Canada.
    2817 
    2818 
     2763The authors would like to recognize the design assistance of Glen Ditchfield, Richard Bilson, Thierry Delisle, and Andrew Beach on the features described in this paper, and thank Magnus Madsen for feedback in the writing.
     2764This work is supported through a corporate partnership with Huawei Ltd.\ (\url{http://www.huawei.com}), and Aaron Moss and Peter Buhr are partially funded by the Natural Sciences and Engineering Research Council of Canada.
     2765
     2766% the first author's \grantsponsor{NSERC-PGS}{NSERC PGS D}{http://www.nserc-crsng.gc.ca/Students-Etudiants/PG-CS/BellandPostgrad-BelletSuperieures_eng.asp} scholarship.
     2767
     2768
     2769\bibliographystyle{plain}
    28192770\bibliography{pl}
    28202771
     
    28252776\label{sec:BenchmarkStackImplementation}
    28262777
    2827 Throughout, @/***/@ designates a counted redundant type annotation; code reformatted for brevity.
     2778\lstset{basicstyle=\linespread{0.9}\sf\small}
     2779
     2780Throughout, @/***/@ designates a counted redundant type annotation.
    28282781
    28292782\smallskip\noindent
    2830 C
    2831 \begin{cfa}[xleftmargin=2\parindentlnth,aboveskip=0pt,belowskip=0pt]
    2832 struct stack_node {
    2833         void * value;
    2834         struct stack_node * next;
    2835 };
    2836 struct stack { struct stack_node* head; };
    2837 void clear_stack( struct stack * s, void (*free_el)( void * ) ) {
    2838         for ( struct stack_node * next = s->head; next; ) {
    2839                 struct stack_node * crnt = next;
    2840                 next = crnt->next;
    2841                 free_el( crnt->value );
    2842                 free( crnt );
    2843         }
    2844         s->head = NULL;
    2845 }
    2846 struct stack new_stack() { return (struct stack){ NULL }; /***/ }
    2847 void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) {
    2848         struct stack_node ** crnt = &s->head;
    2849         for ( struct stack_node * next = t->head; next; next = next->next ) {
    2850                 *crnt = malloc( sizeof(struct stack_node) ); /***/
    2851                 (*crnt)->value = copy( next->value );
    2852                 crnt = &(*crnt)->next;
    2853         }
    2854         *crnt = NULL;
    2855 }
    2856 struct stack * assign_stack( struct stack * s, const struct stack * t,
    2857                 void * (*copy_el)( const void * ), void (*free_el)( void * ) ) {
    2858         if ( s->head == t->head ) return s;
    2859         clear_stack( s, free_el ); /***/
    2860         copy_stack( s, t, copy_el ); /***/
    2861         return s;
    2862 }
    2863 _Bool stack_empty( const struct stack * s ) { return s->head == NULL; }
    2864 void push_stack( struct stack * s, void * v ) {
    2865         struct stack_node * n = malloc( sizeof(struct stack_node) ); /***/
    2866         *n = (struct stack_node){ v, s->head }; /***/
    2867         s->head = n;
    2868 }
    2869 void * pop_stack( struct stack * s ) {
    2870         struct stack_node * n = s->head;
    2871         s->head = n->next;
    2872         void * v = n->value;
    2873         free( n );
    2874         return v;
    2875 }
    2876 \end{cfa}
    2877 
    2878 \medskip\noindent
    28792783\CFA
    28802784\begin{cfa}[xleftmargin=2\parindentlnth,aboveskip=0pt,belowskip=0pt]
     2785forall( otype T ) struct stack_node;
     2786forall( otype T ) struct stack {
     2787        stack_node(T) * head;
     2788};
    28812789forall( otype T ) struct stack_node {
    28822790        T value;
    28832791        stack_node(T) * next;
    28842792};
    2885 forall( otype T ) struct stack { stack_node(T) * head; };
    2886 forall( otype T ) void clear( stack(T) & s ) with( s ) {
    2887         for ( stack_node(T) * next = head; next; ) {
    2888                 stack_node(T) * crnt = next;
    2889                 next = crnt->next;
    2890                 ^(*crnt){};
    2891                 free(crnt);
    2892         }
    2893         head = 0;
    2894 }
    2895 forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    2896 forall( otype T ) void ?{}( stack(T) & s, stack(T) t ) {
     2793forall( otype T) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     2794forall( otype T) void ?{}( stack(T) & s, stack(T) t ) {
    28972795        stack_node(T) ** crnt = &s.head;
    28982796        for ( stack_node(T) * next = t.head; next; next = next->next ) {
    2899                 *crnt = alloc();
    2900                 ((*crnt)->value){ next->value };
    2901                 crnt = &(*crnt)->next;
     2797                stack_node(T) * new_node = ((stack_node(T)*)malloc());
     2798                (*new_node){ next->value }; /***/
     2799                *crnt = new_node;
     2800                stack_node(T) * acrnt = *crnt;
     2801                crnt = &acrnt->next;
    29022802        }
    29032803        *crnt = 0;
     
    29112811forall( otype T ) void ^?{}( stack(T) & s) { clear( s ); }
    29122812forall( otype T ) _Bool empty( const stack(T) & s ) { return s.head == 0; }
    2913 forall( otype T ) void push( stack(T) & s, T value ) with( s ) {
    2914         stack_node(T) * n = alloc();
    2915         (*n){ value, head };
    2916         head = n;
    2917 }
    2918 forall( otype T ) T pop( stack(T) & s ) with( s ) {
    2919         stack_node(T) * n = head;
    2920         head = n->next;
     2813forall( otype T ) void push( stack(T) & s, T value ) {
     2814        stack_node(T) * new_node = ((stack_node(T)*)malloc());
     2815        (*new_node){ value, s.head }; /***/
     2816        s.head = new_node;
     2817}
     2818forall( otype T ) T pop( stack(T) & s ) {
     2819        stack_node(T) * n = s.head;
     2820        s.head = n->next;
    29212821        T v = n->value;
    2922         ^(*n){};
    2923         free( n );
     2822        delete( n );
    29242823        return v;
    29252824}
    2926 \end{cfa}
    2927 
    2928 \begin{comment}
    2929 forall( otype T ) {
    2930         struct stack_node {
    2931                 T value;
    2932                 stack_node(T) * next;
    2933         };
    2934         struct stack { stack_node(T) * head; };
    2935         void clear( stack(T) & s ) with( s ) {
    2936                 for ( stack_node(T) * next = head; next; ) {
    2937                         stack_node(T) * crnt = next;
    2938                         next = crnt->next;
    2939                         ^(*crnt){};
    2940                         free(crnt);
    2941                 }
    2942                 head = 0;
     2825forall( otype T ) void clear( stack(T) & s ) {
     2826        for ( stack_node(T) * next = s.head; next; ) {
     2827                stack_node(T) * crnt = next;
     2828                next = crnt->next;
     2829                delete( crnt );
    29432830        }
    2944         void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    2945         void ?{}( stack(T) & s, stack(T) t ) {
    2946                 stack_node(T) ** crnt = &s.head;
    2947                 for ( stack_node(T) * next = t.head; next; next = next->next ) {
    2948                         *crnt = alloc();
    2949                         ((*crnt)->value){ next->value };
    2950                         crnt = &(*crnt)->next;
    2951                 }
    2952                 *crnt = 0;
    2953         }
    2954         stack(T) ?=?( stack(T) & s, stack(T) t ) {
    2955                 if ( s.head == t.head ) return s;
    2956                 clear( s );
    2957                 s{ t };
    2958                 return s;
    2959         }
    2960         void ^?{}( stack(T) & s) { clear( s ); }
    2961         _Bool empty( const stack(T) & s ) { return s.head == 0; }
    2962         void push( stack(T) & s, T value ) with( s ) {
    2963                 stack_node(T) * n = alloc();
    2964                 (*n){ value, head };
    2965                 head = n;
    2966         }
    2967         T pop( stack(T) & s ) with( s ) {
    2968                 stack_node(T) * n = head;
    2969                 head = n->next;
    2970                 T v = n->value;
    2971                 ^(*n){};
    2972                 free( n );
    2973                 return v;
    2974         }
    2975 }
    2976 \end{comment}
     2831        s.head = 0;
     2832}
     2833\end{cfa}
    29772834
    29782835\medskip\noindent
    29792836\CC
    29802837\begin{cfa}[xleftmargin=2\parindentlnth,aboveskip=0pt,belowskip=0pt]
    2981 template<typename T> struct stack {
     2838template<typename T> class stack {
    29822839        struct node {
    29832840                T value;
    29842841                node * next;
    2985                 node( const T & v, node * n = nullptr ) : value( v ), next( n ) {}
     2842                node( const T & v, node * n = nullptr ) : value(v), next(n) {}
    29862843        };
    29872844        node * head;
    2988         stack() : head( nullptr ) {}
    2989         stack( const stack<T> & o ) { copy( o ); }
     2845        void copy(const stack<T>& o) {
     2846                node ** crnt = &head;
     2847                for ( node * next = o.head;; next; next = next->next ) {
     2848                        *crnt = new node{ next->value }; /***/
     2849                        crnt = &(*crnt)->next;
     2850                }
     2851                *crnt = nullptr;
     2852        }
     2853  public:
     2854        stack() : head(nullptr) {}
     2855        stack(const stack<T>& o) { copy(o); }
     2856        stack(stack<T> && o) : head(o.head) { o.head = nullptr; }
     2857        ~stack() { clear(); }
     2858        stack & operator= (const stack<T>& o) {
     2859                if ( this == &o ) return *this;
     2860                clear();
     2861                copy(o);
     2862                return *this;
     2863        }
     2864        stack & operator= (stack<T> && o) {
     2865                if ( this == &o ) return *this;
     2866                head = o.head;
     2867                o.head = nullptr;
     2868                return *this;
     2869        }
     2870        bool empty() const { return head == nullptr; }
     2871        void push(const T & value) { head = new node{ value, head };  /***/ }
     2872        T pop() {
     2873                node * n = head;
     2874                head = n->next;
     2875                T x = std::move(n->value);
     2876                delete n;
     2877                return x;
     2878        }
    29902879        void clear() {
    29912880                for ( node * next = head; next; ) {
     
    29962885                head = nullptr;
    29972886        }
    2998         void copy( const stack<T> & o ) {
    2999                 node ** crnt = &head;
    3000                 for ( node * next = o.head; next; next = next->next ) {
    3001                         *crnt = new node{ next->value }; /***/
    3002                         crnt = &(*crnt)->next;
    3003                 }
    3004                 *crnt = nullptr;
     2887};
     2888\end{cfa}
     2889
     2890\medskip\noindent
     2891C
     2892\begin{cfa}[xleftmargin=2\parindentlnth,aboveskip=0pt,belowskip=0pt]
     2893struct stack_node {
     2894        void * value;
     2895        struct stack_node * next;
     2896};
     2897struct stack new_stack() { return (struct stack){ NULL }; /***/ }
     2898void copy_stack(struct stack * s, const struct stack * t, void * (*copy)(const void *)) {
     2899        struct stack_node ** crnt = &s->head;
     2900        for ( struct stack_node * next = t->head; next; next = next->next ) {
     2901                *crnt = malloc(sizeof(struct stack_node)); /***/
     2902                **crnt = (struct stack_node){ copy(next->value) }; /***/
     2903                crnt = &(*crnt)->next;
    30052904        }
    3006         ~stack() { clear(); }
    3007         stack & operator= ( const stack<T> & o ) {
    3008                 if ( this == &o ) return *this;
    3009                 clear();
    3010                 copy( o );
    3011                 return *this;
     2905        *crnt = 0;
     2906}
     2907_Bool stack_empty(const struct stack * s) { return s->head == NULL; }
     2908void push_stack(struct stack * s, void * value) {
     2909        struct stack_node * n = malloc(sizeof(struct stack_node)); /***/
     2910        *n = (struct stack_node){ value, s->head }; /***/
     2911        s->head = n;
     2912}
     2913void * pop_stack(struct stack * s) {
     2914        struct stack_node * n = s->head;
     2915        s->head = n->next;
     2916        void * x = n->value;
     2917        free(n);
     2918        return x;
     2919}
     2920void clear_stack(struct stack * s, void (*free_el)(void *)) {
     2921        for ( struct stack_node * next = s->head; next; ) {
     2922                struct stack_node * crnt = next;
     2923                next = crnt->next;
     2924                free_el(crnt->value);
     2925                free(crnt);
    30122926        }
    3013         bool empty() const { return head == nullptr; }
    3014         void push( const T & value ) { head = new node{ value, head };  /***/ }
    3015         T pop() {
    3016                 node * n = head;
    3017                 head = n->next;
    3018                 T v = std::move( n->value );
    3019                 delete n;
    3020                 return v;
    3021         }
    3022 };
     2927        s->head = NULL;
     2928}
    30232929\end{cfa}
    30242930
     
    30262932\CCV
    30272933\begin{cfa}[xleftmargin=2\parindentlnth,aboveskip=0pt,belowskip=0pt]
    3028 struct stack {
    3029         struct node {
    3030                 ptr<object> value;
    3031                 node * next;
    3032                 node( const object & v, node * n = nullptr ) : value( v.new_copy() ), next( n ) {}
    3033         };
    3034         node * head;
    3035         void clear() {
    3036                 for ( node * next = head; next; ) {
    3037                         node * crnt = next;
    3038                         next = crnt->next;
    3039                         delete crnt;
    3040                 }
    3041                 head = nullptr;
     2934stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
     2935void stack::copy(const stack & o) {
     2936        node ** crnt = &head;
     2937        for ( node * next = o.head; next; next = next->next ) {
     2938                *crnt = new node{ *next->value };
     2939                crnt = &(*crnt)->next;
    30422940        }
    3043         void copy( const stack & o ) {
    3044                 node ** crnt = &head;
    3045                 for ( node * next = o.head; next; next = next->next ) {
    3046                         *crnt = new node{ *next->value }; /***/
    3047                         crnt = &(*crnt)->next;
    3048                 }
    3049                 *crnt = nullptr;
     2941        *crnt = nullptr;
     2942}
     2943stack::stack() : head(nullptr) {}
     2944stack::stack(const stack & o) { copy(o); }
     2945stack::stack(stack && o) : head(o.head) { o.head = nullptr; }
     2946stack::~stack() { clear(); }
     2947stack & stack::operator= (const stack & o) {
     2948        if ( this == &o ) return *this;
     2949        clear();
     2950        copy(o);
     2951        return *this;
     2952}
     2953stack & stack::operator= (stack && o) {
     2954        if ( this == &o ) return *this;
     2955        head = o.head;
     2956        o.head = nullptr;
     2957        return *this;
     2958}
     2959bool stack::empty() const { return head == nullptr; }
     2960void stack::push(const object & value) { head = new node{ value, head }; /***/ }
     2961ptr<object> stack::pop() {
     2962        node * n = head;
     2963        head = n->next;
     2964        ptr<object> x = std::move(n->value);
     2965        delete n;
     2966        return x;
     2967}
     2968void stack::clear() {
     2969        for ( node * next = head; next; ) {
     2970                node * crnt = next;
     2971                next = crnt->next;
     2972                delete crnt;
    30502973        }
    3051         stack() : head( nullptr ) {}
    3052         stack( const stack & o ) { copy( o ); }
    3053         ~stack() { clear(); }
    3054         stack & operator= ( const stack & o ) {
    3055                 if ( this == &o ) return *this;
    3056                 clear();
    3057                 copy( o );
    3058                 return *this;
    3059         }
    3060         bool empty() const { return head == nullptr; }
    3061         void push( const object & value ) { head = new node{ value, head }; /***/ }
    3062         ptr<object> pop() {
    3063                 node * n = head;
    3064                 head = n->next;
    3065                 ptr<object> v = std::move( n->value );
    3066                 delete n;
    3067                 return v;
    3068         }
    3069 };
     2974        head = nullptr;
     2975}
    30702976\end{cfa}
    30712977
  • doc/papers/general/evaluation/c-bench.c

    r32cab5b rb2fe1c9  
    55#include "c-stack.h"
    66
     7_Bool* new_bool( _Bool b ) {
     8        _Bool* q = malloc(sizeof(_Bool)); /***/
     9        *q = b;
     10        return q;
     11}
     12
    713char* new_char( char c ) {
    814        char* q = malloc(sizeof(char)); /***/
    915        *q = c;
    10         return q;
    11 }
    12 
    13 short* new_short( short s ) {
    14         short* q = malloc(sizeof(short)); /***/
    15         *q = s;
    1616        return q;
    1717}
     
    2323}
    2424
     25void* copy_bool( const void* p ) { return new_bool( *(const _Bool*)p ); } /***/
    2526void* copy_char( const void* p ) { return new_char( *(const char*)p ); } /***/
    26 void* copy_short( const void* p ) { return new_short( *(const short*)p ); } /***/
    2727void* copy_int( const void* p ) { return new_int( *(const int*)p ); } /***/
    28 void* copy_pair_short_char( const void* p ) { return copy_pair( p, copy_short, copy_char ); } /***/
    29 void free_pair_short_char( void* p ) { free_pair( p, free, free ); } /***/
     28void* copy_pair_bool_char( const void* p ) { return copy_pair( p, copy_bool, copy_char ); } /***/
     29void free_pair_bool_char( void* p ) { free_pair( p, free, free ); } /***/
     30
     31int cmp_bool( const void* a, const void* b ) { /***/
     32        return *(const _Bool*)a == *(const _Bool*)b ? 0 : *(const _Bool*)a < *(const _Bool*)b ? -1 : 1;
     33}
    3034
    3135int cmp_char( const void* a, const void* b ) { /***/
    3236        return *(const char*)a == *(const char*)b ? 0 : *(const char*)a < *(const char*)b ? -1 : 1;
    33 }
    34 
    35 int cmp_short( const void* a, const void* b ) { /***/
    36         return *(const short*)a == *(const short*)b ? 0 : *(const short*)a < *(const short*)b ? -1 : 1;
    3737}
    3838
     
    4949                free(xi); )
    5050
    51         struct pair * maxp = new_pair( new_short(0), new_char('\0') ),
    52                 * valp = new_pair( new_short(42), new_char('a') );
     51        struct pair * maxp = new_pair( new_bool(0), new_char('\0') ),
     52                * valp = new_pair( new_bool(1), new_char('a') );
    5353        struct stack sp = new_stack(), tp;
    5454
    55         REPEAT_TIMED( "push_pair", N, push_stack( &sp, copy_pair_short_char( valp ) ); )
    56         TIMED( "copy_pair", copy_stack( &tp, &sp, copy_pair_short_char ); /***/ )
    57         TIMED( "clear_pair", clear_stack( &sp, free_pair_short_char ); /***/ )
     55        REPEAT_TIMED( "push_pair", N, push_stack( &sp, copy_pair_bool_char( valp ) ); )
     56        TIMED( "copy_pair", copy_stack( &tp, &sp, copy_pair_bool_char ); /***/ )
     57        TIMED( "clear_pair", clear_stack( &sp, free_pair_bool_char ); /***/ )
    5858        REPEAT_TIMED( "pop_pair", N,
    5959                struct pair * xp = pop_stack( &tp );
    60                 if ( cmp_pair( xp, maxp, cmp_short, cmp_char /***/ ) > 0 ) {
    61                         free_pair_short_char( maxp ); /***/
     60                if ( cmp_pair( xp, maxp, cmp_bool, cmp_char /***/ ) > 0 ) {
     61                        free_pair_bool_char( maxp ); /***/
    6262                        maxp = xp;
    6363                } else {
    64                         free_pair_short_char( xp ); /***/
     64                        free_pair_bool_char( xp ); /***/
    6565                } )
    66         free_pair_short_char( maxp ); /***/
    67         free_pair_short_char( valp ); /***/
     66        free_pair_bool_char( maxp ); /***/
     67        free_pair_bool_char( valp ); /***/
    6868}
  • doc/papers/general/evaluation/c-stack.c

    r32cab5b rb2fe1c9  
    33
    44struct stack_node {
    5         void * value;
    6         struct stack_node * next;
     5        void* value;
     6        struct stack_node* next;
    77};
    88
    9 void clear_stack( struct stack * s, void (*free_el)( void * ) ) {
    10         for ( struct stack_node * next = s->head; next; ) {
    11                 struct stack_node * crnt = next;
     9struct stack new_stack() { return (struct stack){ NULL }; /***/ }
     10
     11void copy_stack(struct stack* s, const struct stack* t, void* (*copy)(const void*)) {
     12        struct stack_node** crnt = &s->head;
     13        for ( struct stack_node* next = t->head; next; next = next->next ) {
     14                *crnt = malloc(sizeof(struct stack_node)); /***/
     15                **crnt = (struct stack_node){ copy(next->value) }; /***/
     16                crnt = &(*crnt)->next;
     17        }
     18        *crnt = 0;
     19}
     20
     21void clear_stack(struct stack* s, void (*free_el)(void*)) {
     22    for ( struct stack_node* next = s->head; next; ) {
     23                struct stack_node* crnt = next;
    1224                next = crnt->next;
    13                 free_el( crnt->value );
    14                 free( crnt );
     25                free_el(crnt->value);
     26                free(crnt);
    1527        }
    1628        s->head = NULL;
    1729}
    1830
    19 struct stack new_stack() { return (struct stack){ NULL }; /***/ }
     31_Bool stack_empty(const struct stack* s) { return s->head == NULL; }
    2032
    21 void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) {
    22         struct stack_node ** crnt = &s->head;
    23         for ( struct stack_node * next = t->head; next; next = next->next ) {
    24                 *crnt = malloc( sizeof(struct stack_node) ); /***/
    25                 (*crnt)->value = copy( next->value );
    26                 crnt = &(*crnt)->next;
    27         }
    28         *crnt = NULL;
    29 }
    30 struct stack * assign_stack( struct stack * s, const struct stack * t,
    31                 void * (*copy_el)( const void * ), void (*free_el)( void * ) ) {
    32         if ( s->head == t->head ) return s;
    33         clear_stack( s, free_el ); /***/
    34         copy_stack( s, t, copy_el ); /***/
    35         return s;
    36 }
    37 
    38 _Bool stack_empty( const struct stack * s ) { return s->head == NULL; }
    39 
    40 void push_stack( struct stack * s, void * v ) {
    41         struct stack_node * n = malloc( sizeof(struct stack_node) ); /***/
    42         *n = (struct stack_node){ v, s->head }; /***/
     33void push_stack(struct stack* s, void* value) {
     34        struct stack_node* n = malloc(sizeof(struct stack_node)); /***/
     35        *n = (struct stack_node){ value, s->head }; /***/
    4336        s->head = n;
    4437}
    4538
    46 void * pop_stack( struct stack * s ) {
    47         struct stack_node * n = s->head;
     39void* pop_stack(struct stack* s) {
     40        struct stack_node* n = s->head;
    4841        s->head = n->next;
    49         void * v = n->value;
    50         free( n );
    51         return v;
     42        void* x = n->value;
     43        free(n);
     44        return x;
    5245}
  • doc/papers/general/evaluation/c-stack.h

    r32cab5b rb2fe1c9  
    88struct stack new_stack();
    99void copy_stack(struct stack* dst, const struct stack* src, void* (*copy)(const void*));
    10 struct stack* assign_stack(struct stack* dst, const struct stack* src,
    11         void* (*copy_el)(const void*), void (*free_el)(void*));
    1210void clear_stack(struct stack* s, void (*free_el)(void*));
    1311
  • doc/papers/general/evaluation/cfa-bench.c

    r32cab5b rb2fe1c9  
    33#include "cfa-pair.h"
    44
    5 int main() {
     5int main( int argc, char * argv[] ) {
    66        int max = 0, val = 42;
    77        stack( int ) si, ti;
    88
    99        REPEAT_TIMED( "push_int", N, push( si, val ); )
    10         TIMED( "copy_int", ti{ si }; )
     10        TIMED( "copy_int", ti = si; )
    1111        TIMED( "clear_int", clear( si ); )
    12         REPEAT_TIMED( "pop_int", N, int x = pop( ti ); if ( x > max ) max = x; )
     12        REPEAT_TIMED( "pop_int", N,
     13                int x = pop( ti ); if ( x > max ) max = x; )
    1314
    14         pair( short, char ) max = { 0h, '\0' }, val = { 42h, 'a' };
    15         stack( pair( short, char ) ) sp, tp;
     15        pair( _Bool, char ) max = { (_Bool)0 /***/, '\0' }, val = { (_Bool)1 /***/, 'a' };
     16        stack( pair( _Bool, char ) ) sp, tp;
    1617
    1718        REPEAT_TIMED( "push_pair", N, push( sp, val ); )
    18         TIMED( "copy_pair", tp{ sp }; )
     19        TIMED( "copy_pair", tp = sp; )
    1920        TIMED( "clear_pair", clear( sp ); )
    20         REPEAT_TIMED( "pop_pair", N, pair(short, char) x = pop( tp ); if ( x > max ) max = x; )
     21        REPEAT_TIMED( "pop_pair", N,
     22                pair(_Bool, char) x = pop( tp ); if ( x > max ) max = x; )
    2123}
  • doc/papers/general/evaluation/cfa-stack.c

    r32cab5b rb2fe1c9  
    22#include "cfa-stack.h"
    33
    4 forall( otype T ) struct stack_node {
     4forall(otype T) struct stack_node {
    55        T value;
    66        stack_node(T) * next;
    77};
    88
    9 forall( otype T ) void clear( stack(T) & s ) with( s ) {
    10         for ( stack_node(T) * next = head; next; ) {
    11                 stack_node(T) * crnt = next;
    12                 next = crnt->next;
    13                 ^(*crnt){};
    14                 free(crnt);
    15         }
    16         head = 0;
    17 }
     9forall(otype T) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    1810
    19 forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    20 
    21 forall( otype T ) void ?{}( stack(T) & s, stack(T) t ) {
     11forall(otype T) void ?{}( stack(T) & s, stack(T) t ) {
    2212        stack_node(T) ** crnt = &s.head;
    2313        for ( stack_node(T) * next = t.head; next; next = next->next ) {
    24                 *crnt = alloc();
    25                 ((*crnt)->value){ next->value };
     14                stack_node(T)* new_node = (stack_node(T)*)malloc(); /***/
     15                (*new_node){ next->value };
     16                *crnt = new_node;
    2617                crnt = &(*crnt)->next;
    2718        }
     
    2920}
    3021
    31 forall( otype T ) stack(T) ?=?( stack(T) & s, stack(T) t ) {
     22forall(otype T) stack(T) ?=?( stack(T) & s, stack(T) t ) {
    3223        if ( s.head == t.head ) return s;
    3324        clear( s );
     
    3627}
    3728
    38 forall( otype T ) void ^?{}( stack(T) & s) { clear( s ); }
     29forall(otype T) void ^?{}( stack(T) & s) { clear( s ); }
    3930
    40 forall( otype T ) _Bool empty( const stack(T) & s ) { return s.head == 0; }
     31forall(otype T) _Bool empty( const stack(T) & s ) { return s.head == 0; }
    4132
    42 forall( otype T ) void push( stack(T) & s, T value ) with( s ) {
    43         stack_node(T) * n = alloc();
    44         (*n){ value, head };
    45         head = n;
     33forall(otype T) void push( stack(T) & s, T value ) {
     34        stack_node(T)* new_node = (stack_node(T)*)malloc(); /***/
     35        (*new_node){ value, s.head };
     36        s.head = new_node;
    4637}
    4738
    48 forall( otype T ) T pop( stack(T) & s ) with( s ) {
    49         stack_node(T) * n = head;
    50         head = n->next;
     39forall(otype T) T pop( stack(T) & s ) {
     40        stack_node(T) * n = s.head;
     41        s.head = n->next;
    5142        T v = n->value;
    5243        ^(*n){};
     
    5445        return v;
    5546}
     47
     48forall(otype T) void clear( stack(T) & s ) {
     49        for ( stack_node(T) * next = s.head; next; ) {
     50                stack_node(T) * crnt = next;
     51                next = crnt->next;
     52                ^(*crnt){};
     53                free(crnt);
     54        }
     55        s.head = 0;
     56}
  • doc/papers/general/evaluation/cfa-stack.h

    r32cab5b rb2fe1c9  
    11#pragma once
    22
    3 forall( otype T ) struct stack_node;
    4 forall( otype T ) struct stack {
     3forall(otype T) struct stack_node;
     4forall(otype T) struct stack {
    55        stack_node(T) * head;
    66};
    77
    8 forall( otype T ) void ?{}( stack(T) & s );
    9 forall( otype T ) void ?{}( stack(T) & s, stack(T) t );
    10 forall( otype T ) stack(T) ?=?( stack(T) & s, stack(T) t );
    11 forall( otype T ) void ^?{}( stack(T) & s);
     8forall(otype T) void ?{}( stack(T) & s );
     9forall(otype T) void ?{}( stack(T) & s, stack(T) t );
     10forall(otype T) stack(T) ?=?( stack(T) & s, stack(T) t );
     11forall(otype T) void ^?{}( stack(T) & s);
    1212
    13 forall( otype T ) _Bool empty( const stack(T) & s );
    14 forall( otype T ) void push( stack(T) & s, T value );
    15 forall( otype T ) T pop( stack(T) & s );
    16 forall( otype T ) void clear( stack(T) & s );
     13forall(otype T) _Bool empty( const stack(T) & s );
     14forall(otype T) void push( stack(T) & s, T value );
     15forall(otype T) T pop( stack(T) & s );
     16forall(otype T) void clear( stack(T) & s );
  • doc/papers/general/evaluation/cpp-bench.cpp

    r32cab5b rb2fe1c9  
    1313        REPEAT_TIMED( "pop_int", N, maxi = std::max( maxi, ti.pop() ); )
    1414
    15         pair<short, char> maxp = { 0, '\0' }, valp = { 42, 'a' };
    16         stack<pair<short, char>> sp, tp;
     15        pair<bool, char> maxp = { false, '\0' }, valp = { true, 'a' };
     16        stack<pair<bool, char>> sp, tp;
    1717       
    1818        REPEAT_TIMED( "push_pair", N, sp.push( valp ); )
  • doc/papers/general/evaluation/cpp-stack.hpp

    r32cab5b rb2fe1c9  
    22#include <utility>
    33
    4 template<typename T> struct stack {
     4template<typename T> class stack {
    55        struct node {
    66                T value;
    7                 node * next;
    8                 node( const T & v, node * n = nullptr ) : value( v ), next( n ) {}
     7                node* next;
     8
     9                node( const T& v, node* n = nullptr ) : value(v), next(n) {}
    910        };
    10         node * head;
     11        node* head;
    1112
    12         stack() : head( nullptr ) {}
    13         stack( const stack<T> & o ) { copy( o ); }
    14 
     13        void copy(const stack<T>& o) {
     14                node** crnt = &head;
     15                for ( node* next = o.head; next; next = next->next ) {
     16                        *crnt = new node{ next->value }; /***/
     17                        crnt = &(*crnt)->next;
     18                }
     19                *crnt = nullptr;
     20        }
     21public:
    1522        void clear() {
    16                 for ( node * next = head; next; ) {
    17                         node * crnt = next;
     23            for ( node* next = head; next; ) {
     24                        node* crnt = next;
    1825                        next = crnt->next;
    1926                        delete crnt;
     
    2229        }
    2330
    24         void copy( const stack<T> & o ) {
    25                 node ** crnt = &head;
    26                 for ( node * next = o.head; next; next = next->next ) {
    27                         *crnt = new node{ next->value }; /***/
    28                         crnt = &(*crnt)->next;
    29                 }
    30                 *crnt = nullptr;
     31        stack() : head(nullptr) {}
     32        stack(const stack<T>& o) { copy(o); }
     33        stack(stack<T>&& o) : head(o.head) { o.head = nullptr; }
     34        ~stack() { clear(); }
     35
     36        stack& operator= (const stack<T>& o) {
     37                if ( this == &o ) return *this;
     38                clear();
     39                copy(o);
     40                return *this;
    3141        }
    3242
    33         ~stack() { clear(); }
    34 
    35         stack & operator= ( const stack<T> & o ) {
     43        stack& operator= (stack<T>&& o) {
    3644                if ( this == &o ) return *this;
    37                 clear();
    38                 copy( o );
     45                head = o.head;
     46                o.head = nullptr;
    3947                return *this;
    4048        }
     
    4250        bool empty() const { return head == nullptr; }
    4351
    44         void push( const T & value ) { head = new node{ value, head };  /***/ }
     52        void push(const T& value) { head = new node{ value, head };  /***/ }
    4553
    4654        T pop() {
    47                 node * n = head;
     55                node* n = head;
    4856                head = n->next;
    49                 T v = std::move( n->value );
     57                T x = std::move(n->value);
    5058                delete n;
    51                 return v;
     59                return x;
    5260        }
    5361};
  • doc/papers/general/evaluation/cpp-vbench.cpp

    r32cab5b rb2fe1c9  
    1313        REPEAT_TIMED( "pop_int", N, maxi = std::max( maxi, ti.pop()->as<integer>() ); /***/ )
    1414
    15         ptr<pair> maxp = make<pair>( make<short_integer>(0), make<character>('\0') );
    16         pair valp{ make<short_integer>(42), make<character>('a') };
     15        ptr<pair> maxp = make<pair>( make<boolean>(false), make<character>('\0') );
     16        pair valp{ make<boolean>(true), make<character>('a') };
    1717        stack sp, tp;
    1818       
  • doc/papers/general/evaluation/cpp-vstack.cpp

    r32cab5b rb2fe1c9  
    22#include <utility>
    33
    4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
     4stack::node::node( const object& v, node* n ) : value( v.new_copy() ), next( n ) {}
     5
     6void stack::copy(const stack& o) {
     7        node** crnt = &head;
     8        for ( node* next = o.head; next; next = next->next ) {
     9                *crnt = new node{ *next->value };
     10                crnt = &(*crnt)->next;
     11        }
     12        *crnt = nullptr;
     13}
     14
     15stack::stack() : head(nullptr) {}
     16stack::stack(const stack& o) { copy(o); }
     17stack::stack(stack&& o) : head(o.head) { o.head = nullptr; }
     18stack::~stack() { clear(); }
     19
     20stack& stack::operator= (const stack& o) {
     21        if ( this == &o ) return *this;
     22        clear();
     23        copy(o);
     24        return *this;
     25}
     26
     27stack& stack::operator= (stack&& o) {
     28        if ( this == &o ) return *this;
     29        head = o.head;
     30        o.head = nullptr;
     31        return *this;
     32}
    533
    634void stack::clear() {
    7         for ( node * next = head; next; ) {
    8                 node * crnt = next;
     35    for ( node* next = head; next; ) {
     36                node* crnt = next;
    937                next = crnt->next;
    1038                delete crnt;
     
    1341}
    1442
    15 void stack::copy( const stack & o ) {
    16         node ** crnt = &head;
    17         for ( node * next = o.head; next; next = next->next ) {
    18                 *crnt = new node{ *next->value }; /***/
    19                 crnt = &(*crnt)->next;
    20         }
    21         *crnt = nullptr;
    22 }
    23 
    24 stack::stack() : head( nullptr ) {}
    25 stack::stack( const stack & o ) { copy( o ); }
    26 stack::~stack() { clear(); }
    27 
    28 stack & stack::operator=( const stack & o ) {
    29         if ( this == &o ) return *this;
    30         clear();
    31         copy( o );
    32         return *this;
    33 }
    3443
    3544bool stack::empty() const { return head == nullptr; }
    3645
    37 void stack::push( const object & value ) { head = new node{ value, head }; /***/ }
     46void stack::push(const object& value) { head = new node{ value, head }; /***/ }
    3847
    3948ptr<object> stack::pop() {
    40         node * n = head;
     49        node* n = head;
    4150        head = n->next;
    42         ptr<object> v = std::move( n->value );
     51        ptr<object> x = std::move(n->value);
    4352        delete n;
    44         return v;
     53        return x;
    4554}
  • doc/papers/general/evaluation/cpp-vstack.hpp

    r32cab5b rb2fe1c9  
    22#include "object.hpp"
    33
    4 struct stack {
     4class stack {
    55        struct node {
    66                ptr<object> value;
    7                 node * next;
    8                 node( const object & v, node * n = nullptr );
     7                node* next;
     8
     9                node( const object& v, node* n = nullptr );
    910        };
    10         node * head;
     11        node* head;
     12
     13        void copy(const stack& o);
     14public:
     15        stack();
     16        stack(const stack& o);
     17        stack(stack&& o);
     18        ~stack();
     19        stack& operator= (const stack& o);
     20        stack& operator= (stack&& o);
    1121
    1222        void clear();
    13         void copy( const stack & o );
    14 
    15         stack();
    16         stack( const stack & o );
    17         ~stack();
    18         stack & operator=( const stack& o );
    1923        bool empty() const;
    20         void push( const object & value );
     24        void push(const object& value);
    2125        ptr<object> pop();
    2226};
  • doc/papers/general/evaluation/object.hpp

    r32cab5b rb2fe1c9  
    6767};
    6868
     69class boolean : public ordered, public printable {
     70        bool x;
     71public:
     72        boolean() = default;
     73        boolean(bool x) : x(x) {}
     74        boolean(const boolean&) = default;
     75        boolean(boolean&&) = default;
     76        ptr<object> new_inst() const override { return make<boolean>(); }
     77        ptr<object> new_copy() const override { return make<boolean>(*this); }
     78        boolean& operator= (const boolean& that) {
     79                x = that.x;
     80                return *this;   
     81        }
     82        object& operator= (const object& that) override { return *this = that.as<boolean>(); } /***/
     83        boolean& operator= (boolean&&) = default;
     84        ~boolean() override = default;
     85
     86        int cmp(const boolean& that) const { return x == that.x ? 0 : x == false ? -1 : 1; }
     87        int cmp(const ordered& that) const override { return cmp( that.as<boolean>() ); } /***/
     88
     89        void print(std::ostream& out) const override { out << (x ? "true" : "false"); }
     90};
     91
    6992class character : public ordered, public printable {
    7093        char x;
     
    93116};
    94117
    95 class short_integer : public ordered, public printable {
    96         short x;
    97 public:
    98         short_integer() = default;
    99         short_integer(short x) : x(x) {}
    100         short_integer(const short_integer&) = default;
    101         short_integer(short_integer&&) = default;
    102         ptr<object> new_inst() const override { return make<short_integer>(); }
    103         ptr<object> new_copy() const override { return make<short_integer>(*this); }
    104         short_integer& operator= (const short_integer& that) {
    105                 x = that.x;
    106                 return *this;   
    107         }
    108         object& operator= (const object& that) override { return *this = that.as<short_integer>(); } /***/
    109         short_integer& operator= (short_integer&&) = default;
    110         ~short_integer() override = default;
    111 
    112         int cmp(const short_integer& that) const { return x == that.x ? 0 : x < that.x ? -1 : 1; }
    113         int cmp(const ordered& that) const override { return cmp( that.as<short_integer>() ); } /***/
    114 
    115         void print(std::ostream& out) const override { out << x; }
    116 };
    117 
    118118class integer : public ordered, public printable {
    119119        int x;
     
    137137
    138138        void print(std::ostream& out) const override { out << x; }
     139};
     140
     141class c_string : public printable {
     142        static constexpr const char* empty = "";
     143        const char* s;
     144public:
     145        c_string() : s(empty) {}
     146        c_string(const char* s) : s(s) {}
     147        c_string(const c_string&) = default;
     148        c_string(c_string&&) = default;
     149        ptr<object> new_inst() const override { return make<c_string>(); }
     150        ptr<object> new_copy() const override { return make<c_string>(s); }
     151        c_string& operator= (const c_string& that) {
     152                s = that.s;
     153                return *this;
     154        }
     155        object& operator= (const object& that) override { return *this = that.as<c_string>(); } /***/
     156        c_string& operator= (c_string&&) = default;
     157        ~c_string() override = default;
     158
     159        void print(std::ostream& out) const override { out << s; }
    139160};
    140161
     
    167188                return y->as<ordered>().cmp( that.y->as<ordered>() ); /***/
    168189        }
    169         int cmp(const ordered& that) const override { return cmp( that.as<pair>() ); } /***/
     190        int cmp(const ordered& that) const override { return cmp( that.as<pair>() ); }
    170191
    171192        void print(std::ostream& out) const override {
  • doc/papers/general/evaluation/timing.dat

    r32cab5b rb2fe1c9  
    11"400 million repetitions"       "C"     "\\CFA{}"       "\\CC{}"        "\\CC{obj}"
    2 "push\nint"     3002    2459    1542    3269
    3 "copy\nint"     2985    2057    1539    3083
    4 "clear\nint"    1374    827     756     1469
    5 "pop\nint"      1416    1221    760     5098
    6 "push\npair"    4214    2752    950     6873
    7 "copy\npair"    6127    2105    987     7293
    8 "clear\npair"   2881    885     751     3460
    9 "pop\npair"     3046    5434    822     24962
     2"push\nint"     2976    2225    1522    3266
     3"copy\nnt"      2932    7072    1526    3110
     4"clear\nint"    1380    731     750     1488
     5"pop\nint"      1444    1196    756     5156
     6"push\npair"    3695    2257    953     6840
     7"copy\npair"    6034    6650    994     7224
     8"clear\npair"   2832    848     742     3297
     9"pop\npair"     3009    5348    797     25235
     10
  • doc/papers/general/evaluation/timing.gp

    r32cab5b rb2fe1c9  
    2222SCALE=1000
    2323set ylabel "seconds"
    24 set yrange [0:10]
    25 
    26 set label "25.0" at 7.125,10.5
    2724
    2825# set datafile separator ","
  • doc/refrat/keywords.tex

    r32cab5b rb2fe1c9  
    1111%% Created On       : Sun Aug  6 08:17:27 2017
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Apr  6 15:16:11 2018
    14 %% Update Count     : 7
     13%% Last Modified On : Wed Aug 30 22:10:10 2017
     14%% Update Count     : 5
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616\begin{tabular}{@{}llllll@{}}
    1717\begin{tabular}{@{}l@{}}
     18©_At©                   \\
    1819©catch©                 \\
    1920©catchResume©   \\
    2021©choose©                \\
    2122©coroutine©             \\
    22 ©disable©               \\
    2323\end{tabular}
    2424&
    2525\begin{tabular}{@{}l@{}}
     26©disable©               \\
    2627©dtype©                 \\
    2728©enable©                \\
    28 ©exception©             \\
    2929©fallthrough©   \\
    3030©fallthru©              \\
     
    3535©forall©                \\
    3636©ftype©                 \\
     37©lvalue©                \\
    3738©monitor©               \\
    38 ©mutex©                 \\
    3939\end{tabular}
    4040&
    4141\begin{tabular}{@{}l@{}}
     42©mutex©                 \\
    4243©one_t©                 \\
    4344©otype©                 \\
    4445©throw©                 \\
    4546©throwResume©   \\
    46 ©trait©                 \\
    4747\end{tabular}
    4848&
    4949\begin{tabular}{@{}l@{}}
     50©trait©                 \\
    5051©try©                   \\
    5152©ttype©                 \\
    5253©virtual©               \\
    5354©waitfor©               \\
    54 ©when©                  \\
    5555\end{tabular}
    5656&
    5757\begin{tabular}{@{}l@{}}
     58©when©                  \\
    5859©with©                  \\
    5960©zero_t©                \\
    60                                 \\
    6161                                \\
    6262                                \\
  • doc/user/user.tex

    r32cab5b rb2fe1c9  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat Apr 14 19:04:30 2018
    14 %% Update Count     : 3318
     13%% Last Modified On : Tue Feb 13 08:31:21 2018
     14%% Update Count     : 3161
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    283283
    284284double key = 5.0, vals[10] = { /* 10 sorted floating values */ };
    285 double * val = (double *)bsearch( &key, vals, 10, sizeof(vals[0]), comp );      §\C{// search sorted array}§
     285double * val = (double *)bsearch( &key, vals, 10, sizeof(vals[0]), comp );      $\C{// search sorted array}$
    286286\end{lstlisting}
    287287which can be augmented simply with a polymorphic, type-safe, \CFA-overloaded wrappers:
     
    292292
    293293forall( otype T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t size ) {
    294         T * result = bsearch( key, arr, size ); §\C{// call first version}§
    295         return result ? result - arr : size; }  §\C{// pointer subtraction includes sizeof(T)}§
    296 
    297 double * val = bsearch( 5.0, vals, 10 );        §\C{// selection based on return type}§
     294        T * result = bsearch( key, arr, size ); $\C{// call first version}$
     295        return result ? result - arr : size; }  $\C{// pointer subtraction includes sizeof(T)}$
     296
     297double * val = bsearch( 5.0, vals, 10 );        $\C{// selection based on return type}$
    298298int posn = bsearch( 5.0, vals, 10 );
    299299\end{lstlisting}
     
    353353The 1999 C standard plus GNU extensions.
    354354\item
    355 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]@-fgnu89-inline@}}
     355\Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}}
    356356Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files.
    357357\end{description}
     
    506506
    507507C, \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.
    508 \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$.
     508\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$.
    509509The 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)©.
    510510
     
    524524
    525525
    526 \section{\texorpdfstring{Labelled \protect\lstinline@continue@ / \protect\lstinline@break@}{Labelled continue / break}}
     526\section{\texorpdfstring{Labelled \LstKeywordStyle{continue} / \LstKeywordStyle{break}}{Labelled continue / break}}
    527527
    528528While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure.
    529529Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting.
    530 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.
     530To 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.
    531531For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement;
    532532for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement.
     
    613613\end{figure}
    614614
    615 Both labelled ©continue© and ©break© are a ©goto©\index{goto@\lstinline@goto@!restricted} restricted in the following ways:
     615Both labelled ©continue© and ©break© are a ©goto©\index{goto@\lstinline $goto$!restricted} restricted in the following ways:
    616616\begin{itemize}
    617617\item
     
    629629
    630630
    631 \section{\texorpdfstring{\protect\lstinline@switch@ Statement}{switch Statement}}
     631\section{\texorpdfstring{\LstKeywordStyle{switch} Statement}{switch Statement}}
    632632
    633633C allows a number of questionable forms for the ©switch© statement:
     
    834834
    835835
    836 \section{\texorpdfstring{\protect\lstinline@case@ Clause}{case Clause}}
     836\section{\texorpdfstring{\LstKeywordStyle{case} Clause}{case Clause}}
    837837
    838838C restricts the ©case© clause of a ©switch© statement to a single value.
     
    871871\end{tabular}
    872872\end{cquote}
    873 In addition, subranges are allowed to specify case values.\footnote{
    874 gcc has the same mechanism but awkward syntax, \lstinline@2 ...42@, because a space is required after a number, otherwise the period is a decimal point.}
     873In addition, two forms of subranges are allowed to specify case values: a new \CFA form and an existing GNU C form.\footnote{
     874The GNU C form \emph{requires} spaces around the ellipse.}
     875\begin{cquote}
     876\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
     877\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{GNU C}}     \\
    875878\begin{cfa}
    876879switch ( i ) {
    877   case ®1~5:®                                   §\C{// 1, 2, 3, 4, 5}§
     880  case ®1~5:®
    878881        ...
    879   case ®10~15:®                                 §\C{// 10, 11, 12, 13, 14, 15}§
     882  case ®10~15:®
    880883        ...
    881884}
    882885\end{cfa}
     886&
     887\begin{cfa}
     888switch ( i )
     889  case ®1 ... 5®:
     890        ...
     891  case ®10 ... 15®:
     892        ...
     893}
     894\end{cfa}
     895&
     896\begin{cfa}
     897
     898// 1, 2, 3, 4, 5
     899
     900// 10, 11, 12, 13, 14, 15
     901
     902
     903\end{cfa}
     904\end{tabular}
     905\end{cquote}
    883906Lists of subranges are also allowed.
    884907\begin{cfa}
     
    887910
    888911
    889 \section{\texorpdfstring{\protect\lstinline@with@ Statement}{with Statement}}
    890 \label{s:WithStatement}
    891 
    892 Grouping heterogeneous data into \newterm{aggregate}s (structure/union) is a common programming practice, and an aggregate can be further organized into more complex structures, such as arrays and containers:
    893 \begin{cfa}
    894 struct S {                                                                      §\C{// aggregate}§
    895         char c;                                                                 §\C{// fields}§
    896         int i;
    897         double d;
    898 };
    899 S s, as[10];
    900 \end{cfa}
    901 However, functions manipulating aggregates must repeat the aggregate name to access its containing fields:
    902 \begin{cfa}
    903 void f( S s ) {
    904         `s.`c; `s.`i; `s.`d;                                    §\C{// access containing fields}§
    905 }
    906 \end{cfa}
    907 which extends to multiple levels of qualification for nested aggregates.
    908 A similar situation occurs in object-oriented programming, \eg \CC:
    909 \begin{C++}
    910 struct S {
    911         char c;                                                                 §\C{// fields}§
    912         int i;
    913         double d;
    914         void f() {                                                              §\C{// implicit ``this'' aggregate}§
    915                 `this->`c; `this->`i; `this->`d;        §\C{// access containing fields}§
    916         }
    917 }
    918 \end{C++}
    919 Object-oriented nesting of member functions in a \lstinline[language=C++]@class/struct@ allows eliding \lstinline[language=C++]$this->$ because of lexical scoping.
    920 However, for other aggregate parameters, qualification is necessary:
    921 \begin{cfa}
    922 struct T { double m, n; };
    923 int S::f( T & t ) {                                                     §\C{// multiple aggregate parameters}§
    924         c; i; d;                                                                §\C{\color{red}// this--{\textgreater}.c, this--{\textgreater}.i, this--{\textgreater}.d}§
    925         `t.`m; `t.`n;                                                   §\C{// must qualify}§
    926 }
    927 \end{cfa}
    928 
    929 To simplify the programmer experience, \CFA provides a @with@ statement (see Pascal~\cite[\S~4.F]{Pascal}) to elide aggregate qualification to fields by opening a scope containing the field identifiers.
    930 Hence, the qualified fields become variables with the side-effect that it is easier to optimizing field references in a block.
    931 \begin{cfa}
    932 void f( S & this ) `with ( this )` {            §\C{// with statement}§
    933         c; i; d;                                                                §\C{\color{red}// this.c, this.i, this.d}§
    934 }
    935 \end{cfa}
    936 with the generality of opening multiple aggregate-parameters:
    937 \begin{cfa}
    938 void f( S & s, T & t ) `with ( s, t )` {                §\C{// multiple aggregate parameters}§
    939         c; i; d;                                                                §\C{\color{red}// s.c, s.i, s.d}§
    940         m; n;                                                                   §\C{\color{red}// t.m, t.n}§
    941 }
    942 \end{cfa}
    943 
    944 In detail, the @with@ statement has the form:
    945 \begin{cfa}
    946 §\emph{with-statement}§:
    947         'with' '(' §\emph{expression-list}§ ')' §\emph{compound-statement}§
    948 \end{cfa}
    949 and may appear as the body of a function or nested within a function body.
    950 Each expression in the expression-list provides a type and object.
    951 The type must be an aggregate type.
    952 (Enumerations are already opened.)
    953 The object is the implicit qualifier for the open structure-fields.
    954 
    955 All expressions in the expression list are open in parallel within the compound statement.
    956 This semantic is different from Pascal, which nests the openings from left to right.
    957 The difference between parallel and nesting occurs for fields with the same name and type:
    958 \begin{cfa}
    959 struct S { int `i`; int j; double m; } s, w;
    960 struct T { int `i`; int k; int m; } t, w;
    961 with ( s, t ) {
    962         j + k;                                                                  §\C{// unambiguous, s.j + t.k}§
    963         m = 5.0;                                                                §\C{// unambiguous, t.m = 5.0}§
    964         m = 1;                                                                  §\C{// unambiguous, s.m = 1}§
    965         int a = m;                                                              §\C{// unambiguous, a = s.i }§
    966         double b = m;                                                   §\C{// unambiguous, b = t.m}§
    967         int c = s.i + t.i;                                              §\C{// unambiguous, qualification}§
    968         (double)m;                                                              §\C{// unambiguous, cast}§
    969 }
    970 \end{cfa}
    971 For parallel semantics, both @s.i@ and @t.i@ are visible, so @i@ is ambiguous without qualification;
    972 for nested semantics, @t.i@ hides @s.i@, so @i@ implies @t.i@.
    973 \CFA's ability to overload variables means fields with the same name but different types are automatically disambiguated, eliminating most qualification when opening multiple aggregates.
    974 Qualification or a cast is used to disambiguate.
    975 
    976 There is an interesting problem between parameters and the function-body @with@, \eg:
    977 \begin{cfa}
    978 void ?{}( S & s, int i ) with ( s ) {           §\C{// constructor}§
    979         `s.i = i;`  j = 3;  m = 5.5;                    §\C{// initialize fields}§
    980 }
    981 \end{cfa}
    982 Here, the assignment @s.i = i@ means @s.i = s.i@, which is meaningless, and there is no mechanism to qualify the parameter @i@, making the assignment impossible using the function-body @with@.
    983 To solve this problem, parameters are treated like an initialized aggregate:
    984 \begin{cfa}
    985 struct Params {
    986         S & s;
    987         int i;
    988 } params;
    989 \end{cfa}
    990 and implicitly opened \emph{after} a function-body open, to give them higher priority:
    991 \begin{cfa}
    992 void ?{}( S & s, int `i` ) with ( s ) `with( §\emph{\color{red}params}§ )` {
    993         s.i = `i`; j = 3; m = 5.5;
    994 }
    995 \end{cfa}
    996 Finally, a cast may be used to disambiguate among overload variables in a @with@ expression:
    997 \begin{cfa}
    998 with ( w ) { ... }                                                      §\C{// ambiguous, same name and no context}§
    999 with ( (S)w ) { ... }                                           §\C{// unambiguous, cast}§
    1000 \end{cfa}
    1001 and @with@ expressions may be complex expressions with type reference (see Section~\ref{s:References}) to aggregate:
    1002 % \begin{cfa}
    1003 % struct S { int i, j; } sv;
    1004 % with ( sv ) {                                                         §\C{// implicit reference}§
    1005 %       S & sr = sv;
    1006 %       with ( sr ) {                                                   §\C{// explicit reference}§
    1007 %               S * sp = &sv;
    1008 %               with ( *sp ) {                                          §\C{// computed reference}§
    1009 %                       i = 3; j = 4;                                   §\C{\color{red}// sp--{\textgreater}i, sp--{\textgreater}j}§
    1010 %               }
    1011 %               i = 2; j = 3;                                           §\C{\color{red}// sr.i, sr.j}§
    1012 %       }
    1013 %       i = 1; j = 2;                                                   §\C{\color{red}// sv.i, sv.j}§
    1014 % }
    1015 % \end{cfa}
     912\section{\texorpdfstring{\LstKeywordStyle{with} Clause / Statement}{with Clause / Statement}}
     913\label{s:WithClauseStatement}
    1016914
    1017915In \Index{object-oriented} programming, there is an implicit first parameter, often names \textbf{©self©} or \textbf{©this©}, which is elided.
     
    1037935\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.
    1038936\begin{cfa}
    1039 int mem( S & this ) ®with( this )® { §\C{// with clause}§
     937int mem( S & this ) ®with this® { §\C{// with clause}§
    1040938        i = 1;                                          §\C{\color{red}// this.i}§
    1041939        j = 2;                                          §\C{\color{red}// this.j}§
     
    1045943\begin{cfa}
    1046944struct T { double m, n; };
    1047 int mem2( S & this1, T & this2 ) ®with( this1, this2 )® {
     945int mem2( S & this1, T & this2 ) ®with this1, this2® {
    1048946        i = 1; j = 2;
    1049947        m = 1.0; n = 2.0;
     
    1056954        struct S1 { ... } s1;
    1057955        struct S2 { ... } s2;
    1058         ®with( s1 )® {                          §\C{// with statement}§
     956        ®with s1® {                                     §\C{// with statement}§
    1059957                // access fields of s1 without qualification
    1060958                ®with s2® {                             §\C{// nesting}§
     
    1073971struct S { int i; int j; double m; } a, c;
    1074972struct T { int i; int k; int m } b, c;
    1075 with( a, b )
    1076 {
    1077 }
    1078 \end{cfa}
    1079 
    1080 \begin{comment}
     973®with a, b® {
     974        j + k;                                          §\C{// unambiguous, unique names define unique types}§
     975        i;                                                      §\C{// ambiguous, same name and type}§
     976        a.i + b.i;                                      §\C{// unambiguous, qualification defines unique names}§
     977        m;                                                      §\C{// ambiguous, same name and no context to define unique type}§
     978        m = 5.0;                                        §\C{// unambiguous, same name and context defines unique type}§
     979        m = 1;                                          §\C{// unambiguous, same name and context defines unique type}§
     980}
     981®with c® { ... }                                §\C{// ambiguous, same name and no context}§
     982®with (S)c® { ... }                             §\C{// unambiguous, same name and cast defines unique type}§
     983\end{cfa}
     984
    1081985The components in the "with" clause
    1082986
     
    11031007the "with" to be implemented because I hate having to type all those object
    11041008names for fields. It's a great way to drive people away from the language.
    1105 \end{comment}
    11061009
    11071010
     
    16921595
    16931596\item
    1694 lvalue to reference conversion: \lstinline[deletekeywords=lvalue]@lvalue-type cv1 T@ converts to ©cv2 T &©, which allows implicitly converting variables to references.
     1597lvalue to reference conversion: \lstinline[deletekeywords=lvalue]$lvalue-type cv1 T$ converts to ©cv2 T &©, which allows implicitly converting variables to references.
    16951598\begin{cfa}
    16961599int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &)
     
    64586361
    64596362
    6460 \section{Time}
    6461 \label{s:TimeLib}
    6462 
    6463 
    6464 %\subsection{\texorpdfstring{\protect\lstinline@Duration@}{Duration}}
    6465 \subsection{\texorpdfstring{\LstKeywordStyle{\textmd{Duration}}}{Duration}}
    6466 \label{s:Duration}
    6467 
    6468 \leavevmode
    6469 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6470 struct Duration {
    6471         int64_t tv;                                                     §\C{// nanoseconds}§
    6472 };
    6473 
    6474 void ?{}( Duration & dur );
    6475 void ?{}( Duration & dur, zero_t );
    6476 
    6477 Duration ?=?( Duration & dur, zero_t );
    6478 
    6479 Duration +?( Duration rhs );
    6480 Duration ?+?( Duration & lhs, Duration rhs );
    6481 Duration ?+=?( Duration & lhs, Duration rhs );
    6482 
    6483 Duration -?( Duration rhs );
    6484 Duration ?-?( Duration & lhs, Duration rhs );
    6485 Duration ?-=?( Duration & lhs, Duration rhs );
    6486 
    6487 Duration ?*?( Duration lhs, int64_t rhs );
    6488 Duration ?*?( int64_t lhs, Duration rhs );
    6489 Duration ?*=?( Duration & lhs, int64_t rhs );
    6490 
    6491 int64_t ?/?( Duration lhs, Duration rhs );
    6492 Duration ?/?( Duration lhs, int64_t rhs );
    6493 Duration ?/=?( Duration & lhs, int64_t rhs );
    6494 double div( Duration lhs, Duration rhs );
    6495 
    6496 Duration ?%?( Duration lhs, Duration rhs );
    6497 Duration ?%=?( Duration & lhs, Duration rhs );
    6498 
    6499 _Bool ?==?( Duration lhs, Duration rhs );
    6500 _Bool ?!=?( Duration lhs, Duration rhs );
    6501 _Bool ?<? ( Duration lhs, Duration rhs );
    6502 _Bool ?<=?( Duration lhs, Duration rhs );
    6503 _Bool ?>? ( Duration lhs, Duration rhs );
    6504 _Bool ?>=?( Duration lhs, Duration rhs );
    6505 
    6506 _Bool ?==?( Duration lhs, zero_t );
    6507 _Bool ?!=?( Duration lhs, zero_t );
    6508 _Bool ?<? ( Duration lhs, zero_t );
    6509 _Bool ?<=?( Duration lhs, zero_t );
    6510 _Bool ?>? ( Duration lhs, zero_t );
    6511 _Bool ?>=?( Duration lhs, zero_t );
    6512 
    6513 Duration abs( Duration rhs );
    6514 
    6515 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Duration dur );
    6516 
    6517 Duration ?`ns( int64_t nsec );
    6518 Duration ?`us( int64_t usec );
    6519 Duration ?`ms( int64_t msec );
    6520 Duration ?`s( int64_t sec );
    6521 Duration ?`s( double sec );
    6522 Duration ?`m( int64_t min );
    6523 Duration ?`m( double min );
    6524 Duration ?`h( int64_t hours );
    6525 Duration ?`h( double hours );
    6526 Duration ?`d( int64_t days );
    6527 Duration ?`d( double days );
    6528 Duration ?`w( int64_t weeks );
    6529 Duration ?`w( double weeks );
    6530 
    6531 int64_t ?`ns( Duration dur );
    6532 int64_t ?`us( Duration dur );
    6533 int64_t ?`ms( Duration dur );
    6534 int64_t ?`s( Duration dur );
    6535 int64_t ?`m( Duration dur );
    6536 int64_t ?`h( Duration dur );
    6537 int64_t ?`d( Duration dur );
    6538 int64_t ?`w( Duration dur );
    6539 \end{cfa}
    6540 
    6541 
    6542 %\subsection{\texorpdfstring{\protect\lstinline@\timeval@}{timeval}}
    6543 \subsection{\texorpdfstring{\LstKeywordStyle{\textmd{timeval}}}{timeval}}
    6544 \label{s:timeval}
    6545 
    6546 \leavevmode
    6547 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6548 void ?{}( timeval & t );
    6549 void ?{}( timeval & t, time_t sec, suseconds_t usec );
    6550 void ?{}( timeval & t, time_t sec );
    6551 void ?{}( timeval & t, zero_t );
    6552 void ?{}( timeval & t, Time time );
    6553 
    6554 timeval ?=?( timeval & t, zero_t );
    6555 timeval ?+?( timeval & lhs, timeval rhs );
    6556 timeval ?-?( timeval & lhs, timeval rhs );
    6557 _Bool ?==?( timeval lhs, timeval rhs );
    6558 _Bool ?!=?( timeval lhs, timeval rhs );
    6559 \end{cfa}
    6560 
    6561 
    6562 \subsection{\texorpdfstring{\protect\lstinline@timespec@}{timespec}}
    6563 \label{s:timespec}
    6564 
    6565 \leavevmode
    6566 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6567 void ?{}( timespec & t );
    6568 void ?{}( timespec & t, time_t sec, __syscall_slong_t nsec );
    6569 void ?{}( timespec & t, time_t sec );
    6570 void ?{}( timespec & t, zero_t );
    6571 void ?{}( timespec & t, Time time );
    6572 
    6573 timespec ?=?( timespec & t, zero_t );
    6574 timespec ?+?( timespec & lhs, timespec rhs );
    6575 timespec ?-?( timespec & lhs, timespec rhs );
    6576 _Bool ?==?( timespec lhs, timespec rhs );
    6577 _Bool ?!=?( timespec lhs, timespec rhs );
    6578 \end{cfa}
    6579 
    6580 
    6581 \subsection{\texorpdfstring{\protect\lstinline@itimerval@}{itimerval}}
    6582 \label{s:itimerval}
    6583 
    6584 \leavevmode
    6585 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6586 void ?{}( itimerval & itv, Duration alarm );
    6587 void ?{}( itimerval & itv, Duration alarm, Duration interval );
    6588 \end{cfa}
    6589 
    6590 
    6591 \subsection{\texorpdfstring{\protect\lstinline@Time@}{Time}}
    6592 \label{s:Time}
    6593 
    6594 \leavevmode
    6595 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6596 struct Time {
    6597         uint64_t tv;                                            §\C{// nanoseconds since UNIX epoch}§
    6598 };
    6599 
    6600 void ?{}( Time & time );
    6601 void ?{}( Time & time, zero_t );
    6602 void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 );
    6603 Time ?=?( Time & time, zero_t );
    6604 
    6605 void ?{}( Time & time, timeval t );
    6606 Time ?=?( Time & time, timeval t );
    6607 
    6608 void ?{}( Time & time, timespec t );
    6609 Time ?=?( Time & time, timespec t );
    6610 
    6611 Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.tv + rhs.tv }; }
    6612 Time ?+?( Duration lhs, Time rhs ) { return rhs + lhs; }
    6613 Time ?+=?( Time & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; }
    6614 
    6615 Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.tv - rhs.tv }; }
    6616 Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tv - rhs.tv }; }
    6617 Time ?-=?( Time & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; }
    6618 _Bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; }
    6619 _Bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; }
    6620 _Bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; }
    6621 _Bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; }
    6622 _Bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; }
    6623 _Bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; }
    6624 
    6625 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Time time );
    6626 
    6627 char * yy_mm_dd( Time time, char * buf );
    6628 char * ?`ymd( Time time, char * buf ) { // short form
    6629         return yy_mm_dd( time, buf );
    6630 } // ymd
    6631 
    6632 char * mm_dd_yy( Time time, char * buf );
    6633 char * ?`mdy( Time time, char * buf ) { // short form
    6634         return mm_dd_yy( time, buf );
    6635 } // mdy
    6636 
    6637 char * dd_mm_yy( Time time, char * buf );
    6638 char * ?`dmy( Time time, char * buf ) { // short form
    6639         return dd_mm_yy( time, buf );;
    6640 } // dmy
    6641 
    6642 size_t strftime( char * buf, size_t size, const char * fmt, Time time );
    6643 \end{cfa}
    6644 
    6645 
    6646 \section{Clock}
    6647 
    6648 \subsection{C time}
    6649 \label{s:Ctime}
    6650 
    6651 \leavevmode
    6652 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6653 char * ctime( time_t tp );
    6654 char * ctime_r( time_t tp, char * buf );
    6655 tm * gmtime( time_t tp );
    6656 tm * gmtime_r( time_t tp, tm * result );
    6657 tm * localtime( time_t tp );
    6658 tm * localtime_r( time_t tp, tm * result );
    6659 \end{cfa}
    6660 
    6661 
    6662 %\subsection{\texorpdfstring{\protect\lstinline@Clock@}{Clock}}
    6663 \subsection{\texorpdfstring{\LstKeywordStyle{\textmd{Clock}}}{Clock}}
    6664 \label{s:Clock}
    6665 
    6666 \leavevmode
    6667 \begin{cfa}[aboveskip=0pt,belowskip=0pt]
    6668 struct Clock {
    6669         Duration offset;                                        §\C{// for virtual clock: contains offset from real-time}§
    6670         int clocktype;                                          §\C{// implementation only -1 (virtual), CLOCK\_REALTIME}§
    6671 };
    6672 
    6673 void resetClock( Clock & clk );
    6674 void resetClock( Clock & clk, Duration adj );
    6675 void ?{}( Clock & clk );
    6676 void ?{}( Clock & clk, Duration adj );
    6677 Duration getRes();
    6678 Time getTimeNsec();                                             §\C{// with nanoseconds}§
    6679 Time getTime();                                                 §\C{// without nanoseconds}§
    6680 Time getTime( Clock & clk );
    6681 Time ?()( Clock & clk );
    6682 timeval getTime( Clock & clk );
    6683 tm getTime( Clock & clk );
    6684 \end{cfa}
    6685 
    6686 
    66876363\section{Multi-precision Integers}
    66886364\label{s:MultiPrecisionIntegers}
     
    69826658\end{cfa}
    69836659
     6660
    69846661\bibliographystyle{plain}
    69856662\bibliography{pl}
  • src/CodeGen/CodeGenerator.cc

    r32cab5b rb2fe1c9  
    203203
    204204        void CodeGenerator::handleAggregate( AggregateDecl * aggDecl, const std::string & kind ) {
     205                genAttributes( aggDecl->get_attributes() );
     206
    205207                if( ! aggDecl->get_parameters().empty() && ! genC ) {
    206208                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
     
    211213                }
    212214
    213                 output << kind;
    214                 genAttributes( aggDecl->get_attributes() );
    215                 output << aggDecl->get_name();
     215                output << kind << aggDecl->get_name();
    216216
    217217                if ( aggDecl->has_body() ) {
     
    298298                        output << " }";
    299299                }
    300         }
    301 
    302         void CodeGenerator::postvisit( StaticAssertDecl * assertDecl ) {
    303                 output << "_Static_assert(";
    304                 assertDecl->condition->accept( *visitor );
    305                 output << ", ";
    306                 assertDecl->message->accept( *visitor );
    307                 output << ")";
    308300        }
    309301
     
    936928                        output << "continue";
    937929                        break;
    938                   case BranchStmt::FallThrough:
    939                   case BranchStmt::FallThroughDefault:
    940                         assertf( ! genC, "fallthru should not reach code generation." );
    941                   output << "fallthru";
    942                         break;
    943930                } // switch
    944                 // print branch target for labelled break/continue/fallthru in debug mode
    945                 if ( ! genC && branchStmt->get_type() != BranchStmt::Goto ) {
    946                         if ( ! branchStmt->get_target().empty() ) {
    947                                 output << " " << branchStmt->get_target();
    948                         } else if ( branchStmt->get_type() == BranchStmt::FallThrough ) {
    949                                 output << " default";
    950                         }
    951                 }
    952931                output << ";";
    953932        }
  • src/CodeGen/CodeGenerator.h

    r32cab5b rb2fe1c9  
    4242                void postvisit( FunctionDecl * );
    4343                void postvisit( ObjectDecl * );
    44                 void postvisit( UnionDecl * aggregateDecl );
    45                 void postvisit( EnumDecl * aggregateDecl );
    46                 void postvisit( TraitDecl * aggregateDecl );
    47                 void postvisit( TypedefDecl * typeDecl );
    48                 void postvisit( TypeDecl * typeDecl );
    49                 void postvisit( StaticAssertDecl * assertDecl );
     44                void postvisit( UnionDecl *aggregateDecl );
     45                void postvisit( EnumDecl *aggregateDecl );
     46                void postvisit( TraitDecl *aggregateDecl );
     47                void postvisit( TypedefDecl *typeDecl );
     48                void postvisit( TypeDecl *typeDecl );
    5049
    5150                //*** Initializer
  • src/CodeGen/OperatorTable.cc

    r32cab5b rb2fe1c9  
    7979        } // namespace
    8080
    81         bool operatorLookup( const std::string & funcName, OperatorInfo & info ) {
     81        bool operatorLookup( std::string funcName, OperatorInfo &info ) {
    8282                static bool init = false;
    8383                if ( ! init ) {
     
    100100                        return true;
    101101                } // if
    102         }
    103 
    104         bool isOperator( const std::string & funcName ) {
    105                 OperatorInfo info;
    106                 return operatorLookup( funcName, info );
    107102        }
    108103
  • src/CodeGen/OperatorTable.h

    r32cab5b rb2fe1c9  
    4141        };
    4242
    43         bool isOperator( const std::string & funcName );
    44         bool operatorLookup( const std::string & funcName, OperatorInfo & info );
     43        bool operatorLookup( std::string funcName, OperatorInfo &info );
    4544
    4645        bool isConstructor( const std::string & );
  • src/Common/Debug.h

    r32cab5b rb2fe1c9  
    2828namespace Debug {
    2929        /// debug codegen a translation unit
    30         static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, __attribute__((unused)) LinkageSpec::Spec linkageFilter = LinkageSpec::Compiler ) {
     30        static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
    3131        #ifdef DEBUG
    3232                std::list< Declaration * > decls;
    3333
    34                 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
    35                         return ! (decl->linkage & linkageFilter);
     34                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
     35                        return ! LinkageSpec::isBuiltin( decl->get_linkage() );
    3636                });
    3737
    3838                std::cerr << "======" << label << "======" << std::endl;
    39                 CodeGen::generate( decls, std::cerr, true, true );
     39                CodeGen::generate( decls, std::cerr, false, true );
    4040        #endif
    4141        } // dump
    4242
    43         static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, __attribute__((unused)) LinkageSpec::Spec linkageFilter = LinkageSpec::Compiler ) {
     43        static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
    4444        #ifdef DEBUG
    4545                std::list< Declaration * > decls;
    4646
    47                 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
    48                         return ! (decl->linkage & linkageFilter);
     47                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
     48                        return ! LinkageSpec::isBuiltin( decl->get_linkage() );
    4949                });
    5050
  • src/Common/ErrorObjects.h

    r32cab5b rb2fe1c9  
    3535class SemanticErrorException : public std::exception {
    3636  public:
    37         SemanticErrorException() = default;
     37        SemanticErrorException() = default;
    3838        SemanticErrorException( CodeLocation location, std::string error );
    3939        ~SemanticErrorException() throw() {}
  • src/Common/PassVisitor.h

    r32cab5b rb2fe1c9  
    6666        virtual void visit( TypedefDecl * typeDecl ) override final;
    6767        virtual void visit( AsmDecl * asmDecl ) override final;
    68         virtual void visit( StaticAssertDecl * assertDecl ) override final;
    6968
    7069        virtual void visit( CompoundStmt * compoundStmt ) override final;
     
    162161        virtual Declaration * mutate( TypedefDecl * typeDecl ) override final;
    163162        virtual AsmDecl * mutate( AsmDecl * asmDecl ) override final;
    164         virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final;
    165163
    166164        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final;
  • src/Common/PassVisitor.impl.h

    r32cab5b rb2fe1c9  
    685685
    686686//--------------------------------------------------------------------------
    687 // StaticAssertDecl
    688 template< typename pass_type >
    689 void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) {
    690         VISIT_START( node );
    691 
    692         maybeAccept_impl( node->condition, *this );
    693         maybeAccept_impl( node->message  , *this );
    694 
    695         VISIT_END( node );
    696 }
    697 
    698 template< typename pass_type >
    699 StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) {
    700         MUTATE_START( node );
    701 
    702         maybeMutate_impl( node->condition, *this );
    703         maybeMutate_impl( node->message  , *this );
    704 
    705         MUTATE_END( StaticAssertDecl, node );
    706 }
    707 
    708 //--------------------------------------------------------------------------
    709687// CompoundStmt
    710688template< typename pass_type >
     
    15121490        indexerScopedAccept( node->result, *this );
    15131491        maybeAccept_impl   ( node->type  , *this );
     1492        maybeAccept_impl   ( node->member, *this );
    15141493
    15151494        VISIT_END( node );
     
    15231502        indexerScopedMutate( node->result, *this );
    15241503        maybeMutate_impl   ( node->type  , *this );
     1504        maybeMutate_impl   ( node->member, *this );
    15251505
    15261506        MUTATE_END( Expression, node );
  • src/Common/SemanticError.h

    r32cab5b rb2fe1c9  
    3838constexpr const char * const WarningFormats[] = {
    3939        "self assignment of expression: %s",
    40         "rvalue to reference conversion of rvalue: %s",
    4140};
    4241
    4342enum class Warning {
    4443        SelfAssignment,
    45         RvalueToReferenceConversion,
    4644        NUMBER_OF_WARNINGS, //This MUST be the last warning
    4745};
     
    5250);
    5351
    54 // ## used here to allow empty __VA_ARGS__
    55 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], ## __VA_ARGS__)
     52#define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id], __VA_ARGS__)
    5653
    5754void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
  • src/ControlStruct/ExceptTranslate.cc

    r32cab5b rb2fe1c9  
    3434#include "SynTree/Statement.h"        // for CompoundStmt, CatchStmt, ThrowStmt
    3535#include "SynTree/Type.h"             // for FunctionType, Type, noQualifiers
    36 #include "SynTree/DeclReplacer.h"     // for DeclReplacer
     36#include "SynTree/VarExprReplacer.h"  // for VarExprReplacer, VarExprReplace...
    3737#include "SynTree/Visitor.h"          // for acceptAll
    3838
     
    314314                        // Update variables in the body to point to this local copy.
    315315                        {
    316                                 DeclReplacer::DeclMap mapping;
     316                                VarExprReplacer::DeclMap mapping;
    317317                                mapping[ handler_decl ] = local_except;
    318                                 DeclReplacer::replace( handler->body, mapping );
     318                                VarExprReplacer::replace( handler->body, mapping );
    319319                        }
    320320
  • src/ControlStruct/MLEMutator.cc

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 17:08:25 2018
    13 // Update Count     : 219
     12// Last Modified On : Thu Aug  4 11:21:32 2016
     13// Update Count     : 202
    1414//
    1515
     
    3838        }
    3939        namespace {
    40                 bool isLoop( const MLEMutator::Entry & e ) { return dynamic_cast< WhileStmt * >( e.get_controlStructure() ) || dynamic_cast< ForStmt * >( e.get_controlStructure() ); }
    41                 bool isSwitch( const MLEMutator::Entry & e ) { return dynamic_cast< SwitchStmt *>( e.get_controlStructure() ); }
    42 
    43                 bool isBreakTarget( const MLEMutator::Entry & e ) { return isLoop( e ) || isSwitch( e ) || dynamic_cast< CompoundStmt *>( e.get_controlStructure() ); }
    44                 bool isContinueTarget( const MLEMutator::Entry & e ) { return isLoop( e ); }
    45                 bool isFallthroughTarget( const MLEMutator::Entry & e ) { return dynamic_cast< CaseStmt *>( e.get_controlStructure() );; }
    46                 bool isFallthroughDefaultTarget( const MLEMutator::Entry & e ) { return isSwitch( e ); }
    47         } // namespace
     40                Statement * isLoop( Statement * stmt ) { return dynamic_cast< WhileStmt * >( stmt ) ? stmt : dynamic_cast< ForStmt * >( stmt ) ? stmt : 0; }
     41        }
    4842
    4943        // break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
    5044        // through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the
    5145        // body of statements
    52         void MLEMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) {
    53                 SemanticErrorException errors;
    54 
     46        void MLEMutator::fixBlock( std::list< Statement * > &kids ) {
    5547                for ( std::list< Statement * >::iterator k = kids.begin(); k != kids.end(); k++ ) {
    56                         if ( caseClause ) {
    57                                 // once a label is seen, it's no longer a valid fallthrough target
    58                                 for ( Label & l : (*k)->labels ) {
    59                                         fallthroughLabels.erase( l );
    60                                 }
    61                         }
    62 
    63                         // aggregate errors since the PassVisitor mutate loop was unrollled
    64                         try {
    65                                 *k = (*k)->acceptMutator(*visitor);
    66                         } catch( SemanticErrorException &e ) {
    67                                 errors.append( e );
    68                         }
     48                        *k = (*k)->acceptMutator(*visitor);
    6949
    7050                        if ( ! get_breakLabel().empty() ) {
     
    7555                        } // if
    7656                } // for
    77 
    78                 if ( ! errors.isEmpty() ) {
    79                         throw errors;
    80                 }
    8157        }
    8258
     
    8763                        Label brkLabel = generator->newLabel("blockBreak", cmpndStmt);
    8864                        enclosingControlStructures.push_back( Entry( cmpndStmt, brkLabel ) );
    89                         GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
    9065                } // if
    9166
     
    9974                                set_breakLabel( enclosingControlStructures.back().useBreakExit() );
    10075                        } // if
     76                        enclosingControlStructures.pop_back();
    10177                } // if
    10278        }
     
    136112                                        if ( isContinue ) {
    137113                                                // continue target is outermost loop
    138                                                 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isContinueTarget );
     114                                                targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), [](Entry &e) { return isLoop( e.get_controlStructure() ); } );
    139115                                        } else {
    140                                                 // break target is outermost loop, switch, or block control structure
    141                                                 if ( enclosingControlStructures.empty() ) SemanticError( branchStmt->location, "'break' outside a loop, 'switch', or labelled block" );
    142                                                 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isBreakTarget );
     116                                                // break target is outmost control structure
     117                                                if ( enclosingControlStructures.empty() ) SemanticError( branchStmt->location, "'break' outside a loop, switch, or labelled block" );
     118                                                targetEntry = enclosingControlStructures.rbegin();
    143119                                        } // if
    144120                                } else {
     
    147123                                } // if
    148124                                // ensure that selected target is valid
    149                                 if ( targetEntry == enclosingControlStructures.rend() || (isContinue && ! isContinueTarget( *targetEntry ) ) ) {
     125                                if ( targetEntry == enclosingControlStructures.rend() || (isContinue && ! isLoop( targetEntry->get_controlStructure() ) ) ) {
    150126                                        SemanticError( branchStmt->location, toString( (isContinue ? "'continue'" : "'break'"), " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), originalTarget ) );
    151127                                } // if
    152128                                break;
    153129                        }
    154                         case BranchStmt::FallThrough:
    155                                 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isFallthroughTarget );
    156                                 // ensure that selected target is valid
    157                                 if ( targetEntry == enclosingControlStructures.rend() ) {
    158                                         SemanticError( branchStmt->location, "'fallthrough' must be enclosed in a 'switch' or 'choose'" );
    159                                 } // if
    160                                 if ( branchStmt->get_target() != "" ) {
    161                                         // labelled fallthrough
    162                                         // target must be in the set of valid fallthrough labels
    163                                         if ( ! fallthroughLabels.count( branchStmt->get_target() ) ) {
    164                                                 SemanticError( branchStmt->location, toString( "'fallthrough' target must be a later case statement: ", originalTarget ) );
    165                                         }
    166                                         return new BranchStmt( originalTarget, BranchStmt::Goto );
    167                                 }
    168                                 break;
    169                         case BranchStmt::FallThroughDefault: {
    170                                 // fallthrough default
    171                                 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isFallthroughDefaultTarget );
    172 
    173                                 // ensure that fallthrough is within a switch or choose
    174                                 if ( targetEntry == enclosingControlStructures.rend() ) {
    175                                         SemanticError( branchStmt->location, "'fallthrough' must be enclosed in a 'switch' or 'choose'" );
    176                                 } // if
    177 
    178                                 // ensure that switch or choose has a default clause
    179                                 SwitchStmt * switchStmt = strict_dynamic_cast< SwitchStmt * >( targetEntry->get_controlStructure() );
    180                                 bool foundDefault = false;
    181                                 for ( Statement * stmt : switchStmt->statements ) {
    182                                         CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
    183                                         if ( caseStmt->isDefault() ) {
    184                                                 foundDefault = true;
    185                                         } // if
    186                                 } // for
    187                                 if ( ! foundDefault ) {
    188                                         SemanticError( branchStmt->location, "'fallthrough default' must be enclosed in a 'switch' or 'choose' control structure with a 'default' clause" );
    189                                 }
    190                                 break;
    191                         }
    192 
    193130                        default:
    194131                                assert( false );
     
    206143                                exitLabel = targetEntry->useContExit();
    207144                                break;
    208                   case BranchStmt::FallThrough:
    209                                 assert( targetEntry->useFallExit() != "");
    210                                 exitLabel = targetEntry->useFallExit();
    211                                 break;
    212                   case BranchStmt::FallThroughDefault:
    213                                 assert( targetEntry->useFallDefaultExit() != "");
    214                                 exitLabel = targetEntry->useFallDefaultExit();
    215                                 // check that fallthrough default comes before the default clause
    216                                 if ( ! targetEntry->isFallDefaultValid() ) {
    217                                         SemanticError( branchStmt->location, "'fallthrough default' must precede the 'default' clause" );
    218                                 }
    219                                 break;
    220145                  default:
    221146                                assert(0);                                      // shouldn't be here
     
    262187                Label contLabel = generator->newLabel("loopContinue", loopStmt);
    263188                enclosingControlStructures.push_back( Entry( loopStmt, brkLabel, contLabel ) );
    264                 GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
    265189        }
    266190
     
    273197
    274198                // this will take the necessary steps to add definitions of the previous two labels, if they are used.
    275                 loopStmt->body = mutateLoop( loopStmt->get_body(), e );
     199                loopStmt->set_body( mutateLoop( loopStmt->get_body(), e ) );
     200                enclosingControlStructures.pop_back();
    276201                return loopStmt;
    277202        }
     
    299224                        Label brkLabel = generator->newLabel("blockBreak", ifStmt);
    300225                        enclosingControlStructures.push_back( Entry( ifStmt, brkLabel ) );
    301                         GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
    302226                } // if
    303227        }
     
    309233                                set_breakLabel( enclosingControlStructures.back().useBreakExit() );
    310234                        } // if
     235                        enclosingControlStructures.pop_back();
    311236                } // if
    312237                return ifStmt;
     
    315240        void MLEMutator::premutate( CaseStmt *caseStmt ) {
    316241                visit_children = false;
    317 
    318                 // mark default as seen before visiting its statements to catch default loops
    319                 if ( caseStmt->isDefault() ) {
    320                         enclosingControlStructures.back().seenDefault();
    321                 } // if
    322 
    323242                caseStmt->condition = maybeMutate( caseStmt->condition, *visitor );
    324                 Label fallLabel = generator->newLabel( "fallThrough", caseStmt );
    325                 {
    326                         // ensure that stack isn't corrupted by exceptions in fixBlock
    327                         auto guard = makeFuncGuard( [&]() { enclosingControlStructures.push_back( Entry( caseStmt, fallLabel ) ); }, [this]() { enclosingControlStructures.pop_back(); } );
    328 
    329                         // empty case statement
    330                         if( ! caseStmt->stmts.empty() ) {
    331                                 // the parser ensures that all statements in a case are grouped into a block
    332                                 CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
    333                                 fixBlock( block->kids, true );
    334 
    335                                 // add fallthrough label if necessary
    336                                 assert( ! enclosingControlStructures.empty() );
    337                                 if ( enclosingControlStructures.back().isFallUsed() ) {
    338                                         std::list<Label> ls{ enclosingControlStructures.back().useFallExit() };
    339                                         caseStmt->stmts.push_back( new NullStmt( ls ) );
    340                                 } // if
    341                         } // if
    342                 }
    343                 assert( ! enclosingControlStructures.empty() );
    344                 assertf( dynamic_cast<SwitchStmt *>( enclosingControlStructures.back().get_controlStructure() ), "Control structure enclosing a case clause must be a switch, but is: %s", toCString( enclosingControlStructures.back().get_controlStructure() ) );
    345                 if ( caseStmt->isDefault() ) {
    346                         if ( enclosingControlStructures.back().isFallDefaultUsed() ) {
    347                                 // add fallthrough default label if necessary
    348                                 std::list<Label> ls{ enclosingControlStructures.back().useFallDefaultExit() };
    349                                 caseStmt->stmts.push_front( new NullStmt( ls ) );
    350                         } // if
    351                 } // if
     243                fixBlock( caseStmt->stmts );
    352244        }
    353245
     
    355247                // generate a label for breaking out of a labeled switch
    356248                Label brkLabel = generator->newLabel("switchBreak", switchStmt);
    357                 auto it = std::find_if( switchStmt->statements.rbegin(), switchStmt->statements.rend(), [](Statement * stmt) {
    358                         CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
    359                         return caseStmt->isDefault();
    360                 });
    361                 CaseStmt * defaultCase = it != switchStmt->statements.rend() ? strict_dynamic_cast<CaseStmt *>( *it ) : nullptr;
    362                 Label fallDefaultLabel = defaultCase ? generator->newLabel( "fallThroughDefault", defaultCase ) : "";
    363                 enclosingControlStructures.push_back( Entry(switchStmt, brkLabel, fallDefaultLabel) );
    364                 GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
    365 
    366                 // Collect valid labels for fallthrough. This is initially all labels at the same level as a case statement.
    367                 // As labels are seen during traversal, they are removed, since fallthrough is not allowed to jump backwards.
    368                 for ( Statement * stmt : switchStmt->statements ) {
    369                         CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
    370                         if ( caseStmt->stmts.empty() ) continue;
    371                         CompoundStmt * block = dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
    372                         for ( Statement * stmt : block->kids ) {
    373                                 for ( Label & l : stmt->labels ) {
    374                                         fallthroughLabels.insert( l );
    375                                 }
    376                         }
    377                 }
     249                enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) );
    378250        }
    379251
     
    400272
    401273                assert ( enclosingControlStructures.back() == switchStmt );
     274                enclosingControlStructures.pop_back();
    402275                return switchStmt;
    403276        }
  • src/ControlStruct/MLEMutator.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 16:42:32 2018
    13 // Update Count     : 41
     12// Last Modified On : Sat Jul 22 09:19:59 2017
     13// Update Count     : 35
    1414//
    1515
     
    1919#include <map>                     // for map
    2020#include <string>                  // for string
    21 #include <set>                     // for unordered_set
    2221
    2322#include "Common/PassVisitor.h"
     
    3029        class LabelGenerator;
    3130
    32         class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting, public WithGuards {
     31        class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting {
     32                class Entry;
     33
    3334          public:
    34                 class Entry;
    3535                MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
    3636                ~MLEMutator();
     
    5252                Label &get_breakLabel() { return breakLabel; }
    5353                void set_breakLabel( Label newValue ) { breakLabel = newValue; }
    54 
     54          private:
    5555                class Entry {
    5656                  public:
    57                         // specialized constructors for each combination of statement with labelled break/continue/fallthrough that is valid to cleanup the use cases
    58                         explicit Entry( ForStmt *stmt, Label breakExit, Label contExit ) :
    59                                 stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {}
     57                        explicit Entry( Statement *_loop, Label _breakExit, Label _contExit = Label("") ) :
     58                                loop( _loop ), breakExit( _breakExit ), contExit( _contExit ), breakUsed(false), contUsed(false) {}
    6059
    61                         explicit Entry( WhileStmt *stmt, Label breakExit, Label contExit ) :
    62                                 stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {}
     60                        bool operator==( const Statement *stmt ) { return loop == stmt; }
     61                        bool operator!=( const Statement *stmt ) { return loop != stmt; }
    6362
    64                         explicit Entry( CompoundStmt *stmt, Label breakExit ) :
    65                                 stmt( stmt ), breakExit( breakExit ) {}
     63                        bool operator==( const Entry &other ) { return loop == other.get_controlStructure(); }
    6664
    67                         explicit Entry( IfStmt *stmt, Label breakExit ) :
    68                                 stmt( stmt ), breakExit( breakExit ) {}
    69 
    70                         explicit Entry( CaseStmt *stmt, Label fallExit ) :
    71                                 stmt( stmt ), fallExit( fallExit ) {}
    72 
    73                         explicit Entry( SwitchStmt *stmt, Label breakExit, Label fallDefaultExit ) :
    74                                 stmt( stmt ), breakExit( breakExit ), fallDefaultExit( fallDefaultExit ) {}
    75 
    76                         bool operator==( const Statement *other ) { return stmt == other; }
    77                         bool operator!=( const Statement *other ) { return stmt != other; }
    78 
    79                         bool operator==( const Entry &other ) { return stmt == other.get_controlStructure(); }
    80 
    81                         Statement *get_controlStructure() const { return stmt; }
     65                        Statement *get_controlStructure() const { return loop; }
    8266
    8367                        Label useContExit() { contUsed = true; return contExit; }
    8468                        Label useBreakExit() { breakUsed = true; return breakExit; }
    85                         Label useFallExit() { fallUsed = true; return fallExit; }
    86                         Label useFallDefaultExit() { fallDefaultUsed = true; return fallDefaultExit; }
    8769
    8870                        bool isContUsed() const { return contUsed; }
    8971                        bool isBreakUsed() const { return breakUsed; }
    90                         bool isFallUsed() const { return fallUsed; }
    91                         bool isFallDefaultUsed() const { return fallDefaultUsed; }
    92                         void seenDefault() { fallDefaultValid = false; }
    93                         bool isFallDefaultValid() const { return fallDefaultValid; }
    9472                  private:
    95                         Statement *stmt;
    96                         Label breakExit, contExit, fallExit, fallDefaultExit;
    97                         bool breakUsed = false, contUsed = false, fallUsed = false, fallDefaultUsed = false;
    98                         bool fallDefaultValid = true;
     73                        Statement *loop;
     74                        Label breakExit, contExit;
     75                        bool breakUsed, contUsed;
    9976                };
    10077
    101           private:
    10278                std::map< Label, Statement * > *targetTable;
    103                 std::set< Label > fallthroughLabels;
    10479                std::list< Entry > enclosingControlStructures;
    10580                Label breakLabel;
     
    11287                Statement * posthandleLoopStmt( LoopClass * loopStmt );
    11388
    114                 void fixBlock( std::list< Statement * > &kids, bool caseClause = false );
     89                void fixBlock( std::list< Statement * > &kids );
    11590        };
    11691} // namespace ControlStruct
  • src/GenPoly/GenPoly.cc

    r32cab5b rb2fe1c9  
    100100                if ( dynamic_cast< TypeInstType * >( type ) ) {
    101101                        return type;
    102                 } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
    103                         return isPolyType( arrayType->base, env );
    104102                } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
    105103                        if ( hasPolyParams( structType->get_parameters(), env ) ) return type;
     
    117115                                return type;
    118116                        }
    119                 } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
    120                         return isPolyType( arrayType->base, tyVars, env );
    121117                } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
    122118                        if ( hasPolyParams( structType->get_parameters(), tyVars, env ) ) return type;
  • src/GenPoly/Lvalue.cc

    r32cab5b rb2fe1c9  
    4545                Expression * mkDeref( Expression * arg ) {
    4646                        if ( SymTab::dereferenceOperator ) {
    47                                 // note: reference depth can be arbitrarily deep here, so peel off the outermost pointer/reference, not just pointer because they are effecitvely equivalent in this pass
    4847                                VariableExpr * deref = new VariableExpr( SymTab::dereferenceOperator );
    4948                                deref->result = new PointerType( Type::Qualifiers(), deref->result );
     
    6059                }
    6160
    62                 struct ReferenceConversions final : public WithStmtsToAdd {
     61                struct ReferenceConversions final {
    6362                        Expression * postmutate( CastExpr * castExpr );
    6463                        Expression * postmutate( AddressExpr * addrExpr );
     
    115114        }
    116115
    117         void convertLvalue( std::list< Declaration* > & translationUnit ) {
     116        void convertLvalue( std::list< Declaration* >& translationUnit ) {
    118117                PassVisitor<ReferenceConversions> refCvt;
    119118                PassVisitor<ReferenceTypeElimination> elim;
     
    151150                                        // use type of return variable rather than expr result type, since it may have been changed to a pointer type
    152151                                        FunctionType * ftype = GenPoly::getFunctionType( func->get_type() );
    153                                         Type * ret = ftype->returnVals.empty() ? nullptr : ftype->returnVals.front()->get_type();
    154                                         return func->linkage == LinkageSpec::Intrinsic && dynamic_cast<ReferenceType *>( ret );
     152                                        Type * ret = ftype->get_returnVals().empty() ? nullptr : ftype->get_returnVals().front()->get_type();
     153                                        return func->get_linkage() == LinkageSpec::Intrinsic && dynamic_cast<ReferenceType *>( ret );
    155154                                }
    156155                        }
     
    161160                        if ( isIntrinsicReference( appExpr ) ) {
    162161                                // eliminate reference types from intrinsic applications - now they return lvalues
    163                                 Type * result = appExpr->result;
    164                                 appExpr->result = result->stripReferences()->clone();
    165                                 appExpr->result->set_lvalue( true );
     162                                Type * result = appExpr->get_result();
     163                                appExpr->set_result( result->stripReferences()->clone() );
     164                                appExpr->get_result()->set_lvalue( true );
    166165                                if ( ! inIntrinsic ) {
    167166                                        // when not in an intrinsic function, add a cast to
    168167                                        // don't add cast when in an intrinsic function, since they already have the cast
    169168                                        Expression * ret = new CastExpr( appExpr, result );
    170                                         std::swap( ret->env, appExpr->env );
     169                                        ret->set_env( appExpr->get_env() );
     170                                        appExpr->set_env( nullptr );
    171171                                        return ret;
    172172                                }
     
    187187                                assertf( ftype, "Function declaration does not have function type." );
    188188                                // can be of differing lengths only when function is variadic
    189                                 assertf( ftype->parameters.size() == appExpr->args.size() || ftype->isVarArgs, "ApplicationExpr args do not match formal parameter type." );
     189                                assertf( ftype->get_parameters().size() == appExpr->get_args().size() || ftype->get_isVarArgs(), "ApplicationExpr args do not match formal parameter type." );
    190190
    191191
    192192                                unsigned int i = 0;
    193                                 const unsigned int end = ftype->parameters.size();
    194                                 for ( auto p : unsafe_group_iterate( appExpr->args, ftype->parameters ) ) {
     193                                const unsigned int end = ftype->get_parameters().size();
     194                                for ( auto p : unsafe_group_iterate( appExpr->get_args(), ftype->get_parameters() ) ) {
    195195                                        if (i == end) break;
    196196                                        Expression *& arg = std::get<0>( p );
     
    198198                                        PRINT(
    199199                                                std::cerr << "pair<0>: " << arg << std::endl;
    200                                                 std::cerr << " -- " << arg->result << std::endl;
    201200                                                std::cerr << "pair<1>: " << formal << std::endl;
    202201                                        )
    203202                                        if ( dynamic_cast<ReferenceType*>( formal ) ) {
    204                                                 PRINT(
    205                                                         std::cerr << "===formal is reference" << std::endl;
    206                                                 )
    207                                                 // TODO: it's likely that the second condition should be ... && ! isIntrinsicReference( arg ), but this requires investigation.
    208                                                 if ( function->get_linkage() != LinkageSpec::Intrinsic && isIntrinsicReference( arg ) ) {
    209                                                         // if argument is dereference or array subscript, the result isn't REALLY a reference, but non-intrinsic functions expect a reference: take address
    210                                                         PRINT(
    211                                                                 std::cerr << "===is intrinsic arg in non-intrinsic call - adding address" << std::endl;
    212                                                         )
    213                                                         arg = new AddressExpr( arg );
    214                                                 } else if ( function->get_linkage() == LinkageSpec::Intrinsic && arg->result->referenceDepth() != 0 ) {
    215                                                         // argument is a 'real' reference, but function expects a C lvalue: add a dereference to the reference-typed argument
    216                                                         PRINT(
    217                                                                 std::cerr << "===is non-intrinsic arg in intrinsic call - adding deref to arg" << std::endl;
    218                                                         )
    219                                                         Type * baseType = InitTweak::getPointerBase( arg->result );
    220                                                         assertf( baseType, "parameter is reference, arg must be pointer or reference: %s", toString( arg->result ).c_str() );
     203                                                if ( isIntrinsicReference( arg ) ) { // do not combine conditions, because that changes the meaning of the else if
     204                                                        if ( function->get_linkage() != LinkageSpec::Intrinsic ) { // intrinsic functions that turn pointers into references
     205                                                                // if argument is dereference or array subscript, the result isn't REALLY a reference, so it's not necessary to fix the argument
     206                                                                PRINT(
     207                                                                        std::cerr << "===is intrinsic arg in non-intrinsic call - adding address" << std::endl;
     208                                                                )
     209                                                                arg = new AddressExpr( arg );
     210                                                        }
     211                                                } else if ( function->get_linkage() == LinkageSpec::Intrinsic ) {
     212                                                        // std::cerr << "===adding deref to arg" << std::endl;
     213                                                        // if the parameter is a reference, add a dereference to the reference-typed argument.
     214                                                        Type * baseType = InitTweak::getPointerBase( arg->get_result() );
     215                                                        assertf( baseType, "parameter is reference, arg must be pointer or reference: %s", toString( arg->get_result() ).c_str() );
    221216                                                        PointerType * ptrType = new PointerType( Type::Qualifiers(), baseType->clone() );
    222                                                         delete arg->result;
     217                                                        delete arg->get_result();
    223218                                                        arg->set_result( ptrType );
    224219                                                        arg = mkDeref( arg );
    225                                                         assertf( arg->result->referenceDepth() == 0, "Reference types should have been eliminated from intrinsic function calls, but weren't: %s", toCString( arg->result ) );
    226220                                                }
    227221                                        }
     
    255249                Expression * AddrRef::postmutate( AddressExpr * addrExpr ) {
    256250                        if ( refDepth == 0 ) {
    257                                 if ( ! isIntrinsicReference( addrExpr->arg ) ) {
     251                                if ( ! isIntrinsicReference( addrExpr->get_arg() ) ) {
    258252                                        // try to avoid ?[?]
    259                                         refDepth = addrExpr->arg->result->referenceDepth();
     253                                        refDepth = addrExpr->get_arg()->get_result()->referenceDepth();
    260254                                }
    261255                        }
     
    286280                        // pointer casts in the right places.
    287281
    288                         // Note: reference depth difference is the determining factor in what code is run, rather than whether something is
    289                         // reference type or not, since conversion still needs to occur when both types are references that differ in depth.
    290 
    291                         Type * destType = castExpr->result;
    292                         Type * srcType = castExpr->arg->result;
    293                         int depth1 = destType->referenceDepth();
    294                         int depth2 = srcType->referenceDepth();
    295                         int diff = depth1 - depth2;
    296 
    297                         if ( diff > 0 && ! srcType->get_lvalue() ) {
    298                                 // rvalue to reference conversion -- introduce temporary
    299                                 // know that reference depth of cast argument is 0, need to introduce n temporaries for reference depth of n, e.g.
    300                                 //   (int &&&)3;
    301                                 // becomes
    302                                 //   int __ref_tmp_0 = 3;
    303                                 //   int & __ref_tmp_1 = _&_ref_tmp_0;
    304                                 //   int && __ref_tmp_2 = &__ref_tmp_1;
    305                                 //   &__ref_tmp_2;
    306                                 // the last & comes from the remaining reference conversion code
    307                                 SemanticWarning( castExpr->arg->location, Warning::RvalueToReferenceConversion, toCString( castExpr->arg ) );
    308 
    309                                 static UniqueName tempNamer( "__ref_tmp_" );
    310                                 ObjectDecl * temp = ObjectDecl::newObject( tempNamer.newName(), castExpr->arg->result->clone(), new SingleInit( castExpr->arg ) );
    311                                 PRINT( std::cerr << "made temp: " << temp << std::endl; )
    312                                 stmtsToAddBefore.push_back( new DeclStmt( temp ) );
    313                                 for ( int i = 0; i < depth1-1; i++ ) { // xxx - maybe this should be diff-1? check how this works with reference type for srcType
    314                                         ObjectDecl * newTemp = ObjectDecl::newObject( tempNamer.newName(), new ReferenceType( Type::Qualifiers(), temp->type->clone() ), new SingleInit( new AddressExpr( new VariableExpr( temp ) ) ) );
    315                                         PRINT( std::cerr << "made temp" << i << ": " << newTemp << std::endl; )
    316                                         stmtsToAddBefore.push_back( new DeclStmt( newTemp ) );
    317                                         temp = newTemp;
    318                                 }
    319                                 // update diff so that remaining code works out correctly
    320                                 castExpr->arg = new VariableExpr( temp );
    321                                 PRINT( std::cerr << "update cast to: " << castExpr << std::endl; )
    322                                 srcType = castExpr->arg->result;
    323                                 depth2 = srcType->referenceDepth();
    324                                 diff = depth1 - depth2;
    325                                 assert( diff == 1 );
    326                         }
    327 
    328                         // handle conversion between different depths
    329                         PRINT (
    330                                 if ( depth1 || depth2 ) {
    331                                         std::cerr << "destType: " << destType << " / srcType: " << srcType << std::endl;
    332                                         std::cerr << "depth: " << depth1 << " / " << depth2 << std::endl;
    333                                 }
    334                         )
    335                         if ( diff > 0 ) {
    336                                 // conversion to type with more depth (e.g. int & -> int &&): add address-of for each level of difference
     282                        // conversion to reference type
     283                        if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( castExpr->get_result() ) ) {
     284                                (void)refType;
     285                                if ( ReferenceType * otherRef = dynamic_cast< ReferenceType * >( castExpr->get_arg()->get_result() ) ) {
     286                                        // nothing to do if casting from reference to reference.
     287                                        (void)otherRef;
     288                                        PRINT( std::cerr << "convert reference to reference -- nop" << std::endl; )
     289                                        if ( isIntrinsicReference( castExpr->get_arg() ) ) {
     290                                                Expression * callExpr = castExpr->get_arg();
     291                                                PRINT(
     292                                                        std::cerr << "but arg is deref -- &" << std::endl;
     293                                                        std::cerr << callExpr << std::endl;
     294                                                )
     295                                                callExpr = new AddressExpr( callExpr ); // this doesn't work properly for multiple casts
     296                                                delete callExpr->get_result();
     297                                                callExpr->set_result( refType->clone() );
     298                                                // move environment out to new top-level
     299                                                callExpr->set_env( castExpr->get_env() );
     300                                                castExpr->set_arg( nullptr );
     301                                                castExpr->set_env( nullptr );
     302                                                delete castExpr;
     303                                                return callExpr;
     304                                        }
     305                                        int depth1 = refType->referenceDepth();
     306                                        int depth2 = otherRef->referenceDepth();
     307                                        int diff = depth1-depth2;
     308                                        if ( diff == 0 ) {
     309                                                // conversion between references of the same depth
     310                                                assertf( depth1 == depth2, "non-intrinsic reference with cast of reference to reference not yet supported: %d %d %s", depth1, depth2, toString( castExpr ).c_str() );
     311                                                PRINT( std::cerr << castExpr << std::endl; )
     312                                                return castExpr;
     313                                        } else if ( diff < 0 ) {
     314                                                // conversion from reference to reference with less depth (e.g. int && -> int &): add dereferences
     315                                                Expression * ret = castExpr->arg;
     316                                                for ( int i = 0; i < diff; ++i ) {
     317                                                        ret = mkDeref( ret );
     318                                                }
     319                                                ret->env = castExpr->env;
     320                                                delete ret->result;
     321                                                ret->result = castExpr->result;
     322                                                ret->result->set_lvalue( true ); // ensure result is lvalue
     323                                                castExpr->env = nullptr;
     324                                                castExpr->arg = nullptr;
     325                                                castExpr->result = nullptr;
     326                                                delete castExpr;
     327                                                return ret;
     328                                        } else if ( diff > 0 ) {
     329                                                // conversion from reference to reference with more depth (e.g. int & -> int &&): add address-of
     330                                                Expression * ret = castExpr->arg;
     331                                                for ( int i = 0; i < diff; ++i ) {
     332                                                        ret = new AddressExpr( ret );
     333                                                }
     334                                                ret->env = castExpr->env;
     335                                                delete ret->result;
     336                                                ret->result = castExpr->result;
     337                                                castExpr->env = nullptr;
     338                                                castExpr->arg = nullptr;
     339                                                castExpr->result = nullptr;
     340                                                delete castExpr;
     341                                                return ret;
     342                                        }
     343
     344                                        assertf( depth1 == depth2, "non-intrinsic reference with cast of reference to reference not yet supported: %d %d %s", depth1, depth2, toString( castExpr ).c_str() );
     345                                        PRINT( std::cerr << castExpr << std::endl; )
     346                                        return castExpr;
     347                                } else if ( castExpr->arg->result->get_lvalue() ) {
     348                                        // conversion from lvalue to reference
     349                                        // xxx - keep cast, but turn into pointer cast??
     350                                        // xxx - memory
     351                                        PRINT(
     352                                                std::cerr << "convert lvalue to reference -- &" << std::endl;
     353                                                std::cerr << castExpr->arg << std::endl;
     354                                        )
     355                                        AddressExpr * ret = new AddressExpr( castExpr->arg );
     356                                        if ( refType->base->get_qualifiers() != castExpr->arg->result->get_qualifiers() ) {
     357                                                // must keep cast if cast-to type is different from the actual type
     358                                                castExpr->arg = ret;
     359                                                return castExpr;
     360                                        }
     361                                        ret->env = castExpr->env;
     362                                        delete ret->result;
     363                                        ret->result = castExpr->result;
     364                                        castExpr->env = nullptr;
     365                                        castExpr->arg = nullptr;
     366                                        castExpr->result = nullptr;
     367                                        delete castExpr;
     368                                        return ret;
     369                                } else {
     370                                        // rvalue to reference conversion -- introduce temporary
     371                                }
     372                                assertf( false, "Only conversions to reference from lvalue are currently supported: %s", toString( castExpr ).c_str() );
     373                        } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( castExpr->arg->result ) ) {
     374                                (void)refType;
     375                                // conversion from reference to rvalue
     376                                PRINT(
     377                                        std::cerr << "convert reference to rvalue -- *" << std::endl;
     378                                        std::cerr << "was = " << castExpr << std::endl;
     379                                )
    337380                                Expression * ret = castExpr->arg;
    338                                 for ( int i = 0; i < diff; ++i ) {
    339                                         ret = new AddressExpr( ret );
    340                                 }
    341                                 if ( srcType->get_lvalue() && srcType->get_qualifiers() != strict_dynamic_cast<ReferenceType *>( destType )->base->get_qualifiers() ) {
    342                                         // must keep cast if cast-to type is different from the actual type
    343                                         castExpr->arg = ret;
    344                                         return castExpr;
    345                                 }
    346                                 ret->env = castExpr->env;
    347                                 delete ret->result;
    348                                 ret->result = castExpr->result;
    349                                 castExpr->env = nullptr;
    350                                 castExpr->arg = nullptr;
    351                                 castExpr->result = nullptr;
    352                                 delete castExpr;
    353                                 return ret;
    354                         } else if ( diff < 0 ) {
    355                                 // conversion to type with less depth (e.g. int && -> int &): add dereferences for each level of difference
    356                                 diff = -diff; // care only about magnitude now
    357                                 Expression * ret = castExpr->arg;
    358                                 for ( int i = 0; i < diff; ++i ) {
     381                                TypeSubstitution * env = castExpr->env;
     382                                castExpr->set_env( nullptr );
     383                                if ( ! isIntrinsicReference( ret ) ) {
     384                                        // dereference if not already dereferenced
    359385                                        ret = mkDeref( ret );
    360386                                }
    361                                 if ( ! ResolvExpr::typesCompatibleIgnoreQualifiers( destType->stripReferences(), srcType->stripReferences(), SymTab::Indexer() ) ) {
     387                                if ( ResolvExpr::typesCompatibleIgnoreQualifiers( castExpr->result, castExpr->arg->result->stripReferences(), SymTab::Indexer() ) ) {
     388                                        // can remove cast if types are compatible, changing expression type to value type
     389                                        ret->result = castExpr->result->clone();
     390                                        ret->result->set_lvalue( true );  // ensure result is lvalue
     391                                        castExpr->arg = nullptr;
     392                                        delete castExpr;
     393                                } else {
    362394                                        // must keep cast if types are different
    363395                                        castExpr->arg = ret;
    364                                         return castExpr;
    365                                 }
    366                                 ret->env = castExpr->env;
    367                                 delete ret->result;
    368                                 ret->result = castExpr->result;
    369                                 ret->result->set_lvalue( true ); // ensure result is lvalue
    370                                 castExpr->env = nullptr;
    371                                 castExpr->arg = nullptr;
    372                                 castExpr->result = nullptr;
    373                                 delete castExpr;
     396                                        ret = castExpr;
     397                                }
     398                                ret->set_env( env );
     399                                PRINT( std::cerr << "now: " << ret << std::endl; )
    374400                                return ret;
    375                         } else {
    376                                 assert( diff == 0 );
    377                                 // conversion between references of the same depth
    378                                 return castExpr;
    379                         }
     401                        }
     402                        return castExpr;
    380403                }
    381404
    382405                Type * ReferenceTypeElimination::postmutate( ReferenceType * refType ) {
    383                         Type * base = refType->base;
     406                        Type * base = refType->get_base();
    384407                        Type::Qualifiers qualifiers = refType->get_qualifiers();
    385                         refType->base = nullptr;
     408                        refType->set_base( nullptr );
    386409                        delete refType;
    387410                        return new PointerType( qualifiers, base );
     
    391414                Expression * GeneralizedLvalue::applyTransformation( Expression * expr, Expression * arg, Func mkExpr ) {
    392415                        if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( arg ) ) {
    393                                 Expression * arg1 = commaExpr->arg1->clone();
    394                                 Expression * arg2 = commaExpr->arg2->clone();
     416                                Expression * arg1 = commaExpr->get_arg1()->clone();
     417                                Expression * arg2 = commaExpr->get_arg2()->clone();
    395418                                Expression * ret = new CommaExpr( arg1, mkExpr( arg2 )->acceptMutator( *visitor ) );
    396                                 ret->env = expr->env;
    397                                 expr->env = nullptr;
     419                                ret->set_env( expr->get_env() );
     420                                expr->set_env( nullptr );
    398421                                delete expr;
    399422                                return ret;
    400423                        } else if ( ConditionalExpr * condExpr = dynamic_cast< ConditionalExpr * >( arg ) ) {
    401                                 Expression * arg1 = condExpr->arg1->clone();
    402                                 Expression * arg2 = condExpr->arg2->clone();
    403                                 Expression * arg3 = condExpr->arg3->clone();
     424                                Expression * arg1 = condExpr->get_arg1()->clone();
     425                                Expression * arg2 = condExpr->get_arg2()->clone();
     426                                Expression * arg3 = condExpr->get_arg3()->clone();
    404427                                ConditionalExpr * ret = new ConditionalExpr( arg1, mkExpr( arg2 )->acceptMutator( *visitor ), mkExpr( arg3 )->acceptMutator( *visitor ) );
    405                                 ret->env = expr->env;
    406                                 expr->env = nullptr;
     428                                ret->set_env( expr->get_env() );
     429                                expr->set_env( nullptr );
    407430                                delete expr;
    408431
     
    413436                                AssertionSet needAssertions, haveAssertions;
    414437                                OpenVarSet openVars;
    415                                 unify( ret->arg2->result, ret->arg3->result, newEnv, needAssertions, haveAssertions, openVars, SymTab::Indexer(), commonType );
    416                                 ret->result = commonType ? commonType : ret->arg2->result->clone();
     438                                unify( ret->get_arg2()->get_result(), ret->get_arg3()->get_result(), newEnv, needAssertions, haveAssertions, openVars, SymTab::Indexer(), commonType );
     439                                ret->set_result( commonType ? commonType : ret->get_arg2()->get_result()->clone() );
    417440                                return ret;
    418441                        }
     
    421444
    422445                Expression * GeneralizedLvalue::postmutate( MemberExpr * memExpr ) {
    423                         return applyTransformation( memExpr, memExpr->aggregate, [=]( Expression * aggr ) { return new MemberExpr( memExpr->member, aggr ); } );
     446                        return applyTransformation( memExpr, memExpr->get_aggregate(), [=]( Expression * aggr ) { return new MemberExpr( memExpr->get_member(), aggr ); } );
    424447                }
    425448
    426449                Expression * GeneralizedLvalue::postmutate( AddressExpr * addrExpr ) {
    427                         return applyTransformation( addrExpr, addrExpr->arg, []( Expression * arg ) { return new AddressExpr( arg ); } );
     450                        return applyTransformation( addrExpr, addrExpr->get_arg(), []( Expression * arg ) { return new AddressExpr( arg ); } );
    428451                }
    429452
    430453                Expression * CollapseAddrDeref::postmutate( AddressExpr * addrExpr ) {
    431                         Expression * arg = addrExpr->arg;
     454                        Expression * arg = addrExpr->get_arg();
    432455                        if ( isIntrinsicReference( arg ) ) {
    433456                                std::string fname = InitTweak::getFunctionName( arg );
     
    435458                                        Expression *& arg0 = InitTweak::getCallArg( arg, 0 );
    436459                                        Expression * ret = arg0;
    437                                         ret->set_env( addrExpr->env );
     460                                        ret->set_env( addrExpr->get_env() );
    438461                                        arg0 = nullptr;
    439                                         addrExpr->env = nullptr;
     462                                        addrExpr->set_env( nullptr );
    440463                                        delete addrExpr;
    441464                                        return ret;
     
    464487                                        // }
    465488                                        if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( arg ) ) {
    466                                                 Expression * ret = addrExpr->arg;
    467                                                 ret->env = appExpr->env;
    468                                                 addrExpr->arg = nullptr;
    469                                                 appExpr->env = nullptr;
     489                                                Expression * ret = addrExpr->get_arg();
     490                                                ret->set_env( appExpr->get_env() );
     491                                                addrExpr->set_arg( nullptr );
     492                                                appExpr->set_env( nullptr );
    470493                                                delete appExpr;
    471494                                                return ret;
  • src/Makefile.in

    r32cab5b rb2fe1c9  
    249249        SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \
    250250        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
    251         SynTree/driver_cfa_cpp-DeclReplacer.$(OBJEXT) \
     251        SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT) \
    252252        Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \
    253253        Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT) \
     
    526526        SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
    527527        SynTree/Initializer.cc SynTree/TypeSubstitution.cc \
    528         SynTree/Attribute.cc SynTree/DeclReplacer.cc \
     528        SynTree/Attribute.cc SynTree/VarExprReplacer.cc \
    529529        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
    530530        Tuples/Explode.cc Virtual/ExpandCasts.cc
     
    912912SynTree/driver_cfa_cpp-Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    913913        SynTree/$(DEPDIR)/$(am__dirstamp)
    914 SynTree/driver_cfa_cpp-DeclReplacer.$(OBJEXT):  \
     914SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT):  \
    915915        SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    916916Tuples/$(am__dirstamp):
     
    10391039@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Po@am__quote@
    10401040@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Po@am__quote@
    1041 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Po@am__quote@
    10421041@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Po@am__quote@
    10431042@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Po@am__quote@
     
    10611060@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Po@am__quote@
    10621061@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po@am__quote@
     1062@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po@am__quote@
    10631063@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
    10641064@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@
     
    24982498@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Attribute.obj `if test -f 'SynTree/Attribute.cc'; then $(CYGPATH_W) 'SynTree/Attribute.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Attribute.cc'; fi`
    24992499
    2500 SynTree/driver_cfa_cpp-DeclReplacer.o: SynTree/DeclReplacer.cc
    2501 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-DeclReplacer.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Tpo -c -o SynTree/driver_cfa_cpp-DeclReplacer.o `test -f 'SynTree/DeclReplacer.cc' || echo '$(srcdir)/'`SynTree/DeclReplacer.cc
    2502 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Po
    2503 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/DeclReplacer.cc' object='SynTree/driver_cfa_cpp-DeclReplacer.o' libtool=no @AMDEPBACKSLASH@
    2504 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2505 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-DeclReplacer.o `test -f 'SynTree/DeclReplacer.cc' || echo '$(srcdir)/'`SynTree/DeclReplacer.cc
    2506 
    2507 SynTree/driver_cfa_cpp-DeclReplacer.obj: SynTree/DeclReplacer.cc
    2508 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-DeclReplacer.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Tpo -c -o SynTree/driver_cfa_cpp-DeclReplacer.obj `if test -f 'SynTree/DeclReplacer.cc'; then $(CYGPATH_W) 'SynTree/DeclReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/DeclReplacer.cc'; fi`
    2509 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-DeclReplacer.Po
    2510 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/DeclReplacer.cc' object='SynTree/driver_cfa_cpp-DeclReplacer.obj' libtool=no @AMDEPBACKSLASH@
    2511 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2512 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-DeclReplacer.obj `if test -f 'SynTree/DeclReplacer.cc'; then $(CYGPATH_W) 'SynTree/DeclReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/DeclReplacer.cc'; fi`
     2500SynTree/driver_cfa_cpp-VarExprReplacer.o: SynTree/VarExprReplacer.cc
     2501@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarExprReplacer.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo -c -o SynTree/driver_cfa_cpp-VarExprReplacer.o `test -f 'SynTree/VarExprReplacer.cc' || echo '$(srcdir)/'`SynTree/VarExprReplacer.cc
     2502@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po
     2503@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarExprReplacer.cc' object='SynTree/driver_cfa_cpp-VarExprReplacer.o' libtool=no @AMDEPBACKSLASH@
     2504@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2505@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarExprReplacer.o `test -f 'SynTree/VarExprReplacer.cc' || echo '$(srcdir)/'`SynTree/VarExprReplacer.cc
     2506
     2507SynTree/driver_cfa_cpp-VarExprReplacer.obj: SynTree/VarExprReplacer.cc
     2508@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarExprReplacer.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo -c -o SynTree/driver_cfa_cpp-VarExprReplacer.obj `if test -f 'SynTree/VarExprReplacer.cc'; then $(CYGPATH_W) 'SynTree/VarExprReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarExprReplacer.cc'; fi`
     2509@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po
     2510@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarExprReplacer.cc' object='SynTree/driver_cfa_cpp-VarExprReplacer.obj' libtool=no @AMDEPBACKSLASH@
     2511@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2512@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarExprReplacer.obj `if test -f 'SynTree/VarExprReplacer.cc'; then $(CYGPATH_W) 'SynTree/VarExprReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarExprReplacer.cc'; fi`
    25132513
    25142514Tuples/driver_cfa_cpp-TupleAssignment.o: Tuples/TupleAssignment.cc
  • src/Parser/DeclarationNode.cc

    r32cab5b rb2fe1c9  
    7171        attr.expr = nullptr;
    7272        attr.type = nullptr;
    73 
    74         assert.condition = nullptr;
    75         assert.message = nullptr;
    7673}
    7774
     
    9188        // asmName, no delete, passed to next stage
    9289        delete initializer;
    93 
    94         delete assert.condition;
    95         delete assert.message;
    9690}
    9791
     
    123117        newnode->attr.expr = maybeClone( attr.expr );
    124118        newnode->attr.type = maybeClone( attr.type );
    125 
    126         newnode->assert.condition = maybeClone( assert.condition );
    127         newnode->assert.message = maybeClone( assert.message );
    128119        return newnode;
    129120} // DeclarationNode::clone
     
    443434        return newnode;
    444435}
    445 
    446 DeclarationNode * DeclarationNode::newStaticAssert( ExpressionNode * condition, Expression * message ) {
    447         DeclarationNode * newnode = new DeclarationNode;
    448         newnode->assert.condition = condition;
    449         newnode->assert.message = message;
    450         return newnode;
    451 }
    452 
    453436
    454437void appendError( string & dst, const string & src ) {
     
    10691052        } // if
    10701053
    1071         if ( assert.condition ) {
    1072                 return new StaticAssertDecl( maybeBuild< Expression >( assert.condition ), strict_dynamic_cast< ConstantExpr * >( maybeClone( assert.message ) ) );
    1073         }
    1074 
    10751054        // SUE's cannot have function specifiers, either
    10761055        //
  • src/Parser/ExpressionNode.cc

    r32cab5b rb2fe1c9  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 22 11:57:39 2018
    13 // Update Count     : 801
     12// Last Modified On : Sat Mar  3 18:22:33 2018
     13// Update Count     : 796
    1414//
    1515
     
    9494} // checkLNInt
    9595
     96static void sepNumeric( string & str, string & units ) {
     97        string::size_type posn = str.find_first_of( "`" );
     98        if ( posn != string::npos ) {
     99                units = "?" + str.substr( posn );                               // extract units
     100                str.erase( posn );                                                              // remove units
     101        } // if
     102} // sepNumeric
     103
    96104Expression * build_constantInteger( string & str ) {
    97105        static const BasicType::Kind kind[2][6] = {
     
    100108                { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, },
    101109        };
     110
     111        string units;
     112        sepNumeric( str, units );                                                       // separate constant from units
    102113
    103114        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
     
    221232        } // if
    222233  CLEANUP:
     234        if ( units.length() != 0 ) {
     235                ret = new UntypedExpr( new NameExpr( units ), { ret } );
     236        } // if
    223237
    224238        delete &str;                                                                            // created by lex
     
    254268        };
    255269
     270        string units;
     271        sepNumeric( str, units );                                                       // separate constant from units
     272
    256273        bool complx = false;                                                            // real, complex
    257274        int size = 1;                                                                           // 0 => float, 1 => double, 2 => long double
     
    286303        if ( lnth != -1 ) {                                                                     // explicit length ?
    287304                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ) );
     305        } // if
     306        if ( units.length() != 0 ) {
     307                ret = new UntypedExpr( new NameExpr( units ), { ret } );
    288308        } // if
    289309
  • src/Parser/ParseNode.h

    r32cab5b rb2fe1c9  
    246246        static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    247247        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    248         static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
    249248
    250249        DeclarationNode();
     
    314313        Attr_t attr;
    315314
    316         struct StaticAssert_t {
    317                 ExpressionNode * condition;
    318                 Expression * message;
    319         };
    320         StaticAssert_t assert;
    321 
    322315        BuiltinType builtin;
    323316
     
    399392
    400393Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
    401 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt );
     394Statement * build_switch( ExpressionNode * ctl, StatementNode * stmt );
    402395Statement * build_case( ExpressionNode * ctl );
    403396Statement * build_default();
  • src/Parser/StatementNode.cc

    r32cab5b rb2fe1c9  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 14:31:32 2018
    13 // Update Count     : 348
     12// Last Modified On : Fri Sep  1 23:25:23 2017
     13// Update Count     : 346
    1414//
    1515
     
    116116}
    117117
    118 Statement *build_switch( bool isSwitch, ExpressionNode *ctl, StatementNode *stmt ) {
     118Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt ) {
    119119        std::list< Statement * > branches;
    120120        buildMoveList< Statement, StatementNode >( stmt, branches );
    121         if ( ! isSwitch ) {                                                                             // choose statement
    122                 for ( Statement * stmt : branches ) {
    123                         CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
    124                         if ( ! caseStmt->stmts.empty() ) {                      // code after "case" => end of case list
    125                                 CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
    126                                 block->kids.push_back( new BranchStmt( "", BranchStmt::Break ) );
    127                         } // if
    128                 } // for
    129         } // if
    130121        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    131122        return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
  • src/Parser/lex.ll

    r32cab5b rb2fe1c9  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Fri Apr  6 15:16:15 2018
    13  * Update Count     : 670
     12 * Last Modified On : Sat Mar  3 18:38:16 2018
     13 * Update Count     : 640
    1414 */
    1515
     
    5454
    5555void rm_underscore() {
    56         // SKULLDUGGERY: remove underscores (ok to shorten?)
     56        // Remove underscores in numeric constant by copying the non-underscore characters to the front of the string.
    5757        yyleng = 0;
    58         for ( int i = 0; yytext[i] != '\0'; i += 1 ) {          // copying non-underscore characters to front of string
     58        for ( int i = 0; yytext[i] != '\0'; i += 1 ) {
     59                if ( yytext[i] == '`' ) {
     60                        // copy user suffix
     61                        for ( ; yytext[i] != '\0'; i += 1 ) {
     62                                yytext[yyleng] = yytext[i];
     63                                yyleng += 1;
     64                        } // for
     65                        break;
     66                } // if
    5967                if ( yytext[i] != '_' ) {
    6068                        yytext[yyleng] = yytext[i];
     
    6371        } // for
    6472        yytext[yyleng] = '\0';
    65 } // rm_underscore
     73}
    6674
    6775// Stop warning due to incorrectly generated flex code.
     
    8290attr_identifier "@"{identifier}
    8391
     92user_suffix_opt ("`"{identifier})?
     93
    8494                                // numeric constants, CFA: '_' in constant
    8595hex_quad {hex}("_"?{hex}){3}
    8696size_opt (8|16|32|64|128)?
    8797length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH])
    88 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?
     98integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?{user_suffix_opt}
    8999
    90100octal_digits ({octal})|({octal}({octal}|"_")*{octal})
     
    108118floating_length ([fFdDlL]|[lL]{floating_size})
    109119floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    110 floating_suffix_opt ("_"?({floating_suffix}|"DL"))?
     120floating_suffix_opt ("_"?({floating_suffix}|"DL"))?{user_suffix_opt}
    111121decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal})
    112122floating_decimal {decimal_digits}"."{exponent}?{floating_suffix_opt}
     
    115125
    116126binary_exponent "_"?[pP]"_"?[+-]?{decimal_digits}
    117 hex_floating_suffix_opt ("_"?({floating_suffix}))?
     127hex_floating_suffix_opt ("_"?({floating_suffix}))?{user_suffix_opt}
    118128hex_floating_fraction ({hex_digits}?"."{hex_digits})|({hex_digits}".")
    119129hex_floating_constant {hex_prefix}(({hex_floating_fraction}{binary_exponent})|({hex_digits}{binary_exponent})){hex_floating_suffix_opt}
     
    198208__asm                   { KEYWORD_RETURN(ASM); }                                // GCC
    199209__asm__                 { KEYWORD_RETURN(ASM); }                                // GCC
     210_At                             { KEYWORD_RETURN(AT); }                                 // CFA
    200211_Atomic                 { KEYWORD_RETURN(ATOMIC); }                             // C11
    201212__attribute             { KEYWORD_RETURN(ATTRIBUTE); }                  // GCC
     
    228239exception               { KEYWORD_RETURN(EXCEPTION); }                  // CFA
    229240extern                  { KEYWORD_RETURN(EXTERN); }
     241fallthru                { KEYWORD_RETURN(FALLTHRU); }                   // CFA
    230242fallthrough             { KEYWORD_RETURN(FALLTHROUGH); }                // CFA
    231 fallthru                { KEYWORD_RETURN(FALLTHRU); }                   // CFA
    232243finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    233244float                   { KEYWORD_RETURN(FLOAT); }
     
    259270__builtin_offsetof { KEYWORD_RETURN(OFFSETOF); }                // GCC
    260271one_t                   { NUMERIC_RETURN(ONE_T); }                              // CFA
    261 or                              { QKEYWORD_RETURN(WOR); }                               // CFA
    262272otype                   { KEYWORD_RETURN(OTYPE); }                              // CFA
    263273register                { KEYWORD_RETURN(REGISTER); }
     
    296306__volatile__    { KEYWORD_RETURN(VOLATILE); }                   // GCC
    297307waitfor                 { KEYWORD_RETURN(WAITFOR); }
     308or                              { QKEYWORD_RETURN(WOR); }                               // CFA
    298309when                    { KEYWORD_RETURN(WHEN); }
    299310while                   { KEYWORD_RETURN(WHILE); }
     
    303314                                /* identifier */
    304315{identifier}    { IDENTIFIER_RETURN(); }
    305 "`"{identifier}"`" {                                                                    // CFA
    306         yytext[yyleng - 1] = '\0'; yytext += 1;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
    307         IDENTIFIER_RETURN();
    308 }
    309316{attr_identifier} { ATTRIBUTE_RETURN(); }
     317"`"                             { BEGIN BKQUOTE; }
     318<BKQUOTE>{identifier} { IDENTIFIER_RETURN(); }
     319<BKQUOTE>"`"    { BEGIN 0; }
    310320
    311321                                /* numeric constants */
     
    322332({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); }
    323333<QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); }
    324 <QUOTE>['\n]    { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
     334<QUOTE>['\n]{user_suffix_opt}   { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
    325335                                /* ' stop editor highlighting */
    326336
     
    328338({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); }
    329339<STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); }
    330 <STRING>["\n]   { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
     340<STRING>["\n]{user_suffix_opt}  { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
    331341                                /* " stop editor highlighting */
    332342
     
    338348                                /* punctuation */
    339349"@"                             { ASCIIOP_RETURN(); }
    340 "`"                             { ASCIIOP_RETURN(); }
    341350"["                             { ASCIIOP_RETURN(); }
    342351"]"                             { ASCIIOP_RETURN(); }
     
    403412"?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); }
    404413"^?{}"                  { IDENTIFIER_RETURN(); }
    405 "?`"{identifier} { IDENTIFIER_RETURN(); }                               // postfix operator
     414"?`"{identifier} { IDENTIFIER_RETURN(); }                               // unit operator
    406415"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    407416        /*
  • src/Parser/parser.yy

    r32cab5b rb2fe1c9  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 28 17:52:24 2018
    13 // Update Count     : 3130
     12// Last Modified On : Thu Feb 22 17:48:54 2018
     13// Update Count     : 3028
    1414//
    1515
     
    126126        } // if
    127127} // rebindForall
    128 
    129 NameExpr * build_postfix_name( const string * name ) {
    130         NameExpr * new_name = build_varref( new string( "?`" + *name ) );
    131         delete name;
    132         return new_name;
    133 } // build_postfix_name
    134128
    135129bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
     
    260254%type<sn> statement_decl                                statement_decl_list                     statement_list_nodecl
    261255%type<sn> selection_statement
    262 %type<sn> switch_clause_list_opt                switch_clause_list
     256%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    263257%type<en> case_value
    264258%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
     259%type<sn> fall_through                                  fall_through_opt
    265260%type<sn> iteration_statement                   jump_statement
    266261%type<sn> expression_statement                  asm_statement
     
    486481        | '(' compound_statement ')'                                            // GCC, lambda expression
    487482                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
    488         | constant '`' IDENTIFIER                                                       // CFA, postfix call
    489                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    490         | string_literal '`' IDENTIFIER                                         // CFA, postfix call
    491                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
    492         | IDENTIFIER '`' IDENTIFIER                                                     // CFA, postfix call
    493                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }
    494         | tuple '`' IDENTIFIER                                                          // CFA, postfix call
    495                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    496         | '(' comma_expression ')' '`' IDENTIFIER                       // CFA, postfix call
    497                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    498483        | type_name '.' no_attr_identifier                                      // CFA, nested type
    499                 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; }
     484                { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } // FIX ME
    500485        | type_name '.' '[' push field_list pop ']'                     // CFA, nested type / tuple field selector
    501                 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; }
     486                { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } // FIX ME
    502487        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
    503                 { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; }
     488                { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; } // FIX ME
    504489        ;
    505490
     
    550535        | '(' type_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal
    551536                { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); }
    552         | '(' type_no_function ')' '@' '{' initializer_list comma_opt '}' // CFA, explicit C compound-literal
    553                 { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    554537        | '^' primary_expression '{' argument_expression_list '}' // CFA
    555538                {
     
    687670        | '(' type_no_function ')' cast_expression
    688671                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    689         | '(' COROUTINE '&' ')' cast_expression                         // CFA
    690                 { SemanticError( yylloc, "coroutine cast is currently unimplemented." ); $$ = nullptr; }
    691         | '(' THREAD '&' ')' cast_expression                            // CFA
    692                 { SemanticError( yylloc, "monitor cast is currently unimplemented." ); $$ = nullptr; }
    693         | '(' MONITOR '&' ')' cast_expression                           // CFA
    694                 { SemanticError( yylloc, "thread cast is currently unimplemented." ); $$ = nullptr; }
    695672                // VIRTUAL cannot be opt because of look ahead issues
    696         | '(' VIRTUAL ')' cast_expression                                       // CFA
     673        | '(' VIRTUAL ')' cast_expression
    697674                { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $4 ), maybeMoveBuildType( nullptr ) ) ); }
    698         | '(' VIRTUAL type_no_function ')' cast_expression      // CFA
     675        | '(' VIRTUAL type_no_function ')' cast_expression
    699676                { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $5 ), maybeMoveBuildType( $3 ) ) ); }
    700677//      | '(' type_no_function ')' tuple
     
    788765        | logical_OR_expression '?' comma_expression ':' conditional_expression
    789766                { $$ = new ExpressionNode( build_cond( $1, $3, $5 ) ); }
    790                 // FIX ME: computes $1 twice
     767                // FIX ME: this hack computes $1 twice
    791768        | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand
    792769                { $$ = new ExpressionNode( build_cond( $1, $1, $4 ) ); }
     
    803780                { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
    804781        | unary_expression '=' '{' initializer_list comma_opt '}'
    805                 { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; }
     782                { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; } // FIX ME
    806783        ;
    807784
     
    873850        | exception_statement
    874851        | enable_disable_statement
    875                 { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; }
     852                { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } // FIX ME
    876853        | asm_statement
    877854        ;
     
    940917                { $$ = new StatementNode( build_if( $4, $6, $8 ) ); }
    941918        | SWITCH '(' comma_expression ')' case_clause
    942                 { $$ = new StatementNode( build_switch( true, $3, $5 ) ); }
     919                { $$ = new StatementNode( build_switch( $3, $5 ) ); }
    943920        | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    944921                {
    945                         StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) );
     922                        StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
    946923                        // The semantics of the declaration list is changed to include associated initialization, which is performed
    947924                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
     
    952929                }
    953930        | CHOOSE '(' comma_expression ')' case_clause           // CFA
    954                 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); }
    955         | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    956                 {
    957                         StatementNode *sw = new StatementNode( build_switch( false, $3, $8 ) );
     931                { $$ = new StatementNode( build_switch( $3, $5 ) ); }
     932        | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA
     933                {
     934                        StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
    958935                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    959936                }
     
    993970        ;
    994971
    995 //label_list_opt:
    996 //      // empty
    997 //      | identifier_or_type_name ':'
    998 //      | label_list_opt identifier_or_type_name ':'
    999 //      ;
    1000 
    1001972case_label_list:                                                                                // CFA
    1002973        case_label
     
    1019990        | switch_clause_list case_label_list statement_list_nodecl
    1020991                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); }
     992        ;
     993
     994choose_clause_list_opt:                                                                 // CFA
     995        // empty
     996                { $$ = nullptr; }
     997        | choose_clause_list
     998        ;
     999
     1000choose_clause_list:                                                                             // CFA
     1001        case_label_list fall_through
     1002                { $$ = $1->append_last_case( $2 ); }
     1003        | case_label_list statement_list_nodecl fall_through_opt
     1004                { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); }
     1005        | choose_clause_list case_label_list fall_through
     1006                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); }
     1007        | choose_clause_list case_label_list statement_list_nodecl fall_through_opt
     1008                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); }
     1009        ;
     1010
     1011fall_through_opt:                                                                               // CFA
     1012        // empty
     1013                { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } // insert implicit break
     1014        | fall_through
     1015        ;
     1016
     1017fall_through_name:                                                                              // CFA
     1018        FALLTHRU
     1019        | FALLTHROUGH
     1020        ;
     1021
     1022fall_through:                                                                                   // CFA
     1023        fall_through_name
     1024                { $$ = nullptr; }
     1025        | fall_through_name ';'
     1026                { $$ = nullptr; }
    10211027        ;
    10221028
     
    10441050                // whereas normal operator precedence yields goto (*i)+3;
    10451051                { $$ = new StatementNode( build_computedgoto( $3 ) ); }
    1046                 // A semantic check is required to ensure fallthru appears only in the body of a choose statement.
    1047     | fall_through_name ';'                                                             // CFA
    1048                 { $$ = new StatementNode( build_branch( BranchStmt::FallThrough ) ); }
    1049     | fall_through_name identifier_or_type_name ';'             // CFA
    1050                 { $$ = new StatementNode( build_branch( $2, BranchStmt::FallThrough ) ); }
    1051         | fall_through_name DEFAULT ';'                                         // CFA
    1052                 { $$ = new StatementNode( build_branch( BranchStmt::FallThroughDefault ) ); }
    10531052        | CONTINUE ';'
    10541053                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
     
    10681067                { $$ = new StatementNode( build_return( $2 ) ); }
    10691068        | RETURN '{' initializer_list comma_opt '}'
    1070                 { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
     1069                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; } // FIX ME
    10711070        | THROW assignment_expression_opt ';'                           // handles rethrow
    10721071                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    10771076        ;
    10781077
    1079 fall_through_name:                                                                              // CFA
    1080         FALLTHRU
    1081         | FALLTHROUGH
    1082         ;
    1083 
    10841078with_statement:
    10851079        WITH '(' tuple_expression_list ')' statement
     
    10921086mutex_statement:
    10931087        MUTEX '(' argument_expression_list ')' statement
    1094                 { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; }
     1088                { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; } // FIX ME
    10951089        ;
    10961090
    10971091when_clause:
    1098         WHEN '(' comma_expression ')'                           { $$ = $3; }
     1092        WHEN '(' comma_expression ')'
     1093                { $$ = $3; }
    10991094        ;
    11001095
     
    11201115
    11211116timeout:
    1122         TIMEOUT '(' comma_expression ')'                        { $$ = $3; }
     1117        TIMEOUT '(' comma_expression ')'
     1118                { $$ = $3; }
    11231119        ;
    11241120
     
    11631159        //empty
    11641160                { $$ = nullptr; }
    1165         | ';' conditional_expression                            { $$ = $2; }
     1161        | ';' conditional_expression
     1162                { $$ = $2; }
    11661163        ;
    11671164
    11681165handler_key:
    1169         CATCH                                                                           { $$ = CatchStmt::Terminate; }
    1170         | CATCHRESUME                                                           { $$ = CatchStmt::Resume; }
     1166        CATCH
     1167                { $$ = CatchStmt::Terminate; }
     1168        | CATCHRESUME
     1169                { $$ = CatchStmt::Resume; }
    11711170        ;
    11721171
    11731172finally_clause:
    1174         FINALLY compound_statement                                      { $$ = new StatementNode( build_finally( $2 ) ); }
     1173        FINALLY compound_statement
     1174                {
     1175                        $$ = new StatementNode( build_finally( $2 ) );
     1176                }
    11751177        ;
    11761178
     
    13141316static_assert:
    13151317        STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11
    1316                 { $$ = DeclarationNode::newStaticAssert( $3, $5 ); }
     1318                { SemanticError( yylloc, "Static assert is currently unimplemented." ); $$ = nullptr; } // FIX ME
    13171319
    13181320// C declaration syntax is notoriously confusing and error prone. Cforall provides its own type, variable and function
     
    24112413                        $$ = $2;
    24122414                }
    2413         | type_qualifier_list '{' external_definition_list '}'                  // CFA, namespace
     2415        | forall '{' external_definition_list '}'                       // CFA, namespace
    24142416        ;
    24152417
  • src/ResolvExpr/CommonType.cc

    r32cab5b rb2fe1c9  
    2828
    2929// #define DEBUG
    30 #ifdef DEBUG
    31 #define PRINT(x) x
    32 #else
    33 #define PRINT(x)
    34 #endif
    3530
    3631namespace ResolvExpr {
     
    7570                // need unify to bind type variables
    7671                if ( unify( t1, t2, env, have, need, newOpen, indexer, common ) ) {
    77                         PRINT(
    78                                 std::cerr << "unify success: " << widenFirst << " " << widenSecond << std::endl;
    79                         )
     72                        // std::cerr << "unify success: " << widenFirst << " " << widenSecond << std::endl;
    8073                        if ( (widenFirst || t2->get_qualifiers() <= t1->get_qualifiers()) && (widenSecond || t1->get_qualifiers() <= t2->get_qualifiers()) ) {
    81                                 PRINT(
    82                                         std::cerr << "widen okay" << std::endl;
    83                                 )
     74                                // std::cerr << "widen okay" << std::endl;
    8475                                common->get_qualifiers() |= t1->get_qualifiers();
    8576                                common->get_qualifiers() |= t2->get_qualifiers();
     
    8778                        }
    8879                }
    89                 PRINT(
    90                         std::cerr << "exact unify failed: " << t1 << " " << t2 << std::endl;
    91                 )
     80                // std::cerr << "exact unify failed: " << t1 << " " << t2 << std::endl;
    9281                return nullptr;
    9382        }
     
    10594                        // special case where one type has a reference depth of 1 larger than the other
    10695                        if ( diff > 0 || diff < 0 ) {
    107                                 PRINT(
    108                                         std::cerr << "reference depth diff: " << diff << std::endl;
    109                                 )
     96                                // std::cerr << "reference depth diff: " << diff << std::endl;
    11097                                Type * result = nullptr;
    11198                                ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 );
     
    122109                                if ( result && ref1 ) {
    123110                                        // formal is reference, so result should be reference
    124                                         PRINT(
    125                                                 std::cerr << "formal is reference; result should be reference" << std::endl;
    126                                         )
     111                                        // std::cerr << "formal is reference; result should be reference" << std::endl;
    127112                                        result = new ReferenceType( ref1->get_qualifiers(), result );
    128113                                }
    129                                 PRINT(
    130                                         std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl;
    131                                 )
     114                                // std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl;
    132115                                return result;
    133116                        }
  • src/ResolvExpr/ConversionCost.cc

    r32cab5b rb2fe1c9  
    275275                        // xxx - not positive this is correct, but appears to allow casting int => enum
    276276                        cost = Cost::unsafe;
    277                 } // if
    278                 // no cases for zero_t/one_t because it should not be possible to convert int, etc. to zero_t/one_t.
     277                } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) {
     278                        cost = Cost::unsafe;
     279                } // if
    279280        }
    280281
     
    308309                                // assignResult == 0 means Cost::Infinity
    309310                        } // if
    310                         // case case for zero_t because it should not be possible to convert pointers to zero_t.
     311                } else if ( dynamic_cast< ZeroType * >( dest ) ) {
     312                        cost = Cost::unsafe;
    311313                } // if
    312314        }
  • src/ResolvExpr/Resolver.cc

    r32cab5b rb2fe1c9  
    5959                void previsit( TypeDecl *typeDecl );
    6060                void previsit( EnumDecl * enumDecl );
    61                 void previsit( StaticAssertDecl * assertDecl );
    6261
    6362                void previsit( ArrayType * at );
     
    362361                GuardValue( inEnumDecl );
    363362                inEnumDecl = true;
    364         }
    365 
    366         void Resolver::previsit( StaticAssertDecl * assertDecl ) {
    367                 findIntegralExpression( assertDecl->condition, indexer );
    368363        }
    369364
  • src/SymTab/Validate.cc

    r32cab5b rb2fe1c9  
    8989                void previsit( StructDecl * aggregateDecl );
    9090                void previsit( UnionDecl * aggregateDecl );
    91                 void previsit( StaticAssertDecl * assertDecl );
    9291
    9392          private:
     
    148147                void previsit( ObjectDecl * object );
    149148                void previsit( FunctionDecl * func );
    150                 void previsit( FunctionType * ftype );
    151149                void previsit( StructDecl * aggrDecl );
    152150                void previsit( UnionDecl * aggrDecl );
     
    298296        }
    299297
    300         bool shouldHoist( Declaration *decl ) {
    301                 return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl ) || dynamic_cast< StaticAssertDecl * >( decl );
     298        bool isStructOrUnion( Declaration *decl ) {
     299                return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl );
    302300        }
    303301
     
    312310                } // if
    313311                // Always remove the hoisted aggregate from the inner structure.
    314                 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, shouldHoist, false ); } );
     312                GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion, false ); } );
    315313        }
    316314
     
    330328                if ( inst->baseUnion ) {
    331329                        declsToAddBefore.push_front( inst->baseUnion );
    332                 }
    333         }
    334 
    335         void HoistStruct::previsit( StaticAssertDecl * assertDecl ) {
    336                 if ( parentAggr ) {
    337                         declsToAddBefore.push_back( assertDecl );
    338330                }
    339331        }
     
    634626
    635627        void ForallPointerDecay::previsit( ObjectDecl *object ) {
    636                 // ensure that operator names only apply to functions or function pointers
    637                 if ( CodeGen::isOperator( object->name ) && ! dynamic_cast< FunctionType * >( object->type->stripDeclarator() ) ) {
    638                         SemanticError( object->location, toCString( "operator ", object->name.c_str(), " is not a function or function pointer." ) );
    639                 }
     628                forallFixer( object->type->forall, object );
     629                if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type ) ) {
     630                        forallFixer( pointer->base->forall, object );
     631                } // if
    640632                object->fixUniqueId();
    641633        }
    642634
    643635        void ForallPointerDecay::previsit( FunctionDecl *func ) {
     636                forallFixer( func->type->forall, func );
    644637                func->fixUniqueId();
    645         }
    646 
    647         void ForallPointerDecay::previsit( FunctionType * ftype ) {
    648                 forallFixer( ftype->forall, ftype );
    649638        }
    650639
  • src/SynTree/CompoundStmt.cc

    r32cab5b rb2fe1c9  
    2323#include "Statement.h"                // for CompoundStmt, Statement, DeclStmt
    2424#include "SynTree/Label.h"            // for Label
    25 #include "SynTree/DeclReplacer.h"     // for DeclReplacer
     25#include "SynTree/VarExprReplacer.h"  // for VarExprReplacer, VarExprReplace...
    2626
    2727using std::string;
     
    4949        // recursively execute this routine. There may be more efficient ways of doing
    5050        // this.
    51         DeclReplacer::DeclMap declMap;
     51        VarExprReplacer::DeclMap declMap;
    5252        std::list< Statement * >::const_iterator origit = other.kids.begin();
    5353        for ( Statement * s : kids ) {
     
    6464        }
    6565        if ( ! declMap.empty() ) {
    66                 DeclReplacer::replace( this, declMap );
     66                VarExprReplacer::replace( this, declMap );
    6767        }
    6868}
  • src/SynTree/Declaration.cc

    r32cab5b rb2fe1c9  
    8181
    8282
    83 StaticAssertDecl::StaticAssertDecl( Expression * condition, ConstantExpr * message ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), condition( condition ), message( message )  {
    84 }
    85 
    86 StaticAssertDecl::StaticAssertDecl( const StaticAssertDecl & other ) : Declaration( other ), condition( maybeClone( other.condition ) ), message( maybeClone( other.message ) )  {
    87 }
    88 
    89 StaticAssertDecl::~StaticAssertDecl() {
    90         delete condition;
    91         delete message;
    92 }
    93 
    94 void StaticAssertDecl::print( std::ostream &os, Indenter indent ) const {
    95         os << "Static Assert with condition: ";
    96         condition->print( os, indent+1 );
    97         os << std::endl << indent << "and message: ";
    98         message->print( os, indent+1 );
    99 os << std::endl;
    100 }
    101 
    102 void StaticAssertDecl::printShort( std::ostream &os, Indenter indent ) const {
    103         print( os, indent );
    104 }
    105 
    10683// Local Variables: //
    10784// tab-width: 4 //
  • src/SynTree/Declaration.h

    r32cab5b rb2fe1c9  
    365365};
    366366
    367 class StaticAssertDecl : public Declaration {
    368 public:
    369         Expression * condition;
    370         ConstantExpr * message;   // string literal
    371 
    372         StaticAssertDecl( Expression * condition, ConstantExpr * message );
    373         StaticAssertDecl( const StaticAssertDecl & other );
    374         virtual ~StaticAssertDecl();
    375 
    376         virtual StaticAssertDecl * clone() const override { return new StaticAssertDecl( *this ); }
    377         virtual void accept( Visitor &v ) override { v.visit( this ); }
    378         virtual StaticAssertDecl * acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    379         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    380         virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    381 };
    382 
    383367std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data );
    384368
  • src/SynTree/FunctionDecl.cc

    r32cab5b rb2fe1c9  
    2626#include "Statement.h"           // for CompoundStmt
    2727#include "Type.h"                // for Type, FunctionType, Type::FuncSpecif...
    28 #include "DeclReplacer.h"
     28#include "VarExprReplacer.h"
    2929
    3030extern bool translation_unit_nomain;
     
    4141                : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    4242
    43         DeclReplacer::DeclMap declMap;
     43        VarExprReplacer::DeclMap declMap;
    4444        for ( auto p : group_iterate( other.type->parameters, type->parameters ) ) {
    4545                declMap[ std::get<0>(p) ] = std::get<1>(p);
     
    4949        }
    5050        if ( ! declMap.empty() ) {
    51                 DeclReplacer::replace( this, declMap );
     51                VarExprReplacer::replace( this, declMap );
    5252        }
    5353        cloneAll( other.withExprs, withExprs );
  • src/SynTree/Mutator.h

    r32cab5b rb2fe1c9  
    3434        virtual Declaration * mutate( TypedefDecl * typeDecl ) = 0;
    3535        virtual AsmDecl * mutate( AsmDecl * asmDecl ) = 0;
    36         virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0;
    3736
    3837        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) = 0;
  • src/SynTree/Statement.cc

    r32cab5b rb2fe1c9  
    3434Statement::Statement( const std::list<Label> & labels ) : labels( labels ) {}
    3535
    36 void Statement::print( std::ostream & os, Indenter indent ) const {
     36void Statement::print( std::ostream & os, Indenter ) const {
    3737        if ( ! labels.empty() ) {
    38                 os << indent << "... Labels: {";
     38                os << "Labels: {";
    3939                for ( const Label & l : labels ) {
    4040                        os << l << ",";
     
    223223
    224224void CaseStmt::print( std::ostream &os, Indenter indent ) const {
    225         if ( isDefault() ) os << indent << "Default ";
     225        if ( isDefault() ) os << "Default ";
    226226        else {
    227                 os << indent << "Case ";
     227                os << "Case ";
    228228                condition->print( os, indent );
    229229        } // if
     
    231231
    232232        for ( Statement * stmt : stmts ) {
    233                 os << indent+1;
    234233                stmt->print( os, indent+1 );
    235234        }
     
    479478}
    480479
    481 void NullStmt::print( std::ostream &os, Indenter indent ) const {
     480void NullStmt::print( std::ostream &os, Indenter ) const {
    482481        os << "Null Statement" << endl;
    483         Statement::print( os, indent );
    484482}
    485483
  • src/SynTree/Statement.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 14:53:02 2018
    13 // Update Count     : 78
     12// Last Modified On : Sun Sep  3 20:46:46 2017
     13// Update Count     : 77
    1414//
    1515
     
    255255class BranchStmt : public Statement {
    256256  public:
    257         enum Type { Goto = 0, Break, Continue, FallThrough, FallThroughDefault };
     257        enum Type { Goto = 0, Break, Continue };
    258258
    259259        // originalTarget kept for error messages.
  • src/SynTree/SynTree.h

    r32cab5b rb2fe1c9  
    3838class TypedefDecl;
    3939class AsmDecl;
    40 class StaticAssertDecl;
    4140
    4241class Statement;
  • src/SynTree/TypeSubstitution.cc

    r32cab5b rb2fe1c9  
    149149                return inst;
    150150        } else {
    151                 // cut off infinite loop for the case where a type is bound to itself.
    152                 // Note: this does not prevent cycles in the general case, so it may be necessary to do something more sophisticated here.
    153                 // TODO: investigate preventing type variables from being bound to themselves in the first place.
    154                 if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) {
    155                         if ( inst->name == replacement->name ) {
    156                                 return inst;
    157                         }
    158                 }
    159                 // std::cerr << "found " << inst->name << ", replacing with " << i->second << std::endl;
     151///         std::cerr << "found " << inst->get_name() << ", replacing with ";
     152///         i->second->print( std::cerr );
     153///         std::cerr << std::endl;
    160154                subCount++;
    161155                Type * newtype = i->second->clone();
    162156                newtype->get_qualifiers() |= inst->get_qualifiers();
    163157                delete inst;
    164                 // Note: need to recursively apply substitution to the new type because normalize does not substitute bound vars, but bound vars must be substituted when not in freeOnly mode.
    165                 return newtype->acceptMutator( *visitor );
     158                return newtype;
    166159        } // if
    167160}
  • src/SynTree/TypeSubstitution.h

    r32cab5b rb2fe1c9  
    129129
    130130// definitition must happen after PassVisitor is included so that WithGuards can be used
    131 struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter> {
     131struct TypeSubstitution::Substituter : public WithGuards {
    132132                Substituter( TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
    133133
  • src/SynTree/Visitor.h

    r32cab5b rb2fe1c9  
    3636        virtual void visit( TypedefDecl * typeDecl ) = 0;
    3737        virtual void visit( AsmDecl * asmDecl ) = 0;
    38         virtual void visit( StaticAssertDecl * assertDecl ) = 0;
    3938
    4039        virtual void visit( CompoundStmt * compoundStmt ) = 0;
  • src/SynTree/module.mk

    r32cab5b rb2fe1c9  
    4848       SynTree/TypeSubstitution.cc \
    4949       SynTree/Attribute.cc \
    50        SynTree/DeclReplacer.cc
     50       SynTree/VarExprReplacer.cc
    5151
  • src/benchmark/bench.h

    r32cab5b rb2fe1c9  
    1010#if defined(__cforall)
    1111}
    12 //#include <bits/cfatime.h>
     12#include <bits/cfatime.h>
    1313#endif
    1414
  • src/libcfa/Makefile.am

    r32cab5b rb2fe1c9  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu Apr 12 14:38:34 2018
    14 ## Update Count     : 231
     13## Last Modified On : Fri Feb  9 15:51:24 2018
     14## Update Count     : 223
    1515###############################################################################
    1616
     
    4646CC = ${abs_top_srcdir}/src/driver/cfa
    4747
    48 headers = fstream iostream iterator limits rational time stdlib \
     48headers = fstream iostream iterator limits rational stdlib \
    4949          containers/maybe containers/pair containers/result containers/vector
    5050
     
    100100        math                            \
    101101        gmp                             \
    102         time_t.h                        \
    103         clock                   \
    104102        bits/align.h            \
     103        bits/cfatime.h          \
    105104        bits/containers.h               \
    106105        bits/defs.h             \
  • src/libcfa/Makefile.in

    r32cab5b rb2fe1c9  
    150150am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    151151        bits/debug.c fstream.c iostream.c iterator.c limits.c \
    152         rational.c time.c stdlib.c containers/maybe.c \
    153         containers/pair.c containers/result.c containers/vector.c \
     152        rational.c stdlib.c containers/maybe.c containers/pair.c \
     153        containers/result.c containers/vector.c \
    154154        concurrency/coroutine.c concurrency/thread.c \
    155155        concurrency/kernel.c concurrency/monitor.c assert.c \
     
    165165        libcfa_d_a-iostream.$(OBJEXT) libcfa_d_a-iterator.$(OBJEXT) \
    166166        libcfa_d_a-limits.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \
    167         libcfa_d_a-time.$(OBJEXT) libcfa_d_a-stdlib.$(OBJEXT) \
     167        libcfa_d_a-stdlib.$(OBJEXT) \
    168168        containers/libcfa_d_a-maybe.$(OBJEXT) \
    169169        containers/libcfa_d_a-pair.$(OBJEXT) \
     
    184184libcfa_a_LIBADD =
    185185am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c bits/debug.c \
    186         fstream.c iostream.c iterator.c limits.c rational.c time.c \
    187         stdlib.c containers/maybe.c containers/pair.c \
    188         containers/result.c containers/vector.c \
    189         concurrency/coroutine.c concurrency/thread.c \
    190         concurrency/kernel.c concurrency/monitor.c assert.c \
    191         exception.c virtual.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
    192         concurrency/alarm.c concurrency/invoke.c \
    193         concurrency/preemption.c
     186        fstream.c iostream.c iterator.c limits.c rational.c stdlib.c \
     187        containers/maybe.c containers/pair.c containers/result.c \
     188        containers/vector.c concurrency/coroutine.c \
     189        concurrency/thread.c concurrency/kernel.c \
     190        concurrency/monitor.c assert.c exception.c virtual.c \
     191        concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \
     192        concurrency/invoke.c concurrency/preemption.c
    194193@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    195194@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
     
    198197am__objects_6 = libcfa_a-fstream.$(OBJEXT) libcfa_a-iostream.$(OBJEXT) \
    199198        libcfa_a-iterator.$(OBJEXT) libcfa_a-limits.$(OBJEXT) \
    200         libcfa_a-rational.$(OBJEXT) libcfa_a-time.$(OBJEXT) \
    201         libcfa_a-stdlib.$(OBJEXT) containers/libcfa_a-maybe.$(OBJEXT) \
     199        libcfa_a-rational.$(OBJEXT) libcfa_a-stdlib.$(OBJEXT) \
     200        containers/libcfa_a-maybe.$(OBJEXT) \
    202201        containers/libcfa_a-pair.$(OBJEXT) \
    203202        containers/libcfa_a-result.$(OBJEXT) \
     
    261260  esac
    262261am__nobase_cfa_include_HEADERS_DIST = fstream iostream iterator limits \
    263         rational time stdlib containers/maybe containers/pair \
     262        rational stdlib containers/maybe containers/pair \
    264263        containers/result containers/vector concurrency/coroutine \
    265264        concurrency/thread concurrency/kernel concurrency/monitor \
    266         ${shell find stdhdr -type f -printf "%p "} math gmp time_t.h \
    267         clock bits/align.h bits/containers.h bits/defs.h bits/debug.h \
    268         bits/locks.h concurrency/invoke.h
     265        ${shell find stdhdr -type f -printf "%p "} math gmp \
     266        bits/align.h bits/cfatime.h bits/containers.h bits/defs.h \
     267        bits/debug.h bits/locks.h concurrency/invoke.h
    269268HEADERS = $(nobase_cfa_include_HEADERS)
    270269am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     
    420419EXTRA_FLAGS = -g -Wall -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@
    421420AM_CCASFLAGS = @CFA_FLAGS@
    422 headers = fstream iostream iterator limits rational time stdlib \
     421headers = fstream iostream iterator limits rational stdlib \
    423422        containers/maybe containers/pair containers/result \
    424423        containers/vector $(am__append_3)
     
    437436        math                            \
    438437        gmp                             \
    439         time_t.h                        \
    440         clock                   \
    441438        bits/align.h            \
     439        bits/cfatime.h          \
    442440        bits/containers.h               \
    443441        bits/defs.h             \
     
    613611@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@
    614612@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-stdlib.Po@am__quote@
    615 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-time.Po@am__quote@
    616613@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-virtual.Po@am__quote@
    617614@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@
     
    625622@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@
    626623@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
    627 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-time.Po@am__quote@
    628624@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-virtual.Po@am__quote@
    629625@AMDEP_TRUE@@am__include@ @am__quote@bits/$(DEPDIR)/libcfa_a-debug.Po@am__quote@
     
    790786@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-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi`
    791787
    792 libcfa_d_a-time.o: time.c
    793 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-time.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-time.Tpo -c -o libcfa_d_a-time.o `test -f 'time.c' || echo '$(srcdir)/'`time.c
    794 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-time.Tpo $(DEPDIR)/libcfa_d_a-time.Po
    795 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='time.c' object='libcfa_d_a-time.o' libtool=no @AMDEPBACKSLASH@
    796 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    797 @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-time.o `test -f 'time.c' || echo '$(srcdir)/'`time.c
    798 
    799 libcfa_d_a-time.obj: time.c
    800 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-time.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-time.Tpo -c -o libcfa_d_a-time.obj `if test -f 'time.c'; then $(CYGPATH_W) 'time.c'; else $(CYGPATH_W) '$(srcdir)/time.c'; fi`
    801 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-time.Tpo $(DEPDIR)/libcfa_d_a-time.Po
    802 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='time.c' object='libcfa_d_a-time.obj' libtool=no @AMDEPBACKSLASH@
    803 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    804 @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-time.obj `if test -f 'time.c'; then $(CYGPATH_W) 'time.c'; else $(CYGPATH_W) '$(srcdir)/time.c'; fi`
    805 
    806788libcfa_d_a-stdlib.o: stdlib.c
    807789@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-stdlib.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-stdlib.Tpo -c -o libcfa_d_a-stdlib.o `test -f 'stdlib.c' || echo '$(srcdir)/'`stdlib.c
     
    10971079@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    10981080@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-rational.obj `if test -f 'rational.c'; then $(CYGPATH_W) 'rational.c'; else $(CYGPATH_W) '$(srcdir)/rational.c'; fi`
    1099 
    1100 libcfa_a-time.o: time.c
    1101 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-time.o -MD -MP -MF $(DEPDIR)/libcfa_a-time.Tpo -c -o libcfa_a-time.o `test -f 'time.c' || echo '$(srcdir)/'`time.c
    1102 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-time.Tpo $(DEPDIR)/libcfa_a-time.Po
    1103 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='time.c' object='libcfa_a-time.o' libtool=no @AMDEPBACKSLASH@
    1104 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1105 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-time.o `test -f 'time.c' || echo '$(srcdir)/'`time.c
    1106 
    1107 libcfa_a-time.obj: time.c
    1108 @am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-time.obj -MD -MP -MF $(DEPDIR)/libcfa_a-time.Tpo -c -o libcfa_a-time.obj `if test -f 'time.c'; then $(CYGPATH_W) 'time.c'; else $(CYGPATH_W) '$(srcdir)/time.c'; fi`
    1109 @am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-time.Tpo $(DEPDIR)/libcfa_a-time.Po
    1110 @AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='time.c' object='libcfa_a-time.obj' libtool=no @AMDEPBACKSLASH@
    1111 @AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1112 @am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-time.obj `if test -f 'time.c'; then $(CYGPATH_W) 'time.c'; else $(CYGPATH_W) '$(srcdir)/time.c'; fi`
    11131081
    11141082libcfa_a-stdlib.o: stdlib.c
  • src/libcfa/bits/locks.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Oct 31 15:14:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 18:18:13 2018
    13 // Update Count     : 9
     12// Last Modified On : Fri Dec  8 16:02:22 2017
     13// Update Count     : 1
    1414//
    1515
     
    6464
    6565        extern void yield( unsigned int );
     66        extern thread_local struct thread_desc *    volatile this_thread;
     67        extern thread_local struct processor *      volatile this_processor;
    6668
    6769        static inline void ?{}( __spinlock_t & this ) {
     
    7476                if( result ) {
    7577                        disable_interrupts();
    76                         // __cfaabi_dbg_debug_do(
    77                         //      this.prev_name = caller;
    78                         //      this.prev_thrd = TL_GET( this_thread );
    79                         // )
     78                        __cfaabi_dbg_debug_do(
     79                                this.prev_name = caller;
     80                                this.prev_thrd = this_thread;
     81                        )
    8082                }
    8183                return result;
     
    105107                }
    106108                disable_interrupts();
    107                 // __cfaabi_dbg_debug_do(
    108                 //      this.prev_name = caller;
    109                 //      this.prev_thrd = TL_GET( this_thread );
    110                 // )
     109                __cfaabi_dbg_debug_do(
     110                        this.prev_name = caller;
     111                        this.prev_thrd = this_thread;
     112                )
    111113        }
    112114
  • src/libcfa/concurrency/alarm.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Fri Jun 2 11:31:25 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr  9 13:36:18 2018
    13 // Update Count     : 61
     12// Last Modified On : Fri Jul 21 22:35:18 2017
     13// Update Count     : 1
    1414//
    1515
     
    2626#include "preemption.h"
    2727
     28
     29static inline void ?{}( itimerval & this, __cfa_time_t * alarm ) with( this ) {
     30        it_value.tv_sec = alarm->val / (1`cfa_s).val;                   // seconds
     31        it_value.tv_usec = max( (alarm->val % (1`cfa_s).val) / (1`cfa_us).val, 1000 ); // microseconds
     32        it_interval.tv_sec = 0;
     33        it_interval.tv_usec = 0;
     34}
     35
     36static inline void ?{}( __cfa_time_t & this, timespec * curr ) {
     37        uint64_t secs  = curr->tv_sec;
     38        uint64_t nsecs = curr->tv_nsec;
     39        this.val = from_s(secs).val + nsecs;
     40}
     41
    2842//=============================================================================================
    2943// Clock logic
    3044//=============================================================================================
    3145
    32 Time __kernel_get_time() {
     46__cfa_time_t __kernel_get_time() {
    3347        timespec curr;
    34         clock_gettime( CLOCK_MONOTONIC_RAW, &curr );            // CLOCK_REALTIME
    35         return (Time){ curr };
     48        clock_gettime( CLOCK_REALTIME, &curr );
     49        return (__cfa_time_t){ &curr };
    3650}
    3751
    38 void __kernel_set_timer( Duration alarm ) {
    39         setitimer( ITIMER_REAL, &(itimerval){ alarm }, NULL );
     52void __kernel_set_timer( __cfa_time_t alarm ) {
     53        itimerval val = { &alarm };
     54        setitimer( ITIMER_REAL, &val, NULL );
    4055}
    4156
     
    4459//=============================================================================================
    4560
    46 void ?{}( alarm_node_t & this, thread_desc * thrd, Time alarm, Duration period ) with( this ) {
     61void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = 0`cfa_s, __cfa_time_t period = 0`cfa_s ) with( this ) {
    4762        this.thrd = thrd;
    4863        this.alarm = alarm;
     
    5368}
    5469
    55 void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period ) with( this ) {
     70void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = 0`cfa_s, __cfa_time_t period = 0`cfa_s ) with( this ) {
    5671        this.proc = proc;
    5772        this.alarm = alarm;
  • src/libcfa/concurrency/alarm.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Fri Jun 2 11:31:25 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 26 16:25:41 2018
    13 // Update Count     : 11
     12// Last Modified On : Sat Jul 22 09:59:27 2017
     13// Update Count     : 3
    1414//
    1515
     
    2121#include <assert.h>
    2222
    23 #include "time"
     23#include "bits/cfatime.h"
    2424
    2525struct thread_desc;
     
    3030//=============================================================================================
    3131
    32 Time __kernel_get_time();
    33 void __kernel_set_timer( Duration alarm );
     32__cfa_time_t __kernel_get_time();
     33void __kernel_set_timer( __cfa_time_t alarm );
    3434
    3535//=============================================================================================
     
    3838
    3939struct alarm_node_t {
    40         Time alarm;                             // time when alarm goes off
    41         Duration period;                        // if > 0 => period of alarm
     40        __cfa_time_t alarm;             // time when alarm goes off
     41        __cfa_time_t period;            // if > 0 => period of alarm
    4242        alarm_node_t * next;            // intrusive link list field
    4343
     
    5353typedef alarm_node_t ** __alarm_it_t;
    5454
    55 void ?{}( alarm_node_t & this, thread_desc * thrd, Time alarm, Duration period );
    56 void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
     55void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = 0`cfa_s, __cfa_time_t period = 0`cfa_s );
     56void ?{}( alarm_node_t & this, processor   * proc, __cfa_time_t alarm = 0`cfa_s, __cfa_time_t period = 0`cfa_s );
    5757void ^?{}( alarm_node_t & this );
    5858
  • src/libcfa/concurrency/coroutine

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 18:23:45 2018
    13 // Update Count     : 8
     12// Last Modified On : Wed Aug 30 07:58:29 2017
     13// Update Count     : 3
    1414//
    1515
     
    6060}
    6161
     62// Get current coroutine
     63extern thread_local coroutine_desc * volatile this_coroutine;
     64
    6265// Private wrappers for context switch and stack creation
    6366extern void CoroutineCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
     
    6669// Suspend implementation inlined for performance
    6770static inline void suspend() {
    68         coroutine_desc * src = TL_GET( this_coroutine );                        // optimization
     71        coroutine_desc * src = this_coroutine;          // optimization
    6972
    7073        assertf( src->last != 0,
     
    8386forall(dtype T | is_coroutine(T))
    8487static inline void resume(T & cor) {
    85         coroutine_desc * src = TL_GET( this_coroutine );                        // optimization
     88        coroutine_desc * src = this_coroutine;          // optimization
    8689        coroutine_desc * dst = get_coroutine(cor);
    8790
     
    108111
    109112static inline void resume(coroutine_desc * dst) {
    110         coroutine_desc * src = TL_GET( this_coroutine );                        // optimization
     113        coroutine_desc * src = this_coroutine;          // optimization
    111114
    112115        // not resuming self ?
  • src/libcfa/concurrency/coroutine.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon Nov 28 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 17:20:57 2018
    13 // Update Count     : 9
     12// Last Modified On : Thu Feb  8 16:10:31 2018
     13// Update Count     : 4
    1414//
    1515
     
    9999// Wrapper for co
    100100void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    101         verify( TL_GET( preemption_state ).enabled || TL_GET( this_processor )->do_terminate );
     101        verify( preemption_state.enabled || this_processor->do_terminate );
    102102        disable_interrupts();
    103103
     
    106106
    107107        // set new coroutine that task is executing
    108         TL_SET( this_coroutine, dst );
     108        this_coroutine = dst;
    109109
    110110        // context switch to specified coroutine
     
    117117
    118118        enable_interrupts( __cfaabi_dbg_ctx );
    119         verify( TL_GET( preemption_state ).enabled || TL_GET( this_processor )->do_terminate );
     119        verify( preemption_state.enabled || this_processor->do_terminate );
    120120} //ctxSwitchDirect
    121121
     
    172172
    173173        void __leave_coroutine(void) {
    174                 coroutine_desc * src = TL_GET( this_coroutine ); // optimization
     174                coroutine_desc * src = this_coroutine;          // optimization
    175175
    176176                assertf( src->starter != 0,
  • src/libcfa/concurrency/invoke.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Jan 17 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 22:33:59 2018
    13 // Update Count     : 30
     12// Last Modified On : Fri Feb  9 14:41:55 2018
     13// Update Count     : 6
    1414//
    1515
     
    1717#include "bits/defs.h"
    1818#include "bits/locks.h"
    19 
    20 #define TL_GET( member ) kernelThreadData.member
    21 #define TL_SET( member, value ) kernelThreadData.member = value;
    2219
    2320#ifdef __cforall
     
    3330                static inline struct thread_desc             * & get_next( struct thread_desc             & this );
    3431                static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this );
    35 
    36                 extern thread_local struct KernelThreadData {
    37                         struct coroutine_desc * volatile this_coroutine;
    38                         struct thread_desc    * volatile this_thread;
    39                         struct processor      * volatile this_processor;
    40 
    41                         struct {
    42                                 volatile unsigned short disable_count;
    43                                 volatile bool enabled;
    44                                 volatile bool in_progress;
    45                         } preemption_state;
    46                 } kernelThreadData;
    4732        }
    48 
    49         static inline struct coroutine_desc * volatile active_coroutine() { return TL_GET( this_coroutine ); }
    50         static inline struct thread_desc * volatile active_thread() { return TL_GET( this_thread ); }
    51         static inline struct processor * volatile active_processor() { return TL_GET( this_processor ); }
    5233        #endif
    5334
    5435        struct coStack_t {
    55                 size_t size;                                                                    // size of stack
    56                 void * storage;                                                                 // pointer to stack
    57                 void * limit;                                                                   // stack grows towards stack limit
    58                 void * base;                                                                    // base of stack
    59                 void * context;                                                                 // address of cfa_context_t
    60                 void * top;                                                                             // address of top of storage
    61                 bool userStack;                                                                 // whether or not the user allocated the stack
     36                // size of stack
     37                size_t size;
     38
     39                // pointer to stack
     40                void *storage;
     41
     42                // stack grows towards stack limit
     43                void *limit;
     44
     45                // base of stack
     46                void *base;
     47
     48                // address of cfa_context_t
     49                void *context;
     50
     51                // address of top of storage
     52                void *top;
     53
     54                // whether or not the user allocated the stack
     55                bool userStack;
    6256        };
    6357
     
    6559
    6660        struct coroutine_desc {
    67                 struct coStack_t stack;                                                 // stack information of the coroutine
    68                 const char * name;                                                              // textual name for coroutine/task, initialized by uC++ generated code
    69                 int errno_;                                                                             // copy of global UNIX variable errno
    70                 enum coroutine_state state;                                             // current execution status for coroutine
    71                 struct coroutine_desc * starter;                                // first coroutine to resume this one
    72                 struct coroutine_desc * last;                                   // last coroutine to resume this one
     61                // stack information of the coroutine
     62                struct coStack_t stack;
     63
     64                // textual name for coroutine/task, initialized by uC++ generated code
     65                const char *name;
     66
     67                // copy of global UNIX variable errno
     68                int errno_;
     69
     70                // current execution status for coroutine
     71                enum coroutine_state state;
     72
     73                // first coroutine to resume this one
     74                struct coroutine_desc * starter;
     75
     76                // last coroutine to resume this one
     77                struct coroutine_desc * last;
    7378        };
    7479
  • src/libcfa/concurrency/kernel

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 10 14:46:49 2018
    13 // Update Count     : 10
     12// Last Modified On : Sat Jul 22 09:58:39 2017
     13// Update Count     : 2
    1414//
    1515
     
    1919
    2020#include "invoke.h"
    21 #include "time_t.h"
     21#include "bits/cfatime.h"
    2222
    2323extern "C" {
     
    4949
    5050        // Preemption rate on this cluster
    51         Duration preemption_rate;
     51        __cfa_time_t preemption_rate;
    5252};
    5353
    54 extern Duration default_preemption();
     54extern __cfa_time_t default_preemption();
    5555
    5656void ?{} (cluster & this);
  • src/libcfa/concurrency/kernel.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr  9 16:11:46 2018
    13 // Update Count     : 24
     12// Last Modified On : Thu Feb  8 23:52:19 2018
     13// Update Count     : 5
    1414//
    1515
     
    2525
    2626//CFA Includes
    27 #include "time"
    2827#include "kernel_private.h"
    2928#include "preemption.h"
     
    5352// Global state
    5453
     54thread_local coroutine_desc * volatile this_coroutine;
     55thread_local thread_desc *    volatile this_thread;
     56thread_local processor *      volatile this_processor;
     57
    5558// volatile thread_local bool preemption_in_progress = 0;
    5659// volatile thread_local bool preemption_enabled = false;
    5760// volatile thread_local unsigned short disable_preempt_count = 1;
    5861
    59 thread_local struct KernelThreadData kernelThreadData = {
    60         NULL,
    61         NULL,
    62         NULL,
    63         { 1, false, false }
    64 };
     62volatile thread_local __cfa_kernel_preemption_state_t preemption_state = { false, false, 1 };
    6563
    6664//-----------------------------------------------------------------------------
     
    174172                terminate(&this);
    175173                verify(this.do_terminate);
    176                 verify(TL_GET( this_processor ) != &this);
     174                verify(this_processor != &this);
    177175                P( terminated );
    178                 verify(TL_GET( this_processor ) != &this);
     176                verify(this_processor != &this);
    179177                pthread_join( kernel_thread, NULL );
    180178        }
     
    215213                        if(readyThread)
    216214                        {
    217                                 verify( ! TL_GET( preemption_state ).enabled );
     215                                verify( !preemption_state.enabled );
    218216
    219217                                runThread(this, readyThread);
    220218
    221                                 verify( ! TL_GET( preemption_state ).enabled );
     219                                verify( !preemption_state.enabled );
    222220
    223221                                //Some actions need to be taken from the kernel
     
    251249
    252250        //Update global state
    253         TL_SET( this_thread, dst );
     251        this_thread = dst;
    254252
    255253        // Context Switch to the thread
     
    259257
    260258void returnToKernel() {
    261         coroutine_desc * proc_cor = get_coroutine(TL_GET( this_processor )->runner);
    262         coroutine_desc * thrd_cor = TL_GET( this_thread )->curr_cor = TL_GET( this_coroutine );
     259        coroutine_desc * proc_cor = get_coroutine(this_processor->runner);
     260        coroutine_desc * thrd_cor = this_thread->curr_cor = this_coroutine;
    263261        ThreadCtxSwitch(thrd_cor, proc_cor);
    264262}
     
    268266void finishRunning(processor * this) with( this->finish ) {
    269267        if( action_code == Release ) {
    270                 verify( ! TL_GET( preemption_state ).enabled );
     268                verify( !preemption_state.enabled );
    271269                unlock( *lock );
    272270        }
     
    275273        }
    276274        else if( action_code == Release_Schedule ) {
    277                 verify( ! TL_GET( preemption_state ).enabled );
     275                verify( !preemption_state.enabled );
    278276                unlock( *lock );
    279277                ScheduleThread( thrd );
    280278        }
    281279        else if( action_code == Release_Multi ) {
    282                 verify( ! TL_GET( preemption_state ).enabled );
     280                verify( !preemption_state.enabled );
    283281                for(int i = 0; i < lock_count; i++) {
    284282                        unlock( *locks[i] );
     
    309307void * CtxInvokeProcessor(void * arg) {
    310308        processor * proc = (processor *) arg;
    311         TL_SET( this_processor, proc );
    312         TL_SET( this_coroutine, NULL );
    313         TL_SET( this_thread, NULL );
    314         TL_GET( preemption_state ).enabled = false;
    315         TL_GET( preemption_state ).disable_count = 1;
     309        this_processor = proc;
     310        this_coroutine = NULL;
     311        this_thread = NULL;
     312        preemption_state.enabled = false;
     313        preemption_state.disable_count = 1;
    316314        // SKULLDUGGERY: We want to create a context for the processor coroutine
    317315        // which is needed for the 2-step context switch. However, there is no reason
     
    325323
    326324        //Set global state
    327         TL_SET( this_coroutine, get_coroutine(proc->runner) );
    328         TL_SET( this_thread, NULL );
     325        this_coroutine = get_coroutine(proc->runner);
     326        this_thread = NULL;
    329327
    330328        //We now have a proper context from which to schedule threads
     
    354352
    355353void kernel_first_resume(processor * this) {
    356         coroutine_desc * src = TL_GET( this_coroutine );
     354        coroutine_desc * src = this_coroutine;
    357355        coroutine_desc * dst = get_coroutine(this->runner);
    358356
    359         verify( ! TL_GET( preemption_state ).enabled );
     357        verify( !preemption_state.enabled );
    360358
    361359        create_stack(&dst->stack, dst->stack.size);
    362360        CtxStart(&this->runner, CtxInvokeCoroutine);
    363361
    364         verify( ! TL_GET( preemption_state ).enabled );
     362        verify( !preemption_state.enabled );
    365363
    366364        dst->last = src;
     
    371369
    372370        // set new coroutine that task is executing
    373         TL_SET( this_coroutine, dst );
     371        this_coroutine = dst;
    374372
    375373        // SKULLDUGGERY normally interrupts are enable before leaving a coroutine ctxswitch.
     
    388386        src->state = Active;
    389387
    390         verify( ! TL_GET( preemption_state ).enabled );
     388        verify( !preemption_state.enabled );
    391389}
    392390
     
    394392// Scheduler routines
    395393void ScheduleThread( thread_desc * thrd ) {
    396         // if( ! thrd ) return;
     394        // if( !thrd ) return;
    397395        verify( thrd );
    398396        verify( thrd->self_cor.state != Halted );
    399397
    400         verify( ! TL_GET( preemption_state ).enabled );
     398        verify( !preemption_state.enabled );
    401399
    402400        verifyf( thrd->next == NULL, "Expected null got %p", thrd->next );
    403401
    404         with( *TL_GET( this_processor )->cltr ) {
     402        with( *this_processor->cltr ) {
    405403                lock  ( ready_queue_lock __cfaabi_dbg_ctx2 );
    406404                append( ready_queue, thrd );
     
    408406        }
    409407
    410         verify( ! TL_GET( preemption_state ).enabled );
     408        verify( !preemption_state.enabled );
    411409}
    412410
    413411thread_desc * nextThread(cluster * this) with( *this ) {
    414         verify( ! TL_GET( preemption_state ).enabled );
     412        verify( !preemption_state.enabled );
    415413        lock( ready_queue_lock __cfaabi_dbg_ctx2 );
    416414        thread_desc * head = pop_head( ready_queue );
    417415        unlock( ready_queue_lock );
    418         verify( ! TL_GET( preemption_state ).enabled );
     416        verify( !preemption_state.enabled );
    419417        return head;
    420418}
     
    422420void BlockInternal() {
    423421        disable_interrupts();
    424         verify( ! TL_GET( preemption_state ).enabled );
     422        verify( !preemption_state.enabled );
    425423        returnToKernel();
    426         verify( ! TL_GET( preemption_state ).enabled );
     424        verify( !preemption_state.enabled );
    427425        enable_interrupts( __cfaabi_dbg_ctx );
    428426}
     
    430428void BlockInternal( __spinlock_t * lock ) {
    431429        disable_interrupts();
    432         TL_GET( this_processor )->finish.action_code = Release;
    433         TL_GET( this_processor )->finish.lock        = lock;
    434 
    435         verify( ! TL_GET( preemption_state ).enabled );
     430        this_processor->finish.action_code = Release;
     431        this_processor->finish.lock        = lock;
     432
     433        verify( !preemption_state.enabled );
    436434        returnToKernel();
    437         verify( ! TL_GET( preemption_state ).enabled );
     435        verify( !preemption_state.enabled );
    438436
    439437        enable_interrupts( __cfaabi_dbg_ctx );
     
    442440void BlockInternal( thread_desc * thrd ) {
    443441        disable_interrupts();
    444         TL_GET( this_processor )->finish.action_code = Schedule;
    445         TL_GET( this_processor )->finish.thrd        = thrd;
    446 
    447         verify( ! TL_GET( preemption_state ).enabled );
     442        this_processor->finish.action_code = Schedule;
     443        this_processor->finish.thrd        = thrd;
     444
     445        verify( !preemption_state.enabled );
    448446        returnToKernel();
    449         verify( ! TL_GET( preemption_state ).enabled );
     447        verify( !preemption_state.enabled );
    450448
    451449        enable_interrupts( __cfaabi_dbg_ctx );
     
    455453        assert(thrd);
    456454        disable_interrupts();
    457         TL_GET( this_processor )->finish.action_code = Release_Schedule;
    458         TL_GET( this_processor )->finish.lock        = lock;
    459         TL_GET( this_processor )->finish.thrd        = thrd;
    460 
    461         verify( ! TL_GET( preemption_state ).enabled );
     455        this_processor->finish.action_code = Release_Schedule;
     456        this_processor->finish.lock        = lock;
     457        this_processor->finish.thrd        = thrd;
     458
     459        verify( !preemption_state.enabled );
    462460        returnToKernel();
    463         verify( ! TL_GET( preemption_state ).enabled );
     461        verify( !preemption_state.enabled );
    464462
    465463        enable_interrupts( __cfaabi_dbg_ctx );
     
    468466void BlockInternal(__spinlock_t * locks [], unsigned short count) {
    469467        disable_interrupts();
    470         TL_GET( this_processor )->finish.action_code = Release_Multi;
    471         TL_GET( this_processor )->finish.locks       = locks;
    472         TL_GET( this_processor )->finish.lock_count  = count;
    473 
    474         verify( ! TL_GET( preemption_state ).enabled );
     468        this_processor->finish.action_code = Release_Multi;
     469        this_processor->finish.locks       = locks;
     470        this_processor->finish.lock_count  = count;
     471
     472        verify( !preemption_state.enabled );
    475473        returnToKernel();
    476         verify( ! TL_GET( preemption_state ).enabled );
     474        verify( !preemption_state.enabled );
    477475
    478476        enable_interrupts( __cfaabi_dbg_ctx );
     
    481479void BlockInternal(__spinlock_t * locks [], unsigned short lock_count, thread_desc * thrds [], unsigned short thrd_count) {
    482480        disable_interrupts();
    483         TL_GET( this_processor )->finish.action_code = Release_Multi_Schedule;
    484         TL_GET( this_processor )->finish.locks       = locks;
    485         TL_GET( this_processor )->finish.lock_count  = lock_count;
    486         TL_GET( this_processor )->finish.thrds       = thrds;
    487         TL_GET( this_processor )->finish.thrd_count  = thrd_count;
    488 
    489         verify( ! TL_GET( preemption_state ).enabled );
     481        this_processor->finish.action_code = Release_Multi_Schedule;
     482        this_processor->finish.locks       = locks;
     483        this_processor->finish.lock_count  = lock_count;
     484        this_processor->finish.thrds       = thrds;
     485        this_processor->finish.thrd_count  = thrd_count;
     486
     487        verify( !preemption_state.enabled );
    490488        returnToKernel();
    491         verify( ! TL_GET( preemption_state ).enabled );
     489        verify( !preemption_state.enabled );
    492490
    493491        enable_interrupts( __cfaabi_dbg_ctx );
     
    495493
    496494void LeaveThread(__spinlock_t * lock, thread_desc * thrd) {
    497         verify( ! TL_GET( preemption_state ).enabled );
    498         TL_GET( this_processor )->finish.action_code = thrd ? Release_Schedule : Release;
    499         TL_GET( this_processor )->finish.lock        = lock;
    500         TL_GET( this_processor )->finish.thrd        = thrd;
     495        verify( !preemption_state.enabled );
     496        this_processor->finish.action_code = thrd ? Release_Schedule : Release;
     497        this_processor->finish.lock        = lock;
     498        this_processor->finish.thrd        = thrd;
    501499
    502500        returnToKernel();
     
    509507// Kernel boot procedures
    510508void kernel_startup(void) {
    511         verify( ! TL_GET( preemption_state ).enabled );
     509        verify( !preemption_state.enabled );
    512510        __cfaabi_dbg_print_safe("Kernel : Starting\n");
    513511
     
    533531
    534532        //initialize the global state variables
    535         TL_SET( this_processor, mainProcessor );
    536         TL_SET( this_thread, mainThread );
    537         TL_SET( this_coroutine, &mainThread->self_cor );
     533        this_processor = mainProcessor;
     534        this_thread = mainThread;
     535        this_coroutine = &mainThread->self_cor;
    538536
    539537        // Enable preemption
     
    547545        // context. Hence, the main thread does not begin through CtxInvokeThread, like all other threads. The trick here is that
    548546        // mainThread is on the ready queue when this call is made.
    549         kernel_first_resume( TL_GET( this_processor ) );
     547        kernel_first_resume( this_processor );
    550548
    551549
     
    554552        __cfaabi_dbg_print_safe("Kernel : Started\n--------------------------------------------------\n\n");
    555553
    556         verify( ! TL_GET( preemption_state ).enabled );
     554        verify( !preemption_state.enabled );
    557555        enable_interrupts( __cfaabi_dbg_ctx );
    558         verify( TL_GET( preemption_state ).enabled );
     556        verify( preemption_state.enabled );
    559557}
    560558
     
    562560        __cfaabi_dbg_print_safe("\n--------------------------------------------------\nKernel : Shutting down\n");
    563561
    564         verify( TL_GET( preemption_state ).enabled );
     562        verify( preemption_state.enabled );
    565563        disable_interrupts();
    566         verify( ! TL_GET( preemption_state ).enabled );
     564        verify( !preemption_state.enabled );
    567565
    568566        // SKULLDUGGERY: Notify the mainProcessor it needs to terminates.
     
    604602
    605603        // first task to abort ?
    606         if ( ! kernel_abort_called ) {                  // not first task to abort ?
     604        if ( !kernel_abort_called ) {                   // not first task to abort ?
    607605                kernel_abort_called = true;
    608606                unlock( kernel_abort_lock );
     
    619617        }
    620618
    621         return TL_GET( this_thread );
     619        return this_thread;
    622620}
    623621
     
    628626        __cfaabi_dbg_bits_write( abort_text, len );
    629627
    630         if ( get_coroutine(thrd) != TL_GET( this_coroutine ) ) {
    631                 len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", TL_GET( this_coroutine )->name, TL_GET( this_coroutine ) );
     628        if ( thrd != this_coroutine ) {
     629                len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine->name, this_coroutine );
    632630                __cfaabi_dbg_bits_write( abort_text, len );
    633631        }
     
    638636
    639637int kernel_abort_lastframe( void ) __attribute__ ((__nothrow__)) {
    640         return get_coroutine(TL_GET( this_thread )) == get_coroutine(mainThread) ? 4 : 2;
     638        return get_coroutine(this_thread) == get_coroutine(mainThread) ? 4 : 2;
    641639}
    642640
     
    668666        if ( count < 0 ) {
    669667                // queue current task
    670                 append( waiting, (thread_desc *)TL_GET( this_thread ) );
     668                append( waiting, (thread_desc *)this_thread );
    671669
    672670                // atomically release spin lock and block
  • src/libcfa/concurrency/kernel_private.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon Feb 13 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 29 14:06:40 2018
    13 // Update Count     : 3
     12// Last Modified On : Sat Jul 22 09:58:09 2017
     13// Update Count     : 2
    1414//
    1515
     
    6666extern event_kernel_t * event_kernel;
    6767
    68 //extern thread_local coroutine_desc * volatile this_coroutine;
    69 //extern thread_local thread_desc *    volatile this_thread;
    70 //extern thread_local processor *      volatile this_processor;
     68extern thread_local coroutine_desc * volatile this_coroutine;
     69extern thread_local thread_desc *    volatile this_thread;
     70extern thread_local processor *      volatile this_processor;
    7171
    7272// extern volatile thread_local bool preemption_in_progress;
  • src/libcfa/concurrency/monitor.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Thd Feb 23 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 14:30:26 2018
    13 // Update Count     : 9
     12// Last Modified On : Fri Feb 16 14:49:53 2018
     13// Update Count     : 5
    1414//
    1515
     
    8585                // Lock the monitor spinlock
    8686                lock( this->lock __cfaabi_dbg_ctx2 );
    87                 thread_desc * thrd = TL_GET( this_thread );
     87                thread_desc * thrd = this_thread;
    8888
    8989                __cfaabi_dbg_print_safe( "Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);
     
    134134                // Lock the monitor spinlock
    135135                lock( this->lock __cfaabi_dbg_ctx2 );
    136                 thread_desc * thrd = TL_GET( this_thread );
     136                thread_desc * thrd = this_thread;
    137137
    138138                __cfaabi_dbg_print_safe( "Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner);
     
    168168
    169169                        // Create the node specific to this wait operation
    170                         wait_ctx_primed( TL_GET( this_thread ), 0 )
     170                        wait_ctx_primed( this_thread, 0 )
    171171
    172172                        // Some one else has the monitor, wait for him to finish and then run
     
    179179                        __cfaabi_dbg_print_safe( "Kernel :  blocking \n" );
    180180
    181                         wait_ctx( TL_GET( this_thread ), 0 )
     181                        wait_ctx( this_thread, 0 )
    182182                        this->dtor_node = &waiter;
    183183
     
    199199                lock( this->lock __cfaabi_dbg_ctx2 );
    200200
    201                 __cfaabi_dbg_print_safe( "Kernel : %10p Leaving mon %p (%p)\n", TL_GET( this_thread ), this, this->owner);
    202 
    203                 verifyf( TL_GET( this_thread ) == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", TL_GET( this_thread ), this->owner, this->recursion, this );
     201                __cfaabi_dbg_print_safe( "Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner);
     202
     203                verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", this_thread, this->owner, this->recursion, this );
    204204
    205205                // Leaving a recursion level, decrement the counter
     
    227227        void __leave_dtor_monitor_desc( monitor_desc * this ) {
    228228                __cfaabi_dbg_debug_do(
    229                         if( TL_GET( this_thread ) != this->owner ) {
    230                                 abort( "Destroyed monitor %p has inconsistent owner, expected %p got %p.\n", this, TL_GET( this_thread ), this->owner);
     229                        if( this_thread != this->owner ) {
     230                                abort( "Destroyed monitor %p has inconsistent owner, expected %p got %p.\n", this, this_thread, this->owner);
    231231                        }
    232232                        if( this->recursion != 1 ) {
     
    297297
    298298        // Save previous thread context
    299         this.prev = TL_GET( this_thread )->monitors;
     299        this.prev = this_thread->monitors;
    300300
    301301        // Update thread context (needed for conditions)
    302         (TL_GET( this_thread )->monitors){m, count, func};
     302        (this_thread->monitors){m, count, func};
    303303
    304304        // __cfaabi_dbg_print_safe( "MGUARD : enter %d\n", count);
     
    322322
    323323        // Restore thread context
    324         TL_GET( this_thread )->monitors = this.prev;
     324        this_thread->monitors = this.prev;
    325325}
    326326
     
    332332
    333333        // Save previous thread context
    334         this.prev = TL_GET( this_thread )->monitors;
     334        this.prev = this_thread->monitors;
    335335
    336336        // Update thread context (needed for conditions)
    337         (TL_GET( this_thread )->monitors){m, 1, func};
     337        (this_thread->monitors){m, 1, func};
    338338
    339339        __enter_monitor_dtor( this.m, func );
     
    346346
    347347        // Restore thread context
    348         TL_GET( this_thread )->monitors = this.prev;
     348        this_thread->monitors = this.prev;
    349349}
    350350
     
    386386
    387387        // Create the node specific to this wait operation
    388         wait_ctx( TL_GET( this_thread ), user_info );
     388        wait_ctx( this_thread, user_info );
    389389
    390390        // Append the current wait operation to the ones already queued on the condition
     
    425425        //Some more checking in debug
    426426        __cfaabi_dbg_debug_do(
    427                 thread_desc * this_thrd = TL_GET( this_thread );
     427                thread_desc * this_thrd = this_thread;
    428428                if ( this.monitor_count != this_thrd->monitors.size ) {
    429429                        abort( "Signal on condition %p made with different number of monitor(s), expected %zi got %zi", &this, this.monitor_count, this_thrd->monitors.size );
     
    473473
    474474        // Create the node specific to this wait operation
    475         wait_ctx_primed( TL_GET( this_thread ), 0 )
     475        wait_ctx_primed( this_thread, 0 )
    476476
    477477        //save contexts
     
    566566
    567567                                // Create the node specific to this wait operation
    568                                 wait_ctx_primed( TL_GET( this_thread ), 0 );
     568                                wait_ctx_primed( this_thread, 0 );
    569569
    570570                                // Save monitor states
     
    612612
    613613        // Create the node specific to this wait operation
    614         wait_ctx_primed( TL_GET( this_thread ), 0 );
     614        wait_ctx_primed( this_thread, 0 );
    615615
    616616        monitor_save;
     
    618618
    619619        for( __lock_size_t i = 0; i < count; i++) {
    620                 verify( monitors[i]->owner == TL_GET( this_thread ) );
     620                verify( monitors[i]->owner == this_thread );
    621621        }
    622622
     
    812812
    813813static inline void brand_condition( condition & this ) {
    814         thread_desc * thrd = TL_GET( this_thread );
     814        thread_desc * thrd = this_thread;
    815815        if( !this.monitors ) {
    816816                // __cfaabi_dbg_print_safe( "Branding\n" );
  • src/libcfa/concurrency/preemption.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon Jun 5 14:20:42 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr  9 13:52:39 2018
    13 // Update Count     : 36
     12// Last Modified On : Fri Feb  9 16:38:13 2018
     13// Update Count     : 14
    1414//
    1515
     
    2323}
    2424
     25#include "bits/cfatime.h"
    2526#include "bits/signal.h"
    2627
    2728#if !defined(__CFA_DEFAULT_PREEMPTION__)
    28 #define __CFA_DEFAULT_PREEMPTION__ 10`ms
     29#define __CFA_DEFAULT_PREEMPTION__ 10`cfa_ms
    2930#endif
    3031
    31 Duration default_preemption() __attribute__((weak)) {
     32__cfa_time_t default_preemption() __attribute__((weak)) {
    3233        return __CFA_DEFAULT_PREEMPTION__;
    3334}
     
    7778
    7879// Get next expired node
    79 static inline alarm_node_t * get_expired( alarm_list_t * alarms, Time currtime ) {
     80static inline alarm_node_t * get_expired( alarm_list_t * alarms, __cfa_time_t currtime ) {
    8081        if( !alarms->head ) return NULL;                          // If no alarms return null
    8182        if( alarms->head->alarm >= currtime ) return NULL;        // If alarms head not expired return null
     
    8788        alarm_node_t * node = NULL;                     // Used in the while loop but cannot be declared in the while condition
    8889        alarm_list_t * alarms = &event_kernel->alarms;  // Local copy for ease of reading
    89         Time currtime = __kernel_get_time();                    // Check current time once so we everything "happens at once"
     90        __cfa_time_t currtime = __kernel_get_time();    // Check current time once so we everything "happens at once"
    9091
    9192        //Loop throught every thing expired
     
    101102
    102103                // Check if this is a periodic alarm
    103                 Duration period = node->period;
     104                __cfa_time_t period = node->period;
    104105                if( period > 0 ) {
    105106                        node->alarm = currtime + period;    // Alarm is periodic, add currtime to it (used cached current time)
     
    116117
    117118// Update the preemption of a processor and notify interested parties
    118 void update_preemption( processor * this, Duration duration ) {
     119void update_preemption( processor * this, __cfa_time_t duration ) {
    119120        alarm_node_t * alarm = this->preemption_alarm;
    120121
    121122        // Alarms need to be enabled
    122         if ( duration > 0 && ! alarm->set ) {
     123        if ( duration > 0 && !alarm->set ) {
    123124                alarm->alarm = __kernel_get_time() + duration;
    124125                alarm->period = duration;
    125126                register_self( alarm );
    126127        }
    127         // Zero duration but alarm is set
     128        // Zero duraction but alarm is set
    128129        else if ( duration == 0 && alarm->set ) {
    129130                unregister_self( alarm );
     
    149150        // Disable interrupts by incrementing the counter
    150151        void disable_interrupts() {
    151                 TL_GET( preemption_state ).enabled = false;
    152                 __attribute__((unused)) unsigned short new_val = TL_GET( preemption_state ).disable_count + 1;
    153                 TL_GET( preemption_state ).disable_count = new_val;
     152                preemption_state.enabled = false;
     153                __attribute__((unused)) unsigned short new_val = preemption_state.disable_count + 1;
     154                preemption_state.disable_count = new_val;
    154155                verify( new_val < 65_000u );              // If this triggers someone is disabling interrupts without enabling them
    155156        }
     
    158159        // If counter reaches 0, execute any pending CtxSwitch
    159160        void enable_interrupts( __cfaabi_dbg_ctx_param ) {
    160                 processor   * proc = TL_GET( this_processor ); // Cache the processor now since interrupts can start happening after the atomic add
    161                 thread_desc * thrd = TL_GET( this_thread );       // Cache the thread now since interrupts can start happening after the atomic add
    162 
    163                 unsigned short prev = TL_GET( preemption_state ).disable_count;
    164                 TL_GET( preemption_state ).disable_count -= 1;
     161                processor   * proc = this_processor;      // Cache the processor now since interrupts can start happening after the atomic add
     162                thread_desc * thrd = this_thread;         // Cache the thread now since interrupts can start happening after the atomic add
     163
     164                unsigned short prev = preemption_state.disable_count;
     165                preemption_state.disable_count -= 1;
    165166                verify( prev != 0u );                     // If this triggers someone is enabled already enabled interruptsverify( prev != 0u );
    166167
    167168                // Check if we need to prempt the thread because an interrupt was missed
    168169                if( prev == 1 ) {
    169                         TL_GET( preemption_state ).enabled = true;
     170                        preemption_state.enabled = true;
    170171                        if( proc->pending_preemption ) {
    171172                                proc->pending_preemption = false;
     
    181182        // Don't execute any pending CtxSwitch even if counter reaches 0
    182183        void enable_interrupts_noPoll() {
    183                 unsigned short prev = TL_GET( preemption_state ).disable_count;
    184                 TL_GET( preemption_state ).disable_count -= 1;
     184                unsigned short prev = preemption_state.disable_count;
     185                preemption_state.disable_count -= 1;
    185186                verifyf( prev != 0u, "Incremented from %u\n", prev );                     // If this triggers someone is enabled already enabled interrupts
    186187                if( prev == 1 ) {
    187                         TL_GET( preemption_state ).enabled = true;
     188                        preemption_state.enabled = true;
    188189                }
    189190        }
     
    235236// If false : preemption is unsafe and marked as pending
    236237static inline bool preemption_ready() {
    237         bool ready = TL_GET( preemption_state ).enabled && !TL_GET( preemption_state ).in_progress; // Check if preemption is safe
    238         TL_GET( this_processor )->pending_preemption = !ready;                  // Adjust the pending flag accordingly
     238        bool ready = preemption_state.enabled && !preemption_state.in_progress; // Check if preemption is safe
     239        this_processor->pending_preemption = !ready;                        // Adjust the pending flag accordingly
    239240        return ready;
    240241}
     
    250251
    251252        // Start with preemption disabled until ready
    252         TL_GET( preemption_state ).enabled = false;
    253         TL_GET( preemption_state ).disable_count = 1;
     253        preemption_state.enabled = false;
     254        preemption_state.disable_count = 1;
    254255
    255256        // Initialize the event kernel
     
    290291// Used by thread to control when they want to receive preemption signals
    291292void ?{}( preemption_scope & this, processor * proc ) {
    292         (this.alarm){ proc, (Time){ 0 }, 0`s };
     293        (this.alarm){ proc, 0`cfa_s, 0`cfa_s };
    293294        this.proc = proc;
    294295        this.proc->preemption_alarm = &this.alarm;
     
    300301        disable_interrupts();
    301302
    302         update_preemption( this.proc, 0`s );
     303        update_preemption( this.proc, 0`cfa_s );
    303304}
    304305
     
    316317        // before the kernel thread has even started running. When that happens an iterrupt
    317318        // we a null 'this_processor' will be caught, just ignore it.
    318         if(!TL_GET( this_processor )) return;
     319        if(!this_processor) return;
    319320
    320321        choose(sfp->si_value.sival_int) {
    321322                case PREEMPT_NORMAL   : ;// Normal case, nothing to do here
    322                 case PREEMPT_TERMINATE: verify(TL_GET( this_processor )->do_terminate);
     323                case PREEMPT_TERMINATE: verify(this_processor->do_terminate);
    323324                default:
    324325                        abort( "internal error, signal value is %d", sfp->si_value.sival_int );
     
    330331        __cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p).\n", this_processor, this_thread);
    331332
    332         TL_GET( preemption_state ).in_progress = true;  // Sync flag : prevent recursive calls to the signal handler
     333        preemption_state.in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
    333334        signal_unblock( SIGUSR1 );                          // We are about to CtxSwitch out of the signal handler, let other handlers in
    334         TL_GET( preemption_state ).in_progress = false; // Clear the in progress flag
     335        preemption_state.in_progress = false;                    // Clear the in progress flag
    335336
    336337        // Preemption can occur here
    337338
    338         BlockInternal( (thread_desc*)TL_GET( this_thread ) ); // Do the actual CtxSwitch
     339        BlockInternal( (thread_desc*)this_thread );        // Do the actual CtxSwitch
    339340}
    340341
  • src/libcfa/concurrency/preemption.h

    r32cab5b rb2fe1c9  
    1010// Created On       : Mon Jun 5 14:20:42 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 23 17:18:53 2018
    13 // Update Count     : 2
     12// Last Modified On : Fri Jul 21 22:34:25 2017
     13// Update Count     : 1
    1414//
    1515
     
    2121void kernel_start_preemption();
    2222void kernel_stop_preemption();
    23 void update_preemption( processor * this, Duration duration );
     23void update_preemption( processor * this, __cfa_time_t duration );
    2424void tick_preemption();
    2525
  • src/libcfa/concurrency/thread

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 29 14:07:11 2018
    13 // Update Count     : 4
     12// Last Modified On : Sat Jul 22 09:59:40 2017
     13// Update Count     : 3
    1414//
    1515
     
    5252}
    5353
    54 //extern thread_local thread_desc * volatile this_thread;
     54extern thread_local thread_desc * volatile this_thread;
    5555
    5656forall( dtype T | is_thread(T) )
  • src/libcfa/concurrency/thread.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 30 17:19:52 2018
    13 // Update Count     : 8
     12// Last Modified On : Fri Jul 21 22:34:46 2017
     13// Update Count     : 1
    1414//
    1515
     
    2626}
    2727
    28 //extern volatile thread_local processor * this_processor;
     28extern volatile thread_local processor * this_processor;
    2929
    3030//-----------------------------------------------------------------------------
     
    7575        coroutine_desc* thrd_c = get_coroutine(this);
    7676        thread_desc   * thrd_h = get_thread   (this);
    77         thrd_c->last = TL_GET( this_coroutine );
     77        thrd_c->last = this_coroutine;
    7878
    7979        // __cfaabi_dbg_print_safe("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
     
    8181        disable_interrupts();
    8282        create_stack(&thrd_c->stack, thrd_c->stack.size);
    83         TL_SET( this_coroutine, thrd_c );
     83        this_coroutine = thrd_c;
    8484        CtxStart(&this, CtxInvokeThread);
    8585        assert( thrd_c->last->stack.context );
     
    9292extern "C" {
    9393        void __finish_creation(void) {
    94                 coroutine_desc* thrd_c = TL_GET( this_coroutine );
     94                coroutine_desc* thrd_c = this_coroutine;
    9595                ThreadCtxSwitch( thrd_c, thrd_c->last );
    9696        }
     
    9898
    9999void yield( void ) {
    100         verify( TL_GET( preemption_state ).enabled );
    101         BlockInternal( TL_GET( this_thread ) );
    102         verify( TL_GET( preemption_state ).enabled );
     100        verify( preemption_state.enabled );
     101        BlockInternal( this_thread );
     102        verify( preemption_state.enabled );
    103103}
    104104
     
    116116        // set new coroutine that the processor is executing
    117117        // and context switch to it
    118         TL_SET( this_coroutine, dst );
     118        this_coroutine = dst;
    119119        assert( src->stack.context );
    120120        CtxSwitch( src->stack.context, dst->stack.context );
    121         TL_SET( this_coroutine, src );
     121        this_coroutine = src;
    122122
    123123        // set state of new coroutine to active
  • src/libcfa/iostream

    r32cab5b rb2fe1c9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 12 14:34:37 2018
    13 // Update Count     : 150
     12// Last Modified On : Thu Jan 25 13:08:39 2018
     13// Update Count     : 149
    1414//
    1515
     
    159159forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, _Istream_cstrC );
    160160
    161 
    162 #include <time_t.h>                                                                             // Duration (constructors) / Time (constructors)
    163 
    164 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Duration dur );
    165 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Time time );
    166 
    167 
    168161// Local Variables: //
    169162// mode: c //
  • src/libcfa/stdlib.c

    r32cab5b rb2fe1c9  
    9999        char * eeptr;
    100100        re = strtof( sptr, &eeptr );
    101         if ( sptr == eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0f + 0.0f * _Complex_I; }
     101        if ( sptr == *eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0f + 0.0f * _Complex_I; }
    102102        im = strtof( eeptr, &eeptr );
    103         if ( sptr == eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0f + 0.0f * _Complex_I; }
     103        if ( sptr == *eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0f + 0.0f * _Complex_I; }
    104104        if ( *eeptr != 'i' ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0f + 0.0f * _Complex_I; }
    105105        return re + im * _Complex_I;
     
    110110        char * eeptr;
    111111        re = strtod( sptr, &eeptr );
    112         if ( sptr == eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0 + 0.0 * _Complex_I; }
     112        if ( sptr == *eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0 + 0.0 * _Complex_I; }
    113113        im = strtod( eeptr, &eeptr );
    114         if ( sptr == eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0 + 0.0 * _Complex_I; }
     114        if ( sptr == *eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0 + 0.0 * _Complex_I; }
    115115        if ( *eeptr != 'i' ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0 + 0.0 * _Complex_I; }
    116116        return re + im * _Complex_I;
     
    121121        char * eeptr;
    122122        re = strtold( sptr, &eeptr );
    123         if ( sptr == eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0L + 0.0L * _Complex_I; }
     123        if ( sptr == *eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0L + 0.0L * _Complex_I; }
    124124        im = strtold( eeptr, &eeptr );
    125         if ( sptr == eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0L + 0.0L * _Complex_I; }
     125        if ( sptr == *eeptr ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0L + 0.0L * _Complex_I; }
    126126        if ( *eeptr != 'i' ) { if ( eptr != 0 ) *eptr = eeptr; return 0.0L + 0.0L * _Complex_I; }
    127127        return re + im * _Complex_I;
  • src/tests/.expect/attributes.x64.txt

    r32cab5b rb2fe1c9  
    33    L: __attribute__ ((unused)) ((void)1);
    44}
    5 struct __attribute__ ((unused)) __anonymous0 {
     5__attribute__ ((unused)) struct __anonymous0 {
    66};
    77static inline void ___constructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1);
     
    2020    return ___ret__13s__anonymous0_1;
    2121}
    22 struct __attribute__ ((unused)) Agn1;
    23 struct __attribute__ ((unused)) Agn2 {
     22__attribute__ ((unused)) struct Agn1;
     23__attribute__ ((unused)) struct Agn2 {
    2424};
    2525static inline void ___constructor__F_R5sAgn2_autogen___1(struct Agn2 *___dst__R5sAgn2_1);
     
    4545    __E2__C5eAgn3_1,
    4646};
    47 struct __attribute__ ((unused)) __anonymous2;
    48 struct __attribute__ ((unused)) __anonymous3;
     47__attribute__ ((unused)) struct __anonymous2;
     48__attribute__ ((unused)) struct __anonymous3;
    4949struct Fdl {
    5050    __attribute__ ((unused)) signed int __f1__i_1;
     
    314314    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int (*)[10]));
    315315    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int ()));
    316     struct __attribute__ ((unused)) __anonymous4 {
     316    __attribute__ ((unused)) struct __anonymous4 {
    317317        signed int __i__i_2;
    318318    };
  • src/tests/.expect/attributes.x86.txt

    r32cab5b rb2fe1c9  
    33    L: __attribute__ ((unused)) ((void)1);
    44}
    5 struct __attribute__ ((unused)) __anonymous0 {
     5__attribute__ ((unused)) struct __anonymous0 {
    66};
    77static inline void ___constructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1);
     
    2020    return ___ret__13s__anonymous0_1;
    2121}
    22 struct __attribute__ ((unused)) Agn1;
    23 struct __attribute__ ((unused)) Agn2 {
     22__attribute__ ((unused)) struct Agn1;
     23__attribute__ ((unused)) struct Agn2 {
    2424};
    2525static inline void ___constructor__F_R5sAgn2_autogen___1(struct Agn2 *___dst__R5sAgn2_1);
     
    4545    __E2__C5eAgn3_1,
    4646};
    47 struct __attribute__ ((unused)) __anonymous2;
    48 struct __attribute__ ((unused)) __anonymous3;
     47__attribute__ ((unused)) struct __anonymous2;
     48__attribute__ ((unused)) struct __anonymous3;
    4949struct Fdl {
    5050    __attribute__ ((unused)) signed int __f1__i_1;
     
    314314    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int (*)[10]));
    315315    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int ()));
    316     struct __attribute__ ((unused)) __anonymous4 {
     316    __attribute__ ((unused)) struct __anonymous4 {
    317317        signed int __i__i_2;
    318318    };
  • src/tests/.expect/literals.x64.txt

    r32cab5b rb2fe1c9  
    122122struct _Istream_cstrC __cstr__F15s_Istream_cstrC_Pci__1(char *__anonymous_object1340, signed int __size__i_1);
    123123void *___operator_bitor__A0_1_0_0___fail__PFi_Rd0___eof__PFi_Rd0___open__PF_Rd0PCc___close__PF_Rd0___read__PFRd0_Rd0PcUl___ungetc__PFRd0_Rd0c___fmt__PFi_Rd0PCc__FRd0_Rd015s_Istream_cstrC__1(__attribute__ ((unused)) signed int (*__fail__PFi_R7tistype__1)(void *__anonymous_object1341), __attribute__ ((unused)) signed int (*__eof__PFi_R7tistype__1)(void *__anonymous_object1342), __attribute__ ((unused)) void (*__open__PF_R7tistypePCc__1)(void *__is__R7tistype_1, const char *__name__PCc_1), __attribute__ ((unused)) void (*__close__PF_R7tistype__1)(void *__is__R7tistype_1), __attribute__ ((unused)) void *(*__read__PFR7tistype_R7tistypePcUl__1)(void *__anonymous_object1343, char *__anonymous_object1344, unsigned long int __anonymous_object1345), __attribute__ ((unused)) void *(*__ungetc__PFR7tistype_R7tistypec__1)(void *__anonymous_object1346, char __anonymous_object1347), __attribute__ ((unused)) signed int (*__fmt__PFi_R7tistypePCc__1)(void *__anonymous_object1348, const char *__fmt__PCc_1, ...), void *__anonymous_object1349, struct _Istream_cstrC __anonymous_object1350);
    124 struct Duration {
    125     signed long int __tv__l_1;
    126 };
    127 static inline void ___constructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1);
    128 static inline void ___constructor__F_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1);
    129 static inline void ___destructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1);
    130 static inline struct Duration ___operator_assign__F9sDuration_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1);
    131 static inline void ___constructor__F_R9sDurationl_autogen___1(struct Duration *___dst__R9sDuration_1, signed long int __tv__l_1);
    132 static inline void ___constructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1){
    133     ((void)((*___dst__R9sDuration_1).__tv__l_1) /* ?{} */);
    134 }
    135 static inline void ___constructor__F_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1){
    136     ((void)((*___dst__R9sDuration_1).__tv__l_1=___src__9sDuration_1.__tv__l_1) /* ?{} */);
    137 }
    138 static inline void ___destructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1){
    139     ((void)((*___dst__R9sDuration_1).__tv__l_1) /* ^?{} */);
    140 }
    141 static inline struct Duration ___operator_assign__F9sDuration_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1){
    142     struct Duration ___ret__9sDuration_1;
    143     ((void)((*___dst__R9sDuration_1).__tv__l_1=___src__9sDuration_1.__tv__l_1));
    144     ((void)___constructor__F_R9sDuration9sDuration_autogen___1((&___ret__9sDuration_1), (*___dst__R9sDuration_1)));
    145     return ___ret__9sDuration_1;
    146 }
    147 static inline void ___constructor__F_R9sDurationl_autogen___1(struct Duration *___dst__R9sDuration_1, signed long int __tv__l_1){
    148     ((void)((*___dst__R9sDuration_1).__tv__l_1=__tv__l_1) /* ?{} */);
    149 }
    150 static inline void ___constructor__F_R9sDuration__1(struct Duration *__dur__R9sDuration_1){
    151     ((void)((*__dur__R9sDuration_1).__tv__l_1) /* ?{} */);
    152     ((void)((*__dur__R9sDuration_1).__tv__l_1=((signed long int )0)));
    153 }
    154 static inline void ___constructor__F_R9sDurationZ__1(struct Duration *__dur__R9sDuration_1, long int __anonymous_object1351){
    155     ((void)((*__dur__R9sDuration_1).__tv__l_1) /* ?{} */);
    156     ((void)((*__dur__R9sDuration_1).__tv__l_1=((signed long int )0)));
    157 }
    158 struct Time {
    159     unsigned long int __tv__Ul_1;
    160 };
    161 static inline void ___constructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1);
    162 static inline void ___constructor__F_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1);
    163 static inline void ___destructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1);
    164 static inline struct Time ___operator_assign__F5sTime_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1);
    165 static inline void ___constructor__F_R5sTimeUl_autogen___1(struct Time *___dst__R5sTime_1, unsigned long int __tv__Ul_1);
    166 static inline void ___constructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1){
    167     ((void)((*___dst__R5sTime_1).__tv__Ul_1) /* ?{} */);
    168 }
    169 static inline void ___constructor__F_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1){
    170     ((void)((*___dst__R5sTime_1).__tv__Ul_1=___src__5sTime_1.__tv__Ul_1) /* ?{} */);
    171 }
    172 static inline void ___destructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1){
    173     ((void)((*___dst__R5sTime_1).__tv__Ul_1) /* ^?{} */);
    174 }
    175 static inline struct Time ___operator_assign__F5sTime_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1){
    176     struct Time ___ret__5sTime_1;
    177     ((void)((*___dst__R5sTime_1).__tv__Ul_1=___src__5sTime_1.__tv__Ul_1));
    178     ((void)___constructor__F_R5sTime5sTime_autogen___1((&___ret__5sTime_1), (*___dst__R5sTime_1)));
    179     return ___ret__5sTime_1;
    180 }
    181 static inline void ___constructor__F_R5sTimeUl_autogen___1(struct Time *___dst__R5sTime_1, unsigned long int __tv__Ul_1){
    182     ((void)((*___dst__R5sTime_1).__tv__Ul_1=__tv__Ul_1) /* ?{} */);
    183 }
    184 static inline void ___constructor__F_R5sTime__1(struct Time *__time__R5sTime_1){
    185     ((void)((*__time__R5sTime_1).__tv__Ul_1) /* ?{} */);
    186     ((void)((*__time__R5sTime_1).__tv__Ul_1=((unsigned long int )0)));
    187 }
    188 static inline void ___constructor__F_R5sTimeZ__1(struct Time *__time__R5sTime_1, long int __anonymous_object1352){
    189     ((void)((*__time__R5sTime_1).__tv__Ul_1) /* ?{} */);
    190     ((void)((*__time__R5sTime_1).__tv__Ul_1=((unsigned long int )0)));
    191 }
    192 void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd09sDuration__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_R7tostype__1)(void *__anonymous_object1353), __attribute__ ((unused)) void (*__sepReset__PF_R7tostype__1)(void *__anonymous_object1354), __attribute__ ((unused)) void (*__sepReset__PF_R7tostypeb__1)(void *__anonymous_object1355, _Bool __anonymous_object1356), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_R7tostype__1)(void *__anonymous_object1357), __attribute__ ((unused)) void (*__sepSetCur__PF_R7tostypePCc__1)(void *__anonymous_object1358, const char *__anonymous_object1359), __attribute__ ((unused)) _Bool (*__getNL__PFb_R7tostype__1)(void *__anonymous_object1360), __attribute__ ((unused)) void (*__setNL__PF_R7tostypeb__1)(void *__anonymous_object1361, _Bool __anonymous_object1362), __attribute__ ((unused)) void (*__sepOn__PF_R7tostype__1)(void *__anonymous_object1363), __attribute__ ((unused)) void (*__sepOff__PF_R7tostype__1)(void *__anonymous_object1364), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_R7tostype__1)(void *__anonymous_object1365), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_R7tostype__1)(void *__anonymous_object1366), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_R7tostype__1)(void *__anonymous_object1367), __attribute__ ((unused)) void (*__sepSet__PF_R7tostypePCc__1)(void *__anonymous_object1368, const char *__anonymous_object1369), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_R7tostype__1)(void *__anonymous_object1370), __attribute__ ((unused)) void (*__sepSetTuple__PF_R7tostypePCc__1)(void *__anonymous_object1371, const char *__anonymous_object1372), __attribute__ ((unused)) signed int (*__fail__PFi_R7tostype__1)(void *__anonymous_object1373), __attribute__ ((unused)) signed int (*__flush__PFi_R7tostype__1)(void *__anonymous_object1374), __attribute__ ((unused)) void (*__open__PF_R7tostypePCcPCc__1)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_R7tostype__1)(void *__os__R7tostype_1), __attribute__ ((unused)) void *(*__write__PFR7tostype_R7tostypePCcUl__1)(void *__anonymous_object1375, const char *__anonymous_object1376, unsigned long int __anonymous_object1377), __attribute__ ((unused)) signed int (*__fmt__PFi_R7tostypePCc__1)(void *__anonymous_object1378, const char *__fmt__PCc_1, ...), void *__os__R7tostype_1, struct Duration __dur__9sDuration_1);
    193 void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd05sTime__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_R7tostype__1)(void *__anonymous_object1379), __attribute__ ((unused)) void (*__sepReset__PF_R7tostype__1)(void *__anonymous_object1380), __attribute__ ((unused)) void (*__sepReset__PF_R7tostypeb__1)(void *__anonymous_object1381, _Bool __anonymous_object1382), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_R7tostype__1)(void *__anonymous_object1383), __attribute__ ((unused)) void (*__sepSetCur__PF_R7tostypePCc__1)(void *__anonymous_object1384, const char *__anonymous_object1385), __attribute__ ((unused)) _Bool (*__getNL__PFb_R7tostype__1)(void *__anonymous_object1386), __attribute__ ((unused)) void (*__setNL__PF_R7tostypeb__1)(void *__anonymous_object1387, _Bool __anonymous_object1388), __attribute__ ((unused)) void (*__sepOn__PF_R7tostype__1)(void *__anonymous_object1389), __attribute__ ((unused)) void (*__sepOff__PF_R7tostype__1)(void *__anonymous_object1390), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_R7tostype__1)(void *__anonymous_object1391), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_R7tostype__1)(void *__anonymous_object1392), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_R7tostype__1)(void *__anonymous_object1393), __attribute__ ((unused)) void (*__sepSet__PF_R7tostypePCc__1)(void *__anonymous_object1394, const char *__anonymous_object1395), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_R7tostype__1)(void *__anonymous_object1396), __attribute__ ((unused)) void (*__sepSetTuple__PF_R7tostypePCc__1)(void *__anonymous_object1397, const char *__anonymous_object1398), __attribute__ ((unused)) signed int (*__fail__PFi_R7tostype__1)(void *__anonymous_object1399), __attribute__ ((unused)) signed int (*__flush__PFi_R7tostype__1)(void *__anonymous_object1400), __attribute__ ((unused)) void (*__open__PF_R7tostypePCcPCc__1)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_R7tostype__1)(void *__os__R7tostype_1), __attribute__ ((unused)) void *(*__write__PFR7tostype_R7tostypePCcUl__1)(void *__anonymous_object1401, const char *__anonymous_object1402, unsigned long int __anonymous_object1403), __attribute__ ((unused)) signed int (*__fmt__PFi_R7tostypePCc__1)(void *__anonymous_object1404, const char *__fmt__PCc_1, ...), void *__os__R7tostype_1, struct Time __time__5sTime_1);
    194124enum __anonymous0 {
    195125    __sepSize__C13e__anonymous0_1 = 16,
     
    471401
    472402}
    473 _Bool __sepPrt__Fb_R9sofstream__1(struct ofstream *__anonymous_object1405);
    474 void __sepReset__F_R9sofstream__1(struct ofstream *__anonymous_object1406);
    475 void __sepReset__F_R9sofstreamb__1(struct ofstream *__anonymous_object1407, _Bool __anonymous_object1408);
    476 const char *__sepGetCur__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1409);
    477 void __sepSetCur__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1410, const char *__anonymous_object1411);
    478 _Bool __getNL__Fb_R9sofstream__1(struct ofstream *__anonymous_object1412);
    479 void __setNL__F_R9sofstreamb__1(struct ofstream *__anonymous_object1413, _Bool __anonymous_object1414);
    480 void __sepOn__F_R9sofstream__1(struct ofstream *__anonymous_object1415);
    481 void __sepOff__F_R9sofstream__1(struct ofstream *__anonymous_object1416);
    482 _Bool __sepDisable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1417);
    483 _Bool __sepEnable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1418);
    484 const char *__sepGet__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1419);
    485 void __sepSet__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1420, const char *__anonymous_object1421);
    486 const char *__sepGetTuple__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1422);
    487 void __sepSetTuple__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1423, const char *__anonymous_object1424);
    488 signed int __fail__Fi_R9sofstream__1(struct ofstream *__anonymous_object1425);
    489 signed int __flush__Fi_R9sofstream__1(struct ofstream *__anonymous_object1426);
    490 void __open__F_R9sofstreamPCcPCc__1(struct ofstream *__anonymous_object1427, const char *__name__PCc_1, const char *__mode__PCc_1);
    491 void __open__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1428, const char *__name__PCc_1);
    492 void __close__F_R9sofstream__1(struct ofstream *__anonymous_object1429);
    493 struct ofstream *__write__FR9sofstream_R9sofstreamPCcUl__1(struct ofstream *__anonymous_object1430, const char *__data__PCc_1, unsigned long int __size__Ul_1);
    494 signed int __fmt__Fi_R9sofstreamPCc__1(struct ofstream *__anonymous_object1431, const char *__fmt__PCc_1, ...);
     403_Bool __sepPrt__Fb_R9sofstream__1(struct ofstream *__anonymous_object1351);
     404void __sepReset__F_R9sofstream__1(struct ofstream *__anonymous_object1352);
     405void __sepReset__F_R9sofstreamb__1(struct ofstream *__anonymous_object1353, _Bool __anonymous_object1354);
     406const char *__sepGetCur__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1355);
     407void __sepSetCur__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1356, const char *__anonymous_object1357);
     408_Bool __getNL__Fb_R9sofstream__1(struct ofstream *__anonymous_object1358);
     409void __setNL__F_R9sofstreamb__1(struct ofstream *__anonymous_object1359, _Bool __anonymous_object1360);
     410void __sepOn__F_R9sofstream__1(struct ofstream *__anonymous_object1361);
     411void __sepOff__F_R9sofstream__1(struct ofstream *__anonymous_object1362);
     412_Bool __sepDisable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1363);
     413_Bool __sepEnable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1364);
     414const char *__sepGet__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1365);
     415void __sepSet__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1366, const char *__anonymous_object1367);
     416const char *__sepGetTuple__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1368);
     417void __sepSetTuple__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1369, const char *__anonymous_object1370);
     418signed int __fail__Fi_R9sofstream__1(struct ofstream *__anonymous_object1371);
     419signed int __flush__Fi_R9sofstream__1(struct ofstream *__anonymous_object1372);
     420void __open__F_R9sofstreamPCcPCc__1(struct ofstream *__anonymous_object1373, const char *__name__PCc_1, const char *__mode__PCc_1);
     421void __open__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1374, const char *__name__PCc_1);
     422void __close__F_R9sofstream__1(struct ofstream *__anonymous_object1375);
     423struct ofstream *__write__FR9sofstream_R9sofstreamPCcUl__1(struct ofstream *__anonymous_object1376, const char *__data__PCc_1, unsigned long int __size__Ul_1);
     424signed int __fmt__Fi_R9sofstreamPCc__1(struct ofstream *__anonymous_object1377, const char *__fmt__PCc_1, ...);
    495425void ___constructor__F_R9sofstream__1(struct ofstream *__os__R9sofstream_1);
    496426void ___constructor__F_R9sofstreamPCcPCc__1(struct ofstream *__os__R9sofstream_1, const char *__name__PCc_1, const char *__mode__PCc_1);
     
    531461struct ifstream *__read__FR9sifstream_R9sifstreamPcUl__1(struct ifstream *__is__R9sifstream_1, char *__data__Pc_1, unsigned long int __size__Ul_1);
    532462struct ifstream *__ungetc__FR9sifstream_R9sifstreamc__1(struct ifstream *__is__R9sifstream_1, char __c__c_1);
    533 signed int __fmt__Fi_R9sifstreamPCc__1(struct ifstream *__anonymous_object1432, const char *__fmt__PCc_1, ...);
     463signed int __fmt__Fi_R9sifstreamPCc__1(struct ifstream *__anonymous_object1378, const char *__fmt__PCc_1, ...);
    534464void ___constructor__F_R9sifstream__1(struct ifstream *__is__R9sifstream_1);
    535465void ___constructor__F_R9sifstreamPCcPCc__1(struct ifstream *__is__R9sifstream_1, const char *__name__PCc_1, const char *__mode__PCc_1);
     
    541471    struct ofstream *_tmp_cp_ret4;
    542472    __attribute__ ((unused)) struct ofstream *_thunk0(struct ofstream *_p0){
    543         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1433))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1434))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1435, _Bool __anonymous_object1436))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1437))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1438, const char *__anonymous_object1439))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1440))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1441, _Bool __anonymous_object1442))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1443))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1444))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1445))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1446))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1447))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1448, const char *__anonymous_object1449))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1450))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1451, const char *__anonymous_object1452))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1453))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1454))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1455, const char *__anonymous_object1456, unsigned long int __anonymous_object1457))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1458, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    544     }
    545     ((void)(((void)(_tmp_cp_ret4=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1459))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1460))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1461, _Bool __anonymous_object1462))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1463))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1464, const char *__anonymous_object1465))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1466))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1467, _Bool __anonymous_object1468))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1469))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1470))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1471))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1472))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1473))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1474, const char *__anonymous_object1475))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1476))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1477, const char *__anonymous_object1478))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1479))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1480))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1481, const char *__anonymous_object1482, unsigned long int __anonymous_object1483))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1484, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret3=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0c__1(((_Bool (*)(void *__anonymous_object1485))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1486))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1487, _Bool __anonymous_object1488))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1489))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1490, const char *__anonymous_object1491))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1492))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1493, _Bool __anonymous_object1494))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1495))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1496))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1497))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1498))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1499))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1500, const char *__anonymous_object1501))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1502))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1503, const char *__anonymous_object1504))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1505))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1506))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1507, const char *__anonymous_object1508, unsigned long int __anonymous_object1509))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1510, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret2=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1511))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1512))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1513, _Bool __anonymous_object1514))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1515))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1516, const char *__anonymous_object1517))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1518))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1519, _Bool __anonymous_object1520))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1521))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1522))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1523))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1524))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1525))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1526, const char *__anonymous_object1527))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1528))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1529, const char *__anonymous_object1530))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1531))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1532))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1533, const char *__anonymous_object1534, unsigned long int __anonymous_object1535))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1536, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "char ")))) , _tmp_cp_ret2)), __v__c_1)))) , _tmp_cp_ret3)), ((void *(*)(void *__anonymous_object1537))(&_thunk0)))))) , _tmp_cp_ret4));
     473        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1379))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1380))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1381, _Bool __anonymous_object1382))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1383))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1384, const char *__anonymous_object1385))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1386))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1387, _Bool __anonymous_object1388))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1389))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1390))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1391))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1392))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1393))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1394, const char *__anonymous_object1395))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1396))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1397, const char *__anonymous_object1398))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1399))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1400))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1401, const char *__anonymous_object1402, unsigned long int __anonymous_object1403))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1404, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     474    }
     475    ((void)(((void)(_tmp_cp_ret4=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1405))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1406))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1407, _Bool __anonymous_object1408))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1409))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1410, const char *__anonymous_object1411))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1412))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1413, _Bool __anonymous_object1414))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1415))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1416))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1417))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1418))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1419))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1420, const char *__anonymous_object1421))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1422))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1423, const char *__anonymous_object1424))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1425))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1426))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1427, const char *__anonymous_object1428, unsigned long int __anonymous_object1429))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1430, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret3=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0c__1(((_Bool (*)(void *__anonymous_object1431))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1432))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1433, _Bool __anonymous_object1434))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1435))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1436, const char *__anonymous_object1437))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1438))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1439, _Bool __anonymous_object1440))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1441))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1442))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1443))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1444))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1445))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1446, const char *__anonymous_object1447))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1448))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1449, const char *__anonymous_object1450))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1451))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1452))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1453, const char *__anonymous_object1454, unsigned long int __anonymous_object1455))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1456, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret2=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1457))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1458))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1459, _Bool __anonymous_object1460))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1461))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1462, const char *__anonymous_object1463))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1464))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1465, _Bool __anonymous_object1466))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1467))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1468))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1469))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1470))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1471))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1472, const char *__anonymous_object1473))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1474))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1475, const char *__anonymous_object1476))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1477))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1478))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1479, const char *__anonymous_object1480, unsigned long int __anonymous_object1481))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1482, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "char ")))) , _tmp_cp_ret2)), __v__c_1)))) , _tmp_cp_ret3)), ((void *(*)(void *__anonymous_object1483))(&_thunk0)))))) , _tmp_cp_ret4));
    546476}
    547477void __f__F_Sc__1(signed char __v__Sc_1){
     
    550480    struct ofstream *_tmp_cp_ret7;
    551481    __attribute__ ((unused)) struct ofstream *_thunk1(struct ofstream *_p0){
    552         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1538))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1539))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1540, _Bool __anonymous_object1541))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1542))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1543, const char *__anonymous_object1544))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1545))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1546, _Bool __anonymous_object1547))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1548))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1549))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1550))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1551))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1552))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1553, const char *__anonymous_object1554))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1555))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1556, const char *__anonymous_object1557))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1558))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1559))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1560, const char *__anonymous_object1561, unsigned long int __anonymous_object1562))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1563, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    553     }
    554     ((void)(((void)(_tmp_cp_ret7=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1564))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1565))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1566, _Bool __anonymous_object1567))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1568))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1569, const char *__anonymous_object1570))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1571))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1572, _Bool __anonymous_object1573))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1574))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1575))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1576))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1577))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1578))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1579, const char *__anonymous_object1580))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1581))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1582, const char *__anonymous_object1583))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1584))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1585))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1586, const char *__anonymous_object1587, unsigned long int __anonymous_object1588))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1589, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret6=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Sc__1(((_Bool (*)(void *__anonymous_object1590))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1591))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1592, _Bool __anonymous_object1593))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1594))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1595, const char *__anonymous_object1596))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1597))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1598, _Bool __anonymous_object1599))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1600))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1601))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1602))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1603))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1604))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1605, const char *__anonymous_object1606))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1607))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1608, const char *__anonymous_object1609))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1610))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1611))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1612, const char *__anonymous_object1613, unsigned long int __anonymous_object1614))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1615, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret5=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1616))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1617))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1618, _Bool __anonymous_object1619))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1620))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1621, const char *__anonymous_object1622))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1623))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1624, _Bool __anonymous_object1625))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1626))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1627))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1628))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1629))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1630))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1631, const char *__anonymous_object1632))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1633))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1634, const char *__anonymous_object1635))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1636))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1637))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1638, const char *__anonymous_object1639, unsigned long int __anonymous_object1640))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1641, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed char ")))) , _tmp_cp_ret5)), __v__Sc_1)))) , _tmp_cp_ret6)), ((void *(*)(void *__anonymous_object1642))(&_thunk1)))))) , _tmp_cp_ret7));
     482        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1484))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1485))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1486, _Bool __anonymous_object1487))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1488))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1489, const char *__anonymous_object1490))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1491))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1492, _Bool __anonymous_object1493))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1494))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1495))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1496))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1497))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1498))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1499, const char *__anonymous_object1500))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1501))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1502, const char *__anonymous_object1503))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1504))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1505))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1506, const char *__anonymous_object1507, unsigned long int __anonymous_object1508))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1509, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     483    }
     484    ((void)(((void)(_tmp_cp_ret7=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1510))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1511))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1512, _Bool __anonymous_object1513))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1514))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1515, const char *__anonymous_object1516))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1517))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1518, _Bool __anonymous_object1519))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1520))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1521))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1522))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1523))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1524))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1525, const char *__anonymous_object1526))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1527))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1528, const char *__anonymous_object1529))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1530))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1531))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1532, const char *__anonymous_object1533, unsigned long int __anonymous_object1534))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1535, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret6=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Sc__1(((_Bool (*)(void *__anonymous_object1536))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1537))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1538, _Bool __anonymous_object1539))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1540))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1541, const char *__anonymous_object1542))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1543))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1544, _Bool __anonymous_object1545))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1546))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1547))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1548))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1549))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1550))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1551, const char *__anonymous_object1552))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1553))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1554, const char *__anonymous_object1555))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1556))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1557))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1558, const char *__anonymous_object1559, unsigned long int __anonymous_object1560))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1561, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret5=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1562))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1563))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1564, _Bool __anonymous_object1565))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1566))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1567, const char *__anonymous_object1568))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1569))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1570, _Bool __anonymous_object1571))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1572))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1573))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1574))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1575))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1576))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1577, const char *__anonymous_object1578))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1579))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1580, const char *__anonymous_object1581))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1582))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1583))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1584, const char *__anonymous_object1585, unsigned long int __anonymous_object1586))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1587, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed char ")))) , _tmp_cp_ret5)), __v__Sc_1)))) , _tmp_cp_ret6)), ((void *(*)(void *__anonymous_object1588))(&_thunk1)))))) , _tmp_cp_ret7));
    555485}
    556486void __f__F_Uc__1(unsigned char __v__Uc_1){
     
    559489    struct ofstream *_tmp_cp_ret10;
    560490    __attribute__ ((unused)) struct ofstream *_thunk2(struct ofstream *_p0){
    561         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1643))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1644))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1645, _Bool __anonymous_object1646))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1647))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1648, const char *__anonymous_object1649))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1650))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1651, _Bool __anonymous_object1652))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1653))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1654))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1655))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1656))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1657))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1658, const char *__anonymous_object1659))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1660))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1661, const char *__anonymous_object1662))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1663))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1664))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1665, const char *__anonymous_object1666, unsigned long int __anonymous_object1667))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1668, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    562     }
    563     ((void)(((void)(_tmp_cp_ret10=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1669))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1670))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1671, _Bool __anonymous_object1672))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1673))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1674, const char *__anonymous_object1675))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1676))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1677, _Bool __anonymous_object1678))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1679))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1680))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1681))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1682))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1683))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1684, const char *__anonymous_object1685))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1686))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1687, const char *__anonymous_object1688))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1689))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1690))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1691, const char *__anonymous_object1692, unsigned long int __anonymous_object1693))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1694, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret9=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Uc__1(((_Bool (*)(void *__anonymous_object1695))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1696))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1697, _Bool __anonymous_object1698))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1699))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1700, const char *__anonymous_object1701))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1702))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1703, _Bool __anonymous_object1704))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1705))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1706))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1707))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1708))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1709))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1710, const char *__anonymous_object1711))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1712))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1713, const char *__anonymous_object1714))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1715))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1716))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1717, const char *__anonymous_object1718, unsigned long int __anonymous_object1719))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1720, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret8=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1721))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1722))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1723, _Bool __anonymous_object1724))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1725))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1726, const char *__anonymous_object1727))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1728))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1729, _Bool __anonymous_object1730))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1731))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1732))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1733))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1734))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1735))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1736, const char *__anonymous_object1737))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1738))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1739, const char *__anonymous_object1740))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1741))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1742))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1743, const char *__anonymous_object1744, unsigned long int __anonymous_object1745))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1746, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned char ")))) , _tmp_cp_ret8)), __v__Uc_1)))) , _tmp_cp_ret9)), ((void *(*)(void *__anonymous_object1747))(&_thunk2)))))) , _tmp_cp_ret10));
     491        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1589))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1590))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1591, _Bool __anonymous_object1592))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1593))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1594, const char *__anonymous_object1595))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1596))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1597, _Bool __anonymous_object1598))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1599))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1600))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1601))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1602))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1603))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1604, const char *__anonymous_object1605))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1606))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1607, const char *__anonymous_object1608))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1609))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1610))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1611, const char *__anonymous_object1612, unsigned long int __anonymous_object1613))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1614, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     492    }
     493    ((void)(((void)(_tmp_cp_ret10=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1615))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1616))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1617, _Bool __anonymous_object1618))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1619))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1620, const char *__anonymous_object1621))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1622))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1623, _Bool __anonymous_object1624))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1625))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1626))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1627))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1628))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1629))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1630, const char *__anonymous_object1631))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1632))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1633, const char *__anonymous_object1634))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1635))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1636))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1637, const char *__anonymous_object1638, unsigned long int __anonymous_object1639))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1640, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret9=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Uc__1(((_Bool (*)(void *__anonymous_object1641))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1642))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1643, _Bool __anonymous_object1644))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1645))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1646, const char *__anonymous_object1647))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1648))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1649, _Bool __anonymous_object1650))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1651))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1652))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1653))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1654))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1655))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1656, const char *__anonymous_object1657))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1658))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1659, const char *__anonymous_object1660))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1661))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1662))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1663, const char *__anonymous_object1664, unsigned long int __anonymous_object1665))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1666, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret8=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1667))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1668))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1669, _Bool __anonymous_object1670))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1671))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1672, const char *__anonymous_object1673))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1674))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1675, _Bool __anonymous_object1676))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1677))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1678))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1679))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1680))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1681))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1682, const char *__anonymous_object1683))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1684))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1685, const char *__anonymous_object1686))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1687))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1688))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1689, const char *__anonymous_object1690, unsigned long int __anonymous_object1691))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1692, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned char ")))) , _tmp_cp_ret8)), __v__Uc_1)))) , _tmp_cp_ret9)), ((void *(*)(void *__anonymous_object1693))(&_thunk2)))))) , _tmp_cp_ret10));
    564494}
    565495void __f__F_s__1(signed short int __v__s_1){
     
    568498    struct ofstream *_tmp_cp_ret13;
    569499    __attribute__ ((unused)) struct ofstream *_thunk3(struct ofstream *_p0){
    570         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1748))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1749))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1750, _Bool __anonymous_object1751))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1752))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1753, const char *__anonymous_object1754))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1755))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1756, _Bool __anonymous_object1757))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1758))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1759))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1760))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1761))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1762))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1763, const char *__anonymous_object1764))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1765))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1766, const char *__anonymous_object1767))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1768))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1769))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1770, const char *__anonymous_object1771, unsigned long int __anonymous_object1772))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1773, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    571     }
    572     ((void)(((void)(_tmp_cp_ret13=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1774))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1775))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1776, _Bool __anonymous_object1777))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1778))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1779, const char *__anonymous_object1780))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1781))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1782, _Bool __anonymous_object1783))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1784))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1785))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1786))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1787))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1788))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1789, const char *__anonymous_object1790))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1791))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1792, const char *__anonymous_object1793))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1794))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1795))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1796, const char *__anonymous_object1797, unsigned long int __anonymous_object1798))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1799, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret12=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0s__1(((_Bool (*)(void *__anonymous_object1800))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1801))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1802, _Bool __anonymous_object1803))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1804))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1805, const char *__anonymous_object1806))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1807))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1808, _Bool __anonymous_object1809))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1810))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1811))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1812))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1813))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1814))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1815, const char *__anonymous_object1816))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1817))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1818, const char *__anonymous_object1819))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1820))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1821))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1822, const char *__anonymous_object1823, unsigned long int __anonymous_object1824))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1825, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret11=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1826))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1827))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1828, _Bool __anonymous_object1829))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1830))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1831, const char *__anonymous_object1832))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1833))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1834, _Bool __anonymous_object1835))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1836))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1837))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1838))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1839))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1840))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1841, const char *__anonymous_object1842))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1843))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1844, const char *__anonymous_object1845))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1846))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1847))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1848, const char *__anonymous_object1849, unsigned long int __anonymous_object1850))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1851, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed short int")))) , _tmp_cp_ret11)), __v__s_1)))) , _tmp_cp_ret12)), ((void *(*)(void *__anonymous_object1852))(&_thunk3)))))) , _tmp_cp_ret13));
     500        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1694))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1695))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1696, _Bool __anonymous_object1697))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1698))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1699, const char *__anonymous_object1700))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1701))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1702, _Bool __anonymous_object1703))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1704))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1705))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1706))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1707))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1708))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1709, const char *__anonymous_object1710))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1711))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1712, const char *__anonymous_object1713))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1714))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1715))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1716, const char *__anonymous_object1717, unsigned long int __anonymous_object1718))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1719, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     501    }
     502    ((void)(((void)(_tmp_cp_ret13=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1720))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1721))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1722, _Bool __anonymous_object1723))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1724))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1725, const char *__anonymous_object1726))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1727))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1728, _Bool __anonymous_object1729))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1730))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1731))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1732))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1733))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1734))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1735, const char *__anonymous_object1736))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1737))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1738, const char *__anonymous_object1739))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1740))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1741))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1742, const char *__anonymous_object1743, unsigned long int __anonymous_object1744))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1745, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret12=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0s__1(((_Bool (*)(void *__anonymous_object1746))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1747))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1748, _Bool __anonymous_object1749))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1750))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1751, const char *__anonymous_object1752))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1753))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1754, _Bool __anonymous_object1755))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1756))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1757))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1758))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1759))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1760))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1761, const char *__anonymous_object1762))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1763))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1764, const char *__anonymous_object1765))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1766))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1767))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1768, const char *__anonymous_object1769, unsigned long int __anonymous_object1770))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1771, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret11=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1772))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1773))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1774, _Bool __anonymous_object1775))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1776))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1777, const char *__anonymous_object1778))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1779))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1780, _Bool __anonymous_object1781))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1782))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1783))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1784))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1785))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1786))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1787, const char *__anonymous_object1788))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1789))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1790, const char *__anonymous_object1791))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1792))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1793))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1794, const char *__anonymous_object1795, unsigned long int __anonymous_object1796))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1797, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed short int")))) , _tmp_cp_ret11)), __v__s_1)))) , _tmp_cp_ret12)), ((void *(*)(void *__anonymous_object1798))(&_thunk3)))))) , _tmp_cp_ret13));
    573503}
    574504void __f__F_Us__1(unsigned short int __v__Us_1){
     
    577507    struct ofstream *_tmp_cp_ret16;
    578508    __attribute__ ((unused)) struct ofstream *_thunk4(struct ofstream *_p0){
    579         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1853))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1854))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1855, _Bool __anonymous_object1856))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1857))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1858, const char *__anonymous_object1859))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1860))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1861, _Bool __anonymous_object1862))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1863))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1864))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1865))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1866))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1867))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1868, const char *__anonymous_object1869))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1870))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1871, const char *__anonymous_object1872))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1873))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1874))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1875, const char *__anonymous_object1876, unsigned long int __anonymous_object1877))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1878, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    580     }
    581     ((void)(((void)(_tmp_cp_ret16=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1879))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1880))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1881, _Bool __anonymous_object1882))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1883))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1884, const char *__anonymous_object1885))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1886))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1887, _Bool __anonymous_object1888))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1889))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1890))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1891))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1892))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1893))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1894, const char *__anonymous_object1895))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1896))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1897, const char *__anonymous_object1898))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1899))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1900))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1901, const char *__anonymous_object1902, unsigned long int __anonymous_object1903))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1904, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret15=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Us__1(((_Bool (*)(void *__anonymous_object1905))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1906))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1907, _Bool __anonymous_object1908))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1909))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1910, const char *__anonymous_object1911))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1912))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1913, _Bool __anonymous_object1914))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1915))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1916))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1917))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1918))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1919))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1920, const char *__anonymous_object1921))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1922))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1923, const char *__anonymous_object1924))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1925))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1926))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1927, const char *__anonymous_object1928, unsigned long int __anonymous_object1929))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1930, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret14=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1931))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1932))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1933, _Bool __anonymous_object1934))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1935))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1936, const char *__anonymous_object1937))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1938))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1939, _Bool __anonymous_object1940))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1941))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1942))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1943))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1944))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1945))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1946, const char *__anonymous_object1947))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1948))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1949, const char *__anonymous_object1950))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1951))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1952))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1953, const char *__anonymous_object1954, unsigned long int __anonymous_object1955))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1956, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned short int")))) , _tmp_cp_ret14)), __v__Us_1)))) , _tmp_cp_ret15)), ((void *(*)(void *__anonymous_object1957))(&_thunk4)))))) , _tmp_cp_ret16));
     509        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1799))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1800))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1801, _Bool __anonymous_object1802))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1803))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1804, const char *__anonymous_object1805))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1806))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1807, _Bool __anonymous_object1808))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1809))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1810))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1811))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1812))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1813))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1814, const char *__anonymous_object1815))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1816))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1817, const char *__anonymous_object1818))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1819))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1820))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1821, const char *__anonymous_object1822, unsigned long int __anonymous_object1823))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1824, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     510    }
     511    ((void)(((void)(_tmp_cp_ret16=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1825))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1826))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1827, _Bool __anonymous_object1828))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1829))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1830, const char *__anonymous_object1831))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1832))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1833, _Bool __anonymous_object1834))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1835))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1836))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1837))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1838))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1839))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1840, const char *__anonymous_object1841))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1842))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1843, const char *__anonymous_object1844))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1845))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1846))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1847, const char *__anonymous_object1848, unsigned long int __anonymous_object1849))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1850, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret15=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Us__1(((_Bool (*)(void *__anonymous_object1851))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1852))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1853, _Bool __anonymous_object1854))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1855))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1856, const char *__anonymous_object1857))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1858))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1859, _Bool __anonymous_object1860))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1861))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1862))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1863))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1864))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1865))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1866, const char *__anonymous_object1867))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1868))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1869, const char *__anonymous_object1870))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1871))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1872))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1873, const char *__anonymous_object1874, unsigned long int __anonymous_object1875))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1876, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret14=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1877))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1878))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1879, _Bool __anonymous_object1880))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1881))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1882, const char *__anonymous_object1883))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1884))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1885, _Bool __anonymous_object1886))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1887))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1888))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1889))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1890))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1891))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1892, const char *__anonymous_object1893))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1894))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1895, const char *__anonymous_object1896))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1897))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1898))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1899, const char *__anonymous_object1900, unsigned long int __anonymous_object1901))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1902, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned short int")))) , _tmp_cp_ret14)), __v__Us_1)))) , _tmp_cp_ret15)), ((void *(*)(void *__anonymous_object1903))(&_thunk4)))))) , _tmp_cp_ret16));
    582512}
    583513void __f__F_Ul__1(unsigned long int __v__Ul_1){
     
    586516    struct ofstream *_tmp_cp_ret19;
    587517    __attribute__ ((unused)) struct ofstream *_thunk5(struct ofstream *_p0){
    588         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1958))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1959))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1960, _Bool __anonymous_object1961))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1962))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1963, const char *__anonymous_object1964))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1965))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1966, _Bool __anonymous_object1967))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1968))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1969))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1970))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1971))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1972))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1973, const char *__anonymous_object1974))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1975))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1976, const char *__anonymous_object1977))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1978))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1979))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1980, const char *__anonymous_object1981, unsigned long int __anonymous_object1982))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1983, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    589     }
    590     ((void)(((void)(_tmp_cp_ret19=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1984))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1985))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1986, _Bool __anonymous_object1987))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1988))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1989, const char *__anonymous_object1990))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1991))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1992, _Bool __anonymous_object1993))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1994))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1995))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1996))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1997))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1998))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1999, const char *__anonymous_object2000))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object2001))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2002, const char *__anonymous_object2003))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2004))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2005))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2006, const char *__anonymous_object2007, unsigned long int __anonymous_object2008))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2009, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret18=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Ul__1(((_Bool (*)(void *__anonymous_object2010))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2011))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object2012, _Bool __anonymous_object2013))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object2014))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2015, const char *__anonymous_object2016))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object2017))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2018, _Bool __anonymous_object2019))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object2020))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object2021))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2022))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2023))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object2024))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2025, const char *__anonymous_object2026))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object2027))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2028, const char *__anonymous_object2029))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2030))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2031))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2032, const char *__anonymous_object2033, unsigned long int __anonymous_object2034))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2035, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret17=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object2036))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2037))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object2038, _Bool __anonymous_object2039))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object2040))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2041, const char *__anonymous_object2042))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object2043))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2044, _Bool __anonymous_object2045))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object2046))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object2047))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2048))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2049))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object2050))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2051, const char *__anonymous_object2052))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object2053))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2054, const char *__anonymous_object2055))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2056))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2057))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2058, const char *__anonymous_object2059, unsigned long int __anonymous_object2060))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2061, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "size_t")))) , _tmp_cp_ret17)), __v__Ul_1)))) , _tmp_cp_ret18)), ((void *(*)(void *__anonymous_object2062))(&_thunk5)))))) , _tmp_cp_ret19));
     518        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1904))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1905))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1906, _Bool __anonymous_object1907))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1908))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1909, const char *__anonymous_object1910))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1911))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1912, _Bool __anonymous_object1913))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1914))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1915))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1916))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1917))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1918))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1919, const char *__anonymous_object1920))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1921))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1922, const char *__anonymous_object1923))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1924))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1925))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1926, const char *__anonymous_object1927, unsigned long int __anonymous_object1928))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1929, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     519    }
     520    ((void)(((void)(_tmp_cp_ret19=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1930))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1931))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1932, _Bool __anonymous_object1933))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1934))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1935, const char *__anonymous_object1936))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1937))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1938, _Bool __anonymous_object1939))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1940))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1941))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1942))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1943))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1944))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1945, const char *__anonymous_object1946))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1947))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1948, const char *__anonymous_object1949))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1950))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1951))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1952, const char *__anonymous_object1953, unsigned long int __anonymous_object1954))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1955, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret18=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Ul__1(((_Bool (*)(void *__anonymous_object1956))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1957))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1958, _Bool __anonymous_object1959))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1960))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1961, const char *__anonymous_object1962))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1963))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1964, _Bool __anonymous_object1965))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1966))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1967))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1968))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1969))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1970))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1971, const char *__anonymous_object1972))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1973))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1974, const char *__anonymous_object1975))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1976))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1977))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1978, const char *__anonymous_object1979, unsigned long int __anonymous_object1980))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1981, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret17=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1982))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1983))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1984, _Bool __anonymous_object1985))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1986))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1987, const char *__anonymous_object1988))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1989))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1990, _Bool __anonymous_object1991))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1992))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1993))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1994))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1995))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1996))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1997, const char *__anonymous_object1998))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1999))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2000, const char *__anonymous_object2001))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2002))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2003))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2004, const char *__anonymous_object2005, unsigned long int __anonymous_object2006))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2007, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "size_t")))) , _tmp_cp_ret17)), __v__Ul_1)))) , _tmp_cp_ret18)), ((void *(*)(void *__anonymous_object2008))(&_thunk5)))))) , _tmp_cp_ret19));
    591521}
    592522signed int __main__Fi___1(){
  • src/tests/.expect/literals.x86.txt

    r32cab5b rb2fe1c9  
    122122struct _Istream_cstrC __cstr__F15s_Istream_cstrC_Pci__1(char *__anonymous_object1340, signed int __size__i_1);
    123123void *___operator_bitor__A0_1_0_0___fail__PFi_Rd0___eof__PFi_Rd0___open__PF_Rd0PCc___close__PF_Rd0___read__PFRd0_Rd0PcUl___ungetc__PFRd0_Rd0c___fmt__PFi_Rd0PCc__FRd0_Rd015s_Istream_cstrC__1(__attribute__ ((unused)) signed int (*__fail__PFi_R7tistype__1)(void *__anonymous_object1341), __attribute__ ((unused)) signed int (*__eof__PFi_R7tistype__1)(void *__anonymous_object1342), __attribute__ ((unused)) void (*__open__PF_R7tistypePCc__1)(void *__is__R7tistype_1, const char *__name__PCc_1), __attribute__ ((unused)) void (*__close__PF_R7tistype__1)(void *__is__R7tistype_1), __attribute__ ((unused)) void *(*__read__PFR7tistype_R7tistypePcUl__1)(void *__anonymous_object1343, char *__anonymous_object1344, unsigned long int __anonymous_object1345), __attribute__ ((unused)) void *(*__ungetc__PFR7tistype_R7tistypec__1)(void *__anonymous_object1346, char __anonymous_object1347), __attribute__ ((unused)) signed int (*__fmt__PFi_R7tistypePCc__1)(void *__anonymous_object1348, const char *__fmt__PCc_1, ...), void *__anonymous_object1349, struct _Istream_cstrC __anonymous_object1350);
    124 struct Duration {
    125     signed long long int __tv__q_1;
    126 };
    127 static inline void ___constructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1);
    128 static inline void ___constructor__F_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1);
    129 static inline void ___destructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1);
    130 static inline struct Duration ___operator_assign__F9sDuration_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1);
    131 static inline void ___constructor__F_R9sDurationq_autogen___1(struct Duration *___dst__R9sDuration_1, signed long long int __tv__q_1);
    132 static inline void ___constructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1){
    133     ((void)((*___dst__R9sDuration_1).__tv__q_1) /* ?{} */);
    134 }
    135 static inline void ___constructor__F_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1){
    136     ((void)((*___dst__R9sDuration_1).__tv__q_1=___src__9sDuration_1.__tv__q_1) /* ?{} */);
    137 }
    138 static inline void ___destructor__F_R9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1){
    139     ((void)((*___dst__R9sDuration_1).__tv__q_1) /* ^?{} */);
    140 }
    141 static inline struct Duration ___operator_assign__F9sDuration_R9sDuration9sDuration_autogen___1(struct Duration *___dst__R9sDuration_1, struct Duration ___src__9sDuration_1){
    142     struct Duration ___ret__9sDuration_1;
    143     ((void)((*___dst__R9sDuration_1).__tv__q_1=___src__9sDuration_1.__tv__q_1));
    144     ((void)___constructor__F_R9sDuration9sDuration_autogen___1((&___ret__9sDuration_1), (*___dst__R9sDuration_1)));
    145     return ___ret__9sDuration_1;
    146 }
    147 static inline void ___constructor__F_R9sDurationq_autogen___1(struct Duration *___dst__R9sDuration_1, signed long long int __tv__q_1){
    148     ((void)((*___dst__R9sDuration_1).__tv__q_1=__tv__q_1) /* ?{} */);
    149 }
    150 static inline void ___constructor__F_R9sDuration__1(struct Duration *__dur__R9sDuration_1){
    151     ((void)((*__dur__R9sDuration_1).__tv__q_1) /* ?{} */);
    152     ((void)((*__dur__R9sDuration_1).__tv__q_1=((signed long long int )0)));
    153 }
    154 static inline void ___constructor__F_R9sDurationZ__1(struct Duration *__dur__R9sDuration_1, long int __anonymous_object1351){
    155     ((void)((*__dur__R9sDuration_1).__tv__q_1) /* ?{} */);
    156     ((void)((*__dur__R9sDuration_1).__tv__q_1=((signed long long int )0)));
    157 }
    158 struct Time {
    159     unsigned long long int __tv__Uq_1;
    160 };
    161 static inline void ___constructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1);
    162 static inline void ___constructor__F_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1);
    163 static inline void ___destructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1);
    164 static inline struct Time ___operator_assign__F5sTime_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1);
    165 static inline void ___constructor__F_R5sTimeUq_autogen___1(struct Time *___dst__R5sTime_1, unsigned long long int __tv__Uq_1);
    166 static inline void ___constructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1){
    167     ((void)((*___dst__R5sTime_1).__tv__Uq_1) /* ?{} */);
    168 }
    169 static inline void ___constructor__F_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1){
    170     ((void)((*___dst__R5sTime_1).__tv__Uq_1=___src__5sTime_1.__tv__Uq_1) /* ?{} */);
    171 }
    172 static inline void ___destructor__F_R5sTime_autogen___1(struct Time *___dst__R5sTime_1){
    173     ((void)((*___dst__R5sTime_1).__tv__Uq_1) /* ^?{} */);
    174 }
    175 static inline struct Time ___operator_assign__F5sTime_R5sTime5sTime_autogen___1(struct Time *___dst__R5sTime_1, struct Time ___src__5sTime_1){
    176     struct Time ___ret__5sTime_1;
    177     ((void)((*___dst__R5sTime_1).__tv__Uq_1=___src__5sTime_1.__tv__Uq_1));
    178     ((void)___constructor__F_R5sTime5sTime_autogen___1((&___ret__5sTime_1), (*___dst__R5sTime_1)));
    179     return ___ret__5sTime_1;
    180 }
    181 static inline void ___constructor__F_R5sTimeUq_autogen___1(struct Time *___dst__R5sTime_1, unsigned long long int __tv__Uq_1){
    182     ((void)((*___dst__R5sTime_1).__tv__Uq_1=__tv__Uq_1) /* ?{} */);
    183 }
    184 static inline void ___constructor__F_R5sTime__1(struct Time *__time__R5sTime_1){
    185     ((void)((*__time__R5sTime_1).__tv__Uq_1) /* ?{} */);
    186     ((void)((*__time__R5sTime_1).__tv__Uq_1=((unsigned long long int )0)));
    187 }
    188 static inline void ___constructor__F_R5sTimeZ__1(struct Time *__time__R5sTime_1, long int __anonymous_object1352){
    189     ((void)((*__time__R5sTime_1).__tv__Uq_1) /* ?{} */);
    190     ((void)((*__time__R5sTime_1).__tv__Uq_1=((unsigned long long int )0)));
    191 }
    192 void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd09sDuration__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_R7tostype__1)(void *__anonymous_object1353), __attribute__ ((unused)) void (*__sepReset__PF_R7tostype__1)(void *__anonymous_object1354), __attribute__ ((unused)) void (*__sepReset__PF_R7tostypeb__1)(void *__anonymous_object1355, _Bool __anonymous_object1356), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_R7tostype__1)(void *__anonymous_object1357), __attribute__ ((unused)) void (*__sepSetCur__PF_R7tostypePCc__1)(void *__anonymous_object1358, const char *__anonymous_object1359), __attribute__ ((unused)) _Bool (*__getNL__PFb_R7tostype__1)(void *__anonymous_object1360), __attribute__ ((unused)) void (*__setNL__PF_R7tostypeb__1)(void *__anonymous_object1361, _Bool __anonymous_object1362), __attribute__ ((unused)) void (*__sepOn__PF_R7tostype__1)(void *__anonymous_object1363), __attribute__ ((unused)) void (*__sepOff__PF_R7tostype__1)(void *__anonymous_object1364), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_R7tostype__1)(void *__anonymous_object1365), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_R7tostype__1)(void *__anonymous_object1366), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_R7tostype__1)(void *__anonymous_object1367), __attribute__ ((unused)) void (*__sepSet__PF_R7tostypePCc__1)(void *__anonymous_object1368, const char *__anonymous_object1369), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_R7tostype__1)(void *__anonymous_object1370), __attribute__ ((unused)) void (*__sepSetTuple__PF_R7tostypePCc__1)(void *__anonymous_object1371, const char *__anonymous_object1372), __attribute__ ((unused)) signed int (*__fail__PFi_R7tostype__1)(void *__anonymous_object1373), __attribute__ ((unused)) signed int (*__flush__PFi_R7tostype__1)(void *__anonymous_object1374), __attribute__ ((unused)) void (*__open__PF_R7tostypePCcPCc__1)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_R7tostype__1)(void *__os__R7tostype_1), __attribute__ ((unused)) void *(*__write__PFR7tostype_R7tostypePCcUl__1)(void *__anonymous_object1375, const char *__anonymous_object1376, unsigned long int __anonymous_object1377), __attribute__ ((unused)) signed int (*__fmt__PFi_R7tostypePCc__1)(void *__anonymous_object1378, const char *__fmt__PCc_1, ...), void *__os__R7tostype_1, struct Duration __dur__9sDuration_1);
    193 void *___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd05sTime__1(__attribute__ ((unused)) _Bool (*__sepPrt__PFb_R7tostype__1)(void *__anonymous_object1379), __attribute__ ((unused)) void (*__sepReset__PF_R7tostype__1)(void *__anonymous_object1380), __attribute__ ((unused)) void (*__sepReset__PF_R7tostypeb__1)(void *__anonymous_object1381, _Bool __anonymous_object1382), __attribute__ ((unused)) const char *(*__sepGetCur__PFPCc_R7tostype__1)(void *__anonymous_object1383), __attribute__ ((unused)) void (*__sepSetCur__PF_R7tostypePCc__1)(void *__anonymous_object1384, const char *__anonymous_object1385), __attribute__ ((unused)) _Bool (*__getNL__PFb_R7tostype__1)(void *__anonymous_object1386), __attribute__ ((unused)) void (*__setNL__PF_R7tostypeb__1)(void *__anonymous_object1387, _Bool __anonymous_object1388), __attribute__ ((unused)) void (*__sepOn__PF_R7tostype__1)(void *__anonymous_object1389), __attribute__ ((unused)) void (*__sepOff__PF_R7tostype__1)(void *__anonymous_object1390), __attribute__ ((unused)) _Bool (*__sepDisable__PFb_R7tostype__1)(void *__anonymous_object1391), __attribute__ ((unused)) _Bool (*__sepEnable__PFb_R7tostype__1)(void *__anonymous_object1392), __attribute__ ((unused)) const char *(*__sepGet__PFPCc_R7tostype__1)(void *__anonymous_object1393), __attribute__ ((unused)) void (*__sepSet__PF_R7tostypePCc__1)(void *__anonymous_object1394, const char *__anonymous_object1395), __attribute__ ((unused)) const char *(*__sepGetTuple__PFPCc_R7tostype__1)(void *__anonymous_object1396), __attribute__ ((unused)) void (*__sepSetTuple__PF_R7tostypePCc__1)(void *__anonymous_object1397, const char *__anonymous_object1398), __attribute__ ((unused)) signed int (*__fail__PFi_R7tostype__1)(void *__anonymous_object1399), __attribute__ ((unused)) signed int (*__flush__PFi_R7tostype__1)(void *__anonymous_object1400), __attribute__ ((unused)) void (*__open__PF_R7tostypePCcPCc__1)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1), __attribute__ ((unused)) void (*__close__PF_R7tostype__1)(void *__os__R7tostype_1), __attribute__ ((unused)) void *(*__write__PFR7tostype_R7tostypePCcUl__1)(void *__anonymous_object1401, const char *__anonymous_object1402, unsigned long int __anonymous_object1403), __attribute__ ((unused)) signed int (*__fmt__PFi_R7tostypePCc__1)(void *__anonymous_object1404, const char *__fmt__PCc_1, ...), void *__os__R7tostype_1, struct Time __time__5sTime_1);
    194124enum __anonymous0 {
    195125    __sepSize__C13e__anonymous0_1 = 16,
     
    471401
    472402}
    473 _Bool __sepPrt__Fb_R9sofstream__1(struct ofstream *__anonymous_object1405);
    474 void __sepReset__F_R9sofstream__1(struct ofstream *__anonymous_object1406);
    475 void __sepReset__F_R9sofstreamb__1(struct ofstream *__anonymous_object1407, _Bool __anonymous_object1408);
    476 const char *__sepGetCur__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1409);
    477 void __sepSetCur__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1410, const char *__anonymous_object1411);
    478 _Bool __getNL__Fb_R9sofstream__1(struct ofstream *__anonymous_object1412);
    479 void __setNL__F_R9sofstreamb__1(struct ofstream *__anonymous_object1413, _Bool __anonymous_object1414);
    480 void __sepOn__F_R9sofstream__1(struct ofstream *__anonymous_object1415);
    481 void __sepOff__F_R9sofstream__1(struct ofstream *__anonymous_object1416);
    482 _Bool __sepDisable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1417);
    483 _Bool __sepEnable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1418);
    484 const char *__sepGet__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1419);
    485 void __sepSet__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1420, const char *__anonymous_object1421);
    486 const char *__sepGetTuple__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1422);
    487 void __sepSetTuple__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1423, const char *__anonymous_object1424);
    488 signed int __fail__Fi_R9sofstream__1(struct ofstream *__anonymous_object1425);
    489 signed int __flush__Fi_R9sofstream__1(struct ofstream *__anonymous_object1426);
    490 void __open__F_R9sofstreamPCcPCc__1(struct ofstream *__anonymous_object1427, const char *__name__PCc_1, const char *__mode__PCc_1);
    491 void __open__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1428, const char *__name__PCc_1);
    492 void __close__F_R9sofstream__1(struct ofstream *__anonymous_object1429);
    493 struct ofstream *__write__FR9sofstream_R9sofstreamPCcUl__1(struct ofstream *__anonymous_object1430, const char *__data__PCc_1, unsigned long int __size__Ul_1);
    494 signed int __fmt__Fi_R9sofstreamPCc__1(struct ofstream *__anonymous_object1431, const char *__fmt__PCc_1, ...);
     403_Bool __sepPrt__Fb_R9sofstream__1(struct ofstream *__anonymous_object1351);
     404void __sepReset__F_R9sofstream__1(struct ofstream *__anonymous_object1352);
     405void __sepReset__F_R9sofstreamb__1(struct ofstream *__anonymous_object1353, _Bool __anonymous_object1354);
     406const char *__sepGetCur__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1355);
     407void __sepSetCur__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1356, const char *__anonymous_object1357);
     408_Bool __getNL__Fb_R9sofstream__1(struct ofstream *__anonymous_object1358);
     409void __setNL__F_R9sofstreamb__1(struct ofstream *__anonymous_object1359, _Bool __anonymous_object1360);
     410void __sepOn__F_R9sofstream__1(struct ofstream *__anonymous_object1361);
     411void __sepOff__F_R9sofstream__1(struct ofstream *__anonymous_object1362);
     412_Bool __sepDisable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1363);
     413_Bool __sepEnable__Fb_R9sofstream__1(struct ofstream *__anonymous_object1364);
     414const char *__sepGet__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1365);
     415void __sepSet__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1366, const char *__anonymous_object1367);
     416const char *__sepGetTuple__FPCc_R9sofstream__1(struct ofstream *__anonymous_object1368);
     417void __sepSetTuple__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1369, const char *__anonymous_object1370);
     418signed int __fail__Fi_R9sofstream__1(struct ofstream *__anonymous_object1371);
     419signed int __flush__Fi_R9sofstream__1(struct ofstream *__anonymous_object1372);
     420void __open__F_R9sofstreamPCcPCc__1(struct ofstream *__anonymous_object1373, const char *__name__PCc_1, const char *__mode__PCc_1);
     421void __open__F_R9sofstreamPCc__1(struct ofstream *__anonymous_object1374, const char *__name__PCc_1);
     422void __close__F_R9sofstream__1(struct ofstream *__anonymous_object1375);
     423struct ofstream *__write__FR9sofstream_R9sofstreamPCcUl__1(struct ofstream *__anonymous_object1376, const char *__data__PCc_1, unsigned long int __size__Ul_1);
     424signed int __fmt__Fi_R9sofstreamPCc__1(struct ofstream *__anonymous_object1377, const char *__fmt__PCc_1, ...);
    495425void ___constructor__F_R9sofstream__1(struct ofstream *__os__R9sofstream_1);
    496426void ___constructor__F_R9sofstreamPCcPCc__1(struct ofstream *__os__R9sofstream_1, const char *__name__PCc_1, const char *__mode__PCc_1);
     
    531461struct ifstream *__read__FR9sifstream_R9sifstreamPcUl__1(struct ifstream *__is__R9sifstream_1, char *__data__Pc_1, unsigned long int __size__Ul_1);
    532462struct ifstream *__ungetc__FR9sifstream_R9sifstreamc__1(struct ifstream *__is__R9sifstream_1, char __c__c_1);
    533 signed int __fmt__Fi_R9sifstreamPCc__1(struct ifstream *__anonymous_object1432, const char *__fmt__PCc_1, ...);
     463signed int __fmt__Fi_R9sifstreamPCc__1(struct ifstream *__anonymous_object1378, const char *__fmt__PCc_1, ...);
    534464void ___constructor__F_R9sifstream__1(struct ifstream *__is__R9sifstream_1);
    535465void ___constructor__F_R9sifstreamPCcPCc__1(struct ifstream *__is__R9sifstream_1, const char *__name__PCc_1, const char *__mode__PCc_1);
     
    541471    struct ofstream *_tmp_cp_ret4;
    542472    __attribute__ ((unused)) struct ofstream *_thunk0(struct ofstream *_p0){
    543         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1433))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1434))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1435, _Bool __anonymous_object1436))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1437))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1438, const char *__anonymous_object1439))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1440))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1441, _Bool __anonymous_object1442))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1443))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1444))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1445))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1446))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1447))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1448, const char *__anonymous_object1449))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1450))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1451, const char *__anonymous_object1452))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1453))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1454))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1455, const char *__anonymous_object1456, unsigned long int __anonymous_object1457))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1458, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    544     }
    545     ((void)(((void)(_tmp_cp_ret4=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1459))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1460))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1461, _Bool __anonymous_object1462))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1463))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1464, const char *__anonymous_object1465))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1466))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1467, _Bool __anonymous_object1468))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1469))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1470))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1471))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1472))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1473))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1474, const char *__anonymous_object1475))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1476))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1477, const char *__anonymous_object1478))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1479))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1480))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1481, const char *__anonymous_object1482, unsigned long int __anonymous_object1483))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1484, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret3=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0c__1(((_Bool (*)(void *__anonymous_object1485))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1486))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1487, _Bool __anonymous_object1488))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1489))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1490, const char *__anonymous_object1491))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1492))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1493, _Bool __anonymous_object1494))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1495))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1496))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1497))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1498))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1499))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1500, const char *__anonymous_object1501))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1502))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1503, const char *__anonymous_object1504))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1505))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1506))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1507, const char *__anonymous_object1508, unsigned long int __anonymous_object1509))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1510, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret2=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1511))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1512))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1513, _Bool __anonymous_object1514))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1515))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1516, const char *__anonymous_object1517))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1518))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1519, _Bool __anonymous_object1520))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1521))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1522))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1523))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1524))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1525))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1526, const char *__anonymous_object1527))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1528))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1529, const char *__anonymous_object1530))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1531))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1532))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1533, const char *__anonymous_object1534, unsigned long int __anonymous_object1535))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1536, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "char ")))) , _tmp_cp_ret2)), __v__c_1)))) , _tmp_cp_ret3)), ((void *(*)(void *__anonymous_object1537))(&_thunk0)))))) , _tmp_cp_ret4));
     473        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1379))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1380))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1381, _Bool __anonymous_object1382))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1383))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1384, const char *__anonymous_object1385))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1386))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1387, _Bool __anonymous_object1388))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1389))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1390))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1391))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1392))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1393))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1394, const char *__anonymous_object1395))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1396))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1397, const char *__anonymous_object1398))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1399))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1400))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1401, const char *__anonymous_object1402, unsigned long int __anonymous_object1403))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1404, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     474    }
     475    ((void)(((void)(_tmp_cp_ret4=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1405))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1406))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1407, _Bool __anonymous_object1408))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1409))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1410, const char *__anonymous_object1411))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1412))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1413, _Bool __anonymous_object1414))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1415))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1416))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1417))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1418))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1419))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1420, const char *__anonymous_object1421))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1422))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1423, const char *__anonymous_object1424))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1425))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1426))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1427, const char *__anonymous_object1428, unsigned long int __anonymous_object1429))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1430, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret3=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0c__1(((_Bool (*)(void *__anonymous_object1431))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1432))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1433, _Bool __anonymous_object1434))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1435))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1436, const char *__anonymous_object1437))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1438))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1439, _Bool __anonymous_object1440))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1441))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1442))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1443))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1444))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1445))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1446, const char *__anonymous_object1447))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1448))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1449, const char *__anonymous_object1450))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1451))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1452))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1453, const char *__anonymous_object1454, unsigned long int __anonymous_object1455))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1456, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret2=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1457))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1458))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1459, _Bool __anonymous_object1460))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1461))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1462, const char *__anonymous_object1463))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1464))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1465, _Bool __anonymous_object1466))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1467))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1468))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1469))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1470))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1471))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1472, const char *__anonymous_object1473))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1474))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1475, const char *__anonymous_object1476))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1477))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1478))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1479, const char *__anonymous_object1480, unsigned long int __anonymous_object1481))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1482, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "char ")))) , _tmp_cp_ret2)), __v__c_1)))) , _tmp_cp_ret3)), ((void *(*)(void *__anonymous_object1483))(&_thunk0)))))) , _tmp_cp_ret4));
    546476}
    547477void __f__F_Sc__1(signed char __v__Sc_1){
     
    550480    struct ofstream *_tmp_cp_ret7;
    551481    __attribute__ ((unused)) struct ofstream *_thunk1(struct ofstream *_p0){
    552         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1538))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1539))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1540, _Bool __anonymous_object1541))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1542))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1543, const char *__anonymous_object1544))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1545))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1546, _Bool __anonymous_object1547))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1548))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1549))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1550))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1551))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1552))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1553, const char *__anonymous_object1554))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1555))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1556, const char *__anonymous_object1557))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1558))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1559))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1560, const char *__anonymous_object1561, unsigned long int __anonymous_object1562))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1563, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    553     }
    554     ((void)(((void)(_tmp_cp_ret7=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1564))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1565))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1566, _Bool __anonymous_object1567))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1568))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1569, const char *__anonymous_object1570))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1571))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1572, _Bool __anonymous_object1573))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1574))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1575))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1576))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1577))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1578))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1579, const char *__anonymous_object1580))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1581))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1582, const char *__anonymous_object1583))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1584))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1585))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1586, const char *__anonymous_object1587, unsigned long int __anonymous_object1588))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1589, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret6=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Sc__1(((_Bool (*)(void *__anonymous_object1590))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1591))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1592, _Bool __anonymous_object1593))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1594))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1595, const char *__anonymous_object1596))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1597))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1598, _Bool __anonymous_object1599))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1600))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1601))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1602))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1603))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1604))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1605, const char *__anonymous_object1606))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1607))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1608, const char *__anonymous_object1609))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1610))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1611))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1612, const char *__anonymous_object1613, unsigned long int __anonymous_object1614))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1615, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret5=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1616))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1617))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1618, _Bool __anonymous_object1619))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1620))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1621, const char *__anonymous_object1622))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1623))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1624, _Bool __anonymous_object1625))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1626))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1627))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1628))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1629))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1630))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1631, const char *__anonymous_object1632))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1633))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1634, const char *__anonymous_object1635))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1636))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1637))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1638, const char *__anonymous_object1639, unsigned long int __anonymous_object1640))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1641, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed char ")))) , _tmp_cp_ret5)), __v__Sc_1)))) , _tmp_cp_ret6)), ((void *(*)(void *__anonymous_object1642))(&_thunk1)))))) , _tmp_cp_ret7));
     482        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1484))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1485))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1486, _Bool __anonymous_object1487))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1488))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1489, const char *__anonymous_object1490))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1491))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1492, _Bool __anonymous_object1493))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1494))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1495))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1496))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1497))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1498))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1499, const char *__anonymous_object1500))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1501))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1502, const char *__anonymous_object1503))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1504))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1505))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1506, const char *__anonymous_object1507, unsigned long int __anonymous_object1508))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1509, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     483    }
     484    ((void)(((void)(_tmp_cp_ret7=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1510))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1511))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1512, _Bool __anonymous_object1513))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1514))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1515, const char *__anonymous_object1516))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1517))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1518, _Bool __anonymous_object1519))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1520))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1521))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1522))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1523))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1524))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1525, const char *__anonymous_object1526))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1527))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1528, const char *__anonymous_object1529))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1530))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1531))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1532, const char *__anonymous_object1533, unsigned long int __anonymous_object1534))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1535, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret6=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Sc__1(((_Bool (*)(void *__anonymous_object1536))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1537))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1538, _Bool __anonymous_object1539))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1540))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1541, const char *__anonymous_object1542))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1543))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1544, _Bool __anonymous_object1545))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1546))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1547))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1548))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1549))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1550))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1551, const char *__anonymous_object1552))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1553))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1554, const char *__anonymous_object1555))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1556))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1557))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1558, const char *__anonymous_object1559, unsigned long int __anonymous_object1560))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1561, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret5=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1562))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1563))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1564, _Bool __anonymous_object1565))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1566))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1567, const char *__anonymous_object1568))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1569))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1570, _Bool __anonymous_object1571))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1572))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1573))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1574))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1575))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1576))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1577, const char *__anonymous_object1578))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1579))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1580, const char *__anonymous_object1581))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1582))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1583))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1584, const char *__anonymous_object1585, unsigned long int __anonymous_object1586))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1587, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed char ")))) , _tmp_cp_ret5)), __v__Sc_1)))) , _tmp_cp_ret6)), ((void *(*)(void *__anonymous_object1588))(&_thunk1)))))) , _tmp_cp_ret7));
    555485}
    556486void __f__F_Uc__1(unsigned char __v__Uc_1){
     
    559489    struct ofstream *_tmp_cp_ret10;
    560490    __attribute__ ((unused)) struct ofstream *_thunk2(struct ofstream *_p0){
    561         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1643))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1644))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1645, _Bool __anonymous_object1646))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1647))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1648, const char *__anonymous_object1649))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1650))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1651, _Bool __anonymous_object1652))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1653))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1654))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1655))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1656))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1657))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1658, const char *__anonymous_object1659))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1660))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1661, const char *__anonymous_object1662))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1663))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1664))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1665, const char *__anonymous_object1666, unsigned long int __anonymous_object1667))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1668, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    562     }
    563     ((void)(((void)(_tmp_cp_ret10=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1669))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1670))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1671, _Bool __anonymous_object1672))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1673))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1674, const char *__anonymous_object1675))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1676))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1677, _Bool __anonymous_object1678))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1679))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1680))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1681))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1682))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1683))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1684, const char *__anonymous_object1685))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1686))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1687, const char *__anonymous_object1688))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1689))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1690))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1691, const char *__anonymous_object1692, unsigned long int __anonymous_object1693))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1694, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret9=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Uc__1(((_Bool (*)(void *__anonymous_object1695))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1696))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1697, _Bool __anonymous_object1698))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1699))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1700, const char *__anonymous_object1701))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1702))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1703, _Bool __anonymous_object1704))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1705))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1706))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1707))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1708))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1709))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1710, const char *__anonymous_object1711))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1712))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1713, const char *__anonymous_object1714))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1715))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1716))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1717, const char *__anonymous_object1718, unsigned long int __anonymous_object1719))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1720, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret8=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1721))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1722))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1723, _Bool __anonymous_object1724))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1725))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1726, const char *__anonymous_object1727))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1728))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1729, _Bool __anonymous_object1730))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1731))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1732))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1733))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1734))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1735))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1736, const char *__anonymous_object1737))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1738))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1739, const char *__anonymous_object1740))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1741))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1742))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1743, const char *__anonymous_object1744, unsigned long int __anonymous_object1745))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1746, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned char ")))) , _tmp_cp_ret8)), __v__Uc_1)))) , _tmp_cp_ret9)), ((void *(*)(void *__anonymous_object1747))(&_thunk2)))))) , _tmp_cp_ret10));
     491        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1589))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1590))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1591, _Bool __anonymous_object1592))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1593))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1594, const char *__anonymous_object1595))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1596))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1597, _Bool __anonymous_object1598))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1599))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1600))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1601))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1602))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1603))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1604, const char *__anonymous_object1605))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1606))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1607, const char *__anonymous_object1608))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1609))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1610))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1611, const char *__anonymous_object1612, unsigned long int __anonymous_object1613))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1614, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     492    }
     493    ((void)(((void)(_tmp_cp_ret10=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1615))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1616))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1617, _Bool __anonymous_object1618))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1619))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1620, const char *__anonymous_object1621))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1622))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1623, _Bool __anonymous_object1624))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1625))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1626))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1627))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1628))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1629))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1630, const char *__anonymous_object1631))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1632))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1633, const char *__anonymous_object1634))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1635))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1636))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1637, const char *__anonymous_object1638, unsigned long int __anonymous_object1639))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1640, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret9=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Uc__1(((_Bool (*)(void *__anonymous_object1641))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1642))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1643, _Bool __anonymous_object1644))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1645))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1646, const char *__anonymous_object1647))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1648))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1649, _Bool __anonymous_object1650))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1651))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1652))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1653))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1654))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1655))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1656, const char *__anonymous_object1657))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1658))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1659, const char *__anonymous_object1660))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1661))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1662))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1663, const char *__anonymous_object1664, unsigned long int __anonymous_object1665))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1666, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret8=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1667))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1668))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1669, _Bool __anonymous_object1670))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1671))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1672, const char *__anonymous_object1673))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1674))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1675, _Bool __anonymous_object1676))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1677))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1678))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1679))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1680))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1681))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1682, const char *__anonymous_object1683))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1684))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1685, const char *__anonymous_object1686))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1687))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1688))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1689, const char *__anonymous_object1690, unsigned long int __anonymous_object1691))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1692, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned char ")))) , _tmp_cp_ret8)), __v__Uc_1)))) , _tmp_cp_ret9)), ((void *(*)(void *__anonymous_object1693))(&_thunk2)))))) , _tmp_cp_ret10));
    564494}
    565495void __f__F_s__1(signed short int __v__s_1){
     
    568498    struct ofstream *_tmp_cp_ret13;
    569499    __attribute__ ((unused)) struct ofstream *_thunk3(struct ofstream *_p0){
    570         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1748))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1749))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1750, _Bool __anonymous_object1751))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1752))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1753, const char *__anonymous_object1754))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1755))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1756, _Bool __anonymous_object1757))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1758))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1759))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1760))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1761))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1762))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1763, const char *__anonymous_object1764))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1765))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1766, const char *__anonymous_object1767))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1768))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1769))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1770, const char *__anonymous_object1771, unsigned long int __anonymous_object1772))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1773, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    571     }
    572     ((void)(((void)(_tmp_cp_ret13=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1774))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1775))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1776, _Bool __anonymous_object1777))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1778))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1779, const char *__anonymous_object1780))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1781))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1782, _Bool __anonymous_object1783))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1784))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1785))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1786))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1787))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1788))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1789, const char *__anonymous_object1790))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1791))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1792, const char *__anonymous_object1793))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1794))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1795))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1796, const char *__anonymous_object1797, unsigned long int __anonymous_object1798))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1799, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret12=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0s__1(((_Bool (*)(void *__anonymous_object1800))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1801))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1802, _Bool __anonymous_object1803))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1804))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1805, const char *__anonymous_object1806))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1807))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1808, _Bool __anonymous_object1809))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1810))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1811))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1812))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1813))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1814))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1815, const char *__anonymous_object1816))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1817))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1818, const char *__anonymous_object1819))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1820))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1821))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1822, const char *__anonymous_object1823, unsigned long int __anonymous_object1824))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1825, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret11=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1826))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1827))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1828, _Bool __anonymous_object1829))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1830))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1831, const char *__anonymous_object1832))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1833))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1834, _Bool __anonymous_object1835))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1836))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1837))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1838))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1839))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1840))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1841, const char *__anonymous_object1842))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1843))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1844, const char *__anonymous_object1845))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1846))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1847))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1848, const char *__anonymous_object1849, unsigned long int __anonymous_object1850))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1851, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed short int")))) , _tmp_cp_ret11)), __v__s_1)))) , _tmp_cp_ret12)), ((void *(*)(void *__anonymous_object1852))(&_thunk3)))))) , _tmp_cp_ret13));
     500        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1694))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1695))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1696, _Bool __anonymous_object1697))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1698))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1699, const char *__anonymous_object1700))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1701))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1702, _Bool __anonymous_object1703))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1704))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1705))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1706))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1707))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1708))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1709, const char *__anonymous_object1710))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1711))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1712, const char *__anonymous_object1713))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1714))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1715))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1716, const char *__anonymous_object1717, unsigned long int __anonymous_object1718))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1719, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     501    }
     502    ((void)(((void)(_tmp_cp_ret13=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1720))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1721))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1722, _Bool __anonymous_object1723))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1724))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1725, const char *__anonymous_object1726))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1727))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1728, _Bool __anonymous_object1729))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1730))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1731))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1732))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1733))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1734))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1735, const char *__anonymous_object1736))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1737))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1738, const char *__anonymous_object1739))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1740))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1741))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1742, const char *__anonymous_object1743, unsigned long int __anonymous_object1744))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1745, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret12=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0s__1(((_Bool (*)(void *__anonymous_object1746))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1747))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1748, _Bool __anonymous_object1749))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1750))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1751, const char *__anonymous_object1752))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1753))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1754, _Bool __anonymous_object1755))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1756))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1757))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1758))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1759))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1760))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1761, const char *__anonymous_object1762))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1763))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1764, const char *__anonymous_object1765))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1766))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1767))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1768, const char *__anonymous_object1769, unsigned long int __anonymous_object1770))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1771, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret11=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1772))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1773))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1774, _Bool __anonymous_object1775))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1776))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1777, const char *__anonymous_object1778))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1779))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1780, _Bool __anonymous_object1781))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1782))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1783))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1784))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1785))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1786))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1787, const char *__anonymous_object1788))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1789))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1790, const char *__anonymous_object1791))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1792))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1793))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1794, const char *__anonymous_object1795, unsigned long int __anonymous_object1796))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1797, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "signed short int")))) , _tmp_cp_ret11)), __v__s_1)))) , _tmp_cp_ret12)), ((void *(*)(void *__anonymous_object1798))(&_thunk3)))))) , _tmp_cp_ret13));
    573503}
    574504void __f__F_Us__1(unsigned short int __v__Us_1){
     
    577507    struct ofstream *_tmp_cp_ret16;
    578508    __attribute__ ((unused)) struct ofstream *_thunk4(struct ofstream *_p0){
    579         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1853))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1854))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1855, _Bool __anonymous_object1856))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1857))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1858, const char *__anonymous_object1859))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1860))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1861, _Bool __anonymous_object1862))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1863))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1864))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1865))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1866))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1867))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1868, const char *__anonymous_object1869))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1870))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1871, const char *__anonymous_object1872))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1873))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1874))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1875, const char *__anonymous_object1876, unsigned long int __anonymous_object1877))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1878, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    580     }
    581     ((void)(((void)(_tmp_cp_ret16=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1879))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1880))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1881, _Bool __anonymous_object1882))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1883))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1884, const char *__anonymous_object1885))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1886))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1887, _Bool __anonymous_object1888))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1889))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1890))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1891))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1892))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1893))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1894, const char *__anonymous_object1895))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1896))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1897, const char *__anonymous_object1898))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1899))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1900))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1901, const char *__anonymous_object1902, unsigned long int __anonymous_object1903))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1904, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret15=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Us__1(((_Bool (*)(void *__anonymous_object1905))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1906))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1907, _Bool __anonymous_object1908))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1909))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1910, const char *__anonymous_object1911))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1912))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1913, _Bool __anonymous_object1914))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1915))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1916))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1917))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1918))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1919))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1920, const char *__anonymous_object1921))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1922))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1923, const char *__anonymous_object1924))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1925))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1926))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1927, const char *__anonymous_object1928, unsigned long int __anonymous_object1929))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1930, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret14=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1931))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1932))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1933, _Bool __anonymous_object1934))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1935))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1936, const char *__anonymous_object1937))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1938))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1939, _Bool __anonymous_object1940))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1941))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1942))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1943))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1944))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1945))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1946, const char *__anonymous_object1947))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1948))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1949, const char *__anonymous_object1950))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1951))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1952))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1953, const char *__anonymous_object1954, unsigned long int __anonymous_object1955))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1956, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned short int")))) , _tmp_cp_ret14)), __v__Us_1)))) , _tmp_cp_ret15)), ((void *(*)(void *__anonymous_object1957))(&_thunk4)))))) , _tmp_cp_ret16));
     509        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1799))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1800))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1801, _Bool __anonymous_object1802))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1803))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1804, const char *__anonymous_object1805))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1806))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1807, _Bool __anonymous_object1808))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1809))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1810))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1811))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1812))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1813))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1814, const char *__anonymous_object1815))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1816))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1817, const char *__anonymous_object1818))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1819))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1820))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1821, const char *__anonymous_object1822, unsigned long int __anonymous_object1823))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1824, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     510    }
     511    ((void)(((void)(_tmp_cp_ret16=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1825))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1826))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1827, _Bool __anonymous_object1828))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1829))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1830, const char *__anonymous_object1831))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1832))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1833, _Bool __anonymous_object1834))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1835))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1836))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1837))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1838))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1839))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1840, const char *__anonymous_object1841))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1842))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1843, const char *__anonymous_object1844))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1845))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1846))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1847, const char *__anonymous_object1848, unsigned long int __anonymous_object1849))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1850, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret15=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Us__1(((_Bool (*)(void *__anonymous_object1851))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1852))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1853, _Bool __anonymous_object1854))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1855))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1856, const char *__anonymous_object1857))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1858))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1859, _Bool __anonymous_object1860))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1861))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1862))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1863))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1864))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1865))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1866, const char *__anonymous_object1867))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1868))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1869, const char *__anonymous_object1870))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1871))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1872))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1873, const char *__anonymous_object1874, unsigned long int __anonymous_object1875))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1876, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret14=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1877))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1878))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1879, _Bool __anonymous_object1880))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1881))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1882, const char *__anonymous_object1883))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1884))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1885, _Bool __anonymous_object1886))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1887))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1888))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1889))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1890))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1891))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1892, const char *__anonymous_object1893))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1894))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1895, const char *__anonymous_object1896))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1897))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1898))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1899, const char *__anonymous_object1900, unsigned long int __anonymous_object1901))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1902, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "unsigned short int")))) , _tmp_cp_ret14)), __v__Us_1)))) , _tmp_cp_ret15)), ((void *(*)(void *__anonymous_object1903))(&_thunk4)))))) , _tmp_cp_ret16));
    582512}
    583513void __f__F_Ui__1(unsigned int __v__Ui_1){
     
    586516    struct ofstream *_tmp_cp_ret19;
    587517    __attribute__ ((unused)) struct ofstream *_thunk5(struct ofstream *_p0){
    588         return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1958))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1959))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1960, _Bool __anonymous_object1961))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1962))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1963, const char *__anonymous_object1964))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1965))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1966, _Bool __anonymous_object1967))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1968))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1969))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1970))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1971))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1972))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1973, const char *__anonymous_object1974))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1975))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1976, const char *__anonymous_object1977))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1978))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1979))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1980, const char *__anonymous_object1981, unsigned long int __anonymous_object1982))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1983, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
    589     }
    590     ((void)(((void)(_tmp_cp_ret19=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1984))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1985))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1986, _Bool __anonymous_object1987))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1988))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1989, const char *__anonymous_object1990))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1991))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1992, _Bool __anonymous_object1993))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1994))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1995))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1996))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1997))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1998))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1999, const char *__anonymous_object2000))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object2001))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2002, const char *__anonymous_object2003))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2004))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2005))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2006, const char *__anonymous_object2007, unsigned long int __anonymous_object2008))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2009, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret18=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Ui__1(((_Bool (*)(void *__anonymous_object2010))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2011))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object2012, _Bool __anonymous_object2013))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object2014))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2015, const char *__anonymous_object2016))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object2017))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2018, _Bool __anonymous_object2019))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object2020))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object2021))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2022))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2023))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object2024))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2025, const char *__anonymous_object2026))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object2027))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2028, const char *__anonymous_object2029))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2030))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2031))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2032, const char *__anonymous_object2033, unsigned long int __anonymous_object2034))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2035, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret17=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object2036))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2037))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object2038, _Bool __anonymous_object2039))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object2040))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2041, const char *__anonymous_object2042))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object2043))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object2044, _Bool __anonymous_object2045))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object2046))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object2047))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2048))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object2049))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object2050))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2051, const char *__anonymous_object2052))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object2053))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2054, const char *__anonymous_object2055))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2056))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2057))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2058, const char *__anonymous_object2059, unsigned long int __anonymous_object2060))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2061, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "size_t")))) , _tmp_cp_ret17)), __v__Ui_1)))) , _tmp_cp_ret18)), ((void *(*)(void *__anonymous_object2062))(&_thunk5)))))) , _tmp_cp_ret19));
     518        return __endl__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0__1(((_Bool (*)(void *__anonymous_object1904))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1905))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1906, _Bool __anonymous_object1907))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1908))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1909, const char *__anonymous_object1910))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1911))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1912, _Bool __anonymous_object1913))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1914))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1915))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1916))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1917))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1918))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1919, const char *__anonymous_object1920))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1921))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1922, const char *__anonymous_object1923))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1924))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1925))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1926, const char *__anonymous_object1927, unsigned long int __anonymous_object1928))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1929, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)_p0));
     519    }
     520    ((void)(((void)(_tmp_cp_ret19=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PFRd0_Rd0___1(((_Bool (*)(void *__anonymous_object1930))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1931))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1932, _Bool __anonymous_object1933))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1934))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1935, const char *__anonymous_object1936))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1937))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1938, _Bool __anonymous_object1939))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1940))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1941))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1942))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1943))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1944))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1945, const char *__anonymous_object1946))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1947))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1948, const char *__anonymous_object1949))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1950))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1951))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1952, const char *__anonymous_object1953, unsigned long int __anonymous_object1954))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1955, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret18=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0Ui__1(((_Bool (*)(void *__anonymous_object1956))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1957))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1958, _Bool __anonymous_object1959))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1960))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1961, const char *__anonymous_object1962))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1963))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1964, _Bool __anonymous_object1965))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1966))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1967))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1968))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1969))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1970))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1971, const char *__anonymous_object1972))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1973))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1974, const char *__anonymous_object1975))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object1976))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object1977))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object1978, const char *__anonymous_object1979, unsigned long int __anonymous_object1980))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object1981, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)(((void)(_tmp_cp_ret17=((struct ofstream *)___operator_bitor__A0_1_0_0___sepPrt__PFb_Rd0___sepReset__PF_Rd0___sepReset__PF_Rd0b___sepGetCur__PFPCc_Rd0___sepSetCur__PF_Rd0PCc___getNL__PFb_Rd0___setNL__PF_Rd0b___sepOn__PF_Rd0___sepOff__PF_Rd0___sepDisable__PFb_Rd0___sepEnable__PFb_Rd0___sepGet__PFPCc_Rd0___sepSet__PF_Rd0PCc___sepGetTuple__PFPCc_Rd0___sepSetTuple__PF_Rd0PCc___fail__PFi_Rd0___flush__PFi_Rd0___open__PF_Rd0PCcPCc___close__PF_Rd0___write__PFRd0_Rd0PCcUl___fmt__PFi_Rd0PCc__FRd0_Rd0PCc__1(((_Bool (*)(void *__anonymous_object1982))__sepPrt__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1983))__sepReset__F_R9sofstream__1), ((void (*)(void *__anonymous_object1984, _Bool __anonymous_object1985))__sepReset__F_R9sofstreamb__1), ((const char *(*)(void *__anonymous_object1986))__sepGetCur__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1987, const char *__anonymous_object1988))__sepSetCur__F_R9sofstreamPCc__1), ((_Bool (*)(void *__anonymous_object1989))__getNL__Fb_R9sofstream__1), ((void (*)(void *__anonymous_object1990, _Bool __anonymous_object1991))__setNL__F_R9sofstreamb__1), ((void (*)(void *__anonymous_object1992))__sepOn__F_R9sofstream__1), ((void (*)(void *__anonymous_object1993))__sepOff__F_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1994))__sepDisable__Fb_R9sofstream__1), ((_Bool (*)(void *__anonymous_object1995))__sepEnable__Fb_R9sofstream__1), ((const char *(*)(void *__anonymous_object1996))__sepGet__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object1997, const char *__anonymous_object1998))__sepSet__F_R9sofstreamPCc__1), ((const char *(*)(void *__anonymous_object1999))__sepGetTuple__FPCc_R9sofstream__1), ((void (*)(void *__anonymous_object2000, const char *__anonymous_object2001))__sepSetTuple__F_R9sofstreamPCc__1), ((signed int (*)(void *__anonymous_object2002))__fail__Fi_R9sofstream__1), ((signed int (*)(void *__anonymous_object2003))__flush__Fi_R9sofstream__1), ((void (*)(void *__os__R7tostype_1, const char *__name__PCc_1, const char *__mode__PCc_1))__open__F_R9sofstreamPCcPCc__1), ((void (*)(void *__os__R7tostype_1))__close__F_R9sofstream__1), ((void *(*)(void *__anonymous_object2004, const char *__anonymous_object2005, unsigned long int __anonymous_object2006))__write__FR9sofstream_R9sofstreamPCcUl__1), ((signed int (*)(void *__anonymous_object2007, const char *__fmt__PCc_1, ...))__fmt__Fi_R9sofstreamPCc__1), ((void *)__sout__R9sofstream_1), "size_t")))) , _tmp_cp_ret17)), __v__Ui_1)))) , _tmp_cp_ret18)), ((void *(*)(void *__anonymous_object2008))(&_thunk5)))))) , _tmp_cp_ret19));
    591521}
    592522signed int __main__Fi___1(){
  • src/tests/.expect/references.txt

    r32cab5b rb2fe1c9  
    4413 1 12
    5514 14
    6 x = 6 ; x2 = 789
    7 x = 6 ; x2 = 999
    8 x = 12345 ; x2 = 999
    9 x = 22222 ; x2 = 999
    106Default constructing a Y
    117Copy constructing a Y
     
    3228Destructing a Y
    3329Destructing a Y
    34 3 3
    35 3
    36 3
    37 3 9 { 1, 7 }, [1, 2, 3]
    3830Destructing a Y
    3931Destructing a Y
  • src/tests/Makefile.am

    r32cab5b rb2fe1c9  
    110110        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    111111
    112 fallthrough-ERROR: fallthrough.c @CFA_BINDIR@/@CFA_NAME@
    113         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    114 
    115112# Constructor/destructor tests
    116113raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
  • src/tests/Makefile.in

    r32cab5b rb2fe1c9  
    787787        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    788788
    789 fallthrough-ERROR: fallthrough.c @CFA_BINDIR@/@CFA_NAME@
    790         ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    791 
    792789# Constructor/destructor tests
    793790raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
  • src/tests/concurrent/examples/datingService.c

    r32cab5b rb2fe1c9  
    88// Created On       : Mon Oct 30 12:56:20 2017
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Wed Mar 14 22:48:40 2018
    11 // Update Count     : 23
     10// Last Modified On : Tue Jan  2 12:19:01 2018
     11// Update Count     : 22
    1212//
    1313
     
    8888int main() {
    8989        DatingService TheExchange;
    90         Girl * girls[NoOfPairs];
    91         Boy  * boys[NoOfPairs];
     90        Girl *girls[NoOfPairs];
     91        Boy  *boys[NoOfPairs];
    9292
    9393        srandom( /*getpid()*/ 103 );
  • src/tests/concurrent/preempt.c

    r32cab5b rb2fe1c9  
    11#include <kernel>
    22#include <thread>
    3 #include <time>
    43
    54#ifndef PREEMPTION_RATE
    6 #define PREEMPTION_RATE 10`ms
     5#define PREEMPTION_RATE 10_000ul
    76#endif
    87
    9 Duration default_preemption() {
     8unsigned int default_preemption() {
    109        return PREEMPTION_RATE;
    1110}
  • src/tests/concurrent/signal/barge.c

    r32cab5b rb2fe1c9  
    1616
    1717#ifndef PREEMPTION_RATE
    18 #define PREEMPTION_RATE 10`ms
     18#define PREEMPTION_RATE 10_000ul
    1919#endif
    2020
    21 Duration default_preemption() {
     21unsigned int default_preemption() {
    2222        return 0;
    2323}
  • src/tests/concurrent/signal/block.c

    r32cab5b rb2fe1c9  
    1212#include <stdlib>
    1313#include <thread>
    14 #include <time>
     14
     15#include <time.h>
    1516
    1617#ifdef LONG_TEST
     
    2122
    2223#ifndef PREEMPTION_RATE
    23 #define PREEMPTION_RATE 10`ms
     24#define PREEMPTION_RATE 10_000ul
    2425#endif
    2526
    26 Duration default_preemption() {
     27unsigned int default_preemption() {
    2728        return PREEMPTION_RATE;
    2829}
     
    5051//------------------------------------------------------------------------------
    5152void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) {
    52     wait( cond, (uintptr_t)active_thread() );
     53        wait( cond, (uintptr_t)this_thread );
    5354
    5455        yield( random( 10 ) );
     
    5960        }
    6061
    61         a.last_thread = b.last_thread = active_thread();
     62        a.last_thread = b.last_thread = this_thread;
    6263
    6364        yield( random( 10 ) );
     
    7576        yield( random( 10 ) );
    7677
    77         [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = active_thread();
     78        [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread;
    7879
    7980        if( !is_empty( cond ) ) {
     
    105106//------------------------------------------------------------------------------
    106107void barge_op( global_data_t & mutex a ) {
    107         a.last_thread = active_thread();
     108        a.last_thread = this_thread;
    108109}
    109110
  • src/tests/concurrent/signal/disjoint.c

    r32cab5b rb2fe1c9  
    33#include <monitor>
    44#include <thread>
    5 #include <time>
     5
     6#include <time.h>
    67
    78#ifdef LONG_TEST
     
    1213
    1314#ifndef PREEMPTION_RATE
    14 #define PREEMPTION_RATE 10`ms
     15#define PREEMPTION_RATE 10_000ul
    1516#endif
    1617
    17 Duration default_preemption() {
     18unsigned int default_preemption() {
    1819        return PREEMPTION_RATE;
    1920}
  • src/tests/concurrent/signal/wait.c

    r32cab5b rb2fe1c9  
    1010#include <stdlib>
    1111#include <thread>
    12 #include <time>
     12
     13#include <time.h>
    1314
    1415#ifdef LONG_TEST
     
    1920
    2021#ifndef PREEMPTION_RATE
    21 #define PREEMPTION_RATE 10`ms
     22#define PREEMPTION_RATE 10_000ul
    2223#endif
    2324
    24 Duration default_preemption() {
     25unsigned int default_preemption() {
    2526        return PREEMPTION_RATE;
    2627}
  • src/tests/concurrent/waitfor/simple.c

    r32cab5b rb2fe1c9  
    1010
    1111#ifndef PREEMPTION_RATE
    12 #define PREEMPTION_RATE 10`ms
     12#define PREEMPTION_RATE 10_000ul
    1313#endif
    1414
    15 Duration default_preemption() {
     15unsigned int default_preemption() {
    1616        return PREEMPTION_RATE;
    1717}
  • src/tests/coroutine/fibonacci.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Thu Jun  8 07:29:37 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 22 22:45:44 2018
    13 // Update Count     : 15
     12// Last Modified On : Tue Dec  5 22:27:54 2017
     13// Update Count     : 14
    1414//
    1515
     
    2121void ?{}( Fibonacci & fib ) with( fib ) { fn = 0; }
    2222
    23 // main automatically called on first resume
    2423void main( Fibonacci & fib ) with( fib ) {
    2524        int fn1, fn2;                                                                           // retained between resumes
    26         fn = 0;  fn1 = fn;                                                                      // 1st case
     25
     26        fn = 0; fn1 = fn;                                                                       // 1st case
    2727        suspend();                                                                                      // restart last resume
    28         fn = 1;  fn2 = fn1;  fn1 = fn;                                          // 2nd case
     28
     29        fn = 1; fn2 = fn1;  fn1 = fn;                                           // 2nd case
    2930        suspend();                                                                                      // restart last resume
     31
    3032        for ( ;; ) {
    3133                fn = fn1 + fn2; fn2 = fn1;  fn1 = fn;                   // general case
  • src/tests/minmax.c

    r32cab5b rb2fe1c9  
    77// minmax.c --
    88//
    9 // Author           : Peter A. Buhr
     9// Author           : Richard C. Bilson
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 10 17:29:09 2018
    13 // Update Count     : 50
     12// Last Modified On : Mon Feb 29 23:45:16 2016
     13// Update Count     : 49
    1414//
    1515
  • src/tests/operators.c

    r32cab5b rb2fe1c9  
    2727        a(b);
    2828        a + b;
     29        struct accumulator ?+?; // why not, eh?
     30        a + b;
    2931}
    3032
  • src/tests/preempt_longrun/create.c

    r32cab5b rb2fe1c9  
    55
    66#ifndef PREEMPTION_RATE
    7 #define PREEMPTION_RATE 10`ms
     7#define PREEMPTION_RATE 10_000ul
    88#endif
    99
    10 Duration default_preemption() {
     10unsigned int default_preemption() {
    1111        return PREEMPTION_RATE;
    1212}
  • src/tests/preempt_longrun/enter.c

    r32cab5b rb2fe1c9  
    66
    77#ifndef PREEMPTION_RATE
    8 #define PREEMPTION_RATE 10`ms
     8#define PREEMPTION_RATE 10_000ul
    99#endif
    1010
    11 Duration default_preemption() {
     11unsigned int default_preemption() {
    1212        return PREEMPTION_RATE;
    1313}
  • src/tests/preempt_longrun/enter3.c

    r32cab5b rb2fe1c9  
    66
    77#ifndef PREEMPTION_RATE
    8 #define PREEMPTION_RATE 10`ms
     8#define PREEMPTION_RATE 10_000ul
    99#endif
    1010
    11 Duration default_preemption() {
     11unsigned int default_preemption() {
    1212        return PREEMPTION_RATE;
    1313}
  • src/tests/preempt_longrun/processor.c

    r32cab5b rb2fe1c9  
    55
    66#ifndef PREEMPTION_RATE
    7 #define PREEMPTION_RATE 10`ms
     7#define PREEMPTION_RATE 10_000ul
    88#endif
    99
    10 Duration default_preemption() {
     10unsigned int default_preemption() {
    1111        return PREEMPTION_RATE;
    1212}
  • src/tests/preempt_longrun/stack.c

    r32cab5b rb2fe1c9  
    55
    66#ifndef PREEMPTION_RATE
    7 #define PREEMPTION_RATE 10`ms
     7#define PREEMPTION_RATE 10_000ul
    88#endif
    99
    10 Duration default_preemption() {
     10unsigned int default_preemption() {
    1111        return PREEMPTION_RATE;
    1212}
  • src/tests/preempt_longrun/yield.c

    r32cab5b rb2fe1c9  
    99
    1010#ifndef PREEMPTION_RATE
    11 #define PREEMPTION_RATE 10`ms
     11#define PREEMPTION_RATE 10_000ul
    1212#endif
    1313
    14 Duration default_preemption() {
     14unsigned int default_preemption() {
    1515        return PREEMPTION_RATE;
    1616}
  • src/tests/references.c

    r32cab5b rb2fe1c9  
    4646
    4747int main() {
    48         int x = 123456, x2 = 789, *p1 = &x, **p2 = &p1, ***p3 = &p2,
     48        int x = 123456, *p1 = &x, **p2 = &p1, ***p3 = &p2,
    4949                &r1 = x,    &&r2 = r1,   &&&r3 = r2;
    5050        ***p3 = 3;                          // change x
     
    5252        *p3 = &p1;                          // change p2
    5353        int y = 0, z = 11, & ar[3] = { x, y, z };    // initialize array of references
    54         // &ar[1] = &z;                        // change reference array element
    55         // typeof( ar[1] ) p;                  // is int, i.e., the type of referenced object
    56         // typeof( &ar[1] ) q;                 // is int &, i.e., the type of reference
    57         // sizeof( ar[1] ) == sizeof( int );   // is true, i.e., the size of referenced object
    58         // sizeof( &ar[1] ) == sizeof( int *); // is true, i.e., the size of a reference
    5954
    60         ((int*&)&r3) = &x;                  // change r1, (&*)**r3
    61         x = 3;
    6255        // test that basic reference properties are true - r1 should be an alias for x
    6356        printf("%d %d %d\n", x, r1, &x == &r1);
     
    7568        printf("%d %d\n", r1, x);
    7669
    77         ((int&)r3) = 6;                       // change x, ***r3
    78         printf("x = %d ; x2 = %d\n", x, x2);  // check that x was changed
    79         ((int*&)&r3) = &x2;                   // change r1 to refer to x2, (&*)**r3
    80         ((int&)r3) = 999;                     // modify x2
    81         printf("x = %d ; x2 = %d\n", x, x2);  // check that x2 was changed
    82         ((int**&)&&r3) = p2;                  // change r2, (&(&*)*)*r3
    83         ((int&)r3) = 12345;                   // modify x
    84         printf("x = %d ; x2 = %d\n", x, x2);  // check that x was changed
    85         ((int***&)&&&r3) = p3;                // change r3 to p3, (&(&(&*)*)*)r3
    86         ((int&)r3) = 22222;                   // modify x
    87         printf("x = %d ; x2 = %d\n", x, x2);  // check that x was changed
    88 
    8970        // test that reference members are not implicitly constructed/destructed/assigned
    9071        X x1, x2 = x1;
     
    9576        &z1.r = &z1r;
    9677        &z2.r = &z2r;
    97 
    9878        z1 = z2;
    99 
    100         // test rvalue-to-reference conversion
    101         {
    102                 struct S { double x, y; };
    103                 void f( int & i, int & j, S & s, int v[] ) {
    104                         printf("%d %d { %g, %g }, [%d, %d, %d]\n", i, j, s.[x, y], v[0], v[1], v[2]);
    105                 }
    106                 void g(int & i) { printf("%d\n", i); }
    107                 void h(int &&& i) { printf("%d\n", i); }
    108 
    109                 int &&& r = 3;  // rvalue to reference
    110                 int i = r;
    111                 printf("%d %d\n", i, r);  // both 3
    112 
    113                 g( 3 );          // rvalue to reference
    114                 h( (int &&&)3 ); // rvalue to reference
    115 
    116                 int a = 5, b = 4;
    117                 f( 3, a + b, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); // two rvalue to reference
    118         }
    11979}
    12080
  • src/tests/switch.c

    r32cab5b rb2fe1c9  
    1010// Created On       : Tue Jul 12 06:50:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 07:33:05 2018
    13 // Update Count     : 36
     12// Last Modified On : Sat Aug 26 10:14:21 2017
     13// Update Count     : 33
    1414//
    1515
     
    8787                S s;
    8888          case 19:
    89           case 'A'...'Z':
    90           case 0 ...6:                                                                          // space required, or lexed as decimal point
     89          case 'A' ... 'Z':
     90          case 0 ... 6:
    9191          case 20, 30, 40:
    9292                i = 3;
     
    9696          case 8~10:
    9797                f( 3 );
    98                 fallthru;
     98                fallthru
    9999          case 'd':
    100100                j = 5;
  • tools/prettyprinter/Makefile.am

    r32cab5b rb2fe1c9  
    1111## Created On       : Wed Jun 28 12:07:10 2017
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Apr 16 09:43:23 2018
    14 ## Update Count     : 20
     13## Last Modified On : Wed Jun 28 23:11:56 2017
     14## Update Count     : 15
    1515###############################################################################
    1616
  • tools/prettyprinter/lex.ll

    r32cab5b rb2fe1c9  
    1010 * Created On       : Sat Dec 15 11:45:59 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Apr 15 21:28:33 2018
    13  * Update Count     : 271
     12 * Last Modified On : Tue Aug 29 17:33:36 2017
     13 * Update Count     : 268
    1414 */
    1515
     
    5050<INITIAL,C_CODE>"/*" {                                                                  // C style comments */
    5151#if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
    52                 cerr << "\"/*\" : " << yytext << endl;
     52    cerr << "\"/*\" : " << yytext << endl;
    5353#endif
    54                 if ( YYSTATE == C_CODE ) code_str += yytext;
    55                 else comment_str += yytext;
    56                 yy_push_state(C_COMMENT);
     54    if ( YYSTATE == C_CODE ) code_str += yytext;
     55    else comment_str += yytext;
     56    yy_push_state(C_COMMENT);
    5757}
    5858<C_COMMENT>(.|"\n")     {                                                                       // C style comments
    5959#if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
    60                 cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl;
     60    cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl;
    6161#endif
    62                 if ( yy_top_state() == C_CODE ) code_str += yytext;
    63                 else comment_str += yytext;
     62    if ( yy_top_state() == C_CODE ) code_str += yytext;
     63    else comment_str += yytext;
    6464}
    6565<C_COMMENT>"*/" {                                                                               // C style comments
     
    123123<C_CODE>"%}"    { RETURN_TOKEN( RCURL ) }
    124124
    125 ^"%define"[^\n]*"\n" { RETURN_TOKEN( DEFINE ) }
    126 ^"%expect"              { RETURN_TOKEN( EXPECT ) }
    127 ^"%left"                { RETURN_TOKEN( LEFT ) }
    128 ^"%locations"   { RETURN_TOKEN( LOCATIONS ) }
    129 ^"%nonassoc"    { RETURN_TOKEN( NONASSOC ) }
    130 ^"%precedence"  { RETURN_TOKEN( PRECEDENCE ) }
     125^"%union"       { RETURN_TOKEN( UNION ) }
     126^"%start"       { RETURN_TOKEN( START ) }
     127^"%token"       { RETURN_TOKEN( TOKEN ) }
     128^"%type"            { RETURN_TOKEN( TYPE ) }
     129^"%left"            { RETURN_TOKEN( LEFT ) }
     130^"%right"           { RETURN_TOKEN( RIGHT ) }
     131^"%nonassoc"    { RETURN_TOKEN( NONASSOC ) }
     132^"%precedence"  { RETURN_TOKEN( PRECEDENCE ) }
    131133^"%pure_parser" { RETURN_TOKEN( PURE_PARSER ) }
    132 ^"%right"               { RETURN_TOKEN( RIGHT ) }
    133134^"%semantic_parser"     { RETURN_TOKEN( SEMANTIC_PARSER ) }
    134 ^"%start"               { RETURN_TOKEN( START ) }
    135 ^"%thong"               { RETURN_TOKEN( THONG ) }
    136 ^"%token"               { RETURN_TOKEN( TOKEN ) }
    137 ^"%type"                { RETURN_TOKEN( TYPE ) }
    138 ^"%union"               { RETURN_TOKEN( UNION ) }
     135^"%expect"      { RETURN_TOKEN( EXPECT ) }
     136^"%thong"               { RETURN_TOKEN( THONG ) }
    139137
    140 "%prec"                 { RETURN_TOKEN( PREC ) }
     138"%prec"                 { RETURN_TOKEN( PREC ) }
    141139
    142 {integer}               { RETURN_TOKEN( INTEGER ); }
    143 [']{c_char}[']  { RETURN_TOKEN( CHARACTER ); }
    144 {identifier}    { RETURN_TOKEN( IDENTIFIER ); }
     140{integer}           { RETURN_TOKEN( INTEGER ); }
     141[']{c_char}[']  { RETURN_TOKEN( CHARACTER ); }
     142{identifier}    { RETURN_TOKEN( IDENTIFIER ); }
    145143
    146144<C_CODE>["]{s_char}*["] {                                                               // hide braces "{}" in strings
     
    162160%%
    163161void lexC(void) {
    164         BEGIN(C_CODE);
     162    BEGIN(C_CODE);
    165163}
    166164
    167165string lexYacc(void) {
    168         BEGIN(INITIAL);
    169         //cerr << "CODE: " << endl << code_str << endl;
    170         string temp( code_str );
    171         code_str = "";
    172         return temp;
     166    BEGIN(INITIAL);
     167    //cerr << "CODE: " << endl << code_str << endl;
     168    string temp( code_str );
     169    code_str = "";
     170    return temp;
    173171}
    174172
  • tools/prettyprinter/parser.yy

    r32cab5b rb2fe1c9  
    1010// Created On       : Sat Dec 15 13:44:21 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 15 21:40:30 2018
    13 // Update Count     : 1052
     12// Last Modified On : Tue Aug 29 16:34:10 2017
     13// Update Count     : 1047
    1414//
    1515
     
    6161%token<tokenp>  CODE                                                                    // C code
    6262
    63 %token<tokenp>  DEFINE                                                                  // %define
    64 %token<tokenp>  EXPECT                                                                  // %expect
     63%token<tokenp>  START                                                                   // %start
     64%token<tokenp>  UNION                                                                   // %union
     65%token<tokenp>  TOKEN                                                                   // %token
    6566%token<tokenp>  LEFT                                                                    // %left
    66 %token<tokenp>  LOCATIONS                                                               // %locations
     67%token<tokenp>  RIGHT                                                                   // %right
    6768%token<tokenp>  NONASSOC                                                                // %nonassoc
    6869%token<tokenp>  PRECEDENCE                                                              // %precedence
     70%token<tokenp>  TYPE                                                                    // %type
    6971%token<tokenp>  PURE_PARSER                                                             // %pure_parser
    70 %token<tokenp>  RIGHT                                                                   // %right
    7172%token<tokenp>  SEMANTIC_PARSER                                                 // %semantic_parser
    72 %token<tokenp>  START                                                                   // %start
     73%token<tokenp>  EXPECT                                                                  // %expect
    7374%token<tokenp>  THONG                                                                   // %thong
    74 %token<tokenp>  TOKEN                                                                   // %token
    75 %token<tokenp>  TYPE                                                                    // %type
    76 %token<tokenp>  UNION                                                                   // %union
    7775
    7876%token<tokenp>  PREC                                                                    // %prec
    7977
    80 %token                  END_TERMINALS                                                   // ALL TERMINAL TOKEN NAMES MUST APPEAR BEFORE THIS
     78%token          END_TERMINALS                                                           // ALL TERMINAL TOKEN NAMES MUST APPEAR BEFORE THIS
    8179
    8280%type<tokenp>   sections
    83 %token                  _SECTIONS
     81%token          _SECTIONS
    8482%type<tokenp>   mark
    8583%type<tokenp>   defsection_opt
    86 %token                  _DEFSECTION_OPT
     84%token          _DEFSECTION_OPT
    8785%type<tokenp>   declarations
    8886%type<tokenp>   literalblock
    89 %token                  _LITERALBLOCK
     87%token          _LITERALBLOCK
    9088%type<tokenp>   declaration
    91 %token                  _DECLARATION
     89%token          _DECLARATION
    9290%type<tokenp>   union
    9391%type<tokenp>   rword
    9492%type<tokenp>   tag_opt
    95 %token                  _TAG_OPT
     93%token          _TAG_OPT
    9694%type<tokenp>   namenolist
    97 %token                  _NAMENOLIST
     95%token          _NAMENOLIST
    9896%type<tokenp>   nameno
    99 %token                  _NAMENO
     97%token          _NAMENO
    10098%type<tokenp>   namelist
    101 %token                  _NAMELIST
     99%token          _NAMELIST
    102100%type<tokenp>   name
    103101%type<tokenp>   rulesection
    104 %token                  _RULESECTION
     102%token          _RULESECTION
    105103%type<tokenp>   rules
    106 %token                  _RULE
     104%token          _RULE
    107105%type<tokenp>   lhs
    108 %token                  _LHS
     106%token          _LHS
    109107%type<tokenp>   rhs
    110 %token                  _RHS
     108%token          _RHS
    111109%type<tokenp>   prod
    112110%type<tokenp>   prec
    113 %token                  _PREC
     111%token          _PREC
    114112%type<tokenp>   action
    115 %token                  _ACTION
     113%token          _ACTION
    116114%type<tokenp>   usersection_opt
    117 %token                  _USERSECTION_OPT
     115%token          _USERSECTION_OPT
    118116%type<tokenp>   ccode_opt
    119117%type<tokenp>   blocks
     
    236234                    $$ = $1;
    237235                }
    238         | DEFINE                                                                                        // bison
    239         | LOCATIONS
    240236        | THONG                                                                                         // bison
    241237        ;
  • tools/prettyprinter/test.y

    r32cab5b rb2fe1c9  
    66
    77/* adsad2 */
    8 %locations
    9 %define parse.error verbose
     8
    109%%
    1110
Note: See TracChangeset for help on using the changeset viewer.