Changeset d0c91a6 for doc


Ignore:
Timestamp:
Jan 15, 2019, 4:16:15 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
c802eb88
Parents:
5e49e47 (diff), c9aba81 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into jenkins-sandbox

Location:
doc
Files:
23 added
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/Paper.tex

    r5e49e47 rd0c91a6  
    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

    r5e49e47 rd0c91a6  
    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

    r5e49e47 rd0c91a6  
    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}
  • doc/working/exception/impl/exception.c

    r5e49e47 rd0c91a6  
    243243
    244244                                        // Get a function pointer from the relative offset and call it
    245                                         // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher;                                   
     245                                        // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher;
    246246
    247247                                        _Unwind_Reason_Code (*matcher)() =
     
    320320        // on how the assembly works.
    321321        // Setup the personality routine
     322        #if defined(__PIC__)
     323        asm volatile (".cfi_personality 0x9b,CFA.ref.__gcfa_personality_v0");
     324        // Setup the exception table
     325        asm volatile (".cfi_lsda 0x1b, .LLSDACFA2");
     326        #else
    322327        asm volatile (".cfi_personality 0x3,__gcfa_personality_v0");
    323328        // Setup the exception table
    324329        asm volatile (".cfi_lsda 0x3, .LLSDACFA2");
     330        #endif
    325331
    326332        // Label which defines the start of the area for which the handler is setup
     
    356362// Some more works need to be done if we want to have a single
    357363// call to the try routine
     364#if defined(__PIC__)
     365asm (
     366        //HEADER
     367        ".LFECFA1:\n"
     368        "       .globl  __gcfa_personality_v0\n"
     369        "       .section        .gcc_except_table,\"a\",@progbits\n"
     370        ".LLSDACFA2:\n"                                                 //TABLE header
     371        "       .byte   0xff\n"
     372        "       .byte   0xff\n"
     373        "       .byte   0x1\n"
     374        "       .uleb128 .LLSDACSECFA2-.LLSDACSBCFA2\n"         // BODY length
     375        // Body uses language specific data and therefore could be modified arbitrarily
     376        ".LLSDACSBCFA2:\n"                                              // BODY start
     377        "       .uleb128 .TRYSTART-__try_terminate\n"           // Handled area start  (relative to start of function)
     378        "       .uleb128 .TRYEND-.TRYSTART\n"                           // Handled area length
     379        "       .uleb128 .CATCH-__try_terminate\n"                      // Handler landing pad adress  (relative to start of function)
     380        "       .uleb128 1\n"                                           // Action code, gcc seems to use always 0
     381        ".LLSDACSECFA2:\n"                                              // BODY end
     382        "       .text\n"                                                        // TABLE footer
     383        "       .size   __try_terminate, .-__try_terminate\n"
     384);
     385
     386// Somehow this piece of helps with the resolution of debug symbols.
     387__attribute__((unused)) static const int dummy = 0;
     388asm (
     389        "       .hidden CFA.ref.__gcfa_personality_v0\n"        // Declare an new hidden symbol
     390        "       .weak   CFA.ref.__gcfa_personality_v0\n"
     391        "       .section        .data.rel.local.CFA.ref.__gcfa_personality_v0,\"awG\",@progbits,CFA.ref.__gcfa_personality_v0,comdat\n" // No clue what this does specifically
     392        "       .align 8\n"
     393        "       .type CFA.ref.__gcfa_personality_v0, @object\n" // Type of our hidden symbol (it's not actually the function itself)
     394        "       .size CFA.ref.__gcfa_personality_v0, 8\n"               // Size of our hidden symbol
     395        "CFA.ref.__gcfa_personality_v0:\n"
     396        "       .quad __gcfa_personality_v0\n"
     397);
     398#else
    358399asm (
    359400        //HEADER
     
    375416        "       .text\n"                                                        // TABLE footer
    376417        "       .size   __try_terminate, .-__try_terminate\n"
    377         "       .ident  \"GCC: (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901\"\n"
    378 //      "       .section        .note.GNU-stack,\"x\",@progbits\n"
    379418);
     419#endif
  • doc/working/exception/impl/pdc.s

    r5e49e47 rd0c91a6  
    101101        .text
    102102        .size   foo, .-foo
    103         .ident  "GCC: (Ubuntu 7.3.0-21ubuntu1~16.04) 7.3.0"
     103        .ident  "GCC: (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0"
    104104        .section        .note.GNU-stack,"",@progbits
  • doc/working/exception/impl/pic.s

    r5e49e47 rd0c91a6  
    11        .file   "test.c"
    22        .text
     3.Ltext0:
    34        .globl  clean
    45        .type   clean, @function
    56clean:
    67.LFB0:
     8        .file 1 "test.c"
     9        .loc 1 1 0
    710        .cfi_startproc
    811        pushq   %rbp
     
    1215        .cfi_def_cfa_register 6
    1316        movq    %rdi, -8(%rbp)
     17        .loc 1 1 0
    1418        nop
    1519        popq    %rbp
     
    2327foo:
    2428.LFB1:
     29        .loc 1 4 0
    2530        .cfi_startproc
    2631        .cfi_personality 0x9b,DW.ref.__gcc_personality_v0
     
    3944        .cfi_offset 3, -40
    4045        movl    %edi, -52(%rbp)
     46        .loc 1 4 0
    4147        movq    %fs:40, %rax
    4248        movq    %rax, -40(%rbp)
    4349        xorl    %eax, %eax
     50        .loc 1 6 0
    4451        movl    -52(%rbp), %eax
    4552        movl    %eax, %edi
     
    5057        movl    $0, %r12d
    5158.L7:
     59        .loc 1 5 0
    5260        leaq    -44(%rbp), %rax
    5361        movq    %rax, %rdi
     
    5664        cmpl    $1, %r12d
    5765        je      .L4
     66        .loc 1 6 0
    5867        movl    %r13d, %eax
     68        .loc 1 7 0
    5969        movq    -40(%rbp), %rdx
    6070        xorq    %fs:40, %rdx
     
    6474        movq    %rax, %rbx
    6575        movl    $1, %r12d
     76        .loc 1 5 0
    6677        jmp     .L7
    6778.L4:
     
    7182.LEHE1:
    7283.L10:
     84        .loc 1 7 0
    7385        call    __stack_chk_fail@PLT
    7486.L8:
     
    101113        .text
    102114        .size   foo, .-foo
     115.Letext0:
     116        .section        .debug_info,"",@progbits
     117.Ldebug_info0:
     118        .long   0x9c
     119        .value  0x4
     120        .long   .Ldebug_abbrev0
     121        .byte   0x8
     122        .uleb128 0x1
     123        .long   .LASF0
     124        .byte   0xc
     125        .long   .LASF1
     126        .long   .LASF2
     127        .quad   .Ltext0
     128        .quad   .Letext0-.Ltext0
     129        .long   .Ldebug_line0
     130        .uleb128 0x2
     131        .string "foo"
     132        .byte   0x1
     133        .byte   0x4
     134        .long   0x68
     135        .quad   .LFB1
     136        .quad   .LFE1-.LFB1
     137        .uleb128 0x1
     138        .byte   0x9c
     139        .long   0x68
     140        .uleb128 0x3
     141        .string "x"
     142        .byte   0x1
     143        .byte   0x4
     144        .long   0x68
     145        .uleb128 0x3
     146        .byte   0x91
     147        .sleb128 -68
     148        .uleb128 0x4
     149        .string "i"
     150        .byte   0x1
     151        .byte   0x5
     152        .long   0x68
     153        .uleb128 0x2
     154        .byte   0x91
     155        .sleb128 -60
     156        .byte   0
     157        .uleb128 0x5
     158        .byte   0x4
     159        .byte   0x5
     160        .string "int"
     161        .uleb128 0x6
     162        .long   .LASF3
     163        .byte   0x1
     164        .byte   0x1
     165        .quad   .LFB0
     166        .quad   .LFE0-.LFB0
     167        .uleb128 0x1
     168        .byte   0x9c
     169        .long   0x99
     170        .uleb128 0x3
     171        .string "p"
     172        .byte   0x1
     173        .byte   0x1
     174        .long   0x99
     175        .uleb128 0x2
     176        .byte   0x91
     177        .sleb128 -24
     178        .byte   0
     179        .uleb128 0x7
     180        .byte   0x8
     181        .long   0x68
     182        .byte   0
     183        .section        .debug_abbrev,"",@progbits
     184.Ldebug_abbrev0:
     185        .uleb128 0x1
     186        .uleb128 0x11
     187        .byte   0x1
     188        .uleb128 0x25
     189        .uleb128 0xe
     190        .uleb128 0x13
     191        .uleb128 0xb
     192        .uleb128 0x3
     193        .uleb128 0xe
     194        .uleb128 0x1b
     195        .uleb128 0xe
     196        .uleb128 0x11
     197        .uleb128 0x1
     198        .uleb128 0x12
     199        .uleb128 0x7
     200        .uleb128 0x10
     201        .uleb128 0x17
     202        .byte   0
     203        .byte   0
     204        .uleb128 0x2
     205        .uleb128 0x2e
     206        .byte   0x1
     207        .uleb128 0x3f
     208        .uleb128 0x19
     209        .uleb128 0x3
     210        .uleb128 0x8
     211        .uleb128 0x3a
     212        .uleb128 0xb
     213        .uleb128 0x3b
     214        .uleb128 0xb
     215        .uleb128 0x27
     216        .uleb128 0x19
     217        .uleb128 0x49
     218        .uleb128 0x13
     219        .uleb128 0x11
     220        .uleb128 0x1
     221        .uleb128 0x12
     222        .uleb128 0x7
     223        .uleb128 0x40
     224        .uleb128 0x18
     225        .uleb128 0x2116
     226        .uleb128 0x19
     227        .uleb128 0x1
     228        .uleb128 0x13
     229        .byte   0
     230        .byte   0
     231        .uleb128 0x3
     232        .uleb128 0x5
     233        .byte   0
     234        .uleb128 0x3
     235        .uleb128 0x8
     236        .uleb128 0x3a
     237        .uleb128 0xb
     238        .uleb128 0x3b
     239        .uleb128 0xb
     240        .uleb128 0x49
     241        .uleb128 0x13
     242        .uleb128 0x2
     243        .uleb128 0x18
     244        .byte   0
     245        .byte   0
     246        .uleb128 0x4
     247        .uleb128 0x34
     248        .byte   0
     249        .uleb128 0x3
     250        .uleb128 0x8
     251        .uleb128 0x3a
     252        .uleb128 0xb
     253        .uleb128 0x3b
     254        .uleb128 0xb
     255        .uleb128 0x49
     256        .uleb128 0x13
     257        .uleb128 0x2
     258        .uleb128 0x18
     259        .byte   0
     260        .byte   0
     261        .uleb128 0x5
     262        .uleb128 0x24
     263        .byte   0
     264        .uleb128 0xb
     265        .uleb128 0xb
     266        .uleb128 0x3e
     267        .uleb128 0xb
     268        .uleb128 0x3
     269        .uleb128 0x8
     270        .byte   0
     271        .byte   0
     272        .uleb128 0x6
     273        .uleb128 0x2e
     274        .byte   0x1
     275        .uleb128 0x3f
     276        .uleb128 0x19
     277        .uleb128 0x3
     278        .uleb128 0xe
     279        .uleb128 0x3a
     280        .uleb128 0xb
     281        .uleb128 0x3b
     282        .uleb128 0xb
     283        .uleb128 0x27
     284        .uleb128 0x19
     285        .uleb128 0x11
     286        .uleb128 0x1
     287        .uleb128 0x12
     288        .uleb128 0x7
     289        .uleb128 0x40
     290        .uleb128 0x18
     291        .uleb128 0x2117
     292        .uleb128 0x19
     293        .uleb128 0x1
     294        .uleb128 0x13
     295        .byte   0
     296        .byte   0
     297        .uleb128 0x7
     298        .uleb128 0xf
     299        .byte   0
     300        .uleb128 0xb
     301        .uleb128 0xb
     302        .uleb128 0x49
     303        .uleb128 0x13
     304        .byte   0
     305        .byte   0
     306        .byte   0
     307        .section        .debug_aranges,"",@progbits
     308        .long   0x2c
     309        .value  0x2
     310        .long   .Ldebug_info0
     311        .byte   0x8
     312        .byte   0
     313        .value  0
     314        .value  0
     315        .quad   .Ltext0
     316        .quad   .Letext0-.Ltext0
     317        .quad   0
     318        .quad   0
     319        .section        .debug_line,"",@progbits
     320.Ldebug_line0:
     321        .section        .debug_str,"MS",@progbits,1
     322.LASF0:
     323        .string "GNU C11 7.4.0 -mtune=generic -march=x86-64 -g -fexceptions -fPIC -fstack-protector-strong"
     324.LASF2:
     325        .string "/home/tdelisle/workspace/cforall/main/doc/working/exception/impl"
     326.LASF1:
     327        .string "test.c"
     328.LASF3:
     329        .string "clean"
    103330        .hidden DW.ref.__gcc_personality_v0
    104331        .weak   DW.ref.__gcc_personality_v0
    105         .section        .data.DW.ref.__gcc_personality_v0,"awG",@progbits,DW.ref.__gcc_personality_v0,comdat
     332        .section        .data.rel.local.DW.ref.__gcc_personality_v0,"awG",@progbits,DW.ref.__gcc_personality_v0,comdat
    106333        .align 8
    107334        .type   DW.ref.__gcc_personality_v0, @object
     
    109336DW.ref.__gcc_personality_v0:
    110337        .quad   __gcc_personality_v0
    111         .ident  "GCC: (Ubuntu 7.3.0-21ubuntu1~16.04) 7.3.0"
     338        .ident  "GCC: (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0"
    112339        .section        .note.GNU-stack,"",@progbits
Note: See TracChangeset for help on using the changeset viewer.