Changeset 200fcb3 for doc/user


Ignore:
Timestamp:
Dec 12, 2018, 9:16:12 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
5ebb1368
Parents:
3d99498
Message:

add auto newline to sout, change endl to nl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    r3d99498 r200fcb3  
    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}
Note: See TracChangeset for help on using the changeset viewer.