- Timestamp:
- Dec 12, 2018, 9:16:12 AM (6 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
r3d99498 r200fcb3 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Wed Nov 7 17:00:49201814 %% Update Count : 3 39913 %% Last Modified On : Tue Dec 11 23:19:26 2018 14 %% Update Count : 3400 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 178 178 int main( void ) { 179 179 int x = 0, y = 1, z = 2; 180 ®sout | x | y | z | endl;®§\indexc{sout}§180 ®sout | x | y | z;®§\indexc{sout}§ 181 181 } 182 182 \end{cfa} … … 513 513 Floating exponentiation\index{exponentiation!floating} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative. 514 514 \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;515 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi); 516 516 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 517 517 \end{cfa} … … 591 591 & 592 592 \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;593 sout | nl; 594 sout | nl; 595 sout | nl; 596 sout | "zero" | nl; 597 sout | nl; 598 sout | nl; 599 sout | nl; 600 sout | nl; 601 sout | nl; 602 sout | nl; 603 sout | nl; 604 sout | nl; 605 sout | nl; 606 sout | nl; 607 sout | nl; 608 sout | nl; 609 sout | nl | nl; 610 611 sout | nl; 612 sout | nl; 613 sout | nl | nl; 614 615 sout | nl; 616 616 \end{cfa} 617 617 & … … 2459 2459 int bar( int p ) { 2460 2460 ®i® += 1; §\C{// dependent on local variable}§ 2461 sout | ®i® | endl;2461 sout | ®i®; 2462 2462 } 2463 2463 return bar; §\C{// undefined because of local dependence}§ … … 2465 2465 int main() { 2466 2466 * [int]( int ) fp = foo(); §\C{// int (* fp)( int )}§ 2467 sout | fp( 3 ) | endl;2467 sout | fp( 3 ); 2468 2468 } 2469 2469 \end{cfa} … … 3231 3231 \begin{cfa} 3232 3232 int x = 1, y = 2, z = 3; 3233 sout | x ®|® y ®|® z | endl;3233 sout | x ®|® y ®|® z; 3234 3234 \end{cfa} 3235 3235 & … … 3252 3252 \begin{cfa} 3253 3253 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ]; 3254 sout | t1 | t2 | endl;§\C{// print tuples}§3254 sout | t1 | t2; §\C{// print tuples}§ 3255 3255 \end{cfa} 3256 3256 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3264 3264 & 3265 3265 \begin{cfa} 3266 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;3266 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2); 3267 3267 \end{cfa} 3268 3268 \\ … … 3290 3290 A separator does not appear at the start or end of a line. 3291 3291 \begin{cfa}[belowskip=0pt] 3292 sout | 1 | 2 | 3 | endl;3292 sout | 1 | 2 | 3; 3293 3293 \end{cfa} 3294 3294 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3299 3299 A separator does not appear before or after a character literal or variable. 3300 3300 \begin{cfa} 3301 sout | '1' | '2' | '3' | endl;3301 sout | '1' | '2' | '3'; 3302 3302 123 3303 3303 \end{cfa} … … 3306 3306 A separator does not appear before or after a null (empty) C string. 3307 3307 \begin{cfa} 3308 sout | 1 | "" | 2 | "" | 3 | endl;3308 sout | 1 | "" | 2 | "" | 3; 3309 3309 123 3310 3310 \end{cfa} … … 3316 3316 \begin{cfa}[mathescape=off] 3317 3317 sout | "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; 3319 3319 \end{cfa} 3320 3320 %$ … … 3330 3330 \begin{cfa}[belowskip=0pt] 3331 3331 sout | 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"; 3333 3333 \end{cfa} 3334 3334 \begin{cfa}[basicstyle=\tt,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3340 3340 A 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@ 3341 3341 \begin{cfa}[belowskip=0pt] 3342 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl;3342 sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx"; 3343 3343 \end{cfa} 3344 3344 \begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt] … … 3349 3349 If a space is desired before or after one of the special string start/end characters, simply insert a space. 3350 3350 \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;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; 3352 3352 \end{cfa} 3353 3353 \begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt] … … 3366 3366 \begin{cfa}[mathescape=off,belowskip=0pt] 3367 3367 sepSet( sout, ", $" ); §\C{// set separator from " " to ", \$"}§ 3368 sout | 1 | 2 | 3 | " \"" | ®sep® | "\"" | endl;3368 sout | 1 | 2 | 3 | " \"" | ®sep® | "\""; 3369 3369 \end{cfa} 3370 3370 %$ … … 3375 3375 \begin{cfa}[belowskip=0pt] 3376 3376 sepSet( sout, " " ); §\C{// reset separator to " "}§ 3377 sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl;3377 sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\""; 3378 3378 \end{cfa} 3379 3379 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3385 3385 strcpy( store, sepGet( sout ) ); §\C{// copy current separator}§ 3386 3386 sepSet( sout, "_" ); §\C{// change separator to underscore}§ 3387 sout | 1 | 2 | 3 | endl;3387 sout | 1 | 2 | 3; 3388 3388 \end{cfa} 3389 3389 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3392 3392 \begin{cfa}[belowskip=0pt] 3393 3393 sepSet( sout, store ); §\C{// change separator back to original}§ 3394 sout | 1 | 2 | 3 | endl;3394 sout | 1 | 2 | 3; 3395 3395 \end{cfa} 3396 3396 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3403 3403 \begin{cfa}[belowskip=0pt] 3404 3404 sepSetTuple( sout, " " ); §\C{// set tuple separator from ", " to " "}§ 3405 sout | t1 | t2 | " \"" | ®sepTuple® | "\"" | endl;3405 sout | t1 | t2 | " \"" | ®sepTuple® | "\""; 3406 3406 \end{cfa} 3407 3407 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3410 3410 \begin{cfa}[belowskip=0pt] 3411 3411 sepSetTuple( sout, ", " ); §\C{// reset tuple separator to ", "}§ 3412 sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl;3412 sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\""; 3413 3413 \end{cfa} 3414 3414 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 3420 3420 Manipulators \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. 3421 3421 \begin{cfa}[belowskip=0pt] 3422 sout | sepDisable | 1 | 2 | 3 | endl;§\C{// globally turn off implicit separator}§3422 sout | sepDisable | 1 | 2 | 3; §\C{// globally turn off implicit separator}§ 3423 3423 \end{cfa} 3424 3424 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3426 3426 \end{cfa} 3427 3427 \begin{cfa}[belowskip=0pt] 3428 sout | sepEnable | 1 | 2 | 3 | endl; §\C{// globally turn on implicit separator}§3428 sout | sepEnable | 1 | 2 | 3; §\C{// globally turn on implicit separator}§ 3429 3429 \end{cfa} 3430 3430 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3435 3435 Manipulators \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. 3436 3436 \begin{cfa}[belowskip=0pt] 3437 sout | 1 | sepOff | 2 | 3 | endl; §\C{// locally turn off implicit separator}§3437 sout | 1 | sepOff | 2 | 3; §\C{// locally turn off implicit separator}§ 3438 3438 \end{cfa} 3439 3439 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3441 3441 \end{cfa} 3442 3442 \begin{cfa}[belowskip=0pt] 3443 sout | sepDisable | 1 | sepOn | 2 | 3 | endl; §\C{// locally turn on implicit separator}§3443 sout | sepDisable | 1 | sepOn | 2 | 3; §\C{// locally turn on implicit separator}§ 3444 3444 \end{cfa} 3445 3445 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3448 3448 The tuple separator also responses to being turned on and off. 3449 3449 \begin{cfa}[belowskip=0pt] 3450 sout | t1 | sepOff | t2 | endl; §\C{// locally turn on/off implicit separator}§3450 sout | t1 | sepOff | t2; §\C{// locally turn on/off implicit separator}§ 3451 3451 \end{cfa} 3452 3452 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3456 3456 use ©sep© to accomplish this functionality. 3457 3457 \begin{cfa}[belowskip=0pt] 3458 sout | sepOn | 1 | 2 | 3 | sepOn | endl; §\C{// sepOn does nothing at start/end of line}§3458 sout | sepOn | 1 | 2 | 3 | sepOn; §\C{// sepOn does nothing at start/end of line}§ 3459 3459 \end{cfa} 3460 3460 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3462 3462 \end{cfa} 3463 3463 \begin{cfa}[belowskip=0pt] 3464 sout | sep | 1 | 2 | 3 | sep | endl; §\C{// use sep to print separator at start/end of line}§3464 sout | sep | 1 | 2 | 3 | sep ; §\C{// use sep to print separator at start/end of line}§ 3465 3465 \end{cfa} 3466 3466 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3475 3475 int main( void ) { 3476 3476 int x = 1, y = 2, z = 3; 3477 sout | x | y | z | endl;3477 sout | x | y | z; 3478 3478 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ]; 3479 sout | t1 | t2 | endl; // print tuples3480 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; 3484 3484 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; 3486 3486 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; 3490 3490 3491 3491 sepSet( sout, ", $" ); // set separator from " " to ", $" 3492 sout | 1 | 2 | 3 | " \"" | sep | "\"" | endl;3492 sout | 1 | 2 | 3 | " \"" | sep | "\""; 3493 3493 sepSet( sout, " " ); // reset separator to " " 3494 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;3494 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\""; 3495 3495 3496 3496 char store[sepSize]; 3497 3497 strcpy( store, sepGet( sout ) ); 3498 3498 sepSet( sout, "_" ); 3499 sout | 1 | 2 | 3 | endl;3499 sout | 1 | 2 | 3; 3500 3500 sepSet( sout, store ); 3501 sout | 1 | 2 | 3 | endl;3501 sout | 1 | 2 | 3; 3502 3502 3503 3503 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 3504 sout | t1 | t2 | " \"" | sepTuple | "\"" | endl;3504 sout | t1 | t2 | " \"" | sepTuple | "\""; 3505 3505 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 separator3509 sout | sepEnable | 1 | 2 | 3 | endl; // globally turn on implicit separator3510 3511 sout | 1 | sepOff | 2 | 3 | endl; // locally turn on implicit separator3512 sout | sepDisable | 1 | sepOn | 2 | 3 | endl; // globally turn off implicit separator3506 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 3513 3513 sout | sepEnable; 3514 sout | t1 | sepOff | t2 | endl; // locally turn on/off implicit separator3515 3516 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // sepOn does nothing at start/end of line3517 sout | sep | 1 | 2 | 3 | sep | endl; // use sep to print separator at start/end of line3514 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 3518 3518 } 3519 3519 … … 4180 4180 Fibonacci f1, f2; 4181 4181 for ( int i = 1; i <= 10; i += 1 ) { 4182 sout | next( &f1 ) | ' ' | next( &f2 ) | endl;4182 sout | next( &f1 ) | ' ' | next( &f2 ); 4183 4183 } // for 4184 4184 } … … 4246 4246 MyThread f[4]; 4247 4247 } 4248 sout | global.value | endl;4248 sout | global.value; 4249 4249 } 4250 4250 \end{cfa} … … 4324 4324 void main( First * this ) { 4325 4325 for ( int i = 0; i < 10; i += 1 ) { 4326 sout | "First : Suspend No." | i + 1 | endl;4326 sout | "First : Suspend No." | i + 1; 4327 4327 yield(); 4328 4328 } … … 4333 4333 wait( this->lock ); 4334 4334 for ( int i = 0; i < 10; i += 1 ) { 4335 sout | "Second : Suspend No." | i + 1 | endl;4335 sout | "Second : Suspend No." | i + 1; 4336 4336 yield(); 4337 4337 } … … 4340 4340 int main( void ) { 4341 4341 signal_once lock; 4342 sout | "User main begin" | endl;4342 sout | "User main begin"; 4343 4343 { 4344 4344 processor p; … … 4348 4348 } 4349 4349 } 4350 sout | "User main end" | endl;4350 sout | "User main end"; 4351 4351 } 4352 4352 \end{cfa} … … 5045 5045 void ?{}( Line * l ) { 5046 5046 l->lnth = 0.0; 5047 sout | "default" | endl;5047 sout | "default"; 5048 5048 } 5049 5049 … … 5052 5052 void ?{}( Line * l, float lnth ) { 5053 5053 l->lnth = lnth; 5054 sout | "lnth" | l->lnth | endl;5054 sout | "lnth" | l->lnth; 5055 5055 5056 5056 } … … 5058 5058 // destructor 5059 5059 void ^?() { 5060 sout | "destroyed" | endl;5060 sout | "destroyed"; 5061 5061 l.lnth = 0.0; 5062 5062 } … … 5804 5804 In particular, output of ©char© variable now print a character rather than the decimal ASCII value of the character. 5805 5805 \begin{cfa} 5806 sout | 'x' | " " | (int)'x' | endl;5806 sout | 'x' | " " | (int)'x'; 5807 5807 x 120 5808 5808 \end{cfa} … … 7034 7034 #include <gmp>§\indexc{gmp}§ 7035 7035 int main( void ) { 7036 sout | "Factorial Numbers" | endl;7036 sout | "Factorial Numbers"; 7037 7037 Int fact = 1; 7038 7038 7039 sout | 0 | fact | endl;7039 sout | 0 | fact; 7040 7040 for ( unsigned int i = 1; i <= 40; i += 1 ) { 7041 7041 fact *= i; 7042 sout | i | fact | endl;7042 sout | i | fact; 7043 7043 } 7044 7044 }
Note: See TracChangeset
for help on using the changeset viewer.