Changeset e945826 for doc/user/user.tex


Ignore:
Timestamp:
Apr 30, 2016, 2:05:06 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0638c44, 1048b31, fbfde843
Parents:
8bc4ef8
Message:

formatting in iostream.c, and change escape sequences in documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    r8bc4ef8 re945826  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Apr 28 14:45:07 2016
    14 %% Update Count     : 181
     13%% Last Modified On : Sat Apr 30 13:54:32 2016
     14%% Update Count     : 221
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
    1717% requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended
     18
     19% red highlighting ®...® (registered trademark sumbol)
     20% blue highlighting ©...© (copyright symbol)
     21% latex escape §...§ (section symbol)
     22% keyword escape ¶...¶ (pilcrow symbol)
     23% math escape $...$ (dollar symbol)
    1824
    1925\documentclass[openright,twoside]{article}
     
    231237This command works like the GNU \lstinline@gcc@\index{gcc} command, e.g.:
    232238\begin{lstlisting}
    233 cfa [ gcc-options ] C/@{\CFA}@-files [ assembler/loader-files ]
     239cfa [ gcc-options ] C/§\CFA§-files [ assembler/loader-files ]
    234240\end{lstlisting}
    235241\indexc{cfa}\index{compilation!cfa@\lstinline$cfa$}
    236242By default, \CFA programs having the following \lstinline@gcc@ flags turned on:
    237243\begin{description}
    238 \item
    239 \hspace*{-4pt}\lstinline@-std=gnu99@
    240 \indexc{-std=gnu99}\index{compilation option!-std=gnu99@{\lstinline$-std=gnu99$}}
     244\item\hspace*{-4pt}\Indexc{-std=gnu99}\index{compilation option!-std=gnu99@{\lstinline$-std=gnu99$}}
    241245The 1999 C standard plus GNU extensions.
    242 \item
    243 \hspace*{-4pt}\lstinline@-fgnu89-inline@
    244 \indexc{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline$-fgnu89-inline$}}
     246\item\hspace*{-4pt}\Indexc{-fgnu89-¶inline¶}\index{compilation option!-fgnu89-inline@{\lstinline$-fgnu89-¶inline¶$}}
    245247Use the traditional GNU semantics for inline routines in C99 mode.
    246248\end{description}
    247249The following new \CFA option is available:
    248250\begin{description}
    249 \item
    250 \hspace*{-4pt}\lstinline@-CFA@
    251 \indexc{-CFA}\index{compilation option!-CFA@{\lstinline$-CFA$}}
     251\item\hspace*{-4pt}\Indexc{-CFA}\index{compilation option!-CFA@{\lstinline$-CFA$}}
    252252Only the C preprocessor and the \CFA translator steps are performed and the transformed program is written to standard output, which makes it possible to examine the code generated by the \CFA translator.
    253253\end{description}
     
    255255The following preprocessor variables are available:
    256256\begin{description}
    257 \item
    258 \hspace*{-4pt}\lstinline$__CFA__$
    259 \indexc{__CFA__}\index{preprocessor variables!__CFA__@{\lstinline$__CFA__$}}
     257\item\hspace*{-4pt}\Indexc{__CFA__}\index{preprocessor variables!__CFA__@{\lstinline$__CFA__$}}
    260258is always available during preprocessing and its value is the current major \Index{version number} of \CFA.\footnote{
    261259The C preprocessor allows only integer values in a preprocessor variable so a value like ``\Version'' is not allowed.
    262260Hence, the need to have three variables for the major, minor and patch version number.}
    263261
    264 \item
    265 \hspace*{-4pt}\lstinline$__CFA_MINOR__$
    266 \indexc{__CFA_MINOR__}\index{preprocessor variables!__CFA_MINOR__@{\lstinline$__CFA_MINOR__$}}
     262\item\hspace*{-4pt}\Indexc{__CFA_MINOR__}\index{preprocessor variables!__CFA_MINOR__@{\lstinline$__CFA_MINOR__$}}
    267263is always available during preprocessing and its value is the current minor \Index{version number} of \CFA.
    268264
    269 \item
    270 \hspace*{-4pt}\lstinline$__CFA_PATCH__$
    271 \indexc{__CFA_PATCH__}\index{preprocessor variables!__CFA_PATCH__@\lstinline$__CFA_PATCH__$}
     265\item\hspace*{-4pt}\Indexc{__CFA_PATCH__}\index{preprocessor variables!__CFA_PATCH__@\lstinline$__CFA_PATCH__$}
    272266is always available during preprocessing and its value is the current patch \Index{version number} of \CFA.
    273267
    274 \item
    275 \hspace*{-4pt}\lstinline$__CFORALL__$
    276 \indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@\lstinline$__CFORALL__$}
     268\item\hspace*{-4pt}\Indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@\lstinline$__CFORALL__$}
    277269is always available during preprocessing and it has no value.
    278270\end{description}
     
    282274\begin{lstlisting}
    283275#ifndef __CFORALL__
    284 #include <stdio.h>              // C header file
     276#include <stdio.h>                      // C header file
    285277#else
    286 #include <fstream>              // @\CFA{}@ header file
     278#include <fstream>                      // §\CFA{}§ header file
    287279#endif
    288280\end{lstlisting}
     
    294286Numeric constants are extended to allow \Index{underscore}s within constants\index{constant!underscore}, e.g.:
    295287\begin{lstlisting}
    296 2`_`147`_`483`_`648;                            // decimal constant
     2882®_®147®_®483®_®648;                            // decimal constant
    29728956_ul;                                          // decimal unsigned long constant
    2982900_377;                                          // octal constant
     
    360352\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}       & \multicolumn{1}{c}{\textbf{C}}        \\
    361353\begin{lstlisting}
    362 `* int x, y;`
     354®* int x, y;®
    363355\end{lstlisting}
    364356&
     
    488480The point of the new syntax is to allow returning multiple values from a routine~\cite{CLU,Galletly96}, e.g.:
    489481\begin{lstlisting}
    490 `[ int o1, int o2, char o3 ]` f( int i1, char i2, char i3 ) {
    491         @\emph{routine body}@
     482®[ int o1, int o2, char o3 ]® f( int i1, char i2, char i3 ) {
     483        §\emph{routine body}§
    492484}
    493485\end{lstlisting}
     
    500492Declaration qualifiers can only appear at the start of a routine definition, e.g.:
    501493\begin{lstlisting}
    502 extern [ int x ] g( int y ) {@\,@}
     494extern [ int x ] g( int y ) {§\,§}
    503495\end{lstlisting}
    504496Lastly, if there are no output parameters or input parameters, the brackets and/or parentheses must still be specified;
    505497in both cases the type is assumed to be void as opposed to old style C defaults of int return type and unknown parameter types, respectively, as in:
    506498\begin{lstlisting}
    507 [@\,@] g();                                             // no input or output parameters
     499[§\,§] g();                                             // no input or output parameters
    508500[ void ] g( void );                     // no input or output parameters
    509501\end{lstlisting}
     
    556548Because the value in the return variable is automatically returned when a \CFA routine terminates, the \lstinline@return@ statement \emph{does not} contain an expression, as in:
    557549\begin{lstlisting}
    558 `[ int x ]` f() {
     550®[ int x ]® f() {
    559551        ... x = 0; ... x = y; ...
    560         `return;` // implicitly return x
     552        ®return;® // implicitly return x
    561553}
    562554\end{lstlisting}
     
    836828
    837829int fred() {
    838         s.t.c = `S.`R;  // type qualification
    839         struct `S.`T t = { `S.`R, 1, 2 };
    840         enum `S.`C c;
    841         union `S.T.`U u;
     830        s.t.c = ®S.®R;  // type qualification
     831        struct ®S.®T t = { ®S.®R, 1, 2 };
     832        enum ®S.®C c;
     833        union ®S.T.®U u;
    842834}
    843835\end{lstlisting}
     
    863855qsort( ia, size );              // sort ascending order using builtin ?<?
    864856{
    865         `int ?<?( int x, int y ) { return x > y; }` // nested routine
     857        ®int ?<?( int x, int y ) { return x > y; }® // nested routine
    866858        qsort( ia, size );      // sort descending order by local redefinition
    867859}
     
    873865\begin{lstlisting}
    874866[* [int]( int )] foo() {                // int (*foo())( int )
    875         int `i` = 7;
     867        int ®i® = 7;
    876868        int bar( int p ) {
    877                 `i` += 1;                                       // dependent on local variable
    878                 sout | `i` | endl;
     869                ®i® += 1;                                       // dependent on local variable
     870                sout | ®i® | endl;
    879871        }
    880872        return bar;                                     // undefined because of local dependence
     
    897889The general syntax of a tuple is:
    898890\begin{lstlisting}
    899 [ $\emph{exprlist}$ ]
     891[ §\emph{exprlist}§ ]
    900892\end{lstlisting}
    901893where \lstinline@$\emph{exprlist}$@ is a list of one or more expressions separated by commas.
     
    917909The general syntax of a tuple type is:
    918910\begin{lstlisting}
    919 [ @\emph{typelist}@ ]
     911[ §\emph{typelist}§ ]
    920912\end{lstlisting}
    921913where \lstinline@$\emph{typelist}$@ is a list of one or more legal \CFA or C type specifications separated by commas, which may include other tuple type specifications.
     
    10471039Mass assignment has the following form:
    10481040\begin{lstlisting}
    1049 [ @\emph{lvalue}@, ..., @\emph{lvalue}@ ] = @\emph{expr}@;
    1050 \end{lstlisting}
    1051 The left-hand side is a tuple of \lstinline@$\emph{lvalues}$@, which is a list of expressions each yielding an address, i.e., any data object that can appear on the left-hand side of a conventional assignment statement.
     1041[ §\emph{lvalue}§, ..., §\emph{lvalue}§ ] = §\emph{expr}§;
     1042\end{lstlisting}
     1043The left-hand side is a tuple of \emph{lvalues}, which is a list of expressions each yielding an address, i.e., any data object that can appear on the left-hand side of a conventional assignment statement.
    10521044\lstinline@$\emph{expr}$@ is any standard arithmetic expression.
    10531045Clearly, the types of the entities being assigned must be type compatible with the value of the expression.
     
    10861078Multiple assignment has the following form:
    10871079\begin{lstlisting}
    1088 [ @\emph{lvalue}@, . . ., @\emph{lvalue}@ ] = [ @\emph{expr}@, . . ., @\emph{expr}@ ];
    1089 \end{lstlisting}
    1090 The left-hand side is a tuple of \lstinline@$\emph{lvalues}$@, and the right-hand side is a tuple of \lstinline@$\emph{expr}$@s.
    1091 Each \lstinline@$\emph{expr}$@ appearing on the righthand side of a multiple assignment statement is assigned to the corresponding \lstinline@$\emph{lvalues}$@ on the left-hand side of the statement using parallel semantics for each assignment.
     1080[ §\emph{lvalue}§, . . ., §\emph{lvalue}§ ] = [ §\emph{expr}§, . . ., §\emph{expr}§ ];
     1081\end{lstlisting}
     1082The left-hand side is a tuple of \emph{lvalues}, and the right-hand side is a tuple of \emph{expr}s.
     1083Each \emph{expr} appearing on the righthand side of a multiple assignment statement is assigned to the corresponding \emph{lvalues} on the left-hand side of the statement using parallel semantics for each assignment.
    10921084An example of multiple assignment is:
    10931085\begin{lstlisting}
     
    11261118Cascade assignment has the following form:
    11271119\begin{lstlisting}
    1128 @\emph{tuple}@ = @\emph{tuple}@ = ... = @\emph{tuple}@;
     1120§\emph{tuple}§ = §\emph{tuple}§ = ... = §\emph{tuple}§;
    11291121\end{lstlisting}
    11301122and it has the same parallel semantics as for mass and multiple assignment.
     
    11441136Its general form is:
    11451137\begin{lstlisting}
    1146 @\emph{expr}@ . [ @\emph{fieldlist}@ ]
    1147 @\emph{expr}@ -> [ @\emph{fieldlist}@ ]
    1148 \end{lstlisting}
    1149 \lstinline@$\emph{expr}$@ is any expression yielding a value of type record, e.g., \lstinline@struct@, \lstinline@union@.
    1150 Each element of \lstinline@$\emph{ fieldlist}$@ is an element of the record specified by \lstinline@$\emph{expr}$@.
     1138§\emph{expr}§ . [ §\emph{fieldlist}§ ]
     1139§\emph{expr}§ -> [ §\emph{fieldlist}§ ]
     1140\end{lstlisting}
     1141\emph{expr} is any expression yielding a value of type record, e.g., \lstinline@struct@, \lstinline@union@.
     1142Each element of \emph{ fieldlist} is an element of the record specified by \emph{expr}.
    11511143A record-field tuple may be used anywhere a tuple can be used. An example of the use of a record-field tuple is
    11521144the following:
     
    11881180\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}       & \multicolumn{1}{c}{\textbf{C}}        \\
    11891181\begin{lstlisting}
    1190 `L1:` for ( ... ) {
    1191         `L2:` for ( ... ) {
    1192                 `L3:` for ( ... ) {
    1193                         ... break `L1`; ...
    1194                         ... break `L2`; ...
    1195                         ... break `L3`; // or break
     1182®L1:® for ( ... ) {
     1183        ®L2:® for ( ... ) {
     1184                ®L3:® for ( ... ) {
     1185                        ... break ®L1®; ...
     1186                        ... break ®L2®; ...
     1187                        ... break ®L3®; // or break
    11961188                }
    11971189        }
     
    12181210\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}       & \multicolumn{1}{c}{\textbf{C}}        \\
    12191211\begin{lstlisting}
    1220 `L1`: for ( ... ) {
    1221         `L2`: for ( ... ) {
    1222                 `L3`: for ( ... ) {
    1223                         ... continue `L1`; ...
    1224                         ... continue `L2`; ...
    1225                         ... continue `L3`; ...
     1212®L1®: for ( ... ) {
     1213        ®L2®: for ( ... ) {
     1214                ®L3®: for ( ... ) {
     1215                        ... continue ®L1®; ...
     1216                        ... continue ®L2®; ...
     1217                        ... continue ®L3®; ...
    12261218
    12271219                }
     
    14591451\begin{lstlisting}
    14601452switch ( i ) {
    1461   `case 1, 3, 5`:
     1453  ®case 1, 3, 5®:
    14621454        ...
    1463   `case 2, 4, 6`:
     1455  ®case 2, 4, 6®:
    14641456        ...
    14651457}
     
    14911483\begin{lstlisting}
    14921484switch ( i ) {
    1493   `case 1~5:`
     1485  ®case 1~5:®
    14941486        ...
    1495   `case 10~15:`
     1487  ®case 10~15:®
    14961488        ...
    14971489}
     
    20482040For example, given
    20492041\begin{lstlisting}
    2050 auto j = `...`
     2042auto j = ®...®
    20512043\end{lstlisting}
    20522044and the need to write a routine to compute using \lstinline@j@
    20532045\begin{lstlisting}
    2054 void rtn( `...` parm );
     2046void rtn( ®...® parm );
    20552047rtn( j );
    20562048\end{lstlisting}
     
    23722364To make this work, a space is required after the field selection:
    23732365\begin{lstlisting}
    2374 `s.@\textvisiblespace@0` = 0;
    2375 `s.@\textvisiblespace@1` = 1;
     2366®s.§\textvisiblespace§0® = 0;
     2367®s.§\textvisiblespace§1® = 1;
    23762368\end{lstlisting}
    23772369While this sytact is awkward, it is unlikely many programers will name fields of a structure 0 or 1.
    2378 Like the \CC lexical problem with closing template-syntax, e.g, \lstinline@Foo<Bar<int`>>`@, this issue can be solved with a more powerful lexer/parser.
     2370Like the \CC lexical problem with closing template-syntax, e.g, \lstinline@Foo<Bar<int®>>®@, this issue can be solved with a more powerful lexer/parser.
    23792371
    23802372There are several ambiguous cases with operator identifiers, e.g., \lstinline@int *?*?()@, where the string \lstinline@*?*?@ can be lexed as \lstinline@*@/\lstinline@?*?@ or \lstinline@*?@/\lstinline@*?@.
     
    23832375The first case is for the function-call identifier \lstinline@?()@:
    23842376\begin{lstlisting}
    2385 int *@\textvisiblespace@?()();  // declaration: space required after '*'
    2386 *@\textvisiblespace@?()();              // expression: space required after '*'
     2377int *§\textvisiblespace§?()();  // declaration: space required after '*'
     2378*§\textvisiblespace§?()();              // expression: space required after '*'
    23872379\end{lstlisting}
    23882380Without the space, the string \lstinline@*?()@ is ambiguous without N character look ahead;
     
    23912383The 4 remaining cases occur in expressions:
    23922384\begin{lstlisting}
    2393 i++@\textvisiblespace@?i:0;             // space required before '?'
    2394 i--@\textvisiblespace@?i:0;             // space required before '?'
    2395 i@\textvisiblespace@?++i:0;             // space required after '?'
    2396 i@\textvisiblespace@?--i:0;             // space required after '?'
     2385i++§\textvisiblespace§?i:0;             // space required before '?'
     2386i--§\textvisiblespace§?i:0;             // space required before '?'
     2387i§\textvisiblespace§?++i:0;             // space required after '?'
     2388i§\textvisiblespace§?--i:0;             // space required after '?'
    23972389\end{lstlisting}
    23982390In the first two cases, the string \lstinline@i++?@ is ambiguous, where this string can be lexed as \lstinline@i@ / \lstinline@++?@ or \lstinline@i++@ / \lstinline@?@;
     
    40794071Given that nested types in C are equivalent to not using them, i.e., they are essentially useless, it is unlikely there are any realistic usages that break because of this incompatibility.
    40804072
    4081 
    40824073\item
    40834074Change: In C++, the name of a nested class is local to its enclosing class.
     
    40904081struct Y yy; // valid C, invalid C++
    40914082\end{lstlisting}
    4092 Rationale: C++ classes have member functions which require that classes establish scopes. The C rule
    4093 would leave classes as an incomplete scope mechanism which would prevent C++ programmers from maintaining
    4094 locality within a class. A coherent set of scope rules for C++ based on the C rule would be very
    4095 complicated and C++ programmers would be unable to predict reliably the meanings of nontrivial examples
    4096 involving nested or local functions.
    4097 Effect on original feature: Change of semantics of welldefined
    4098 feature.
    4099 Difficulty of converting: Semantic transformation. To make the struct type name visible in the scope of
    4100 the enclosing struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing
    4101 struct is defined. Example:
     4083Rationale: C++ classes have member functions which require that classes establish scopes.
     4084The C rule would leave classes as an incomplete scope mechanism which would prevent C++ programmers from maintaining locality within a class. A coherent set of scope rules for C++ based on the C rule would be very complicated and C++ programmers would be unable to predict reliably the meanings of nontrivial examples involving nested or local functions.
     4085Effect on original feature: Change of semantics of welldefined feature.
     4086Difficulty of converting: Semantic transformation. To make the struct type name visible in the scope of the enclosing struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing struct is defined. Example:
    41024087\begin{lstlisting}
    41034088struct Y; // struct Y and struct X are at the same scope
     
    41064091};
    41074092\end{lstlisting}
    4108 All the definitions of C struct types enclosed in other struct definitions and accessed outside the scope of
    4109 the enclosing struct could be exported to the scope of the enclosing struct. Note: this is a consequence of
    4110 the difference in scope rules, which is documented in 3.3.
     4093All the definitions of C struct types enclosed in other struct definitions and accessed outside the scope of the enclosing struct could be exported to the scope of the enclosing struct.
     4094Note: this is a consequence of the difference in scope rules, which is documented in 3.3.
    41114095How widely used: Seldom.
    41124096\end{enumerate}
     
    41244108\begin{lstlisting}
    41254109int x = 0, y = 1, z = 2;
    4126 `sout` `|` x `|` y `|` z `| endl`;
     4110®sout® ®|® x ®|® y ®|® z ®| endl®;
    41274111\end{lstlisting}
    41284112&
     
    41334117\end{tabular}
    41344118\end{quote2}
    4135 The \CFA form is half as many characters, and is similar to Python I/O with respect to implicit separators.
     4119The \CFA form is half as many characters, and is similar to \Index{Python} I/O with respect to implicit separators.
    41364120
    41374121The logical-or operator is used because it is the lowest-priority overloadable operator, other than assignment.
     
    41794163which is a local mechanism to disable insertion of the separator character.
    41804164\item
    4181 A seperator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off]@([{$£¥¿«@
     4165A seperator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off]@([{$£¥¡¿«@
    41824166%$
    41834167\begin{lstlisting}[mathescape=off]
    4184 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¿" | 7 | "x «" | 8 | endl;
     4168sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¡" | 7 | "x ¿" | 8 | "x «" | 9 | endl;
    41854169\end{lstlisting}
    41864170%$
    41874171\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    4188 x (1 x [2 x {3 x $4 x £5 x ¥6 x ¿7 x «8
     4172x (1 x [2 x {3 x $4 x £5 x ¥6 x ¡7 x ¿8 x «9
    41894173\end{lstlisting}
    41904174%$
     
    41994183\end{lstlisting}
    42004184\item
    4201 A seperator does not appear before or after a C string begining/ending with the characters: \lstinline[showspaces=true]@\`'" \f\n\r\t\v@
     4185A seperator does not appear before or after a C string begining/ending with the \Index{ASCII} quote or whitespace characters: \lstinline[showspaces=true]@`'" \t\v\f\r\n@
    42024186\begin{lstlisting}[belowskip=0pt]
    4203 sout | "x\`" | 1 | "\`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | endl;
    4204 \end{lstlisting}
    4205 \begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    4206 x\`1\`x'2'x"3"x x 4 x
    4207 \end{lstlisting}
    4208 \begin{lstlisting}[showtabs=true,aboveskip=0pt]
    4209 sout | "x\t" | 1 | "\tx" | endl;
    4210 x       1       x
     4187sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | "x\t" | 1 | "\tx" | endl;
     4188\end{lstlisting}
     4189\begin{lstlisting}[mathescape=off,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt]
     4190x`1`x'2'x"3"x x 4 x x   1       x
    42114191\end{lstlisting}
    42124192\end{enumerate}
     
    42604240        sout | '1' | '2' | '3' | endl;
    42614241        sout | 1 | "" | 2 | "" | 3 | endl;
    4262         sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¿" | 7 | "x «" | 8 | endl;
     4242        sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¡" | 7 | "x ¿" | 8 | "x «" | 9 | endl;
    42634243        sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | ") x" | 8 | "] x" | 9 | "} x"
    42644244                 | 10 | "% x" | 11 | "¢ x" | 12 | "» x" | endl;
    4265         sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | endl;
    4266         sout | "x\t" | 1 | "\tx" | endl;
     4245        sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | "x\t" | 1 | "\tx" | endl;
    42674246        sout | sepOn | 1 | 2 | 3 | sepOn | endl;        // separator at start of line
    42684247        sout | 1 | sepOff | 2 | 3 | endl;                       // turn off implicit separator temporarily
     
    42904269\subsection{malloc}
    42914270
    4292 \begin{lstlisting}[escapechar=^]
    4293 forall( otype T ) T * malloc( void );^\indexc{malloc}^
     4271\begin{lstlisting}
     4272forall( otype T ) T * malloc( void );§\indexc{malloc}§
    42944273forall( otype T ) T * malloc( char fill );
    42954274forall( otype T ) T * malloc( T * ptr, size_t size );
    42964275forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
    4297 forall( otype T ) T * calloc( size_t nmemb );^\indexc{calloc}^
    4298 forall( otype T ) T * realloc( T * ptr, size_t size );^\indexc{ato}^
     4276forall( otype T ) T * calloc( size_t nmemb );§\indexc{calloc}§
     4277forall( otype T ) T * realloc( T * ptr, size_t size );§\indexc{ato}§
    42994278forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
    43004279
    4301 forall( otype T ) T * aligned_alloc( size_t alignment );^\indexc{ato}^
     4280forall( otype T ) T * aligned_alloc( size_t alignment );§\indexc{ato}§
    43024281forall( otype T ) T * memalign( size_t alignment );             // deprecated
    43034282forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
     
    43104289\subsection{ato / strto}
    43114290
    4312 \begin{lstlisting}[escapechar=^]
    4313 int ato( const char * ptr );^\indexc{ato}^
     4291\begin{lstlisting}
     4292int ato( const char * ptr );§\indexc{ato}§
    43144293unsigned int ato( const char * ptr );
    43154294long int ato( const char * ptr );
     
    43414320\subsection{bsearch / qsort}
    43424321
    4343 \begin{lstlisting}[escapechar=^]
     4322\begin{lstlisting}
    43444323forall( otype T | { int ?<?( T, T ); } )
    4345 T * bsearch( const T key, const T * arr, size_t dimension );^\indexc{bsearch}^
     4324T * bsearch( const T key, const T * arr, size_t dimension );§\indexc{bsearch}§
    43464325
    43474326forall( otype T | { int ?<?( T, T ); } )
    4348 void qsort( const T * arr, size_t dimension );^\indexc{qsort}^
     4327void qsort( const T * arr, size_t dimension );§\indexc{qsort}§
    43494328\end{lstlisting}
    43504329
     
    43524331\subsection{abs}
    43534332
    4354 \begin{lstlisting}[escapechar=^]
    4355 char abs( char );^\indexc{abs}^
     4333\begin{lstlisting}
     4334char abs( char );§\indexc{abs}§
    43564335int abs( int );
    43574336long int abs( long int );
     
    43684347\subsection{random}
    43694348
    4370 \begin{lstlisting}[escapechar=^]
    4371 void rand48seed( long int s );^\indexc{rand48seed}^
    4372 char rand48();^\indexc{rand48}^
     4349\begin{lstlisting}
     4350void rand48seed( long int s );§\indexc{rand48seed}§
     4351char rand48();§\indexc{rand48}§
    43734352int rand48();
    43744353unsigned int rand48();
     
    43854364\subsection{min / max / swap}
    43864365
    4387 \begin{lstlisting}[escapechar=^]
     4366\begin{lstlisting}
    43884367forall( otype T | { int ?<?( T, T ); } )
    4389 T min( const T t1, const T t2 );^\indexc{min}^
     4368T min( const T t1, const T t2 );§\indexc{min}§
    43904369
    43914370forall( otype T | { int ?>?( T, T ); } )
    4392 T max( const T t1, const T t2 );^\indexc{max}^
     4371T max( const T t1, const T t2 );§\indexc{max}§
    43934372
    43944373forall( otype T )
    4395 void swap( T * t1, T * t2 );^\indexc{swap}^
     4374void swap( T * t1, T * t2 );§\indexc{swap}§
    43964375\end{lstlisting}
    43974376
     
    44054384\subsection{General}
    44064385
    4407 \begin{lstlisting}[escapechar=^]
    4408 float fabs( float );^\indexc{fabs}^
     4386\begin{lstlisting}
     4387float fabs( float );§\indexc{fabs}§
    44094388double fabs( double );
    44104389long double fabs( long double );
     
    44134392long double cabs( long double _Complex );
    44144393
    4415 float ?%?( float, float );^\indexc{fmod}^
     4394float ?%?( float, float );§\indexc{fmod}§
    44164395float fmod( float, float );
    44174396double ?%?( double, double );
     
    44204399long double fmod( long double, long double );
    44214400
    4422 float remainder( float, float );^\indexc{remainder}^
     4401float remainder( float, float );§\indexc{remainder}§
    44234402double remainder( double, double );
    44244403long double remainder( long double, long double );
    44254404
    4426 [ int, float ] remquo( float, float );^\indexc{remquo}^
     4405[ int, float ] remquo( float, float );§\indexc{remquo}§
    44274406float remquo( float, float, int * );
    44284407[ int, double ] remquo( double, double );
     
    44324411
    44334412[ int, float ] div( float, float );                                             // alternative name for remquo
    4434 float div( float, float, int * );^\indexc{div}^
     4413float div( float, float, int * );§\indexc{div}§
    44354414[ int, double ] div( double, double );
    44364415double div( double, double, int * );
     
    44384417long double div( long double, long double, int * );
    44394418
    4440 float fma( float, float, float );^\indexc{fma}^
     4419float fma( float, float, float );§\indexc{fma}§
    44414420double fma( double, double, double );
    44424421long double fma( long double, long double, long double );
    44434422
    4444 float fdim( float, float );^\indexc{fdim}^
     4423float fdim( float, float );§\indexc{fdim}§
    44454424double fdim( double, double );
    44464425long double fdim( long double, long double );
    44474426
    4448 float nan( const char * );^\indexc{nan}^
     4427float nan( const char * );§\indexc{nan}§
    44494428double nan( const char * );
    44504429long double nan( const char * );
     
    44544433\subsection{Exponential}
    44554434
    4456 \begin{lstlisting}[escapechar=^]
    4457 float exp( float );^\indexc{exp}^
     4435\begin{lstlisting}
     4436float exp( float );§\indexc{exp}§
    44584437double exp( double );
    44594438long double exp( long double );
     
    44624441long double _Complex exp( long double _Complex );
    44634442
    4464 float exp2( float );^\indexc{exp2}^
     4443float exp2( float );§\indexc{exp2}§
    44654444double exp2( double );
    44664445long double exp2( long double );
     
    44694448long double _Complex exp2( long double _Complex );
    44704449
    4471 float expm1( float );^\indexc{expm1}^
     4450float expm1( float );§\indexc{expm1}§
    44724451double expm1( double );
    44734452long double expm1( long double );
    44744453
    4475 float log( float );^\indexc{log}^
     4454float log( float );§\indexc{log}§
    44764455double log( double );
    44774456long double log( long double );
     
    44804459long double _Complex log( long double _Complex );
    44814460
    4482 float log2( float );^\indexc{log2}^
     4461float log2( float );§\indexc{log2}§
    44834462double log2( double );
    44844463long double log2( long double );
     
    44874466long double _Complex log2( long double _Complex );
    44884467
    4489 float log10( float );^\indexc{log10}^
     4468float log10( float );§\indexc{log10}§
    44904469double log10( double );
    44914470long double log10( long double );
     
    44944473long double _Complex log10( long double _Complex );
    44954474
    4496 float log1p( float );^\indexc{log1p}^
     4475float log1p( float );§\indexc{log1p}§
    44974476double log1p( double );
    44984477long double log1p( long double );
    44994478
    4500 int ilogb( float );^\indexc{ilogb}^
     4479int ilogb( float );§\indexc{ilogb}§
    45014480int ilogb( double );
    45024481int ilogb( long double );
    45034482
    4504 float logb( float );^\indexc{logb}^
     4483float logb( float );§\indexc{logb}§
    45054484double logb( double );
    45064485long double logb( long double );
     
    45104489\subsection{Power}
    45114490
    4512 \begin{lstlisting}[escapechar=^]
    4513 float sqrt( float );^\indexc{sqrt}^
     4491\begin{lstlisting}
     4492float sqrt( float );§\indexc{sqrt}§
    45144493double sqrt( double );
    45154494long double sqrt( long double );
     
    45184497long double _Complex sqrt( long double _Complex );
    45194498
    4520 float cbrt( float );^\indexc{cbrt}^
     4499float cbrt( float );§\indexc{cbrt}§
    45214500double cbrt( double );
    45224501long double cbrt( long double );
    45234502
    4524 float hypot( float, float );^\indexc{hypot}^
     4503float hypot( float, float );§\indexc{hypot}§
    45254504double hypot( double, double );
    45264505long double hypot( long double, long double );
    45274506
    4528 float pow( float, float );^\indexc{pow}^
     4507float pow( float, float );§\indexc{pow}§
    45294508double pow( double, double );
    45304509long double pow( long double, long double );
     
    45374516\subsection{Trigonometric}
    45384517
    4539 \begin{lstlisting}[escapechar=^]
    4540 float sin( float );^\indexc{sin}^
     4518\begin{lstlisting}
     4519float sin( float );§\indexc{sin}§
    45414520double sin( double );
    45424521long double sin( long double );
     
    45454524long double _Complex sin( long double _Complex );
    45464525
    4547 float cos( float );^\indexc{cos}^
     4526float cos( float );§\indexc{cos}§
    45484527double cos( double );
    45494528long double cos( long double );
     
    45524531long double _Complex cos( long double _Complex );
    45534532
    4554 float tan( float );^\indexc{tan}^
     4533float tan( float );§\indexc{tan}§
    45554534double tan( double );
    45564535long double tan( long double );
     
    45594538long double _Complex tan( long double _Complex );
    45604539
    4561 float asin( float );^\indexc{asin}^
     4540float asin( float );§\indexc{asin}§
    45624541double asin( double );
    45634542long double asin( long double );
     
    45664545long double _Complex asin( long double _Complex );
    45674546
    4568 float acos( float );^\indexc{acos}^
     4547float acos( float );§\indexc{acos}§
    45694548double acos( double );
    45704549long double acos( long double );
     
    45734552long double _Complex acos( long double _Complex );
    45744553
    4575 float atan( float );^\indexc{atan}^
     4554float atan( float );§\indexc{atan}§
    45764555double atan( double );
    45774556long double atan( long double );
     
    45804559long double _Complex atan( long double _Complex );
    45814560
    4582 float atan2( float, float );^\indexc{atan2}^
     4561float atan2( float, float );§\indexc{atan2}§
    45834562double atan2( double, double );
    45844563long double atan2( long double, long double );
    45854564
    45864565float atan( float, float );                                                             // alternative name for atan2
    4587 double atan( double, double );^\indexc{atan}^
     4566double atan( double, double );§\indexc{atan}§
    45884567long double atan( long double, long double );
    45894568\end{lstlisting}
     
    45924571\subsection{Hyperbolic}
    45934572
    4594 \begin{lstlisting}[escapechar=^]
    4595 float sinh( float );^\indexc{sinh}^
     4573\begin{lstlisting}
     4574float sinh( float );§\indexc{sinh}§
    45964575double sinh( double );
    45974576long double sinh( long double );
     
    46004579long double _Complex sinh( long double _Complex );
    46014580
    4602 float cosh( float );^\indexc{cosh}^
     4581float cosh( float );§\indexc{cosh}§
    46034582double cosh( double );
    46044583long double cosh( long double );
     
    46074586long double _Complex cosh( long double _Complex );
    46084587
    4609 float tanh( float );^\indexc{tanh}^
     4588float tanh( float );§\indexc{tanh}§
    46104589double tanh( double );
    46114590long double tanh( long double );
     
    46144593long double _Complex tanh( long double _Complex );
    46154594
    4616 float asinh( float );^\indexc{asinh}^
     4595float asinh( float );§\indexc{asinh}§
    46174596double asinh( double );
    46184597long double asinh( long double );
     
    46214600long double _Complex asinh( long double _Complex );
    46224601
    4623 float acosh( float );^\indexc{acosh}^
     4602float acosh( float );§\indexc{acosh}§
    46244603double acosh( double );
    46254604long double acosh( long double );
     
    46284607long double _Complex acosh( long double _Complex );
    46294608
    4630 float atanh( float );^\indexc{atanh}^
     4609float atanh( float );§\indexc{atanh}§
    46314610double atanh( double );
    46324611long double atanh( long double );
     
    46394618\subsection{Error / Gamma}
    46404619
    4641 \begin{lstlisting}[escapechar=^]
    4642 float erf( float );^\indexc{erf}^
     4620\begin{lstlisting}
     4621float erf( float );§\indexc{erf}§
    46434622double erf( double );
    46444623long double erf( long double );
     
    46474626long double _Complex erf( long double _Complex );
    46484627
    4649 float erfc( float );^\indexc{erfc}^
     4628float erfc( float );§\indexc{erfc}§
    46504629double erfc( double );
    46514630long double erfc( long double );
     
    46544633long double _Complex erfc( long double _Complex );
    46554634
    4656 float lgamma( float );^\indexc{lgamma}^
     4635float lgamma( float );§\indexc{lgamma}§
    46574636double lgamma( double );
    46584637long double lgamma( long double );
     
    46614640long double lgamma( long double, int * );
    46624641
    4663 float tgamma( float );^\indexc{tgamma}^
     4642float tgamma( float );§\indexc{tgamma}§
    46644643double tgamma( double );
    46654644long double tgamma( long double );
     
    46694648\subsection{Nearest Integer}
    46704649
    4671 \begin{lstlisting}[escapechar=^]
    4672 float floor( float );^\indexc{floor}^
     4650\begin{lstlisting}
     4651float floor( float );§\indexc{floor}§
    46734652double floor( double );
    46744653long double floor( long double );
    46754654
    4676 float ceil( float );^\indexc{ceil}^
     4655float ceil( float );§\indexc{ceil}§
    46774656double ceil( double );
    46784657long double ceil( long double );
    46794658
    4680 float trunc( float );^\indexc{trunc}^
     4659float trunc( float );§\indexc{trunc}§
    46814660double trunc( double );
    46824661long double trunc( long double );
    46834662
    4684 float rint( float );^\indexc{rint}^
     4663float rint( float );§\indexc{rint}§
    46854664long double rint( long double );
    46864665long int rint( float );
     
    46914670long long int rint( long double );
    46924671
    4693 long int lrint( float );^\indexc{lrint}^
     4672long int lrint( float );§\indexc{lrint}§
    46944673long int lrint( double );
    46954674long int lrint( long double );
     
    46984677long long int llrint( long double );
    46994678
    4700 float nearbyint( float );^\indexc{nearbyint}^
     4679float nearbyint( float );§\indexc{nearbyint}§
    47014680double nearbyint( double );
    47024681long double nearbyint( long double );
    47034682
    4704 float round( float );^\indexc{round}^
     4683float round( float );§\indexc{round}§
    47054684long double round( long double );
    47064685long int round( float );
     
    47114690long long int round( long double );
    47124691
    4713 long int lround( float );^\indexc{lround}^
     4692long int lround( float );§\indexc{lround}§
    47144693long int lround( double );
    47154694long int lround( long double );
     
    47224701\subsection{Manipulation}
    47234702
    4724 \begin{lstlisting}[escapechar=^]
    4725 float copysign( float, float );^\indexc{copysign}^
     4703\begin{lstlisting}
     4704float copysign( float, float );§\indexc{copysign}§
    47264705double copysign( double, double );
    47274706long double copysign( long double, long double );
    47284707
    4729 float frexp( float, int * );^\indexc{frexp}^
     4708float frexp( float, int * );§\indexc{frexp}§
    47304709double frexp( double, int * );
    47314710long double frexp( long double, int * );
    47324711
    4733 float ldexp( float, int );^\indexc{ldexp}^
     4712float ldexp( float, int );§\indexc{ldexp}§
    47344713double ldexp( double, int );
    47354714long double ldexp( long double, int );
    47364715
    4737 [ float, float ] modf( float );^\indexc{modf}^
     4716[ float, float ] modf( float );§\indexc{modf}§
    47384717float modf( float, float * );
    47394718[ double, double ] modf( double );
     
    47424721long double modf( long double, long double * );
    47434722
    4744 float nextafter( float, float );^\indexc{nextafter}^
     4723float nextafter( float, float );§\indexc{nextafter}§
    47454724double nextafter( double, double );
    47464725long double nextafter( long double, long double );
    47474726
    4748 float nexttoward( float, long double );^\indexc{nexttoward}^
     4727float nexttoward( float, long double );§\indexc{nexttoward}§
    47494728double nexttoward( double, long double );
    47504729long double nexttoward( long double, long double );
    47514730
    4752 float scalbn( float, int );^\indexc{scalbn}^
     4731float scalbn( float, int );§\indexc{scalbn}§
    47534732double scalbn( double, int );
    47544733long double scalbn( long double, int );
    47554734
    4756 float scalbln( float, long int );^\indexc{scalbln}^
     4735float scalbln( float, long int );§\indexc{scalbln}§
    47574736double scalbln( double, long int );
    47584737long double scalbln( long double, long int );
     
    47664745When creating and computing with rational numbers, results are constantly reduced to keep the numerator and denominator as small as possible.
    47674746
    4768 \begin{lstlisting}[escapechar=^]
     4747\begin{lstlisting}
    47694748// implementation
    4770 struct Rational {^\indexc{Rational}^
     4749struct Rational {§\indexc{Rational}§
    47714750        long int numerator, denominator;                                        // invariant: denominator > 0
    47724751}; // Rational
Note: See TracChangeset for help on using the changeset viewer.