Changes in / [29207bf:5ebb1368]


Ignore:
Files:
87 edited

Legend:

Unmodified
Added
Removed
  • benchmark/Makefile.in

    r29207bf r5ebb1368  
    714714
    715715compile-attributes$(EXEEXT):
    716         @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.c
     716        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
    717717
    718718compile-empty$(EXEEXT):
  • benchmark/Monitor.c

    r29207bf r5ebb1368  
    2929        EndTime = Time();
    3030
    31         sout | ( EndTime - StartTime ) / N | endl;
     31        sout | ( EndTime - StartTime ) / N;
    3232}
  • doc/papers/concurrency/Paper.tex

    r29207bf r5ebb1368  
    686686        Fib f1, f2;
    687687        for ( int i = 1; i <= 10; i += 1 ) {
    688                 sout | next( f1 ) | next( f2 ) | endl;
     688                sout | next( f1 ) | next( f2 );
    689689        }
    690690}
     
    772772                        sout | "  ";               // separator
    773773                }
    774                 sout | endl;
     774                sout | nl;
    775775        }
    776776}
    777777void ?{}( Format & fmt ) { `resume( fmt );` }
    778778void ^?{}( Format & fmt ) with( fmt ) {
    779         if ( g != 0 || b != 0 ) sout | endl;
     779        if ( g != 0 || b != 0 ) sout | nl;
    780780}
    781781void format( Format & fmt ) {
     
    855855        for ( int i = 0; i < N; i += 1 ) {
    856856                int p1 = random( 100 ), p2 = random( 100 );
    857                 sout | p1 | " " | p2 | endl;
     857                sout | p1 | " " | p2;
    858858                int status = delivery( c, p1, p2 );
    859                 sout | " $" | money | endl | status | endl;
     859                sout | " $" | money | nl | status;
    860860                receipt += 1;
    861861        }
    862862        stop( c );
    863         sout | "prod stops" | endl;
     863        sout | "prod stops";
    864864}
    865865int payment( Prod & prod, int money ) {
     
    895895        int money = 1, receipt;
    896896        for ( ; ! done; ) {
    897                 sout | p1 | " " | p2 | endl | " $" | money | endl;
     897                sout | p1 | " " | p2 | nl | " $" | money;
    898898                status += 1;
    899899                receipt = payment( p, money );
    900                 sout | " #" | receipt | endl;
     900                sout | " #" | receipt;
    901901                money += 1;
    902902        }
    903         sout | "cons stops" | endl;
     903        sout | "cons stops";
    904904}
    905905int delivery( Cons & cons, int p1, int p2 ) {
     
    10991099
    11001100void main(foo & this) {
    1101         sout | "Hello World!" | endl;
     1101        sout | "Hello World!";
    11021102}
    11031103\end{cfa}
     
    11241124
    11251125void hello(/*unused*/ int) {
    1126         sout | "Hello World!" | endl;
     1126        sout | "Hello World!";
    11271127}
    11281128
     
    11411141thread World {};
    11421142void main( World & this ) {
    1143         sout | "World!" | endl;
     1143        sout | "World!";
    11441144}
    11451145int main() {
    11461146        World w`[10]`;                                                  $\C{// implicit forks after creation}$
    1147         sout | "Hello " | endl;                                 $\C{// "Hello " and 10 "World!" printed concurrently}$
     1147        sout | "Hello ";                                        $\C{// "Hello " and 10 "World!" printed concurrently}$
    11481148}                                                                                       $\C{// implicit joins before destruction}$
    11491149\end{cfa}
     
    11931193                total += subtotals[r];                          $\C{// total subtotal}$
    11941194    }
    1195     sout | total | endl;
     1195    sout | total;
    11961196}
    11971197\end{cfa}
     
    21922192        BENCH(
    21932193                for ( size_t i = 0; i < N; i += 1 ) { @resume( c );@ } )
    2194         sout | result`ns | endl;
     2194        sout | result`ns;
    21952195}
    21962196\end{cfa}
     
    22052205        BENCH(
    22062206                for ( size_t i = 0; i < N; i += 1 ) { @yield();@ } )
    2207         sout | result`ns | endl;
     2207        sout | result`ns;
    22082208}
    22092209\end{cfa}
     
    22442244int main() {
    22452245        BENCH( for( size_t i = 0; i < N; i += 1 ) { @do_call( m1/*, m2, m3, m4*/ );@ } )
    2246         sout | result`ns | endl;
     2246        sout | result`ns;
    22472247}
    22482248\end{cfa}
     
    23052305        BENCH( for ( size_t i = 0; i < N; i += 1 ) { @wait( c );@ } );
    23062306        go = 0; // stop other thread
    2307         sout | result`ns | endl;
     2307        sout | result`ns;
    23082308}
    23092309int main() {
     
    23562356        BENCH( for ( size_t i = 0; i < N; i += 1 ) { @waitfor( do_call, m );@ } )
    23572357        go = 0; // stop other thread
    2358         sout | result`ns | endl;
     2358        sout | result`ns;
    23592359}
    23602360int main() {
     
    23912391int main() {
    23922392        BENCH( for ( size_t i = 0; i < N; i += 1 ) { @MyThread m;@ } )
    2393         sout | result`ns | endl;
     2393        sout | result`ns;
    23942394}
    23952395\end{cfa}
  • doc/proposals/flags.md

    r29207bf r5ebb1368  
    6060        ```
    6161        FunFlags f = some_val();
    62         if ( f ) { sout | "f has some flag(s) set" | endl; }
    63         if ( f & FOO ) { sout | "f has FOO set" | endl; }
     62        if ( f ) { sout | "f has some flag(s) set"; }
     63        if ( f & FOO ) { sout | "f has FOO set"; }
    6464        f |= FOO; // set FOO
    6565        f -= FOO; // unset FOO
     
    8888        ```
    8989        FunFlags f = some_val();
    90         if ( f.FOO ) { sout | "f has FOO set" | endl; }
     90        if ( f.FOO ) { sout | "f has FOO set"; }
    9191        f.FOO = true;    // set FOO
    9292        f.FOO = false;   // unset FOO
  • doc/user/user.tex

    r29207bf r5ebb1368  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Wed Nov  7 17:00:49 2018
    14 %% Update Count     : 3399
     13%% Last Modified On : Tue Dec 11 23:19:26 2018
     14%% Update Count     : 3400
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    178178int main( void ) {
    179179        int x = 0, y = 1, z = 2;
    180         ®sout | x | y | z | endl;®§\indexc{sout}§
     180        ®sout | x | y | z;®§\indexc{sout}§
    181181}
    182182\end{cfa}
     
    513513Floating exponentiation\index{exponentiation!floating} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative.
    514514\begin{cfa}
    515 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl;
     515sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi);
    516516256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i
    517517\end{cfa}
     
    591591&
    592592\begin{cfa}
    593 sout | endl;
    594 sout | endl;
    595 sout | endl;
    596 sout | "zero" | endl;
    597 sout | endl;
    598 sout | endl;
    599 sout | endl;
    600 sout | endl;
    601 sout | endl;
    602 sout | endl;
    603 sout | endl;
    604 sout | endl;
    605 sout | endl;
    606 sout | endl;
    607 sout | endl;
    608 sout | endl;
    609 sout | endl | endl;
    610 
    611 sout | endl;
    612 sout | endl;
    613 sout | endl | endl;
    614 
    615 sout | endl;
     593sout | nl;
     594sout | nl;
     595sout | nl;
     596sout | "zero" | nl;
     597sout | nl;
     598sout | nl;
     599sout | nl;
     600sout | nl;
     601sout | nl;
     602sout | nl;
     603sout | nl;
     604sout | nl;
     605sout | nl;
     606sout | nl;
     607sout | nl;
     608sout | nl;
     609sout | nl | nl;
     610
     611sout | nl;
     612sout | nl;
     613sout | nl | nl;
     614
     615sout | nl;
    616616\end{cfa}
    617617&
     
    24592459        int bar( int p ) {
    24602460                ®i® += 1;                               §\C{// dependent on local variable}§
    2461                 sout | ®i® | endl;
     2461                sout | ®i®;
    24622462        }
    24632463        return bar;                                     §\C{// undefined because of local dependence}§
     
    24652465int main() {
    24662466        * [int]( int ) fp = foo();      §\C{// int (* fp)( int )}§
    2467         sout | fp( 3 ) | endl;
     2467        sout | fp( 3 );
    24682468}
    24692469\end{cfa}
     
    32313231\begin{cfa}
    32323232int x = 1, y = 2, z = 3;
    3233 sout | x ®|® y ®|® z | endl;
     3233sout | x ®|® y ®|® z;
    32343234\end{cfa}
    32353235&
     
    32523252\begin{cfa}
    32533253[int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
    3254 sout | t1 | t2 | endl;                                  §\C{// print tuples}§
     3254sout | t1 | t2;                                         §\C{// print tuples}§
    32553255\end{cfa}
    32563256\begin{cfa}[showspaces=true,aboveskip=0pt]
     
    32643264&
    32653265\begin{cfa}
    3266 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
     3266sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2);
    32673267\end{cfa}
    32683268\\
     
    32903290A separator does not appear at the start or end of a line.
    32913291\begin{cfa}[belowskip=0pt]
    3292 sout | 1 | 2 | 3 | endl;
     3292sout | 1 | 2 | 3;
    32933293\end{cfa}
    32943294\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    32993299A separator does not appear before or after a character literal or variable.
    33003300\begin{cfa}
    3301 sout | '1' | '2' | '3' | endl;
     3301sout | '1' | '2' | '3';
    33023302123
    33033303\end{cfa}
     
    33063306A separator does not appear before or after a null (empty) C string.
    33073307\begin{cfa}
    3308 sout | 1 | "" | 2 | "" | 3 | endl;
     3308sout | 1 | "" | 2 | "" | 3;
    33093309123
    33103310\end{cfa}
     
    33163316\begin{cfa}[mathescape=off]
    33173317sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x =" | 4 | "x $" | 5 | "x £" | 6 | "x ¥"
    3318                 | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 | endl;
     3318                | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10;
    33193319\end{cfa}
    33203320%$
     
    33303330\begin{cfa}[belowskip=0pt]
    33313331sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x"
    3332                 | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" | endl;
     3332                | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x";
    33333333\end{cfa}
    33343334\begin{cfa}[basicstyle=\tt,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    33403340A seperator does not appear before or after a C string begining/ending with the \Index*{ASCII} quote or whitespace characters: \lstinline[basicstyle=\tt,showspaces=true]@`'": \t\v\f\r\n@
    33413341\begin{cfa}[belowskip=0pt]
    3342 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl;
     3342sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx";
    33433343\end{cfa}
    33443344\begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt]
     
    33493349If a space is desired before or after one of the special string start/end characters, simply insert a space.
    33503350\begin{cfa}[belowskip=0pt]
    3351 sout | "x (§\color{red}\texttt{\textvisiblespace}§" | 1 | "§\color{red}\texttt{\textvisiblespace}§) x" | 2 | "§\color{red}\texttt{\textvisiblespace}§, x" | 3 | "§\color{red}\texttt{\textvisiblespace}§:x:§\color{red}\texttt{\textvisiblespace}§" | 4 | endl;
     3351sout | "x (§\color{red}\texttt{\textvisiblespace}§" | 1 | "§\color{red}\texttt{\textvisiblespace}§) x" | 2 | "§\color{red}\texttt{\textvisiblespace}§, x" | 3 | "§\color{red}\texttt{\textvisiblespace}§:x:§\color{red}\texttt{\textvisiblespace}§" | 4;
    33523352\end{cfa}
    33533353\begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt]
     
    33663366\begin{cfa}[mathescape=off,belowskip=0pt]
    33673367sepSet( sout, ", $" );                                          §\C{// set separator from " " to ", \$"}§
    3368 sout | 1 | 2 | 3 | " \"" | ®sep® | "\"" | endl;
     3368sout | 1 | 2 | 3 | " \"" | ®sep® | "\"";
    33693369\end{cfa}
    33703370%$
     
    33753375\begin{cfa}[belowskip=0pt]
    33763376sepSet( sout, " " );                                            §\C{// reset separator to " "}§
    3377 sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl;
     3377sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"";
    33783378\end{cfa}
    33793379\begin{cfa}[showspaces=true,aboveskip=0pt]
     
    33853385strcpy( store, sepGet( sout ) );                          §\C{// copy current separator}§
    33863386sepSet( sout, "_" );                                            §\C{// change separator to underscore}§
    3387 sout | 1 | 2 | 3 | endl;
     3387sout | 1 | 2 | 3;
    33883388\end{cfa}
    33893389\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    33923392\begin{cfa}[belowskip=0pt]
    33933393sepSet( sout, store );                                          §\C{// change separator back to original}§
    3394 sout | 1 | 2 | 3 | endl;
     3394sout | 1 | 2 | 3;
    33953395\end{cfa}
    33963396\begin{cfa}[showspaces=true,aboveskip=0pt]
     
    34033403\begin{cfa}[belowskip=0pt]
    34043404sepSetTuple( sout, " " );                                       §\C{// set tuple separator from ", " to " "}§
    3405 sout | t1 | t2 | " \"" | ®sepTuple® | "\"" | endl;
     3405sout | t1 | t2 | " \"" | ®sepTuple® | "\"";
    34063406\end{cfa}
    34073407\begin{cfa}[showspaces=true,aboveskip=0pt]
     
    34103410\begin{cfa}[belowskip=0pt]
    34113411sepSetTuple( sout, ", " );                                      §\C{// reset tuple separator to ", "}§
    3412 sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl;
     3412sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"";
    34133413\end{cfa}
    34143414\begin{cfa}[showspaces=true,aboveskip=0pt]
     
    34203420Manipulators \Indexc{sepDisable}\index{manipulator!sepDisable@©sepDisable©} and \Indexc{sepEnable}\index{manipulator!sepEnable@©sepEnable©} \emph{globally} toggle printing the separator, \ie the seperator is adjusted with respect to all subsequent printed items.
    34213421\begin{cfa}[belowskip=0pt]
    3422 sout | sepDisable | 1 | 2 | 3 | endl;           §\C{// globally turn off implicit separator}§
     3422sout | sepDisable | 1 | 2 | 3                §\C{// globally turn off implicit separator}§
    34233423\end{cfa}
    34243424\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34263426\end{cfa}
    34273427\begin{cfa}[belowskip=0pt]
    3428 sout | sepEnable | 1 | 2 | 3 | endl;            §\C{// globally turn on implicit separator}§
     3428sout | sepEnable | 1 | 2 | 3;           §\C{// globally turn on implicit separator}§
    34293429\end{cfa}
    34303430\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34353435Manipulators \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} \emph{locally} toggle printing the separator, \ie the seperator is adjusted only with respect to the next printed item.
    34363436\begin{cfa}[belowskip=0pt]
    3437 sout | 1 | sepOff | 2 | 3 | endl;                       §\C{// locally turn off implicit separator}§
     3437sout | 1 | sepOff | 2 | 3;                      §\C{// locally turn off implicit separator}§
    34383438\end{cfa}
    34393439\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34413441\end{cfa}
    34423442\begin{cfa}[belowskip=0pt]
    3443 sout | sepDisable | 1 | sepOn | 2 | 3 | endl; §\C{// locally turn on implicit separator}§
     3443sout | sepDisable | 1 | sepOn | 2 | 3; §\C{// locally turn on implicit separator}§
    34443444\end{cfa}
    34453445\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34483448The tuple separator also responses to being turned on and off.
    34493449\begin{cfa}[belowskip=0pt]
    3450 sout | t1 | sepOff | t2 | endl;                         §\C{// locally turn on/off implicit separator}§
     3450sout | t1 | sepOff | t2;                                §\C{// locally turn on/off implicit separator}§
    34513451\end{cfa}
    34523452\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34563456use ©sep© to accomplish this functionality.
    34573457\begin{cfa}[belowskip=0pt]
    3458 sout | sepOn | 1 | 2 | 3 | sepOn | endl ;       §\C{// sepOn does nothing at start/end of line}§
     3458sout | sepOn | 1 | 2 | 3 | sepOn;       §\C{// sepOn does nothing at start/end of line}§
    34593459\end{cfa}
    34603460\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34623462\end{cfa}
    34633463\begin{cfa}[belowskip=0pt]
    3464 sout | sep | 1 | 2 | 3 | sep | endl ;           §\C{// use sep to print separator at start/end of line}§
     3464sout | sep | 1 | 2 | 3 | sep ;          §\C{// use sep to print separator at start/end of line}§
    34653465\end{cfa}
    34663466\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    34753475int main( void ) {
    34763476        int x = 1, y = 2, z = 3;
    3477         sout | x | y | z | endl;
     3477        sout | x | y | z;
    34783478        [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
    3479         sout | t1 | t2 | endl;                                          // print tuples
    3480         sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
    3481         sout | 1 | 2 | 3 | endl;
    3482         sout | '1' | '2' | '3' | endl;
    3483         sout | 1 | "" | 2 | "" | 3 | endl;
     3479        sout | t1 | t2;                                         // print tuples
     3480        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2);
     3481        sout | 1 | 2 | 3;
     3482        sout | '1' | '2' | '3';
     3483        sout | 1 | "" | 2 | "" | 3;
    34843484        sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x =" | 4 | "x $" | 5 | "x £" | 6 | "x ¥"
    3485                 | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 | endl;
     3485                | 7 | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10;
    34863486        sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x"
    3487                 | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" | endl;
    3488         sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl;
    3489         sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl;
     3487                | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x";
     3488        sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx";
     3489        sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4;
    34903490
    34913491        sepSet( sout, ", $" );                                          // set separator from " " to ", $"
    3492         sout | 1 | 2 | 3 | " \"" | sep | "\"" | endl;
     3492        sout | 1 | 2 | 3 | " \"" | sep | "\"";
    34933493        sepSet( sout, " " );                                            // reset separator to " "
    3494         sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
     3494        sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"";
    34953495
    34963496        char store[sepSize];
    34973497        strcpy( store, sepGet( sout ) );
    34983498        sepSet( sout, "_" );
    3499         sout | 1 | 2 | 3 | endl;
     3499        sout | 1 | 2 | 3;
    35003500        sepSet( sout, store );
    3501         sout | 1 | 2 | 3 | endl;
     3501        sout | 1 | 2 | 3;
    35023502
    35033503        sepSetTuple( sout, " " );                                       // set tuple separator from ", " to " "
    3504         sout | t1 | t2 | " \"" | sepTuple | "\"" | endl;
     3504        sout | t1 | t2 | " \"" | sepTuple | "\"";
    35053505        sepSetTuple( sout, ", " );                                      // reset tuple separator to ", "
    3506         sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
    3507 
    3508         sout | sepDisable | 1 | 2 | 3 | endl;           // globally turn off implicit separator
    3509         sout | sepEnable | 1 | 2 | 3 | endl;            // globally turn on implicit separator
    3510 
    3511         sout | 1 | sepOff | 2 | 3 | endl;                       // locally turn on implicit separator
    3512         sout | sepDisable | 1 | sepOn | 2 | 3 | endl; // globally turn off implicit separator
     3506        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"";
     3507
     3508        sout | sepDisable | 1 | 2 | 3;          // globally turn off implicit separator
     3509        sout | sepEnable | 1 | 2 | 3;           // globally turn on implicit separator
     3510
     3511        sout | 1 | sepOff | 2 | 3;                      // locally turn on implicit separator
     3512        sout | sepDisable | 1 | sepOn | 2 | 3; // globally turn off implicit separator
    35133513        sout | sepEnable;
    3514         sout | t1 | sepOff | t2 | endl;                         // locally turn on/off implicit separator
    3515 
    3516         sout | sepOn | 1 | 2 | 3 | sepOn | endl ;       // sepOn does nothing at start/end of line
    3517         sout | sep | 1 | 2 | 3 | sep | endl ;           // use sep to print separator at start/end of line
     3514        sout | t1 | sepOff | t2;                                // locally turn on/off implicit separator
     3515
     3516        sout | sepOn | 1 | 2 | 3 | sepOn ;      // sepOn does nothing at start/end of line
     3517        sout | sep | 1 | 2 | 3 | sep ;          // use sep to print separator at start/end of line
    35183518}
    35193519
     
    41804180        Fibonacci f1, f2;
    41814181        for ( int i = 1; i <= 10; i += 1 ) {
    4182                 sout | next( &f1 ) | ' ' | next( &f2 ) | endl;
     4182                sout | next( &f1 ) | ' ' | next( &f2 );
    41834183        } // for
    41844184}
     
    42464246                MyThread f[4];
    42474247        }
    4248         sout | global.value | endl;
     4248        sout | global.value;
    42494249}
    42504250\end{cfa}
     
    43244324void main( First * this ) {
    43254325        for ( int i = 0; i < 10; i += 1 ) {
    4326                 sout | "First : Suspend No." | i + 1 | endl;
     4326                sout | "First : Suspend No." | i + 1;
    43274327                yield();
    43284328        }
     
    43334333        wait( this->lock );
    43344334        for ( int i = 0; i < 10; i += 1 ) {
    4335                 sout | "Second : Suspend No." | i + 1 | endl;
     4335                sout | "Second : Suspend No." | i + 1;
    43364336                yield();
    43374337        }
     
    43404340int main( void ) {
    43414341        signal_once lock;
    4342         sout | "User main begin" | endl;
     4342        sout | "User main begin";
    43434343        {
    43444344                processor p;
     
    43484348                }
    43494349        }
    4350         sout | "User main end" | endl;
     4350        sout | "User main end";
    43514351}
    43524352\end{cfa}
     
    50455045void ?{}( Line * l ) {
    50465046        l->lnth = 0.0;
    5047         sout | "default" | endl;
     5047        sout | "default";
    50485048}
    50495049
     
    50525052void ?{}( Line * l, float lnth ) {
    50535053        l->lnth = lnth;
    5054         sout | "lnth" | l->lnth | endl;
     5054        sout | "lnth" | l->lnth;
    50555055
    50565056}
     
    50585058// destructor
    50595059void ^?() {
    5060         sout | "destroyed" | endl;
     5060        sout | "destroyed";
    50615061        l.lnth = 0.0;
    50625062}
     
    58045804In particular, output of ©char© variable now print a character rather than the decimal ASCII value of the character.
    58055805\begin{cfa}
    5806 sout | 'x' | " " | (int)'x' | endl;
     5806sout | 'x' | " " | (int)'x';
    58075807x 120
    58085808\end{cfa}
     
    70347034#include <gmp>§\indexc{gmp}§
    70357035int main( void ) {
    7036         sout | "Factorial Numbers" | endl;
     7036        sout | "Factorial Numbers";
    70377037        Int fact = 1;
    70387038
    7039         sout | 0 | fact | endl;
     7039        sout | 0 | fact;
    70407040        for ( unsigned int i = 1; i <= 40; i += 1 ) {
    70417041                fact *= i;
    7042                 sout | i | fact | endl;
     7042                sout | i | fact;
    70437043        }
    70447044}
  • examples/ArrayN.c

    r29207bf r5ebb1368  
    77
    88forall(otype index_t)
    9 index_t offset_to_index(unsigned offset, index_t size)
    10 {
     9index_t offset_to_index(unsigned offset, index_t size) {
    1110    return [offset / size.0, offset % size.1];
    1211}
    1312
    14 int main(int argc, char* argv[])
    15 {
     13int main(int argc, char* argv[]) {
    1614    unsigned x = 0, y = 0, i = 0;
    1715    unsigned sx = 4, sy = 4;
     
    2018    [x, y] = offset_to_index(6, [sx, sy]);
    2119
    22     sout | x | ' ' | y | endl;
     20    sout | x | ' ' | y;
    2321
    2422    return 0;
  • examples/gc_no_raii/src/internal/collector.c

    r29207bf r5ebb1368  
    3838void* gc_allocate(size_t target_size)
    3939{
    40         // sout | "Allocating " | target_size | " bytes" | endl;
     40        // sout | "Allocating " | target_size | " bytes";
    4141
    4242        size_t size = gc_compute_size(target_size + sizeof(gc_object_header));
    4343
    44         // sout | "Object header size: " | sizeof(gc_object_header) | " bytes" | endl;
    45         // sout | "Actual allocation size: " | size | " bytes" | endl;
     44        // sout | "Object header size: " | sizeof(gc_object_header) | " bytes";
     45        // sout | "Actual allocation size: " | size | " bytes";
    4646
    4747        check(size < POOL_SIZE_BYTES);
  • examples/gc_no_raii/src/internal/state.h

    r29207bf r5ebb1368  
    3838static inline bool gc_needs_collect(gc_state* state)
    3939{
    40         // sout | "Used Space: " | state->used_space | " bytes" | endl;
     40        // sout | "Used Space: " | state->used_space | " bytes";
    4141        return state->used_space * 2 > state->total_space;
    4242}
  • examples/gc_no_raii/src/tools/print.h

    r29207bf r5ebb1368  
    55// #include <fstream.hfa>
    66//
    7 // #define DEBUG_OUT(x) sout | x | endl;
     7// #define DEBUG_OUT(x) sout | x;
    88//
    99// #else
  • examples/multicore.c

    r29207bf r5ebb1368  
    1515
    1616int main(int argc, char* argv[]) {
    17         // sout | "User main begin" | endl;
     17        // sout | "User main begin";
    1818        {
    1919                processor p;
     
    2222                }
    2323        }
    24         // sout | "User main end" | endl;
     24        // sout | "User main end";
    2525}
  • examples/prolog.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:09:39 2016
    13 // Update Count     : 5
     12// Last Modified On : Tue Dec 11 23:27:19 2018
     13// Update Count     : 6
    1414//
    1515
    1616#include <fstream.hfa>
    1717
    18 void printResult( int x ) { sout | "int" | endl; }
    19 void printResult( double x ) { sout | "double" | endl; }
    20 void printResult( char * x ) { sout | "char*" | endl; }
     18void printResult( int x ) { sout | "int"; }
     19void printResult( double x ) { sout | "double"; }
     20void printResult( char * x ) { sout | "char*"; }
    2121
    2222void is_arithmetic( int x ) {}
  • examples/quad.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:07:02 2016
    13 // Update Count     : 8
     12// Last Modified On : Tue Dec 11 23:26:58 2018
     13// Update Count     : 9
    1414//
    1515
     
    2828int main() {
    2929        int N = 2;
    30         sout | "result of quad of" | N | "is" | quad( N ) | endl;
     30        sout | "result of quad of" | N | "is" | quad( N );
    3131}
    3232
  • examples/square.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  8 22:05:48 2016
    13 // Update Count     : 27
     12// Last Modified On : Tue Dec 11 23:28:24 2018
     13// Update Count     : 28
    1414//
    1515
     
    2323int main() {
    2424#if 0
    25         sout | "result of squaring 9 is " | endl;
     25        sout | "result of squaring 9 is ";
    2626
    2727        // char does not have multiplication.
     
    3030        } // ?*?
    3131        char c = 9;
    32         sout | "char\t\t\t" | square( c ) | endl;
     32        sout | "char\t\t\t" | square( c );
    3333
    34         sout | square( s ) | endl;
     34        sout | square( s );
    3535#endif
    3636        short s = 9;
     
    3838#if 0
    3939        signed int i = 9;
    40         sout | "signed int\t\t" | square( i ) | endl;
     40        sout | "signed int\t\t" | square( i );
    4141
    4242        unsigned int ui = 9;
    43         sout | "unsigned int\t\t" | square( ui ) | endl;
     43        sout | "unsigned int\t\t" | square( ui );
    4444
    4545        long int li = 9;
    46         sout | "signed long int\t\t" | square( li ) | endl;
     46        sout | "signed long int\t\t" | square( li );
    4747
    4848        unsigned long int uli = 9;
    49         sout | "unsigned long int\t" | square( uli ) | endl;
     49        sout | "unsigned long int\t" | square( uli );
    5050
    5151        signed long long int lli = 9;
    52         sout | "signed long long int\t" | square( lli ) | endl;
     52        sout | "signed long long int\t" | square( lli );
    5353
    5454        unsigned long long int ulli = 9;
    55         sout | "unsigned long long int\t" | square( ulli ) | endl;
     55        sout | "unsigned long long int\t" | square( ulli );
    5656
    5757        float f = 9.0;
    58         sout | "float\t\t\t" | square( f ) | endl;
     58        sout | "float\t\t\t" | square( f );
    5959
    6060        double d = 9.0;
    61         sout | "double\t\t\t" | square( d ) | endl;
     61        sout | "double\t\t\t" | square( d );
    6262
    6363        long double ld = 9.0;
    64         sout | "long double\t\t" | square( ld ) | endl;
     64        sout | "long double\t\t" | square( ld );
    6565#endif
    6666} // main
  • examples/twice.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct 19 21:52:57 2017
    13 // Update Count     : 46
     12// Last Modified On : Tue Dec 11 23:28:08 2018
     13// Update Count     : 47
    1414//
    1515
     
    2828
    2929int main( void ) {
    30         sout | twice( ' ' ) | ' ' | twice( (signed char)0 ) | twice( (int)1 ) | twice( 3.2 ) | endl;
     30        sout | twice( ' ' ) | ' ' | twice( (signed char)0 ) | twice( (int)1 ) | twice( 3.2 );
    3131}
    3232
  • examples/wrapper/src/main.c

    r29207bf r5ebb1368  
    11#include "pointer.h"
    22
    3 wrapper_t make_copy(wrapper_t copy)
    4 {
     3wrapper_t make_copy(wrapper_t copy) {
    54        return copy;
    65}
    76
    8 int main(int argc, char const *argv[])
    9 {
     7int main(int argc, char const *argv[]) {
    108        wrapper_t p = wrap(6);
    11 
    12         sout | endl | "test started" | endl;
    13 
     9        sout | nl | "test started";
    1410        wrapper_t p2 = p;
    15 
    1611        clear(&p);
    17 
    1812        p = p2;
    19 
    2013        wrapper_t p3 = make_copy(p2);
    21 
    22         sout | endl | "test ended" | endl;
    23 
     14        sout | nl | "test ended";
    2415        return 0;
    2516}
  • examples/wrapper/src/pointer.h

    r29207bf r5ebb1368  
    3434void ?{}(content_t* this)
    3535{
    36         sout | "Constructing content" | endl;
     36        sout | "Constructing content";
    3737        this->count = 0;
    3838}
     
    4040void ^?{}(content_t* this)
    4141{
    42         sout | "Destroying content" | endl;
     42        sout | "Destroying content";
    4343}
    4444
     
    5353void ?{}(wrapper_t* this)
    5454{
    55         sout | "Constructing empty ref pointer" | endl | endl;
     55        sout | "Constructing empty ref pointer" | nl;
    5656        this->ptr = NULL;
    5757}
     
    5959void ?{}(wrapper_t* this, wrapper_t rhs)
    6060{
    61         sout | "Constructing ref pointer from copy" | endl;
     61        sout | "Constructing ref pointer from copy";
    6262        this->ptr = rhs.ptr;
    6363        this->ptr->count++;
    64         sout | "Reference is " | this->ptr->count | endl | endl;
     64        sout | "Reference is " | this->ptr->count | nl;
    6565}
    6666
     
    6969        if(this->ptr)
    7070        {
    71                 sout | "Destroying ref pointer" | endl;
     71                sout | "Destroying ref pointer";
    7272                this->ptr->count--;
    73                 sout | "Reference is " | this->ptr->count | endl | endl;
     73                sout | "Reference is " | this->ptr->count | nl;
    7474                if(!this->ptr->count) delete(this->ptr);
    7575        }
    7676        else
    7777        {
    78                 sout | "Destroying empty ref pointer" | endl | endl;
     78                sout | "Destroying empty ref pointer" | nl;
    7979        }
    8080}
     
    8282wrapper_t ?=?(wrapper_t* this, wrapper_t rhs)
    8383{
    84         sout | "Setting ref pointer" | endl;
     84        sout | "Setting ref pointer";
    8585        if(this->ptr)
    8686        {
    8787                this->ptr->count--;
    88                 sout | "Reference is " | this->ptr->count | endl | endl;
     88                sout | "Reference is " | this->ptr->count | nl;
    8989                if(!this->ptr->count) delete(this->ptr);
    9090        }
    9191        this->ptr = rhs.ptr;
    9292        this->ptr->count++;
    93         sout | "Reference is " | this->ptr->count | endl | endl;
     93        sout | "Reference is " | this->ptr->count | nl;
    9494}
    9595
     
    9898        this->ptr = c;
    9999        this->ptr->count++;
    100         sout | "Setting ref pointer" | endl;
    101         sout | "Reference is " | this->ptr->count | endl | endl;
     100        sout | "Setting ref pointer";
     101        sout | "Reference is " | this->ptr->count | nl;
    102102}
    103103
    104104void clear(wrapper_t* this)
    105105{
    106         sout | "Clearing ref pointer" | endl;
     106        sout | "Clearing ref pointer";
    107107        this->ptr->count--;
    108         sout | "Reference is " | this->ptr->count | endl | endl;
     108        sout | "Reference is " | this->ptr->count | nl;
    109109        if(!this->ptr->count) delete(this->ptr);
    110110        this->ptr = NULL;
  • examples/zero_one.c

    r29207bf r5ebb1368  
    33void foo(zero_t o)
    44{
    5         sout | "It's a Zero!" | endl;
     5        sout | "It's a Zero!";
    66}
    77
    88void foo(one_t o)
    99{
    10         sout | "It's a One!" | endl;
     10        sout | "It's a One!";
    1111}
    1212
    1313void foo(int o)
    1414{
    15         sout | "It's a Number!" | endl;
     15        sout | "It's a Number!";
    1616}
    1717
  • libcfa/src/fstream.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 10 18:19:40 2018
    13 // Update Count     : 284
     12// Last Modified On : Wed Dec 12 08:34:28 2018
     13// Update Count     : 298
    1414//
    1515
     
    2020#include <stdarg.h>                                                                             // varargs
    2121#include <string.h>                                                                             // strlen
    22 #include <stdbool.h>                                                                    // true/false
    2322#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    2423#include <complex.h>                                                                    // creal, cimag
     
    2726#define IO_MSG "I/O error: "
    2827
    29 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, const char * separator, const char * tupleSeparator ) {
     28void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool nonlManip, const char * separator, const char * tupleSeparator ) {
    3029        os.file = file;
    3130        os.sepDefault = sepDefault;
    3231        os.sepOnOff = sepOnOff;
     32        os.nlOnOff = nlOnOff;
     33        os.nonlManip = nonlManip;
    3334        sepSet( os, separator );
    3435        sepSetCur( os, sepGet( os ) );
     
    4445bool getNL( ofstream & os ) { return os.sawNL; }
    4546void setNL( ofstream & os, bool state ) { os.sawNL = state; }
     47bool getANL( ofstream & os ) { return os.nlOnOff; }
     48bool getNonl( ofstream & os ) { return os.nonlManip; }
     49void setNonl( ofstream & os, bool state ) { os.nonlManip = state; }
    4650
    4751// public
     
    7276} // sepEnable
    7377
     78void nlOn( ofstream & os ) { os.nlOnOff = true; }
     79void nlOff( ofstream & os ) { os.nlOnOff = false; }
     80
    7481const char * sepGet( ofstream & os ) { return os.separator; }
    7582void sepSet( ofstream & os, const char * s ) {
     
    103110        } // if
    104111        #endif // __CFA_DEBUG__
    105         (os){ file, true, false, " ", ", " };
     112        (os){ file, true, false, true, false, " ", ", " };
    106113} // open
    107114
     
    147154} // fmt
    148155
    149 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };
     156static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, true, false, " ", ", " };
    150157ofstream & sout = soutFile;
    151 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };
     158static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, true, false, " ", ", " };
    152159ofstream & serr = serrFile;
    153160
  • libcfa/src/fstream.hfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 13:54:27 2018
    13 // Update Count     : 132
     12// Last Modified On : Wed Dec 12 07:52:41 2018
     13// Update Count     : 143
    1414//
    1515
     
    2323        bool sepDefault;
    2424        bool sepOnOff;
     25        bool nlOnOff;
     26        bool nonlManip;
    2527        bool sawNL;
    2628        const char * sepCur;
     
    3739bool getNL( ofstream & );
    3840void setNL( ofstream &, bool );
     41bool getANL( ofstream & );
     42bool getNonl( ofstream & );
     43void setNonl( ofstream &, bool );
    3944
    4045// public
     
    4348bool sepDisable( ofstream & );
    4449bool sepEnable( ofstream & );
     50void nlOn( ofstream & );
     51void nlOff( ofstream & );
    4552
    4653const char * sepGet( ofstream & );
  • libcfa/src/gmp.hfa

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

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov  2 07:17:05 2018
    13 // Update Count     : 474
     12// Last Modified On : Tue Dec 11 22:02:03 2018
     13// Update Count     : 546
    1414//
    1515
     
    1919#include <stdio.h>
    2020#include <stdbool.h>                                                                    // true/false
    21 //#include <string.h>                                                                           // strlen, strcmp
     21//#include <string.h>                                                                   // strlen, strcmp
    2222extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
    2323extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
     
    3232                return os;
    3333        } // ?|?
    34 
    35         ostype & ?|?( ostype & os, char ch ) {
    36                 fmt( os, "%c", ch );
    37                 if ( ch == '\n' ) setNL( os, true );
    38                 sepOff( os );
    39                 return os;
    40         } // ?|?
    41 
    42         ostype & ?|?( ostype & os, signed char c ) {
    43                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    44                 fmt( os, "%hhd", c );
    45                 return os;
    46         } // ?|?
    47 
    48         ostype & ?|?( ostype & os, unsigned char c ) {
    49                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    50                 fmt( os, "%hhu", c );
    51                 return os;
     34        void ?|?( ostype & os, bool b ) {
     35                (ostype)(os | b); if ( getANL( os ) ) nl( os );
     36        } // ?|?
     37
     38        ostype & ?|?( ostype & os, char c ) {
     39                fmt( os, "%c", c );
     40                if ( c == '\n' ) setNL( os, true );
     41                return sepOff( os );
     42        } // ?|?
     43        void ?|?( ostype & os, char c ) {
     44                (ostype)(os | c); if ( getANL( os ) ) nl( os );
     45        } // ?|?
     46
     47        ostype & ?|?( ostype & os, signed char sc ) {
     48                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     49                fmt( os, "%hhd", sc );
     50                return os;
     51        } // ?|?
     52        void ?|?( ostype & os, signed char sc ) {
     53                (ostype)(os | sc); if ( getANL( os ) ) nl( os );
     54        } // ?|?
     55
     56        ostype & ?|?( ostype & os, unsigned char usc ) {
     57                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     58                fmt( os, "%hhu", usc );
     59                return os;
     60        } // ?|?
     61        void ?|?( ostype & os, unsigned char usc ) {
     62                (ostype)(os | usc); if ( getANL( os ) ) nl( os );
    5263        } // ?|?
    5364
     
    5768                return os;
    5869        } // ?|?
     70        void & ?|?( ostype & os, short int si ) {
     71                (ostype)(os | si); if ( getANL( os ) ) nl( os );
     72        } // ?|?
    5973
    6074        ostype & ?|?( ostype & os, unsigned short int usi ) {
     
    6377                return os;
    6478        } // ?|?
     79        void & ?|?( ostype & os, unsigned short int usi ) {
     80                (ostype)(os | usi); if ( getANL( os ) ) nl( os );
     81        } // ?|?
    6582
    6683        ostype & ?|?( ostype & os, int i ) {
     
    6986                return os;
    7087        } // ?|?
     88        void & ?|?( ostype & os, int i ) {
     89                (ostype)(os | i); if ( getANL( os ) ) nl( os );
     90        } // ?|?
    7191
    7292        ostype & ?|?( ostype & os, unsigned int ui ) {
     
    7595                return os;
    7696        } // ?|?
     97        void & ?|?( ostype & os, unsigned int ui ) {
     98                (ostype)(os | ui); if ( getANL( os ) ) nl( os );
     99        } // ?|?
    77100
    78101        ostype & ?|?( ostype & os, long int li ) {
     
    81104                return os;
    82105        } // ?|?
     106        void & ?|?( ostype & os, long int li ) {
     107                (ostype)(os | li); if ( getANL( os ) ) nl( os );
     108        } // ?|?
    83109
    84110        ostype & ?|?( ostype & os, unsigned long int uli ) {
     
    87113                return os;
    88114        } // ?|?
     115        void & ?|?( ostype & os, unsigned long int uli ) {
     116                (ostype)(os | uli); if ( getANL( os ) ) nl( os );
     117        } // ?|?
    89118
    90119        ostype & ?|?( ostype & os, long long int lli ) {
     
    93122                return os;
    94123        } // ?|?
     124        void & ?|?( ostype & os, long long int lli ) {
     125                (ostype)(os | lli); if ( getANL( os ) ) nl( os );
     126        } // ?|?
    95127
    96128        ostype & ?|?( ostype & os, unsigned long long int ulli ) {
     
    99131                return os;
    100132        } // ?|?
     133        void & ?|?( ostype & os, unsigned long long int ulli ) {
     134                (ostype)(os | ulli); if ( getANL( os ) ) nl( os );
     135        } // ?|?
    101136
    102137        ostype & ?|?( ostype & os, float f ) {
     
    105140                return os;
    106141        } // ?|?
     142        void & ?|?( ostype & os, float f ) {
     143                (ostype)(os | f); if ( getANL( os ) ) nl( os );
     144        } // ?|?
    107145
    108146        ostype & ?|?( ostype & os, double d ) {
     
    111149                return os;
    112150        } // ?|?
     151        void & ?|?( ostype & os, double d ) {
     152                (ostype)(os | d); if ( getANL( os ) ) nl( os );
     153        } // ?|?
    113154
    114155        ostype & ?|?( ostype & os, long double ld ) {
     
    117158                return os;
    118159        } // ?|?
     160        void & ?|?( ostype & os, long double ld ) {
     161                (ostype)(os | ld); if ( getANL( os ) ) nl( os );
     162        } // ?|?
    119163
    120164        ostype & ?|?( ostype & os, float _Complex fc ) {
     
    123167                return os;
    124168        } // ?|?
     169        void & ?|?( ostype & os, float _Complex fc ) {
     170                (ostype)(os | fc); if ( getANL( os ) ) nl( os );
     171        } // ?|?
    125172
    126173        ostype & ?|?( ostype & os, double _Complex dc ) {
     
    129176                return os;
    130177        } // ?|?
     178        void & ?|?( ostype & os, double _Complex dc ) {
     179                (ostype)(os | dc); if ( getANL( os ) ) nl( os );
     180        } // ?|?
    131181
    132182        ostype & ?|?( ostype & os, long double _Complex ldc ) {
     
    134184                fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
    135185                return os;
     186        } // ?|?
     187        void & ?|?( ostype & os, long double _Complex ldc ) {
     188                (ostype)(os | ldc); if ( getANL( os ) ) nl( os );
    136189        } // ?|?
    137190
     
    174227                return write( os, str, len );
    175228        } // ?|?
     229        void ?|?( ostype & os, const char * str ) {
     230                (ostype)(os | str); if ( getANL( os ) ) nl( os );
     231        } // ?|?
    176232
    177233//      ostype & ?|?( ostype & os, const char16_t * str ) {
     
    200256                return os;
    201257        } // ?|?
    202 
     258        void ?|?( ostype & os, const void * p ) {
     259                (ostype)(os | p); if ( getANL( os ) ) nl( os );
     260        } // ?|?
    203261
    204262        // manipulators
    205263        ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    206                 return manip( os );
     264                (ostype)(manip( os ));
     265                setNonl( os, false );                                                   // ignore nonl in middle
     266                return os;
     267        } // ?|?
     268        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
     269                (ostype)(manip( os ));
     270                if ( getANL( os ) && ! getNonl( os ) ) nl( os ); // ignore nl if nonl at end
     271                setNonl( os, false );
    207272        } // ?|?
    208273
    209274        ostype & sep( ostype & os ) {
    210                 os | sepGet( os );
    211                 return os;
     275                return (ostype)(os | sepGet( os ));
    212276        } // sep
    213277
    214278        ostype & sepTuple( ostype & os ) {
    215                 os | sepGetTuple( os );
    216                 return os;
     279                return os | sepGetTuple( os );
    217280        } // sepTuple
    218281
    219         ostype & endl( ostype & os ) {
    220                 os | '\n';
     282        ostype & nl( ostype & os ) {
     283                (ostype)(os | '\n');
    221284                setNL( os, true );
    222285                flush( os );
    223                 sepOff( os );                                                                   // prepare for next line
    224                 return os;
    225         } // endl
     286                return sepOff( os );                                                    // prepare for next line
     287        } // nl
     288
     289        ostype & nonl( ostype & os ) {
     290                setNonl( os, true );                                                    // indicate nonl manipulator
     291                return os;
     292        } // nonl
    226293
    227294        ostype & sepOn( ostype & os ) {
    228                 sepOn( os );
     295                sepOn( os );                                                                    // call void returning
    229296                return os;
    230297        } // sepOn
    231298
    232299        ostype & sepOff( ostype & os ) {
    233                 sepOff( os );
     300                sepOff( os );                                                                   // call void returning
    234301                return os;
    235302        } // sepOff
    236303
    237304        ostype & sepEnable( ostype & os ) {
    238                 sepEnable( os );
     305                sepEnable( os );                                                                // call void returning
    239306                return os;
    240307        } // sepEnable
    241308
    242309        ostype & sepDisable( ostype & os ) {
    243                 sepDisable( os );
     310                sepDisable( os );                                                               // call void returning
    244311                return os;
    245312        } // sepDisable
     313
     314        ostype & nlOn( ostype & os ) {
     315                nlOn( os );                                                                             // call void returning
     316                return os;
     317        } // nlOn
     318
     319        ostype & nlOff( ostype & os ) {
     320                nlOff( os );                                                                    // call void returning
     321                return os;
     322        } // nlOff
    246323} // distribution
    247324
    248 
    249325// tuples
    250 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } )
    251 ostype & ?|?( ostype & os, T arg, Params rest ) {
    252         os | arg;                                                                                       // print first argument
    253         sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    254         os | rest;                                                                                      // print remaining arguments
    255         sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
    256         return os;
    257 } // ?|?
     326forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     327        ostype & ?|?( ostype & os, T arg, Params rest ) {
     328                (ostype)(os | arg);                                                             // print first argument
     329                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     330                (ostype)(os | rest);                                                    // print remaining arguments
     331                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     332                return os;
     333        } // ?|?
     334        void ?|?( ostype & os, T arg, Params rest ) {
     335//              (ostype)(?|?( os, arg, rest )); if ( getANL( os ) ) nl( os );
     336                (ostype)(os | arg);                                                             // print first argument
     337                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     338                (ostype)(os | rest);                                                    // print remaining arguments
     339                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     340                if ( getANL( os ) ) nl( os );
     341        } // ?|?
     342} // distribution
    258343
    259344//---------------------------------------
    260345
    261346// writes the range [begin, end) to the given stream
    262 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    263 void write( iterator_type begin, iterator_type end, ostype & os ) {
    264         void print( elt_type i ) { os | i; }
    265         for_each( begin, end, print );
    266 } // ?|?
    267 
    268 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    269 void write_reverse( iterator_type begin, iterator_type end, ostype & os ) {
    270         void print( elt_type i ) { os | i; }
    271         for_each_reverse( begin, end, print );
    272 } // ?|?
     347forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     348        void write( iterator_type begin, iterator_type end, ostype & os ) {
     349                void print( elt_type i ) { os | i; }
     350                for_each( begin, end, print );
     351        } // ?|?
     352
     353        void write_reverse( iterator_type begin, iterator_type end, ostype & os ) {
     354                void print( elt_type i ) { os | i; }
     355                for_each_reverse( begin, end, print );
     356        } // ?|?
     357} // distribution
    273358
    274359//---------------------------------------
     
    386471        } // ?|?
    387472
    388         istype & endl( istype & is ) {
     473        istype & nl( istype & is ) {
    389474                fmt( is, "%*[ \t\f\n\r\v]" );                                   // ignore whitespace
    390475                return is;
    391         } // endl
     476        } // nl
    392477} // distribution
    393478
  • libcfa/src/iostream.hfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 08:22:49 2018
    13 // Update Count     : 156
     12// Last Modified On : Tue Dec 11 22:01:31 2018
     13// Update Count     : 213
    1414//
    1515
     
    2525        const char * sepGetCur( ostype & );                                     // get current separator string
    2626        void sepSetCur( ostype &, const char * );                       // set current separator string
    27         bool getNL( ostype & );                                                 // check newline
     27        bool getNL( ostype & );                                                         // check newline
    2828        void setNL( ostype &, bool );                                           // saw newline
     29        bool getANL( ostype & );                                                        // check auto newline
     30        bool getNonl( ostype & );                                                       // check nonnl manipulator
     31        void setNonl( ostype &, bool );                                         // set nonnl manipulator
    2932        // public
    3033        void sepOn( ostype & );                                                         // turn separator state on
    3134        void sepOff( ostype & );                                                        // turn separator state off
    3235        bool sepDisable( ostype & );                                            // set default state to off, and return previous state
    33         bool sepEnable( ostype & );                                             // set default state to on, and return previous state
     36        bool sepEnable( ostype & );                                                     // set default state to on, and return previous state
     37        void nlOn( ostype & );                                                          // turn auto-newline state on
     38        void nlOff( ostype & );                                                         // turn auto-newline state off
    3439
    3540        const char * sepGet( ostype & );                                        // get separator string
     
    5863forall( dtype ostype | ostream( ostype ) ) {
    5964        ostype & ?|?( ostype &, bool );
     65        void & ?|?( ostype &, bool );
    6066
    6167        ostype & ?|?( ostype &, char );
     68        void & ?|?( ostype &, char );
    6269        ostype & ?|?( ostype &, signed char );
     70        void & ?|?( ostype &, signed char );
    6371        ostype & ?|?( ostype &, unsigned char );
     72        void & ?|?( ostype &, unsigned char );
    6473
    6574        ostype & ?|?( ostype &, short int );
     75        void & ?|?( ostype &, short int );
    6676        ostype & ?|?( ostype &, unsigned short int );
     77        void & ?|?( ostype &, unsigned short int );
    6778        ostype & ?|?( ostype &, int );
     79        void & ?|?( ostype &, int );
    6880        ostype & ?|?( ostype &, unsigned int );
     81        void & ?|?( ostype &, unsigned int );
    6982        ostype & ?|?( ostype &, long int );
     83        void & ?|?( ostype &, long int );
    7084        ostype & ?|?( ostype &, long long int );
     85        void & ?|?( ostype &, long long int );
    7186        ostype & ?|?( ostype &, unsigned long int );
     87        void & ?|?( ostype &, unsigned long int );
    7288        ostype & ?|?( ostype &, unsigned long long int );
     89        void & ?|?( ostype &, unsigned long long int );
    7390
    7491        ostype & ?|?( ostype &, float ); // FIX ME: should not be required
     92        void & ?|?( ostype &, float ); // FIX ME: should not be required
    7593        ostype & ?|?( ostype &, double );
     94        void & ?|?( ostype &, double );
    7695        ostype & ?|?( ostype &, long double );
     96        void & ?|?( ostype &, long double );
    7797
    7898        ostype & ?|?( ostype &, float _Complex );
     99        void & ?|?( ostype &, float _Complex );
    79100        ostype & ?|?( ostype &, double _Complex );
     101        void & ?|?( ostype &, double _Complex );
    80102        ostype & ?|?( ostype &, long double _Complex );
     103        void & ?|?( ostype &, long double _Complex );
    81104
    82105        ostype & ?|?( ostype &, const char * );
     106        void & ?|?( ostype &, const char * );
    83107        // ostype & ?|?( ostype &, const char16_t * );
    84108#if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
     
    87111        // ostype & ?|?( ostype &, const wchar_t * );
    88112        ostype & ?|?( ostype &, const void * );
     113        void & ?|?( ostype &, const void * );
    89114
    90115        // manipulators
    91116        ostype & ?|?( ostype &, ostype & (*)( ostype & ) );
    92         ostype & endl( ostype & );
     117        void ?|?( ostype &, ostype & (*)( ostype & ) );
     118        ostype & nl( ostype & );
     119        ostype & nonl( ostype & );
    93120        ostype & sep( ostype & );
    94121        ostype & sepTuple( ostype & );
     
    97124        ostype & sepDisable( ostype & );
    98125        ostype & sepEnable( ostype & );
     126        ostype & nlOn( ostype & );
     127        ostype & nlOff( ostype & );
    99128} // distribution
    100129
    101130// tuples
    102 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } )
    103 ostype & ?|?( ostype & os, T arg, Params rest );
     131forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     132        ostype & ?|?( ostype & os, T arg, Params rest );
     133        void ?|?( ostype & os, T arg, Params rest );
     134} // distribution
    104135
    105136// writes the range [begin, end) to the given stream
    106 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    107 void write( iterator_type begin, iterator_type end, ostype & os );
    108 
    109 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    110 void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     137forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     138        void write( iterator_type begin, iterator_type end, ostype & os );
     139        void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     140} // distribution
    111141
    112142//---------------------------------------
     
    152182        // manipulators
    153183        istype & ?|?( istype &, istype & (*)( istype & ) );
    154         istype & endl( istype & is );
     184        istype & nl( istype & is );
    155185} // distribution
    156186
     
    164194
    165195
    166 #include <time_t.hfa>                                                                           // Duration (constructors) / Time (constructors)
    167 
    168 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Duration dur );
    169 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Time time );
    170 
     196#include <time_t.hfa>                                                                   // Duration (constructors) / Time (constructors)
     197
     198forall( dtype ostype | ostream( ostype ) ) {
     199        ostype & ?|?( ostype & os, Duration dur );
     200        void ?|?( ostype & os, Duration dur );
     201        ostype & ?|?( ostype & os, Time time );
     202        void ?|?( ostype & os, Time time );
     203} // distribution
    171204
    172205// Local Variables: //
  • libcfa/src/rational.cfa

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

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

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

    r29207bf r5ebb1368  
    1010// Created On       : Thu Jan 28 18:26:16 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:50:44 2018
    13 // Update Count     : 54
     12// Last Modified On : Tue Dec  4 21:33:15 2018
     13// Update Count     : 55
    1414//
    1515
     
    1919int main( void ) {
    2020        signed char ch = -65;
    21         sout | "char\t\t\t"                                     | ch     | "\tabs " | abs( ch ) | endl;
    22         sout | "signed int\t\t"                         | -65    | "\tabs" | abs( -65 ) | endl;
    23         sout | "signed long int\t\t"            | -65l   | "\tabs" | abs( -65l ) | endl;
    24         sout | "signed long long int\t"         | -65ll  | "\tabs" | abs( -65ll ) | endl;
    25         sout | "float\t\t\t"                            | -65.0f | "\tabs" | abs( -65.0f ) | endl;
    26         sout | "double\t\t\t"                           | -65.0  | "\tabs" | abs( -65.0 ) | endl;
    27         sout | "long double\t\t"                        | -65.0l | "\tabs" | abs( -65.0l ) | endl;
    28         sout | "float _Complex\t\t"                     | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF ) | endl;
    29         sout | "double _Complex\t\t"            | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD ) | endl;
    30         sout | "long double _Complex\t"         | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL ) | endl;
     21        sout | "char\t\t\t"                                     | ch     | "\tabs " | abs( ch );
     22        sout | "signed int\t\t"                         | -65    | "\tabs" | abs( -65 );
     23        sout | "signed long int\t\t"            | -65l   | "\tabs" | abs( -65l );
     24        sout | "signed long long int\t"         | -65ll  | "\tabs" | abs( -65ll );
     25        sout | "float\t\t\t"                            | -65.0f | "\tabs" | abs( -65.0f );
     26        sout | "double\t\t\t"                           | -65.0  | "\tabs" | abs( -65.0 );
     27        sout | "long double\t\t"                        | -65.0l | "\tabs" | abs( -65.0l );
     28        sout | "float _Complex\t\t"                     | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF );
     29        sout | "double _Complex\t\t"            | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD );
     30        sout | "long double _Complex\t"         | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL );
    3131} // main
    3232
  • tests/ato.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Thu Feb  4 08:10:57 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:51:03 2018
    13 // Update Count     : 91
     12// Last Modified On : Tue Dec  4 21:33:53 2018
     13// Update Count     : 92
    1414//
    1515
     
    2020        const char * sptr = "-123";
    2121        int i = ato( sptr );
    22         sout | i | sptr | endl;
     22        sout | i | sptr;
    2323        sptr = "123";
    2424        unsigned int ui = ato( sptr );
    25         sout | ui | sptr | endl;
     25        sout | ui | sptr;
    2626
    2727        sptr = "-123";
    2828        long int li = ato( sptr );
    29         sout | li | sptr | endl;
     29        sout | li | sptr;
    3030        sptr = "123";
    3131        unsigned long int uli = ato( sptr );
    32         sout | uli | sptr | endl;
     32        sout | uli | sptr;
    3333
    3434        sptr = "-123";
    3535        long long int lli = ato( sptr );
    36         sout | lli | sptr | endl;
     36        sout | lli | sptr;
    3737        sptr = "123";
    3838        unsigned long long int ulli = ato( sptr );
    39         sout | ulli | sptr | endl;
     39        sout | ulli | sptr;
    4040
    4141        sptr = "-123.456";
    4242        float f = ato( sptr );
    43         sout | f | sptr | endl;
     43        sout | f | sptr;
    4444        sptr = "-123.4567890123456";
    4545        double d = ato( sptr );
    46         sout | d | sptr | endl;
     46        sout | d | sptr;
    4747        sptr = "-123.45678901234567890123456789";
    4848        long double ld = ato( sptr );
    49         sout | ld | sptr | endl;
     49        sout | ld | sptr;
    5050
    5151        sptr = "-123.456-123.456i";
    5252        float _Complex fc = ato( sptr );
    53         sout | fc | sptr | endl;
     53        sout | fc | sptr;
    5454        sptr = "-123.4567890123456+123.4567890123456i";
    5555        double _Complex dc = ato( sptr );
    56         sout | dc | sptr | endl;
     56        sout | dc | sptr;
    5757        sptr = "123.45678901234567890123456789-123.45678901234567890123456789i";
    5858        long double _Complex ldc = ato( sptr );
    59         sout | ldc | sptr | endl;
     59        sout | ldc | sptr;
    6060        sptr = "123.45678901234-123.4567890i";
    6161        long double _Complex ldc2 = ato( sptr );
    62         sout | ldc2 | sptr | endl;
     62        sout | ldc2 | sptr;
    6363
    6464
    6565        sptr = "-123";
    6666        i = strto( sptr, 0, 10 );
    67         sout | i | sptr | endl;
     67        sout | i | sptr;
    6868        sptr = "123";
    6969        ui = strto( sptr, 0, 10 );
    70         sout | ui | sptr | endl;
     70        sout | ui | sptr;
    7171
    7272        sptr = "-123";
    7373        li = strto( sptr, 0, 10 );
    74         sout | li | sptr | endl;
     74        sout | li | sptr;
    7575        sptr = "123";
    7676        uli = strto( sptr, 0, 10 );
    77         sout | uli | sptr | endl;
     77        sout | uli | sptr;
    7878
    7979        sptr = "-123";
    8080        lli = strto( sptr, 0, 10 );
    81         sout | lli | sptr | endl;
     81        sout | lli | sptr;
    8282        sptr = "123";
    8383        ulli = strto( sptr, 0, 10 );
    84         sout | ulli | sptr | endl;
     84        sout | ulli | sptr;
    8585
    8686        sptr = "-123.456";
    8787        f = strto( sptr, 0 );
    88         sout | f | sptr | endl;
     88        sout | f | sptr;
    8989        sptr = "-123.4567890123456";
    9090        d = strto( sptr, 0 );
    91         sout | d | sptr | endl;
     91        sout | d | sptr;
    9292        sptr = "-123.45678901234567890123456789";
    9393        ld = strto( sptr, 0 );
    94         sout | ld | sptr | endl;
     94        sout | ld | sptr;
    9595
    9696        sptr = "-123.456-123.456i";
    9797        fc = strto( sptr, 0 );
    98         sout | fc | sptr | endl;
     98        sout | fc | sptr;
    9999
    100100        char * eptr = 0;
    101101        // sptr = "2fred";
    102102        // fc = strto( sptr, &eptr );
    103         // sout | fc | sptr | eptr | endl;
     103        // sout | fc | sptr | eptr;
    104104
    105105        sptr = "2  3";
    106106        fc = strto( sptr, &eptr );
    107         sout | fc | sptr | eptr | endl;
     107        sout | fc | sptr | eptr;
    108108
    109109        sptr = "-123.4567890123456+123.4567890123456i";
    110110        dc = strto( sptr, 0 );
    111         sout | dc | sptr | endl;
     111        sout | dc | sptr;
    112112        sptr = "123.45678901234567890123456789-123.45678901234567890123456789i";
    113113        ldc = strto( sptr, 0 );
    114         sout | ldc | sptr | endl;
     114        sout | ldc | sptr;
    115115        sptr = "123.45678901234-123.4567890i";
    116116        ldc2 = strto( sptr, 0 );
    117         sout | ldc2 | sptr | endl;
     117        sout | ldc2 | sptr;
    118118} // main
    119119
  • tests/complex.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 24 22:07:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:51:22 2018
    13 // Update Count     : 3
     12// Last Modified On : Tue Dec  4 21:34:21 2018
     13// Update Count     : 4
    1414//
    1515
     
    2525    printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) );
    2626#ifdef __CFA__
    27     sout | "x:" | x | "y:" | y | "z:" | z | endl;
     27    sout | "x:" | x | "y:" | y | "z:" | z;
    2828#endif // __CFA
    2929    x = 2.1 + 1.3i;
     
    3232    printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) );
    3333#ifdef __CFA__
    34     sout | "x:" | x | "y:" | y | "z:" | z | endl;
     34    sout | "x:" | x | "y:" | y | "z:" | z;
    3535#endif // __CFA
    3636}
  • tests/concurrent/coroutineYield.c

    r29207bf r5ebb1368  
    2727        while(true) {
    2828                #if !defined(TEST_FOREVER)
    29                         sout | "Coroutine 1" | endl;
     29                        sout | "Coroutine 1";
    3030                #endif
    3131                yield();
    3232                #if !defined(TEST_FOREVER)
    33                         sout | "Coroutine 2" | endl;
     33                        sout | "Coroutine 2";
    3434                #endif
    3535                suspend();
     
    4242        for(int i = 0; TEST(i < N); i++) {
    4343                #if !defined(TEST_FOREVER)
    44                         sout | "Thread 1" | endl;
     44                        sout | "Thread 1";
    4545                #endif
    4646                resume(c);
    4747                #if !defined(TEST_FOREVER)
    48                         sout | "Thread 2" | endl;
     48                        sout | "Thread 2";
    4949                #endif
    5050                yield();
  • tests/concurrent/examples/boundedBufferEXT.c

    r29207bf r5ebb1368  
    88// Created On       : Wed Apr 18 22:52:12 2018
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Thu Aug 16 08:17:03 2018
    11 // Update Count     : 8
     10// Last Modified On : Tue Dec 11 21:55:02 2018
     11// Update Count     : 9
    1212//
    1313
     
    115115                sum += sums[i];
    116116        } // for
    117         sout | "total:" | sum | endl;
     117        sout | "total:" | sum;
    118118}
    119119
  • tests/concurrent/examples/boundedBufferINT.c

    r29207bf r5ebb1368  
    88// Created On       : Mon Oct 30 12:45:13 2017
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Thu Aug 16 08:17:58 2018
    11 // Update Count     : 83
     10// Last Modified On : Tue Dec 11 21:55:45 2018
     11// Update Count     : 84
    1212//
    1313
     
    116116                sum += sums[i];
    117117        } // for
    118         sout | "total:" | sum | endl;
     118        sout | "total:" | sum;
    119119}
    120120
  • tests/concurrent/examples/datingService.c

    r29207bf r5ebb1368  
    88// Created On       : Mon Oct 30 12:56:20 2017
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Sun May 27 09:05:18 2018
    11 // Update Count     : 26
     10// Last Modified On : Tue Dec 11 21:55:34 2018
     11// Update Count     : 28
    1212//
    1313
     
    5858        yield( random( 100 ) );                                                         // don't all start at the same time
    5959        unsigned int partner = girl( TheExchange, id, ccode );
    60         sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode | endl;
     60        sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode;
    6161        girlck[id] = partner;
    6262} // Girl main
     
    6969
    7070thread Boy {
    71         DatingService &TheExchange;
     71        DatingService & TheExchange;
    7272        unsigned int id, ccode;
    7373}; // Boy
     
    7676        yield( random( 100 ) );                                                         // don't all start at the same time
    7777        unsigned int partner = boy( TheExchange, id, ccode );
    78         sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode | endl;
     78        sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode;
    7979        boyck[id] = partner;
    8080} // Boy main
  • tests/concurrent/examples/matrixSum.c

    r29207bf r5ebb1368  
    1111// Created On       : Mon Oct  9 08:29:28 2017
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Nov  6 17:51:32 2018
    14 // Update Count     : 14
     13// Last Modified On : Tue Dec 11 21:54:55 2018
     14// Update Count     : 15
    1515//
    1616
     
    5454                total += subtotals[r];                                                  // total subtotals
    5555        } // for
    56         sout | total | endl;
     56        sout | total;
    5757}
    5858
  • tests/concurrent/examples/quickSort.c

    r29207bf r5ebb1368  
    99// Created On       : Wed Dec  6 12:15:52 2017
    1010// Last Modified By : Peter A. Buhr
    11 // Last Modified On : Thu Aug 16 08:17:41 2018
    12 // Update Count     : 163
     11// Last Modified On : Tue Dec  4 18:00:27 2018
     12// Update Count     : 167
    1313//
    1414
     
    8888
    8989void usage( char * argv[] ) {
    90         sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )" | endl;
     90        sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )";
    9191        exit( EXIT_FAILURE );                                                           // TERMINATE!
    9292} // usage
     
    114114                                &sortedfile = new( (const char *)argv[2] ); // open the output file
    115115                                if ( fail( sortedfile ) ) {
    116                                         serr | "Error! Could not open sorted output file \"" | argv[2] | "\"" | endl;
     116                                        serr | "Error! Could not open sorted output file \"" | argv[2] | "\"";
    117117                                        usage( argv );
    118118                                } // if
     
    121121                                &unsortedfile = new( (const char *)argv[1] ); // open the input file
    122122                                if ( fail( unsortedfile ) ) {
    123                                         serr | "Error! Could not open unsorted input file \"" | argv[1] | "\"" | endl;
     123                                        serr | "Error! Could not open unsorted input file \"" | argv[1] | "\"";
    124124                                        usage( argv );
    125125                                } // if
     
    127127                } // if
    128128        } // if
     129        sortedfile | nlOff;                                                                     // turn off auto newline
    129130
    130131        enum { ValuesPerLine = 22 };                                            // number of values printed per line
     
    137138                        for ( int counter = 0; counter < size; counter += 1 ) { // read unsorted numbers
    138139                                unsortedfile | values[counter];
    139                                 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | endl | "  ";
     140                                if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
    140141                                sortedfile | values[counter];
    141142                                if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
    142143                        } // for
    143                         sortedfile | endl;
     144                        sortedfile | nl;
    144145                        if ( size > 0 ) {                                                       // values to sort ?
    145146                                Quicksort QS = { values, size - 1, 0 }; // sort values
    146147                        } // wait until sort tasks terminate
    147148                        for ( int counter = 0; counter < size; counter += 1 ) { // print sorted list
    148                                 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | endl | "  ";
     149                                if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
    149150                                sortedfile | values[counter];
    150151                                if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
    151152                        } // for
    152                         sortedfile | endl | endl;
     153                        sortedfile | nl;
    153154
    154155                        delete( values );
  • tests/concurrent/monitor.c

    r29207bf r5ebb1368  
    4040                MyThread f[4];
    4141        }
    42         sout | global.value | endl;
     42        sout | global.value;
    4343}
  • tests/concurrent/multi-monitor.c

    r29207bf r5ebb1368  
    5252                }
    5353        }
    54         sout | global12 | global23 | global13 | endl;
     54        sout | global12 | global23 | global13;
    5555}
  • tests/concurrent/signal/block.c

    r29207bf r5ebb1368  
    5757
    5858        if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) {
    59                 sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread | endl;
     59                sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread;
    6060                abort();
    6161        }
     
    8585
    8686                if( ! signal_block( cond ) ) {
    87                         sout | "ERROR expected to be able to signal" | endl;
     87                        sout | "ERROR expected to be able to signal";
    8888                        abort();
    8989                }
     
    9292
    9393                if(a.last_thread != next || b.last_thread != next) {
    94                         sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread | endl;
     94                        sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread;
    9595                        abort();
    9696                }
     
    130130                Signaller s[4];
    131131                Barger b[13];
    132                 sout | "Starting waiters" | endl;
     132                sout | "Starting waiters";
    133133                {
    134134                        Waiter w[3];
    135135                }
    136                 sout | "Waiters done" | endl;
     136                sout | "Waiters done";
    137137                done = true;
    138138        }
  • tests/concurrent/signal/disjoint.c

    r29207bf r5ebb1368  
    6666        wait( cond );
    6767        if( d.state != SIGNAL ) {
    68                 sout | "ERROR barging!" | endl;
     68                sout | "ERROR barging!";
    6969        }
    7070
    7171        #if !defined(TEST_FOREVER)
    7272                d.counter++;
    73                 if( (d.counter % 1000) == 0 ) sout | d.counter | endl;
     73                if( (d.counter % 1000) == 0 ) sout | d.counter;
    7474        #endif
    7575
     
    9999        bool running = TEST(data.counter < N) && data.counter > 0;
    100100        if( data.state != SIGNAL && running ) {
    101                 sout | "ERROR Eager signal" | data.state | endl;
     101                sout | "ERROR Eager signal" | data.state;
    102102        }
    103103}
     
    124124                        Waiter w[4];
    125125                }
    126                 sout | "All waiter done" | endl;
     126                sout | "All waiter done";
    127127                all_done = true;
    128128        }
  • tests/concurrent/signal/wait.c

    r29207bf r5ebb1368  
    8383                                break;
    8484                        default:
    85                                 sout | "Something went wrong" | endl;
     85                                sout | "Something went wrong";
    8686                                abort();
    8787                }
     
    140140        waiter_left = 4;
    141141        processor p[2];
    142         sout | "Starting" | endl;
     142        sout | "Starting";
    143143        {
    144144                Signaler  e;
     
    150150                }
    151151        }
    152         sout | "Done" | endl;
     152        sout | "Done";
    153153}
  • tests/concurrent/thread.c

    r29207bf r5ebb1368  
    1212void main(First& this) {
    1313        for(int i = 0; i < 10; i++) {
    14                 sout | "First : Suspend No." | i + 1 | endl;
     14                sout | "First : Suspend No." | i + 1;
    1515                yield();
    1616        }
     
    2121        P(*this.lock);
    2222        for(int i = 0; i < 10; i++) {
    23                 sout | "Second : Suspend No." | i + 1 | endl;
     23                sout | "Second : Suspend No." | i + 1;
    2424                yield();
    2525        }
     
    2929int main(int argc, char* argv[]) {
    3030        semaphore lock = { 0 };
    31         sout | "User main begin" | endl;
     31        sout | "User main begin";
    3232        {
    3333                processor p;
     
    3737                }
    3838        }
    39         sout | "User main end" | endl;
     39        sout | "User main end";
    4040}
  • tests/concurrent/waitfor/barge.c

    r29207bf r5ebb1368  
    4848        yield(random( 10 ));
    4949        if( this.state != WAITFOR && !this.done && this.started ) {
    50                 serr | "Barging before caller detected" | endl;
     50                serr | "Barging before caller detected";
    5151        }
    5252
     
    6666                this.state = WAITFOR;
    6767                waitfor(do_call, this) {
    68                         sout | i | endl;
     68                        sout | i;
    6969                }
    7070
    7171                if( this.state != CALL ) {
    72                         serr | "Barging after caller detected" | endl;
     72                        serr | "Barging after caller detected";
    7373                }
    7474        }
     
    8383
    8484int main() {
    85         sout | "Starting" | endl;
     85        sout | "Starting";
    8686        {
    8787                barger_t bargers[17];
     
    8989                waiter_t waiters;
    9090        }
    91         sout | "Stopping" | endl;
     91        sout | "Stopping";
    9292}
  • tests/concurrent/waitfor/dtor.c

    r29207bf r5ebb1368  
    2929        switch(state) {
    3030                case CTOR  : break;
    31                 case MAIN  : if( this.state != CTOR  ) { serr | "ERROR Expected state to be CTOR"  | endl; abort(); } this.state = state; break;
    32                 case AFTER : if( this.state != MAIN  ) { serr | "ERROR Expected state to be MAIN"  | endl; abort(); } this.state = state; break;
    33                 case END   : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER" | endl; abort(); } this.state = state; break;
    34                 case DTOR  : if( this.state != END   ) { serr | "ERROR Expected state to be END"   | endl; abort(); } this.state = state; break;
     31                case MAIN  : if( this.state != CTOR  ) { serr | "ERROR Expected state to be CTOR" ; abort(); } this.state = state; break;
     32                case AFTER : if( this.state != MAIN  ) { serr | "ERROR Expected state to be MAIN" ; abort(); } this.state = state; break;
     33                case END   : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER"; abort(); } this.state = state; break;
     34                case DTOR  : if( this.state != END   ) { serr | "ERROR Expected state to be END"  ; abort(); } this.state = state; break;
    3535        }
    3636}
     
    5454
    5555int main() {
    56         sout | "Starting" | endl;
     56        sout | "Starting";
    5757        processor p;
    5858        for( int i = 0; i < N; i++ ){
     
    6060                yield( random( 100 ) );
    6161        }
    62         sout | "Stopping" | endl;
     62        sout | "Stopping";
    6363}
  • tests/concurrent/waitfor/else.c

    r29207bf r5ebb1368  
    1212void test( M & mutex m ) {
    1313        int i = 0;
    14         sout | "Starting" | endl;
     14        sout | "Starting";
    1515
    1616        when( false ) waitfor( notcalled, m );
    1717
    18         sout | "Step" | i++ | endl;
     18        sout | "Step" | i++;
    1919
    2020        waitfor( notcalled, m ); or else {
    21                 sout | "else called" | endl;
     21                sout | "else called";
    2222        }
    2323
    24         sout | "Step" | i++ | endl;
     24        sout | "Step" | i++;
    2525
    2626        when( true ) waitfor( notcalled, m ); or when( true ) else {
    27                 sout | "else called" | endl;
     27                sout | "else called";
    2828        }
    2929
    30         sout | "Step" | i++ | endl;
     30        sout | "Step" | i++;
    3131
    3232        when( false ) waitfor( notcalled, m ); or when( true ) else {
    33                 sout | "else called" | endl;
     33                sout | "else called";
    3434        }
    3535
    36         sout | "Step" | i++ | endl;
     36        sout | "Step" | i++;
    3737
    3838        when( false ) waitfor( notcalled, m ); or when( false ) else {
    39                 sout | "else called" | endl;
     39                sout | "else called";
    4040        }
    4141
    42         sout | "Done" | endl;
     42        sout | "Done";
    4343}
    4444
  • tests/concurrent/waitfor/recurse.c

    r29207bf r5ebb1368  
    9595        rand_yield();
    9696
    97         sout | "1st" | endl;
     97        sout | "1st" | nl;
    9898
    9999        return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
     
    123123                        case THIRD  : while( !global.ready ) { yield(); } this.state = call3( global, this.idx ); break;
    124124                        case LAST   : while( !global.ready ) { yield(); } this.state = call4( global, this.idx ); break;
    125                         case STOP   : serr | "This should not happen" | endl;
     125                        case STOP   : serr | "This should not happen" | nl;
    126126                }
    127127        }
     
    132132int main() {
    133133        srandom( time(NULL) );
    134         sout | "Starting" | endl;
     134        sout | nlOff;                                   // turn off auto newline
     135        sout | "Starting" | nl;
    135136        {
    136137                waiter_t waiters[4] = {
     
    142143                the_threads = waiters;
    143144        }
    144         sout | "Stopping" | endl;
     145        sout | "Stopping" | nl;
    145146}
  • tests/concurrent/waitfor/simple.c

    r29207bf r5ebb1368  
    3131
    3232void do_wait( global_t * mutex a ) {
    33         sout | "Waiting to accept" | endl;
     33        sout | "Waiting to accept";
    3434        yield( random( 10 ) );
    3535
    36         sout | "Accepting" | endl;
     36        sout | "Accepting";
    3737
    3838        __acceptable_t acceptable;
     
    4343        __waitfor_internal( 1, &acceptable );
    4444
    45         sout | "Accepted" | endl;
     45        sout | "Accepted";
    4646        yield( random( 10 ) );
    4747}
     
    5050        for( int i = 0; i < N; i++ ) {
    5151                do_wait( &globalA );
    52                 sout | i | endl;
     52                sout | i;
    5353        }
    5454
     
    7676        srandom( time( NULL ) );
    7777        printf("%p\n", &globalA);
    78         sout | "Starting" | endl;
     78        sout | "Starting";
    7979        {
    8080                Acceptor r;
     
    8282
    8383        }
    84         sout | "Done" | endl;
     84        sout | "Done";
    8585}
  • tests/concurrent/waitfor/statment.c

    r29207bf r5ebb1368  
    8484                case 7: return call7( m );
    8585                default :
    86                         serr | "Incorrect index" | index | endl;
     86                        serr | "Incorrect index" | index;
    8787                        abort();
    8888        }
     
    102102        while( !done ) {
    103103                   waitfor( get_index, this );
    104                 or waitfor( call1, this ) { sout | "Statement" | endl; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val | endl; } }
    105                 or waitfor( call2, this ) { sout | "Statement" | endl; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val | endl; } }
    106                 or waitfor( call3, this ) { sout | "Statement" | endl; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val | endl; } }
    107                 or waitfor( call4, this ) { sout | "Statement" | endl; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val | endl; } }
    108                 or waitfor( call5, this ) { sout | "Statement" | endl; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val | endl; } }
    109                 or waitfor( call6, this ) { sout | "Statement" | endl; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val | endl; } }
    110                 or waitfor( call7, this ) { sout | "Statement" | endl; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val | endl; } }
     104                or waitfor( call1, this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }
     105                or waitfor( call2, this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }
     106                or waitfor( call3, this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }
     107                or waitfor( call4, this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }
     108                or waitfor( call5, this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }
     109                or waitfor( call6, this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }
     110                or waitfor( call7, this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }
    111111
    112112                done = true;
     
    128128int main() {
    129129        processor p[2];
    130         sout | "Starting" | endl;
     130        sout | "Starting";
    131131        {
    132132                caller c[7];
    133133                waiter w;
    134134        }
    135         sout | "Stopping" | endl;
     135        sout | "Stopping";
    136136}
  • tests/concurrent/waitfor/when.c

    r29207bf r5ebb1368  
    5858void arbiter( global_t & mutex this ) {
    5959        for( int i = 0; i < N; i++ ) {
    60                    when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call | endl; } }
    61                 or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call | endl; } }
    62                 or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call | endl; } }
    63                 or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call | endl; } }
    64                 or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call | endl; } }
    65                 or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call | endl; } }
     60                   when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
     61                or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }
     62                or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }
     63                or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }
     64                or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }
     65                or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }
    6666
    67                 sout | this.last_call | endl;
     67                sout | this.last_call;
    6868        }
    6969
     
    7878int main() {
    7979        srandom( time(NULL) );
    80         sout | "Starting" | endl;
     80        sout | "Starting";
    8181        {
    8282                arbiter_t arbiter;
     
    8484
    8585        }
    86         sout | "Stopping" | endl;
     86        sout | "Stopping";
    8787}
  • tests/coroutine/.expect/fmtLines.txt

    r29207bf r5ebb1368  
    1616difi  ed B  y :   Pete  r A. 
    1717 Buh  r//   Last   Mod  ifie 
    18 d On   : M  on S  ep 1  8 11 
    19 :35:  57 2  017/  / Up  date 
    20  Cou  nt       :   31/  /#in 
     18d On   : T  ue D  ec 1  1 23 
     19:31:  12 2  018/  / Up  date 
     20 Cou  nt       :   32/  /#in 
    2121clud  e <f  stre  am.h  fa># 
    2222incl  ude   <cor  outi  ne.h 
     
    3434t )   {      if   ( fm  t.g   
    3535!= 0   ||   fmt.  b !=   0 ) 
    36  sou  t |   endl  ;}vo  id m 
    37 ain(   For  mat   & fm  t )   
    38 {       fo  r (   ;; )   {                                               
    39                                   // f  or a  s ma  ny c 
    40 hara  cter  s           f  or (   fmt 
    41 .g =   0;   fmt.  g <   5; f 
    42 mt.g   +=   1 )   {             /  / gr 
    43 oups   of   5 bl  ocks                          f 
    44 or (   fmt  .b =   0;   fmt. 
    45 b <   4; f  mt.b   +=   1 )   
    46 {       //   blo  cks   of 4   cha 
    47 ract  ers                               f  or (   ;;   
    48 ) {                                                     //   for   new 
    49 line   cha  ract  ers                                     
    50 susp  end(  );                                  i  f (   
    51 fmt.  ch !  = '\  n' )   bre 
    52 ak;             //   igno  re n  ewli 
    53 ne                              }   // f  or                            so 
    54 ut |   fmt  .ch;                                                        / 
    55 / pr  int   char  acte  r                         
    56 } //   for                      s  out   | "   
    57  ";                                                             /  / pr  int   
    58 bloc  k se  para  tor           } / 
    59 / fo  r         s  out   | en  dl;       
    60                                                                   // p  rint   gro 
    61 up s  epar  ator        } /  / fo 
    62 r} /  / ma  invo  id p  rt(   
    63 Form  at &   fmt  , ch  ar c 
    64 h )   {      fmt  .ch   = ch 
    65 ;      res  ume(   fmt   );} 
    66  //   prti  nt m  ain(  ) {       
    67 Form  at f  mt;   char   ch; 
    68         for   ( ;  ; )   {              s  in | 
    69  ch;                                                                            //   rea 
    70 d on  e ch  arac  ter       if 
    71  ( e  of(   sin   ) )   brea 
    72 k;                                                      //   eof   ?            p 
    73 rt(   fmt,   ch   );    }   //   
    74 for}   //   main  // L  ocal 
    75  Var  iabl  es:   ////   tab 
    76 -wid  th:   4 //  // c  ompi 
    77 le-c  omma  nd:   "cfa   fmt 
    78 Line  s.c"   ///  / En  d: / 
    79 /
     36 sou  t |   nl;}  void   mai 
     37n( F  orma  t &   fmt   ) {       
     38for   ( ;;   ) {                                                                 
     39                //   for   as   many   cha 
     40ract  ers               for   ( f  mt.g 
     41 = 0  ; fm  t.g   < 5;   fmt 
     42.g +  = 1   ) {         //   grou 
     43ps o  f 5   bloc  ks                    for 
     44 ( f  mt.b   = 0  ; fm  t.b   
     45< 4;   fmt  .b +  = 1   ) {       
     46// b  lock  s of   4 c  hara 
     47cter  s                         for   ( ;  ; )   
     48{                                                         // f  or n  ewli 
     49ne c  hara  cter  s                                     su 
     50spen  d();                                      if   ( fm 
     51t.ch   !=   '\n'   ) b  reak 
     52;               /  / ig  nore   new  line 
     53                                  } //   for                              sout 
     54 | f  mt.c  h;                                                  //   
     55prin  t ch  arac  ter                   }   
     56// f  or                        sou  t |   "  " 
     57;                                                               //   prin  t bl 
     58ock   sepa  rato  r             }   //   
     59for             sou  t |   nl;                                   
     60                                  // p  rint   gro  up s 
     61epar  ator      } /  / fo  r} / 
     62/ ma  invo  id p  rt(   Form 
     63at &   fmt  , ch  ar c  h )   
     64{      fmt  .ch   = ch  ;     
     65 res  ume(   fmt   );}   //   
     66prti  nt m  ain(  ) {     Form 
     67at f  mt;         char   ch;    for 
     68 ( ;  ; )   {           s  in |   ch; 
     69                                                                                //   rea  d on 
     70e ch  arac  ter     if   ( e 
     71of(   sin   ) )   brea  k;               
     72                                        //   eof   ?            p  rt(   
     73fmt,   ch   );  }   //   for} 
     74 //   main  // L  ocal   Var 
     75iabl  es:   ////   tab  -wid 
     76th:   4 //  // c  ompi  le-c 
     77omma  nd:   "cfa   fmt  Line 
     78s.c"   ///  / En  d: /  /
  • tests/coroutine/.in/fmtLines.txt

    r29207bf r5ebb1368  
    1010// Created On       : Sun Sep 17 21:56:15 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 18 11:35:57 2017
    13 // Update Count     : 31
     12// Last Modified On : Tue Dec 11 23:31:12 2018
     13// Update Count     : 32
    1414//
    1515
     
    2727
    2828void ^?{}( Format & fmt ) {
    29     if ( fmt.g != 0 || fmt.b != 0 ) sout | endl;
     29    if ( fmt.g != 0 || fmt.b != 0 ) sout | nl;
    3030}
    3131
     
    4242                        sout | "  ";                                                            // print block separator
    4343                } // for
    44                 sout | endl;                                                                    // print group separator
     44                sout | nl;                                                                      // print group separator
    4545        } // for
    4646} // main
  • tests/coroutine/fibonacci.c

    r29207bf r5ebb1368  
    1010// Created On       : Thu Jun  8 07:29:37 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 11:21:58 2018
    13 // Update Count     : 24
     12// Last Modified On : Tue Dec 11 21:57:33 2018
     13// Update Count     : 25
    1414//
    1515
     
    3939        Fibonacci f1, f2;
    4040        for ( 10 ) {                                                                            // print N Fibonacci values
    41                 sout | next( f1 ) | next( f2 ) | endl;
     41                sout | next( f1 ) | next( f2 );
    4242        } // for
    4343}
  • tests/coroutine/fibonacci_1.c

    r29207bf r5ebb1368  
    1010// Created On       : Thu Apr 26 23:20:08 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 11:21:02 2018
    13 // Update Count     : 13
     12// Last Modified On : Tue Dec 11 21:57:54 2018
     13// Update Count     : 14
    1414//
    1515
     
    3636        Fibonacci f1, f2;
    3737        for ( 10 ) {                                                                            // print N Fibonacci values
    38                 sout | next( f1 ) | next( f2 ) | endl;
     38                sout | next( f1 ) | next( f2 );
    3939        } // for
    4040}
  • tests/coroutine/fmtLines.c

    r29207bf r5ebb1368  
    1010// Created On       : Sun Sep 17 21:56:15 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 16 08:20:54 2018
    13 // Update Count     : 45
     12// Last Modified On : Tue Dec 11 21:58:49 2018
     13// Update Count     : 47
    1414//
    1515
     
    3434                        sout | "  ";                                                            // print block separator
    3535                } // for
    36                 sout | endl;                                                                    // print group separator
     36                sout | nl;                                                                              // print group separator
    3737        } // for
    3838} // main
     
    4343
    4444void ^?{}( Format & fmt ) with( fmt ) {
    45         if ( g != 0 || b != 0 ) sout | endl;
     45        if ( g != 0 || b != 0 ) sout | nl;
    4646}
    4747
     
    5252int main() {
    5353        Format fmt;
     54        sout | nlOff;                                                                           // turn off auto newline
    5455
    5556  eof: for () {                                                                                 // read until end of file
  • tests/coroutine/pingpong.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed Sep 20 11:55:23 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 11:31:11 2018
    13 // Update Count     : 28
     12// Last Modified On : Tue Dec 11 21:58:06 2018
     13// Update Count     : 29
    1414//
    1515
     
    4040void main( PingPong & pingpong ) {                                              // ping's starter ::main, pong's starter ping
    4141        for ( pingpong.N ) {                                                            // N ping-pongs
    42                 sout | pingpong.name | endl;
     42                sout | pingpong.name;
    4343                cycle( *pingpong.part );
    4444        } // for
  • tests/coroutine/prodcons.c

    r29207bf r5ebb1368  
    1010// Created On       : Mon Sep 18 12:23:39 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 18 12:55:10 2018
    13 // Update Count     : 51
     12// Last Modified On : Tue Dec 11 21:58:25 2018
     13// Update Count     : 52
    1414//
    1515
     
    3232                int p1 = random( 100 );
    3333                int p2 = random( 100 );
    34                 sout | p1 | " " | p2 | endl;
     34                sout | p1 | " " | p2;
    3535                int status = delivery( *c, p1, p2 );
    36                 sout | " $" | money | endl;
    37                 sout | status | endl;
     36                sout | " $" | money;
     37                sout | status;
    3838                receipt += 1;
    3939        }
    4040        stop( *c );
    41         sout | "prod stops" | endl;
     41        sout | "prod stops";
    4242}
    4343int payment( Prod & prod, int money ) {
     
    6868        int money = 1, receipt;
    6969        for ( ; ! done; ) {
    70                 sout | p1 | " " | p2 | endl;
    71                 sout | " $" | money | endl;
     70                sout | p1 | " " | p2;
     71                sout | " $" | money;
    7272                status += 1;
    7373                receipt = payment( *p, money );
    74                 sout | " #" | receipt | endl;
     74                sout | " #" | receipt;
    7575                money += 1;
    7676        }
    77         sout | "cons stops" | endl;
     77        sout | "cons stops";
    7878}
    7979int delivery( Cons & cons, int p1, int p2 ) {
     
    9292        srandom( /* getpid() */ 103 );                                          // fixed seed for testing
    9393        start( prod, 5, cons );
    94         sout | "main stops" | endl;
     94        sout | "main stops";
    9595}
    9696
  • tests/coroutine/runningTotal.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed Dec  6 08:05:27 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 16 08:22:29 2018
    13 // Update Count     : 3
     12// Last Modified On : Tue Dec 11 21:59:00 2018
     13// Update Count     : 4
    1414//
    1515
     
    4242        RunTotal rntl;
    4343        for ( i; 10 ) {
    44                 sout | i | add( rntl, i ) | endl;
     44                sout | i | add( rntl, i );
    4545        } // for
    4646}
  • tests/div.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Tue Aug  8 16:28:43 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:53:10 2018
    13 // Update Count     : 19
     12// Last Modified On : Tue Dec  4 21:35:01 2018
     13// Update Count     : 20
    1414//
    1515
    1616#include <fstream.hfa>
    17 #include <stdlib.hfa>                                                                           // div
     17#include <stdlib.hfa>                                                                   // div
    1818
    1919struct T { int i; };
     
    2323
    2424int main( void ) {
    25         sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ) | endl;
     25        sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL );
    2626        short s1 = 13, s2 = 5;
    27         sout | "div" | div( s1, s2 ) | endl;
     27        sout | "div" | div( s1, s2 );
    2828        T t1 = { 13 }, t2 = { 5 };
    29         sout | "div" | div( t1, t2 ) | endl;                            // polymorphic div
     29        sout | "div" | div( t1, t2 );                                           // polymorphic div
    3030} // main
    3131
  • tests/except-0.cfa

    r29207bf r5ebb1368  
    2525void ^?{}(signal_exit * this) {
    2626        printf("Exiting: %s\n", this->area);
    27 //      sout | "Exiting:" | this->area | endl;
     27//      sout | "Exiting:" | this->area;
    2828}
    2929
  • tests/fallthrough.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed Mar 14 10:06:25 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov  8 09:09:09 2018
    13 // Update Count     : 16
     12// Last Modified On : Tue Dec  4 21:36:14 2018
     13// Update Count     : 17
    1414//
    1515
     
    1919        choose ( choice ) {
    2020                case 1:
    21                         sout | "case 1" | endl;
     21                        sout | "case 1";
    2222                        fallthru;
    2323                case 2:
    24                         sout | "case 2" | endl;
     24                        sout | "case 2";
    2525                        fallthru;
    26                         sout | "did not fallthru" | endl;
     26                        sout | "did not fallthru";
    2727                        if ( 7 ) fallthru common2;
    2828                        fallthru common1;
    2929                case 3:
    30                         sout | "case 3" | endl;
     30                        sout | "case 3";
    3131                        fallthru default;
    3232                        fallthru common1;
    3333                common1:
    34                         sout | "common1" | endl;
     34                        sout | "common1";
    3535                // break
    3636                case 4:
    37                         sout | "case 4" | endl;
     37                        sout | "case 4";
    3838                        fallthru common2;
    3939                case 5:
    40                         sout | "case 5" | endl;
     40                        sout | "case 5";
    4141                        fallthru common2;
    4242                        fallthru default;
    4343                case 6:
    44                         sout | "case 6" | endl;
     44                        sout | "case 6";
    4545                        fallthru common2;
    4646                common2:
    47                         sout | "common2" | endl;
     47                        sout | "common2";
    4848                // break
    4949                default:
    50                         sout | "default" | endl;
     50                        sout | "default";
    5151                        fallthru;
    5252        }
    5353
    54         sout | endl;
     54        sout | nl;
    5555
    5656        switch ( choice ) {
    5757          case 1:
    58                 sout | "case 1" | endl;
     58                sout | "case 1";
    5959                switch ( choice ) {
    6060                  case 1:
    61                         sout | "case 1" | endl;
     61                        sout | "case 1";
    6262                        for ( int i = 0; i < 4; i += 1 ) {
    6363                                printf("%d\n", i);
     
    6767                break;
    6868          case 5:
    69                 sout | "case 5" | endl;
     69                sout | "case 5";
    7070                if ( choice == 5 ) {
    7171                        if ( choice != 5 ) {
    72                                 sout | "error" | endl;
     72                                sout | "error";
    7373                        } else {
    74                                 sout | "check" | endl;
     74                                sout | "check";
    7575                                fallthru common;
    7676                        } // if
     
    117117int main() {
    118118        test( 1 );
    119         sout | endl;
     119        sout | nl;
    120120        test( 5 );
    121121}
  • tests/fstream_test.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:53:56 2018
    13 // Update Count     : 66
     12// Last Modified On : Tue Dec  4 21:36:34 2018
     13// Update Count     : 67
    1414//
    1515
     
    1818int main( void ) {
    1919        int nombre;
    20         sout | "Entrez un nombre, s'il vous plaît:" | endl;
     20        sout | "Entrez un nombre, s'il vous plaît:";
    2121        sin  | nombre;
    22         sout | "Vous avez entré" | nombre | endl;
     22        sout | "Vous avez entré" | nombre;
    2323        sout | "le nombre" | nombre | "est"
    24                  | (nombre > 0 ? "positif" : nombre == 0 ? "zéro" : "négatif") | endl;
     24                 | (nombre > 0 ? "positif" : nombre == 0 ? "zéro" : "négatif");
    2525
    26         sout | "Entrez trois nombres, s'il vous plaît: " | endl;
     26        sout | "Entrez trois nombres, s'il vous plaît: ";
    2727        int i, j, k;
    2828        sin  | i | j | k;
    29         sout | "Vous avez entré" | "i:" | "" | i | "j:" | "" | j | "k:" | "" | k | endl;
     29        sout | "Vous avez entré" | "i:" | "" | i | "j:" | "" | j | "k:" | "" | k;
    3030}
    3131
  • tests/function-operator.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Fri Aug 25 15:21:11 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  2 09:27:53 2018
    13 // Update Count     : 8
     12// Last Modified On : Tue Dec  4 21:37:09 2018
     13// Update Count     : 9
    1414//
    1515
     
    8383// TODO: abstract over (os, T)
    8484os_wrapper ?=?(os_wrapper & wrapper, int x) {
    85         *wrapper.out | x | endl;
     85        *wrapper.out | x;
    8686        return wrapper;
    8787}
  • tests/gmp.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:54:34 2018
    13 // Update Count     : 557
     12// Last Modified On : Tue Dec  4 21:37:29 2018
     13// Update Count     : 558
    1414//
    1515
     
    1919
    2020int main( void ) {
    21         sout | "constructors" | endl;
     21        sout | "constructors";
    2222        short int si = 3;
    2323        Int x = { "50000000000000000000" }, y = { si }, z = x + y;
    24         sout | x | y | z | endl;
    25         sout | "x:" | x | "y:" | y | "z:" | z | endl;
     24        sout | x | y | z;
     25        sout | "x:" | x | "y:" | y | "z:" | z;
    2626
    27         sout | "conversions" | endl;
     27        sout | "conversions";
    2828        y = 'a';
    29         sout | "y:" | y | endl;
     29        sout | "y:" | y;
    3030        y = "12345678901234567890123456789";
    31         sout | "y:" | y | endl;
     31        sout | "y:" | y;
    3232        y = 100`mp + 100`mp;
    33         sout | "y:" | y | endl;
     33        sout | "y:" | y;
    3434        y = -200u`mp + -200u`mp;
    35         sout | "y:" | y | endl;
     35        sout | "y:" | y;
    3636        y = "12345678901234567890123456789"`mp + "12345678901234567890123456789"`mp;
    37         sout | "y:" | y | endl;
     37        sout | "y:" | y;
    3838        y = si;
    39         sout | "y:" | y | endl;
     39        sout | "y:" | y;
    4040        y = -3;
    41         sout | "y:" | y | endl;
     41        sout | "y:" | y;
    4242        y += 7;
    43         sout | "y:" | y | endl;
     43        sout | "y:" | y;
    4444        y -= 1;
    45         sout | "y:" | y | endl;
     45        sout | "y:" | y;
    4646        int b;
    4747        b = y;
    4848        si = y;
    49         sout | "y:" | y | "b:" | b | "si:" | si | endl;
     49        sout | "y:" | y | "b:" | b | "si:" | si;
    5050
    51         sout | "comparison" | endl;
    52         sout | x == x | endl;
    53         sout | x != x | endl;
    54         sout | x < x | endl;
    55         sout | x <= x | endl;
    56         sout | x > x | endl;
    57         sout | x >= x | endl;
     51        sout | "comparison";
     52        sout | x == x;
     53        sout | x != x;
     54        sout | x < x;
     55        sout | x <= x;
     56        sout | x > x;
     57        sout | x >= x;
    5858
    59         sout | "arithmetic" | endl;
     59        sout | "arithmetic";
    6060        z = x + y + z;
    61         sout | "z:" | z | endl;
     61        sout | "z:" | z;
    6262        z = z = x;
    63         sout | "z:" | z | endl;
     63        sout | "z:" | z;
    6464        z = x - y - z;
    65         sout | "z:" | z | endl;
     65        sout | "z:" | z;
    6666        z = x * y * z;
    67         sout | "z:" | z | endl;
     67        sout | "z:" | z;
    6868        z = x * 3;
    69         sout | "z:" | z | endl;
     69        sout | "z:" | z;
    7070        z = 3 * x;
    71         sout | "z:" | z | endl;
     71        sout | "z:" | z;
    7272        z = x / 3;
    73         sout | "z:" | z | endl;
    74         sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
     73        sout | "z:" | z;
     74        sout | div( x, 3 ) | x / 3 | "," | x % 3;
    7575        [ x, y ] = div( x, 3 );
    76         sout | "x:" | x | "y:" | y | endl;
     76        sout | "x:" | x | "y:" | y;
    7777
    78         sout | endl;
     78        sout;
    7979
    8080        sin | x | y | z;
    81         sout | x | y | z | endl;
     81        sout | x | y | z;
    8282
    83         sout | endl;
     83        sout;
    8484
    85         sout | "Fibonacci Numbers" | endl;
     85        sout | "Fibonacci Numbers";
    8686        Int fn, fn1, fn2;
    8787        fn = (Int){0}; fn1 = fn;                                                        // 1st case
    88         sout | (int)0 | fn | endl;
     88        sout | (int)0 | fn;
    8989        fn = 1; fn2 = fn1; fn1 = fn;                                            // 2nd case
    90         sout | 1 | fn | endl;
     90        sout | 1 | fn;
    9191        for ( i; 2u ~= 200 ) {
    9292                fn = fn1 + fn2; fn2 = fn1; fn1 = fn;                    // general case
    93                 sout | i | fn | endl;
     93                sout | i | fn;
    9494        } // for
    9595
    96         sout | endl;
     96        sout;
    9797
    98         sout | "Factorial Numbers" | endl;
     98        sout | "Factorial Numbers";
    9999        Int fact = 1;                                                                           // 1st case
    100         sout | (int)0 | fact | endl;
     100        sout | (int)0 | fact;
    101101        for ( i; 1u ~= 40u ) {
    102102                fact *= i;                                                                              // general case
    103                 sout | i | fact | endl;
     103                sout | i | fact;
    104104        } // for
    105105} // main
  • tests/heap.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Tue Nov  6 17:54:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov  8 09:03:54 2018
    13 // Update Count     : 17
     12// Last Modified On : Tue Dec 11 21:52:40 2018
     13// Update Count     : 18
    1414//
    1515
     
    4545                for ( i; NoOfAllocs ) {
    4646                        locns[i] = alloc( i );
    47                         //sout | (void *)locns[i] | endl;
     47                        //sout | (void *)locns[i];
    4848                        for ( k; i ) locns[i][k] = '\345';
    4949                } // for
    50                 //sout | (char *)sbrk(0) - start | " bytes" | endl;
     50                //sout | (char *)sbrk(0) - start | " bytes";
    5151
    5252                for ( i; NoOfAllocs ) {
    53                         //sout | (void *)locns[i] | endl;
     53                        //sout | (void *)locns[i];
    5454                        for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage1" );
    5555                        free( locns[i] );
    5656                } // for
    57                 //sout | (char *)sbrk(0) - start | " bytes" | endl;
     57                //sout | (char *)sbrk(0) - start | " bytes";
    5858
    5959                for ( i; NoOfAllocs ) {
    6060                        locns[i] = alloc( i );
    61                         //sout | (void *)locns[i] | endl;
     61                        //sout | (void *)locns[i];
    6262                        for ( k; i ) locns[i][k] = '\345';
    6363                } // for
    6464                for ( i; NoOfAllocs - 1 -~= 0 ) {
    65                         //sout | (void *)locns[i] | endl;
     65                        //sout | (void *)locns[i];
    6666                        for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage2" );
    6767                        free( locns[i] );
     
    186186
    187187        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    188                 //sout | alignments[a] | endl;
     188                //sout | alignments[a];
    189189                for ( s; 1 ~ NoOfAllocs ) {                                             // allocation of size 0 can return null
    190190                        char * area = (char *)memalign( a, s );
    191191                        if ( area == 0 ) abort( "memalign/free out of memory" );
    192                         //sout | i | " " | area | endl;
     192                        //sout | i | " " | area;
    193193                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    194194                                abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, s, area );
     
    203203
    204204        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    205                 //sout | alignments[a] | endl;
     205                //sout | alignments[a];
    206206                for ( i; 1 ~ NoOfMmaps ) {
    207207                        size_t s = i + default_mmap_start();            // cross over point
    208208                        char * area = (char *)memalign( a, s );
    209209                        if ( area == 0 ) abort( "memalign/free out of memory" );
    210                         //sout | i | " " | area | endl;
     210                        //sout | i | " " | area;
    211211                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    212212                                abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)s, area );
     
    268268                char * area = (char *)memalign( a, amount );    // aligned N-byte allocation
    269269                if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    270                 //sout | alignments[a] | " " | area | endl;
     270                //sout | alignments[a] | " " | area;
    271271                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    272272                        abort( "memalign/realloc/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area );
     
    279279                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    280280                        if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    281                         //sout | i | " " | area | endl;
     281                        //sout | i | " " | area;
    282282                        if ( (size_t)area % a != 0 ) {                          // check for initial alignment
    283283                                abort( "memalign/realloc/free bad alignment %p", area );
     
    291291
    292292        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    293                 //sout | alignments[a] | endl;
     293                //sout | alignments[a];
    294294                for ( s; 1 ~ limit ) {                                                  // allocation of size 0 can return null
    295295                        char * area = (char *)cmemalign( a, 1, s );
    296296                        if ( area == 0 ) abort( "cmemalign/free out of memory" );
    297                         //sout | i | " " | area | endl;
     297                        //sout | i | " " | area;
    298298                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    299299                                abort( "cmemalign/free bad alignment : cmemalign(%d,%d) = %p", (int)a, s, area );
     
    314314                char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
    315315                if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    316                 //sout | alignments[a] | " " | area | endl;
     316                //sout | alignments[a] | " " | area;
    317317                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    318318                        abort( "cmemalign/realloc/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area );
     
    328328                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    329329                        if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    330                         //sout | i | " " | area | endl;
     330                        //sout | i | " " | area;
    331331                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    332332                                abort( "cmemalign/realloc/free bad alignment %p", area );
     
    339339                free( area );
    340340    } // for
    341         //sout | "worker" | thisTask() | "successful completion" | endl;
     341        //sout | "worker" | thisTask() | "successful completion";
    342342} // Worker main
    343343
  • tests/hello.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:56:22 2018
    13 // Update Count     : 16
     12// Last Modified On : Tue Dec  4 21:38:39 2018
     13// Update Count     : 17
    1414//
    1515
     
    1717
    1818int main() {
    19         sout | "Hello world!" | endl;
    20         sout | "Bonjour le monde!" | endl;
    21         sout | "Hola Mundo!" | endl;
    22         sout | "Hallo Welt!" | endl;
    23         sout | "Kaixo Mundua!" | endl;
    24         sout | "Chào thế giới!" | endl;
    25         sout | "Привет мир!" | endl;
    26         sout | "שלום עולם!" | endl;
    27         sout | "你好,世界!" | endl;
    28         sout | "こんにちは世界!" | endl;
    29         sout | "안녕하세요 세계!" | endl;
    30         sout | "नमस्ते दुनिया!" | endl;
     19        sout | "Hello world!";
     20        sout | "Bonjour le monde!";
     21        sout | "Hola Mundo!";
     22        sout | "Hallo Welt!";
     23        sout | "Kaixo Mundua!";
     24        sout | "Chào thế giới!";
     25        sout | "Привет мир!";
     26        sout | "שלום עולם!";
     27        sout | "你好,世界!";
     28        sout | "こんにちは世界!";
     29        sout | "안녕하세요 세계!";
     30        sout | "नमस्ते दुनिया!";
    3131}
    3232
  • tests/identity.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:56:54 2018
    13 // Update Count     : 19
     12// Last Modified On : Tue Dec  4 21:38:59 2018
     13// Update Count     : 20
    1414//
    1515
     
    2222
    2323int main() {
    24         sout | "char\t\t\t"                                     | identity( 'z' ) | endl;
    25         sout | "signed int\t\t"                         | identity( 4 ) | endl;
    26         sout | "unsigned int\t\t"                       | identity( 4u ) | endl;
    27         sout | "signed long int\t\t"            | identity( 4l ) | endl;
    28         sout | "unsigned long int\t"            | identity( 4ul ) | endl;
    29         sout | "signed long long int\t"         | identity( 4ll ) | endl;
    30         sout | "unsigned long long int\t"       | identity( 4ull ) | endl;
    31         sout | "float\t\t\t"                            | identity( 4.1f ) | endl;
    32         sout | "double\t\t\t"                           | identity( 4.1 ) | endl;
    33         sout | "long double\t\t"                        | identity( 4.1l ) | endl;
    34         sout | "float _Complex\t\t"                     | identity( -4.1F-2.0iF ) | endl;
    35         sout | "double _Complex\t\t"            | identity( -4.1D-2.0iD ) | endl;
    36         sout | "long double _Complex\t"         | identity( -4.1L-2.0iL ) | endl;
     24        sout | "char\t\t\t"                                     | identity( 'z' );
     25        sout | "signed int\t\t"                         | identity( 4 );
     26        sout | "unsigned int\t\t"                       | identity( 4u );
     27        sout | "signed long int\t\t"            | identity( 4l );
     28        sout | "unsigned long int\t"            | identity( 4ul );
     29        sout | "signed long long int\t"         | identity( 4ll );
     30        sout | "unsigned long long int\t"       | identity( 4ull );
     31        sout | "float\t\t\t"                            | identity( 4.1f );
     32        sout | "double\t\t\t"                           | identity( 4.1 );
     33        sout | "long double\t\t"                        | identity( 4.1l );
     34        sout | "float _Complex\t\t"                     | identity( -4.1F-2.0iF );
     35        sout | "double _Complex\t\t"            | identity( -4.1D-2.0iD );
     36        sout | "long double _Complex\t"         | identity( -4.1L-2.0iL );
    3737}
    3838
  • tests/ifwhileCtl.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Sat Aug 26 10:13:11 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:57:07 2018
    13 // Update Count     : 22
     12// Last Modified On : Tue Dec  4 21:39:18 2018
     13// Update Count     : 23
    1414//
    1515
     
    2222
    2323        if ( int x = 1 ) {
    24                 sout | "x != 0 correct" | endl;
     24                sout | "x != 0 correct";
    2525        } else {
    26                 sout | "x == 0 incorrect" | endl;
     26                sout | "x == 0 incorrect";
    2727        } // if
    2828
    2929        if ( int x = 4, y = 0 ) {
    30                 sout | "x != 0 && y != 0 incorrect" | endl;
     30                sout | "x != 0 && y != 0 incorrect";
    3131        } else if ( int x = 4, y = 1 ) {
    32                 sout | "x != 0 && y != 0 correct" | endl;
     32                sout | "x != 0 && y != 0 correct";
    3333        } else {
    34                 sout | "x == 0 || y == 0 incorrect" | endl;
     34                sout | "x == 0 || y == 0 incorrect";
    3535        } // if
    3636
    3737        if ( int x = 5, y = f( x ); x == y ) {
    38                 sout | "x == y correct" | endl;
     38                sout | "x == y correct";
    3939        } else {
    40                 sout | "x != y incorrect" | endl;
     40                sout | "x != y incorrect";
    4141        } // if
    4242
    4343        if ( struct S { int i; } s = { 3 }; s.i < 4 ) {
    4444                S s1;
    45                 sout | "s.i < 4 correct" | endl;
     45                sout | "s.i < 4 correct";
    4646        } else {
    4747                S s1;
    48                 sout | "s.i >= 4 incorrect" | endl;
     48                sout | "s.i >= 4 incorrect";
    4949        } // if
    5050
    5151        while ( int x = 1 ) {
    52                 sout | "x != 0 correct" | endl;
     52                sout | "x != 0 correct";
    5353                break;
    5454        } // while
    5555
    5656        while ( int x = 4, y = 0 ) {
    57                 sout | "x != 0 && y != 0 incorrect" | endl;
     57                sout | "x != 0 && y != 0 incorrect";
    5858        } // while
    5959
    6060        while ( int x = 5, y = f( x ); x == y ) {
    61                 sout | "x == y correct" | endl;
     61                sout | "x == y correct";
    6262                break;
    6363        } // while
     
    6565        while ( struct S { int i; } s = { 3 }; s.i < 4 ) {
    6666                S s1;
    67                 sout | "s.i < 4 correct" | endl;
     67                sout | "s.i < 4 correct";
    6868                break;
    6969        } // while
  • tests/io1.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:57:17 2018
    13 // Update Count     : 105
     12// Last Modified On : Tue Dec  4 21:40:28 2018
     13// Update Count     : 106
    1414//
    1515
     
    1818int main() {
    1919        int x = 3, y = 5, z = 7;
    20         sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
    21         sout | 1 | 2 | 3 | endl;
    22         sout | '1' | '2' | '3' | endl;
    23         sout | 1 | "" | 2 | "" | 3 | endl;
    24         sout | endl;
     20        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2);
     21        sout | 1 | 2 | 3;
     22        sout | '1' | '2' | '3';
     23        sout | 1 | "" | 2 | "" | 3;
     24        sout;
    2525
    26         sout | "opening delimiters" | endl;
     26        sout | "opening delimiters";
    2727        sout
    2828                 | "x (" | 1
     
    3636                 | "x ¿" | 9
    3737                 | "x «" | 10
    38                  | endl | endl;
     38                 | nl;
    3939
    40         sout | "closing delimiters" | endl;
     40        sout | "closing delimiters";
    4141        sout
    4242                 | 1 | ", x"
     
    5151                 | 10 | "] x"
    5252                 | 11 | "} x"
    53                  | endl | endl;
     53                 | nl;
    5454
    55         sout | "opening/closing delimiters" | endl;
     55        sout | "opening/closing delimiters";
    5656        sout
    5757                 | "x`" | 1 | "`x'" | 2
     
    6161                 | "\vx\n" | 9 | "\nx\r" | 10
    6262                 | "\rx"
    63                  | endl | endl;
     63                 | nl;
    6464
    65         sout | "override opening/closing delimiters" | endl;
    66         sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl;
    67         sout | endl;
     65        sout | "override opening/closing delimiters";
     66        sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4;
     67        sout;
    6868}
    6969
  • tests/io2.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:57:28 2018
    13 // Update Count     : 104
     12// Last Modified On : Tue Dec 11 21:51:52 2018
     13// Update Count     : 109
    1414//
    1515
    1616#include <fstream.hfa>
    1717
    18  #define xstr(s) str(s)
     18#define xstr(s) str(s)
    1919#define str(s) #s
    2020
     
    4141        char s1[size], s2[size];
    4242
    43         ifstream in = { xstr(IN_DIR) "io.data" };                                               // create / open file
     43        ifstream in = { xstr(IN_DIR) "io.data" };                       // create / open file
    4444
    45         sout | "input bacis types" | endl;
     45        sout | "input bacis types";
    4646        in       | b                                                                                    // boolean
    4747                 | c | sc | usc                                                                 // character
     
    5050                 | fc | dc | ldc                                                                // floating-point complex
    5151                 | cstr( s1 ) | cstr( s2, size );                               // C string, length unchecked and checked
    52         sout | endl;
     52        sout | nl;
    5353
    54         sout | "output basic types" | endl;
    55         sout | b | endl                                                                         // boolean
    56                  | c | ' ' | sc | ' ' | usc | endl                              // character
    57                  | si | usi | i | ui | li | uli | lli | ulli | endl // integral
    58                  | f | d | ld | endl                                                    // floating point
    59                  | fc | dc | ldc | endl;                                                // complex
    60         sout | endl;
     54        sout | "output basic types";
     55        sout | b | nl                                                                           // boolean
     56                 | c | ' ' | sc | ' ' | usc | nl                                // character
     57                 | si | usi | i | ui | li | uli | lli | ulli | nl // integral
     58                 | f | d | ld | nl                                                              // floating point
     59                 | fc | dc | ldc;                                                               // complex
     60        sout | nl;
    6161
    62         sout | "tuples" | endl;
     62        sout | "tuples";
    6363        [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ];
    64         sout | t1 | t2 | endl;                                                          // print tuple
    65         sout | endl;
     64        sout | t1 | t2;                                                                         // print tuple
     65        sout | nl;
    6666
    67         sout | "toggle separator" | endl;
    68         sout | f | "" | d | "" | ld | endl                                      // floating point without separator
    69                  | sepDisable | fc | dc | ldc | endl                    // complex without separator
    70                  | fc | sepOn | dc | ldc | endl                                 // local separator add
    71                  | sepEnable | fc | dc | ldc | endl                             // complex with separator
    72                  | fc | sepOff | dc | ldc | endl                                // local separator removal
    73                  | s1 | sepOff | s2 | endl                                              // local separator removal
    74                  | s1 | "" | s2 | endl;                                                 // local separator removal
    75         sout | endl;
     67        sout | "toggle separator";
     68        sout | f | "" | d | "" | ld | nl                                        // floating point without separator
     69                 | sepDisable | fc | dc | ldc | nl                              // complex without separator
     70                 | fc | sepOn | dc | ldc | nl                                   // local separator add
     71                 | sepEnable | fc | dc | ldc | nl                               // complex with separator
     72                 | fc | sepOff | dc | ldc | nl                                  // local separator removal
     73                 | s1 | sepOff | s2 | nl                                                // local separator removal
     74                 | s1 | "" | s2;                                                                // local separator removal
     75        sout | nl;
    7676
    77         sout | "change separator" | endl;
    78         sout | "from \"" | sep | "\"";
     77        sout | "change separator";
     78        sout | "from \"" | sep | "\"" | nonl;
    7979        sepSet( sout, ", $" );                                                          // change separator, maximum of 15 characters
    80         sout | " to \"" | sep | "\"" | endl;
    81         sout | f | d | ld | endl
    82                  | fc | dc | ldc | endl
    83                  | s1 | s2 | endl
    84                  | t1 | t2 | endl;                                                              // print tuple
    85         sout | endl;
    86         sout | "from \"" | sep | "\" ";
     80        sout | " to \"" | sep | "\"";
     81        sout | f | d | ld | nl
     82                 | fc | dc | ldc | nl
     83                 | s1 | s2 | nl
     84                 | t1 | t2;                                                                             // print tuple
     85        sout | nl;
     86        sout | "from \"" | sep | "\" " | nonl;
    8787        sepSet( sout, " " );                                                            // restore separator
    88         sout | "to \"" | sep | "\"" | endl;
    89         sout | f | d | ld | endl
    90                  | fc | dc | ldc | endl
    91                  | s1 | s2 | endl
    92                  | t1 | t2 | endl;                                                              // print tuple
    93         sout | endl;
     88        sout | "to \"" | sep | "\"";
     89        sout | f | d | ld | nl
     90                 | fc | dc | ldc | nl
     91                 | s1 | s2 | nl
     92                 | t1 | t2;                                                                             // print tuple
     93        sout | nl;
    9494
    95         sout | "check sepOn/sepOff" | endl;
    96         sout | sepOn | 1 | 2 | 3 | sepOn | endl;                        // no separator at start/end of line
    97         sout | 1 | sepOff | 2 | 3 | endl;                                       // locally turn off implicit separator
     95        sout | "check sepOn/sepOff";
     96        sout | sepOn | 1 | 2 | 3 | sepOn;                                       // no separator at start/end of line
     97        sout | 1 | sepOff | 2 | 3;                                                      // locally turn off implicit separator
    9898        sout | sepOn | sepOn | 1 | 2 | 3 | sepOn | sepOff | sepOn | '\n'; // no separator at start/end of line
    9999        sout | 1 | 2 | 3 | "\n\n" | sepOn;                                      // no separator at start of next line
    100         sout | 1 | 2 | 3 | endl;
    101         sout | endl;
     100        sout | 1 | 2 | 3;
     101        sout | nl;
    102102
    103         sout | "check enable/disable" | endl;
    104         sout | sepDisable | 1 | 2 | 3 | endl;                           // globally turn off implicit separation
    105         sout | 1 | sepOn | 2 | 3 | endl;                                        // locally turn on implicit separator
    106         sout | sepEnable | 1 | 2 | 3 | endl | sepDisable;       // globally turn on/off implicit separation
    107         sout | 1 | 2 | 3 | endl | sepEnable;                            // globally turn on implicit separation
    108         sout | 1 | 2 | 3 | sepOn | sepDisable | endl;           // ignore seperate at end of line
    109         sout | 1 | 2 | 3 | sepOn | sepEnable | endl;            // separator at end of line
    110         sout | 1 | 2 | 3 | endl;
    111         sout | endl;
     103        sout | "check enable/disable";
     104        sout | sepDisable | 1 | 2 | 3;                                          // globally turn off implicit separation
     105        sout | 1 | sepOn | 2 | 3;                                                       // locally turn on implicit separator
     106        sout | sepEnable | 1 | 2 | 3 | sepDisable;                      // globally turn on/off implicit separation
     107        sout | 1 | 2 | 3 | sepEnable;                                           // globally turn on implicit separation
     108        sout | 1 | 2 | 3 | sepOn | sepDisable;                          // ignore seperate at end of line
     109        sout | 1 | 2 | 3 | sepOn | sepEnable;                           // separator at end of line
     110        sout | 1 | 2 | 3;
     111        sout | nl;
    112112
    113 //      sout | fmt( d, "%8.3f" ) || endl;
    114 //      sout | endl;
     113//      sout | fmt( d, "%8.3f" );
    115114
    116115        sepSetTuple( sout, " " );                                                       // set tuple separator from ", " to " "
    117         sout | t1 | t2 | " \"" | sep | "\"" | endl;
     116        sout | t1 | t2 | " \"" | sep | "\"";
    118117        sepSetTuple( sout, ", " );                                                      // reset tuple separator to ", "
    119         sout | t1 | t2 | " \"" | sep | "\"" | endl;
    120         sout | t1 | t2 | endl;                                                          // print tuple
    121         sout | endl;
     118        sout | t1 | t2 | " \"" | sep | "\"";
     119        sout | t1 | t2;                                                                         // print tuple
     120        sout | nl;
    122121
    123122        [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
    124         sout | [ 3, 4, "a", 7.2 ] | endl;
    125         sout | t3 | endl;
     123        sout | [ 3, 4, "a", 7.2 ];
     124        sout | t3;
    126125        sepSetTuple( sout, " " );
    127         sout | t3 | endl;
    128         sout | sepOn | t3 | sepDisable | t3 | sepEnable | t3 | endl;
     126        sout | t3;
     127        sout | sepOn | t3 | sepDisable | t3 | sepEnable | t3;
    129128        sepSet( sout, "^" );
    130129        sepSetTuple( sout, "-" );
    131         sout | t3 | 3 | 4 | t3 | endl;
     130        sout | t3 | 3 | 4 | t3;
    132131}
    133132
  • tests/literals.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:58:07 2018
    13 // Update Count     : 138
     12// Last Modified On : Tue Dec  4 21:44:01 2018
     13// Update Count     : 139
    1414//
    1515
     
    1818#include <fstream.hfa>
    1919
    20 void f( char v ) { sout | "char " | v | endl; }
    21 void f( signed char v ) { sout | "signed char " | v | endl; }
    22 void f( unsigned char v ) { sout | "unsigned char " | v | endl; }
    23 void f( signed short v ) { sout | "signed short int" | v | endl; }
    24 void f( unsigned short v ) { sout | "unsigned short int" | v | endl; }
    25 void f( size_t v ) { sout | "size_t" | v | endl; }
     20void f( char v ) { sout | "char " | v; }
     21void f( signed char v ) { sout | "signed char " | v; }
     22void f( unsigned char v ) { sout | "unsigned char " | v; }
     23void f( signed short v ) { sout | "signed short int" | v; }
     24void f( unsigned short v ) { sout | "unsigned short int" | v; }
     25void f( size_t v ) { sout | "size_t" | v; }
    2626#endif // __CFA__
    2727
  • tests/loopctrl.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed Aug  8 18:32:59 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Nov  7 16:54:11 2018
    13 // Update Count     : 62
     12// Last Modified On : Wed Dec 12 08:14:44 2018
     13// Update Count     : 76
    1414//
    1515
     
    3232S ?-=?( S & t, one_t ) { t.i -= 1; t.j -= 1; return t; }
    3333ofstream & ?|?( ofstream & os, S v ) { return os | '(' | v.i | v.j | ')'; }
     34void & ?|?( ofstream & os, S v ) { (ofstream)(os | v); if ( getANL( os ) ) nl( os ); }
    3435
    3536int main() {
    36         while () { sout | "empty"; break; }                     sout | endl;
    37         do { sout | "empty"; break; } while ();         sout | endl;
    38         for () { sout | "empty"; break; }                       sout | endl | endl;
     37        sout | nlOff;                                                                           // turn off auto newline
     38        while () { sout | "empty"; break; }                                     sout | nl;
     39        do { sout | "empty"; break; } while ();                         sout | nl;
     40        for () { sout | "empty"; break; }                                       sout | nl;
    3941
    40         for ( 0 ) { sout | "A"; }                                       sout | "zero" | endl;
    41         for ( 1 ) { sout | "A"; }                                       sout | endl;
    42         for ( 10 ) { sout | "A"; }                                      sout | endl;
    43         for ( 1 ~= 10 ~ 2 ) { sout | "B"; }                     sout | endl;
    44         for ( 10 -~= 1 ~ 2 ) { sout | "C"; }            sout | endl;
    45         for ( 0.5 ~ 5.5 ) { sout | "D"; }                       sout | endl;
    46         for ( 5.5 -~ 0.5 ) { sout | "E"; }                      sout | endl | endl;
     42        for ( 0 ) { sout | "A"; }                                                       sout | "zero" | nl;
     43        for ( 1 ) { sout | "A"; }                                                       sout | nl;
     44        for ( 10 ) { sout | "A"; }                                                      sout | nl;
     45        for ( 1 ~= 10 ~ 2 ) { sout | "B"; }                                     sout | nl;
     46        for ( 10 -~= 1 ~ 2 ) { sout | "C"; }                            sout | nl;
     47        for ( 0.5 ~ 5.5 ) { sout | "D"; }                                       sout | nl;
     48        for ( 5.5 -~ 0.5 ) { sout | "E"; }                                      sout | nl | nl;
    4749
    48         for ( i; 10 ) { sout | i; }                                     sout | endl;
    49         for ( i; 1 ~= 10 ~ 2 ) { sout | i; }            sout | endl;
    50         for ( i; 10 -~= 1 ~ 2 ) { sout | i; }           sout | endl;
    51         for ( i; 0.5 ~ 5.5 ) { sout | i; }                      sout | endl;
    52         for ( i; 5.5 -~ 0.5 ) { sout | i; }                     sout | endl;
    53         for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; }       sout | endl;
    54         for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }      sout | endl | endl | endl;
     50        for ( i; 10 ) { sout | i; }                                                     sout | nl;
     51        for ( i; 1 ~= 10 ~ 2 ) { sout | i; }                            sout | nl;
     52        for ( i; 10 -~= 1 ~ 2 ) { sout | i; }                           sout | nl;
     53        for ( i; 0.5 ~ 5.5 ) { sout | i; }                                      sout | nl;
     54        for ( i; 5.5 -~ 0.5 ) { sout | i; }                                     sout | nl;
     55        for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; }                       sout | nl;
     56        for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }                      sout | nl | nl | nl;
    5557
    5658        enum { N = 10 };
    57         for ( N ) { sout | "N"; }                                       sout | endl;
    58         for ( i; N ) { sout | i; }                                      sout | endl;
    59         for ( i; N -~ 0 ) { sout | i; }                         sout | endl | endl | endl;
     59        for ( N ) { sout | "N"; }                                                       sout | nl;
     60        for ( i; N ) { sout | i; }                                                      sout | nl;
     61        for ( i; N -~ 0 ) { sout | i; }                                         sout | nl | nl | nl;
    6062
    6163        const int start = 3, comp = 10, inc = 2;
    62         for ( i; start ~ comp ~ inc + 1 ) { sout | i; } sout | endl | endl;
     64        for ( i; start ~ comp ~ inc + 1 ) { sout | i; }         sout | nl | nl;
    6365
    64         sout | endl;
    65         for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | endl;
    66         for ( s; (S){10,10} ) { sout | s; } sout | endl;
    67         sout | endl;
    68         for ( s; (S){0} ~ (S){10,10} ) { sout | s; } sout | endl;
    69         for ( s; (S){0} ~ (S){10,10} ~ (S){1} ) { sout | s; } sout | endl;
    70         for ( s; (S){0} ~= (S){10,10} ) { sout | s; } sout | endl;
    71         for ( s; (S){0} ~= (S){10,10} ~ (S){1} ) { sout | s; } sout | endl;
    72         sout | endl;
    73         for ( s; (S){10,10} -~ (S){0} ) { sout | s; } sout | endl;
    74         for ( s; (S){10,10} -~ (S){0} ~ (S){1} ) { sout | s; } sout | endl;
    75         for ( s; (S){10,10} -~= (S){0} ) { sout | s; } sout | endl;
    76         for ( s; (S){10,10} -~= (S){0} ~ (S){1} ) { sout | s; } sout | endl;
     66        sout | nl;
     67        for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | nl;
     68        for ( s; (S){10,10} ) { sout | s; } sout | nl;
     69        sout | nl;
     70        for ( s; (S){0} ~ (S){10,10} ) { sout | s; }             sout | nl;
     71        for ( s; (S){0} ~ (S){10,10} ~ (S){1} ) { sout | s; } sout | nl;
     72        for ( s; (S){0} ~= (S){10,10} ) { sout | s; }            sout | nl;
     73        for ( s; (S){0} ~= (S){10,10} ~ (S){1} ) { sout | s; } sout | nl;
     74        sout | nl;
     75        for ( s; (S){10,10} -~ (S){0} ) { sout | s; }            sout | nl;
     76        for ( s; (S){10,10} -~ (S){0} ~ (S){1} ) { sout | s; } sout | nl;
     77        for ( s; (S){10,10} -~= (S){0} ) { sout | s; }           sout | nl;
     78        for ( s; (S){10,10} -~= (S){0} ~ (S){1} ) { sout | s; } sout | nl;
    7779}
    7880
  • tests/math1.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:58:37 2018
    13 // Update Count     : 86
     12// Last Modified On : Tue Dec 11 10:24:31 2018
     13// Update Count     : 88
    1414//
    1515
     
    2222        long double l;
    2323
    24         sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ) | endl;
    25         sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ) | endl;
     24        sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L );
     25        sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L );
    2626        int quot;
    2727        f = remquo( 3.6F, 0.5F, &quot );
    28         sout | "remquo:" | quot | f;
     28        sout | "remquo:" | quot | f | nonl;
    2929        d = remquo( 3.6D, 0.5F, &quot );
    30         sout | quot | d;
     30        sout | quot | d | nonl;
    3131        l = remquo( 3.6L, 0.5L, &quot );
    32         sout | quot | l | endl;
    33         sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L ) | endl;
    34         sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, , 1.0L ) | endl;
    35         sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L ) | endl;
    36         sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" ) | endl;
     32        sout | quot | l;
     33        sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L );
     34        sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, , 1.0L );
     35        sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L );
     36        sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" );
    3737
    3838        //---------------------- Exponential ----------------------
    3939
    40         sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI ) | endl;
    41         sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ) | endl;
    42         sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L ) | endl;
    43         sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI ) | endl;
     40        sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI );
     41        sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L );
     42        sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L );
     43        sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI );
    4444
    4545        int b = 4;
    4646        unsigned int e = 2;
    4747    b \= e;
    48     sout | "\\" | b | b \ e | endl;
    49     sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi) | endl;
     48    sout | "\\" | b | b \ e;
     49    sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi);
    5050} // main
    5151
  • tests/math2.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:58:55 2018
    13 // Update Count     : 83
     12// Last Modified On : Tue Dec  4 23:11:12 2018
     13// Update Count     : 85
    1414//
    1515
     
    2424        //---------------------- Logarithm ----------------------
    2525
    26         sout | "log:" | log( 1.0F ) | log( 1.0D ) | log( 1.0L ) | log( 1.0F+1.0FI ) | log( 1.0D+1.0DI ) | log( 1.0DL+1.0LI ) | endl;
    27         sout | "log2:" | log2( 8.0F ) | log2( 8.0D ) | log2( 8.0L ) | endl;
    28         sout | "log10:" | log10( 100.0F ) | log10( 100.0D ) | log10( 100.0L ) | endl;
    29         sout | "log1p:" | log1p( 1.0F ) | log1p( 1.0D ) | log1p( 1.0L ) | endl;
    30         sout | "ilogb:" | ilogb( 1.0F ) | ilogb( 1.0D ) | ilogb( 1.0L ) | endl;
    31         sout | "logb:" | logb( 8.0F ) | logb( 8.0D ) | logb( 8.0L ) | endl;
     26        sout | "log:" | log( 1.0F ) | log( 1.0D ) | log( 1.0L ) | log( 1.0F+1.0FI ) | log( 1.0D+1.0DI ) | log( 1.0DL+1.0LI );
     27        sout | "log2:" | log2( 8.0F ) | log2( 8.0D ) | log2( 8.0L );
     28        sout | "log10:" | log10( 100.0F ) | log10( 100.0D ) | log10( 100.0L );
     29        sout | "log1p:" | log1p( 1.0F ) | log1p( 1.0D ) | log1p( 1.0L );
     30        sout | "ilogb:" | ilogb( 1.0F ) | ilogb( 1.0D ) | ilogb( 1.0L );
     31        sout | "logb:" | logb( 8.0F ) | logb( 8.0D ) | logb( 8.0L );
    3232
    33         sout | "sqrt:" | sqrt( 1.0F ) | sqrt( 1.0D ) | sqrt( 1.0L ) | sqrt( 1.0F+1.0FI ) | sqrt( 1.0D+1.0DI ) | sqrt( 1.0DL+1.0LI ) | endl;
    34         sout | "cbrt:" | cbrt( 27.0F ) | cbrt( 27.0D ) | cbrt( 27.0L ) | endl;
    35         sout | "hypot:" | hypot( 1.0F, -1.0F ) | hypot( 1.0D, -1.0D ) | hypot( 1.0L, -1.0L ) | endl;
     33        sout | "sqrt:" | sqrt( 1.0F ) | sqrt( 1.0D ) | sqrt( 1.0L ) | sqrt( 1.0F+1.0FI ) | sqrt( 1.0D+1.0DI ) | sqrt( 1.0DL+1.0LI );
     34        sout | "cbrt:" | cbrt( 27.0F ) | cbrt( 27.0D ) | cbrt( 27.0L );
     35        sout | "hypot:" | hypot( 1.0F, -1.0F ) | hypot( 1.0D, -1.0D ) | hypot( 1.0L, -1.0L );
    3636
    3737        //---------------------- Trigonometric ----------------------
    3838
    39         sout | "sin:" | sin( 1.0F ) | sin( 1.0D ) | sin( 1.0L ) | sin( 1.0F+1.0FI ) | sin( 1.0D+1.0DI ) | sin( 1.0DL+1.0LI ) | endl;
    40         sout | "cos:" | cos( 1.0F ) | cos( 1.0D ) | cos( 1.0L ) | cos( 1.0F+1.0FI ) | cos( 1.0D+1.0DI ) | cos( 1.0DL+1.0LI ) | endl;
    41         sout | "tan:" | tan( 1.0F ) | tan( 1.0D ) | tan( 1.0L ) | tan( 1.0F+1.0FI ) | tan( 1.0D+1.0DI ) | tan( 1.0DL+1.0LI ) | endl;
    42         sout | "asin:" | asin( 1.0F ) | asin( 1.0D ) | asin( 1.0L ) | asin( 1.0F+1.0FI ) | asin( 1.0D+1.0DI ) | asin( 1.0DL+1.0LI ) | endl;
    43         sout | "acos:" | acos( 1.0F ) | acos( 1.0D ) | acos( 1.0L ) | acos( 1.0F+1.0FI ) | acos( 1.0D+1.0DI ) | acos( 1.0DL+1.0LI ) | endl;
    44         sout | "atan:" | atan( 1.0F ) | atan( 1.0D ) | atan( 1.0L ) | atan( 1.0F+1.0FI ) | atan( 1.0D+1.0DI ) | atan( 1.0DL+1.0LI ) | endl;
    45         sout | "atan2:" | atan2( 1.0F, 1.0F ) | atan2( 1.0D, 1.0D ) | atan2( 1.0L, 1.0L );
    46         sout | "atan:" | atan( 1.0F, 1.0F ) | atan( 1.0D, 1.0D ) | atan( 1.0L, 1.0L ) | endl;
     39        sout | "sin:" | sin( 1.0F ) | sin( 1.0D ) | sin( 1.0L ) | sin( 1.0F+1.0FI ) | sin( 1.0D+1.0DI ) | sin( 1.0DL+1.0LI );
     40        sout | "cos:" | cos( 1.0F ) | cos( 1.0D ) | cos( 1.0L ) | cos( 1.0F+1.0FI ) | cos( 1.0D+1.0DI ) | cos( 1.0DL+1.0LI );
     41        sout | "tan:" | tan( 1.0F ) | tan( 1.0D ) | tan( 1.0L ) | tan( 1.0F+1.0FI ) | tan( 1.0D+1.0DI ) | tan( 1.0DL+1.0LI );
     42        sout | "asin:" | asin( 1.0F ) | asin( 1.0D ) | asin( 1.0L ) | asin( 1.0F+1.0FI ) | asin( 1.0D+1.0DI ) | asin( 1.0DL+1.0LI );
     43        sout | "acos:" | acos( 1.0F ) | acos( 1.0D ) | acos( 1.0L ) | acos( 1.0F+1.0FI ) | acos( 1.0D+1.0DI ) | acos( 1.0DL+1.0LI );
     44        sout | "atan:" | atan( 1.0F ) | atan( 1.0D ) | atan( 1.0L ) | atan( 1.0F+1.0FI ) | atan( 1.0D+1.0DI ) | atan( 1.0DL+1.0LI );
     45        sout | "atan2:" | atan2( 1.0F, 1.0F ) | atan2( 1.0D, 1.0D ) | atan2( 1.0L, 1.0L ) | nonl;
     46        sout | "atan:" | atan( 1.0F, 1.0F ) | atan( 1.0D, 1.0D ) | atan( 1.0L, 1.0L );
    4747} // main
    4848
  • tests/math3.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:59:05 2018
    13 // Update Count     : 83
     12// Last Modified On : Tue Dec 11 10:15:49 2018
     13// Update Count     : 85
    1414//
    1515
     
    2424        //---------------------- Hyperbolic ----------------------
    2525
    26         sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI ) | endl;
    27         sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI ) | endl;
    28         sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI ) | endl;
    29         sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI ) | endl;
    30         sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI ) | endl;
    31         sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI ) | endl;
     26        sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI );
     27        sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI );
     28        sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI );
     29        sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI );
     30        sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI );
     31        sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI );
    3232
    3333        //---------------------- Error / Gamma ----------------------
    3434
    35         sout | "erf:" | erf( 1.0F ) | erf( 1.0D ) | erf( 1.0L ) | endl;
    36         sout | "erfc:" | erfc( 1.0F ) | erfc( 1.0D ) | erfc( 1.0L ) | endl;
    37         sout | "lgamma:" | lgamma( 4.0F ) | lgamma( 4.0D ) | lgamma( 4.0L ) | endl;
     35        sout | "erf:" | erf( 1.0F ) | erf( 1.0D ) | erf( 1.0L );
     36        sout | "erfc:" | erfc( 1.0F ) | erfc( 1.0D ) | erfc( 1.0L );
     37        sout | "lgamma:" | lgamma( 4.0F ) | lgamma( 4.0D ) | lgamma( 4.0L );
    3838        int sign;
    3939        f = lgamma( 4.0F, &sign );
    40         sout | "lgamma:" | f | sign;
     40        sout | "lgamma:" | f | sign | nonl;
    4141        d = lgamma( 4.0D, &sign );
    42         sout | d | sign;
     42        sout | d | sign | nonl;
    4343        l = lgamma( 4.0L, &sign );
    44         sout | l | sign | endl;
    45         sout | "tgamma:" | tgamma( 4.0F ) | tgamma( 4.0D ) | tgamma( 4.0L ) | endl;
     44        sout | l | sign;
     45        sout | "tgamma:" | tgamma( 4.0F ) | tgamma( 4.0D ) | tgamma( 4.0L );
    4646} // main
    4747
  • tests/math4.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Thu May 24 20:56:54 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:59:14 2018
    13 // Update Count     : 3
     12// Last Modified On : Tue Dec  4 18:15:01 2018
     13// Update Count     : 4
    1414//
    1515
     
    2424        //---------------------- Nearest Integer ----------------------
    2525
    26         sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L ) | endl;
    27         sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L ) | endl;
    28         sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L ) | endl;
    29         sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L ) | endl;
    30         sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L ) | endl;
    31         sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L ) | endl;
    32         sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L ) | endl;
    33         sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L ) | endl;
    34         sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L ) | endl;
    35         sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L ) | endl;
    36         sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L ) | endl;
    37         sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L ) | endl;
    38         sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L ) | endl;
    39         sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L ) | endl;
     26        sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L );
     27        sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L );
     28        sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L );
     29        sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L );
     30        sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L );
     31        sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L );
     32        sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L );
     33        sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L );
     34        sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L );
     35        sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L );
     36        sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L );
     37        sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L );
     38        sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L );
     39        sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L );
    4040
    4141        //---------------------- Manipulation ----------------------
    4242
    43         sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L ) | endl;
     43        sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L );
    4444        int exp;
    4545        f = frexp( 4.0F, &exp );
    46         sout | "frexp:" | f | exp;
     46        sout | "frexp:" | f | exp | nonl;
    4747        d = frexp( 4.0D, &exp );
    48         sout | d | exp;
     48        sout | d | exp | nonl;
    4949        l = frexp( 4.0L, &exp );
    50         sout | l | exp | endl;
    51         sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 ) | endl;
     50        sout | l | exp;
     51        sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 );
    5252        float fi;
    5353        double di;
    5454        long double ldi;
    5555        f = modf( 2.3F, &fi );
    56         sout | "modf:" | fi | f;
     56        sout | "modf:" | fi | f | nonl;
    5757        d = modf( 2.3D, &di );
    58         sout | di | d;
     58        sout | di | d | nonl;
    5959        l = modf( 2.3L, &ldi );
    60         sout | ldi | l | endl;
    61         sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L ) | endl;
    62         sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L ) | endl;
    63         sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L ) | endl;
     60        sout | ldi | l;
     61        sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L );
     62        sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L );
     63        sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L );
    6464
    65         sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 ) | endl;
    66         sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L ) | endl;
     65        sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 );
     66        sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L );
    6767} // main
    6868
  • tests/minmax.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:59:26 2018
    13 // Update Count     : 51
     12// Last Modified On : Tue Dec  4 21:45:31 2018
     13// Update Count     : 52
    1414//
    1515
     
    2222        int ?>?( char op1, char op2 ) { return (int)op1 > (int)op2; }
    2323
    24         sout | "char\t\t\t"                                     | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' ) | endl;
    25         sout | "signed int\t\t"                         | 4 | 3 | "\tmin" | min( 4, 3 ) | endl;
    26         sout | "unsigned int\t\t"                       | 4u | 3u | "\tmin" | min( 4u, 3u ) | endl;
    27         sout | "signed long int\t\t"            | 4l | 3l | "\tmin" | min( 4l, 3l ) | endl;
    28         sout | "unsigned long int\t"            | 4ul | 3ul | "\tmin" | min( 4ul, 3ul ) | endl;
    29         sout | "signed long long int\t"         | 4ll | 3ll | "\tmin" | min( 4ll, 3ll ) | endl;
    30         sout | "unsigned long long int\t"       | 4ull | 3ull | "\tmin" | min( 4ull, 3ull ) | endl;
    31         sout | "float\t\t\t"                            | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f ) | endl;
    32         sout | "double\t\t\t"                           | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 ) | endl;
    33         sout | "long double\t\t"                        | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l ) | endl;
     24        sout | "char\t\t\t"                                     | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' );
     25        sout | "signed int\t\t"                         | 4 | 3 | "\tmin" | min( 4, 3 );
     26        sout | "unsigned int\t\t"                       | 4u | 3u | "\tmin" | min( 4u, 3u );
     27        sout | "signed long int\t\t"            | 4l | 3l | "\tmin" | min( 4l, 3l );
     28        sout | "unsigned long int\t"            | 4ul | 3ul | "\tmin" | min( 4ul, 3ul );
     29        sout | "signed long long int\t"         | 4ll | 3ll | "\tmin" | min( 4ll, 3ll );
     30        sout | "unsigned long long int\t"       | 4ull | 3ull | "\tmin" | min( 4ull, 3ull );
     31        sout | "float\t\t\t"                            | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f );
     32        sout | "double\t\t\t"                           | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 );
     33        sout | "long double\t\t"                        | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l );
    3434
    35         sout | endl;
     35        sout | nl;
    3636
    37         sout | "char\t\t\t"                                     | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' ) | endl;
    38         sout | "signed int\t\t"                         | 4 | 3 | "\tmax" | max( 4, 3 ) | endl;
    39         sout | "unsigned int\t\t"                       | 4u | 3u | "\tmax" | max( 4u, 3u ) | endl;
    40         sout | "signed long int\t\t"            | 4l | 3l | "\tmax" | max( 4l, 3l ) | endl;
    41         sout | "unsigned long int\t"            | 4ul | 3ul | "\tmax" | max( 4ul, 3ul ) | endl;
    42         sout | "signed long long int\t"         | 4ll | 3ll | "\tmax" | max( 4ll, 3ll ) | endl;
    43         sout | "unsigned long long int\t"       | 4ull | 3ull | "\tmax" | max( 4ull, 3ull ) | endl;
    44         sout | "float\t\t\t"                            | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f ) | endl;
    45         sout | "double\t\t\t"                           | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 ) | endl;
    46         sout | "long double\t\t"                        | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l ) | endl;
     37        sout | "char\t\t\t"                                     | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' );
     38        sout | "signed int\t\t"                         | 4 | 3 | "\tmax" | max( 4, 3 );
     39        sout | "unsigned int\t\t"                       | 4u | 3u | "\tmax" | max( 4u, 3u );
     40        sout | "signed long int\t\t"            | 4l | 3l | "\tmax" | max( 4l, 3l );
     41        sout | "unsigned long int\t"            | 4ul | 3ul | "\tmax" | max( 4ul, 3ul );
     42        sout | "signed long long int\t"         | 4ll | 3ll | "\tmax" | max( 4ll, 3ll );
     43        sout | "unsigned long long int\t"       | 4ull | 3ull | "\tmax" | max( 4ull, 3ull );
     44        sout | "float\t\t\t"                            | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f );
     45        sout | "double\t\t\t"                           | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 );
     46        sout | "long double\t\t"                        | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l );
    4747} // main
    4848
  • tests/quotedKeyword.cfa

    r29207bf r5ebb1368  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:46:20 2018
    13 // Update Count     : 22
     12// Last Modified On : Tue Dec  4 21:45:53 2018
     13// Update Count     : 23
    1414//
    1515
     
    4141        st.`struct` = 3;
    4242        `throw` = 4;
    43         sout | `catch` + st.`otype` + st.`struct` + `throw` | endl;
     43        sout | `catch` + st.`otype` + st.`struct` + `throw`;
    4444}
    4545
  • tests/raii/dtor-early-exit.c

    r29207bf r5ebb1368  
    1010// Created On       : Wed Aug 17 08:26:25 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 07:58:39 2018
    13 // Update Count     : 8
     12// Last Modified On : Tue Dec 11 22:05:24 2018
     13// Update Count     : 9
    1414//
    1515
     
    2525// don't want these called
    2626void ?{}(A & a) { assert( false ); }
    27 void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name | endl; a.x = (int*)malloc(); }
     27void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name; a.x = (int*)malloc(); }
    2828void ?{}(A & a, const char * name, int * ptr) { assert( false ); }
    2929
    3030A ?=?(A & a, A b) {  sout | "assign " | a.name | " " | b.name; return a; }
    31 void ?{}(A & a, A b) { sout | "copy construct " | b.name | endl; a.x = (int*)malloc(); }
    32 void ^?{}(A & a) { sout | "destruct " | a.name | endl; free(a.x); }
     31void ?{}(A & a, A b) { sout | "copy construct " | b.name; a.x = (int*)malloc(); }
     32void ^?{}(A & a) { sout | "destruct " | a.name; free(a.x); }
    3333
    3434// test returns
    3535void f(int i) {
    36         sout | "f i=" | i | endl;
     36        sout | "f i=" | i;
    3737        A x = { "x" };  // construct x
    3838        {
     
    5555void g() {
    5656        for (int i = 0; i < 10; i++) {
    57                 sout | "g for i=" | i | endl;
     57                sout | "g for i=" | i;
    5858                A x = { "x" };
    5959                // construct x
    6060                // destruct x
    6161        }
    62         sout | endl;
     62        sout | nl;
    6363        {
    6464                int i = 0;
    6565                while (i < 10) {
    66                         sout | "g while i=" | i | endl;
     66                        sout | "g while i=" | i;
    6767                        A x = { "x" };
    6868                        // construct x
     
    7171                }
    7272        }
    73         sout | endl;
     73        sout;
    7474        for (int i = 0; i < 10; i++) {
    7575                switch(10) {
     
    7878                        case 10: {
    7979                                A y = { "y" };
    80                                 sout | "g switch i=" | i | endl;
     80                                sout | "g switch i=" | i;
    8181                                // construct y
    8282                                break; // destruct y
    8383                        }
    8484                        default: {
    85                                 sout | "g switch i=" | i | endl;
     85                                sout | "g switch i=" | i;
    8686                                A x = { "x" };
    8787                                // construct x
     
    9090                }
    9191        }
    92         sout | endl;
     92        sout | nl;
    9393        for (int k = 0; k < 2; k++) {
    94                 sout | "g for k=" | k | endl;
     94                sout | "g for k=" | k;
    9595                L1: for (int i = 0; i < 10; i++) {
    96                         sout | "g for i=" | i | endl;
     96                        sout | "g for i=" | i;
    9797
    9898                        A x = { "x" };
    9999                        if (i == 2) {
    100                                 sout | "continue L1" | endl;
     100                                sout | "continue L1";
    101101                                continue;  // destruct x
    102102                        } else if (i == 3) {
    103                                 sout | "break L1" | endl;
     103                                sout | "break L1";
    104104                                break;  // destruct x
    105105                        }
    106106
    107107                        L2: for (int j = 0; j < 10; j++) {
    108                                 sout | "g for j=" | j | endl;
     108                                sout | "g for j=" | j;
    109109                                A y = { "y" };
    110110                                if (j == 0) {
    111                                         sout | "continue L2" | endl;
     111                                        sout | "continue L2";
    112112                                        continue; // destruct y - missing because object that needs to be destructed is not a part of this block, it's a part of the for's block
    113113                                } else if (j == 1) {
    114                                         sout | "break L2" | endl;
     114                                        sout | "break L2";
    115115                                        break;  // destruct y
    116116                                } else if (i == 1) {
    117                                         sout | "continue L1" | endl;
     117                                        sout | "continue L1";
    118118                                        continue L1; // destruct x,y - note: continue takes you to destructors for block, so only generate destructor for y
    119119                                } else if (k == 1) {
    120                                         sout | "break L1" | endl;
     120                                        sout | "break L1";
    121121                                        break L1;  // destruct x,y
    122122                                }
     
    125125        }
    126126
    127         sout | endl;
     127        sout | nl;
    128128        L3: if( 3 ) {
    129129                A w = { "w" };
    130130                if( 4 ) {
    131131                        A v = { "v" };
    132                         sout | "break L3" | endl;
     132                        sout | "break L3";
    133133                        break L3;
    134134                }
     
    144144        // * if S_L-S_G is non-empty, error
    145145        // * emit destructors for all variables in S_G-S_L
    146         sout | "h" | endl;
     146        sout | "h";
    147147        {
    148148                L0: ;
     
    152152                        A y = { "y" };
    153153                        // S_L1 = { y }
    154                 L1: sout | "L1" | endl;
     154                L1: sout | "L1";
    155155                        A x = { "x" };
    156156                        // S_L2 = { y, x }
    157                 L2: sout | "L2" | endl;
     157                L2: sout | "L2";
    158158                        if (i == 0) {
    159159                                ++i;
    160                                 sout | "goto L1" | endl;
     160                                sout | "goto L1";
    161161                                // S_G = { y, x }
    162162                                goto L1;  // jump back, destruct b/c before x definition
     
    165165                        } else if (i == 1) {
    166166                                ++i;
    167                                 sout | "goto L2" | endl;
     167                                sout | "goto L2";
    168168                                // S_G = { y, x }
    169169                                goto L2;  // jump back, do not destruct
     
    172172                        } else if (i == 2) {
    173173                                ++i;
    174                                 sout | "goto L3" | endl;
     174                                sout | "goto L3";
    175175                                // S_G = { y, x }
    176176                                goto L3;  // jump ahead, do not destruct
     
    180180                                ++i;
    181181                                A z = { "z" };
    182                                 sout | "goto L3-2" | endl;
     182                                sout | "goto L3-2";
    183183                                // S_G = { z, y, x }
    184184                                goto L3;
     
    187187                        } else {
    188188                                ++i;
    189                                 sout | "goto L4" | endl;
     189                                sout | "goto L4";
    190190                                // S_G = { y, x }
    191191                                goto L4;  // jump ahead, destruct b/c left block x was defined in
     
    194194                        }
    195195                        // S_L3 = { y, x }
    196                 L3: sout | "L3" | endl;
    197                         sout | "goto L2-2" | endl;
     196                L3: sout | "L3";
     197                        sout | "goto L2-2";
    198198                        // S_G = { y, x }
    199199                        goto L2; // jump back, do not destruct