Changeset 0583064b


Ignore:
Timestamp:
Mar 23, 2017, 10:39:30 AM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
6013bd7, 7895d46
Parents:
89e1b16
Message:

additions to printing tuples, iostream, nad user documentations

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    r89e1b16 r0583064b  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Mon Feb 20 12:35:48 2017
    14 %% Update Count     : 1377
     13%% Last Modified On : Thu Mar 23 09:53:57 2017
     14%% Update Count     : 1399
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    9191}% title
    9292
    93 \author{\huge
    94 Peter A. Buhr and ...
     93\author{
     94\huge \CFA Team \medskip \\
     95\Large Peter A. Buhr, Richard Bilson, Thierry Delisle, \smallskip \\
     96\Large Glen Ditchfield, Rodolfo G. Esteves, Aaron Moss, Rob Schluntz
    9597}% author
    9698
     
    46574659which is a local mechanism to disable insertion of the separator character.
    46584660\item
    4659 A separator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off]@([{$£¥¡¿«@
     4661A separator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off]@([{=$£¥¡¿«@
    46604662%$
    46614663\begin{lstlisting}[mathescape=off]
    4662 sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¡" | 7
    4663          | "x ¿" | 8 | "x «" | 9 | endl;
     4664sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x =" | 4 | "x $" | 5 | "x £" | 6 | "x ¥" | 7
     4665         | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 | endl;
    46644666\end{lstlisting}
    46654667%$
    46664668\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    4667 x (1 x [2 x {3 x $4 x £5 x ¥6 x ¡7 x ¿8 x «9
     4669x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10
    46684670\end{lstlisting}
    46694671%$
    46704672\item
     4673{\lstset{deletedelim=**[is][]{¢}{¢}}
    46714674A seperator does not appear after a C string ending with the (extended) \Index{ASCII}\index{ASCII!extended} characters: ©,.:;!?)]}%¢»©
    46724675\begin{lstlisting}[belowskip=0pt]
    4673 sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7
    4674          | ") x" | 8 | "] x" | 9 | "} x" | 10 | "% x" | 11 | "¢ x" | 12 | "» x" | endl;
     4676sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | "% x"
     4677         | 8 | "¢ x" | 9 | "» x" | 10 | ") x" | 11 | "] x" | 12 | "} x" | endl;
    46754678\end{lstlisting}
    46764679\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    4677 1, x 2. x 3: x 4; x 5! x 6? x 7) x 8] x 9} x 10% x 11¢ 12»
    4678 \end{lstlisting}
     46801, x 2. x 3: x 4; x 5! x 6? x 7% x 8¢ x 9» x 10) x 11] x 12} x
     4681\end{lstlisting}}%
    46794682\item
    46804683A 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@
     
    46944697\end{lstlisting}
    46954698\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    4696 sout | 1 | sepOff | 2 | 3 | endl;                       §\C{// turn off implicit separator temporarily}§
     4699sout | 1 | sepOff | 2 | 3 | endl;                       §\C{// turn off implicit separator locally}§
    46974700\end{lstlisting}
    46984701\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    47004703\end{lstlisting}
    47014704\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    4702 sout | sepDisable | 1 | 2 | 3 | endl;           §\C{// turn off implicit separation, affects all subsequent prints
     4705sout | sepDisable | 1 | 2 | 3 | endl;           §\C{// turn off implicit separation globally
    47034706\end{lstlisting}
    47044707\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    47064709\end{lstlisting}
    47074710\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    4708 sout | 1 | sepOn | 2 | 3 | endl;                        §\C{// turn on implicit separator temporarily}§
     4711sout | 1 | sepOn | 2 | 3 | endl;                        §\C{// turn on implicit separator locally}§
    47094712\end{lstlisting}
    47104713\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    47124715\end{lstlisting}
    47134716\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    4714 sout | sepEnable | 1 | 2 | 3 | endl;            §\C{// turn on implicit separation, affects all subsequent prints
     4717sout | sepEnable | 1 | 2 | 3 | endl;            §\C{// turn on implicit separation globally
    47154718\end{lstlisting}
    47164719\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    47304733
    47314734int main() {
    4732         int x = 3, y = 5, z = 7;
    4733         sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
     4735        int x = 0, y = 1, z = 2;
     4736        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl | endl;
    47344737        sout | 1 | 2 | 3 | endl;
    47354738        sout | '1' | '2' | '3' | endl;
    47364739        sout | 1 | "" | 2 | "" | 3 | endl;
    4737         sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¡" | 7 | "x ¿" | 8 | "x «" | 9 | endl;
    4738         sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | ") x" | 8 | "] x" | 9 | "} x"
    4739                  | 10 | "% x" | 11 | "¢ x" | 12 | "» x" | endl;
     4740        sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x =" | 4 | "x $" | 5 | "x £" | 6 | "x ¥" | 7
     4741                | "x ¡" | 8 | "x ¿" | 9 | "x «" | 10 | endl;
     4742        sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | "% x"
     4743                | 8 | "¢ x" | 9 | "» x" | 10 | ") x" | 11 | "] x" | 12 | "} x" | endl;
    47404744        sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x" | "x " | 4 | " x" | "x\t" | 1 | "\tx" | endl;
    47414745        sout | sepOn | 1 | 2 | 3 | sepOn | endl;        // separator at start of line
  • src/libcfa/fstream.c

    r89e1b16 r0583064b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 22 16:17:21 2017
    13 // Update Count     : 221
     12// Last Modified On : Thu Mar 23 08:20:41 2017
     13// Update Count     : 226
    1414//
    1515
     
    2929#define IO_MSG "I/O error: "
    3030
     31void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) {
     32        this->file = file;
     33        this->sepDefault = sepDefault;
     34        this->sepOnOff = sepOnOff;
     35        sepSet( this, separator );
     36        sepSetCur( this, sepGet( this ) );
     37        sepSetTuple( this, tupleSeparator );
     38}
     39
    3140_Bool sepPrt( ofstream * os ) { return os->sepOnOff; }
    3241void sepOn( ofstream * os ) { os->sepOnOff = 1; }
     
    8392                exit( EXIT_FAILURE );
    8493        } // if
    85         os->file = file;
    86         sepOff( os );
    87         sepSet( os, " " );
     94        ?{}( os, file, 1, 0, " ", ", " );
    8895} // open
    8996
     
    125132} // fmt
    126133
    127 void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) {
    128         this->file = file;
    129         this->sepDefault = sepDefault;
    130         this->sepOnOff = sepOnOff;
    131         sepSet( this, separator );
    132         sepSetCur( this, sepGet( this ) );
    133         sepSetTuple( this, tupleSeparator );
    134 }
    135 
    136134static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " };
    137135ofstream *sout = &soutFile;
  • src/libcfa/iostream.c

    r89e1b16 r0583064b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 22 17:46:06 2017
    13 // Update Count     : 359
     12// Last Modified On : Thu Mar 23 08:20:40 2017
     13// Update Count     : 367
    1414//
    1515
     
    201201forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
    202202ostype * ?|?( ostype * os, T arg, Params rest ) {
    203         forall( ttype Params ) ostype * prtTuple( T arg, Params rest ) {
    204                 os | arg;                                                                               // print first argument
    205                 os | rest;                                                                              // print remaining arguments
    206                 return os;
    207         } // prtTuple
    208203        sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    209         prtTuple( arg, rest );                                                          // recursively print tuple
     204        os | arg;                                                                                       // print first argument
     205        os | rest;                                                                                      // print remaining arguments
    210206        sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
    211207        return os;
     
    223219        os | '\n';
    224220        flush( os );
    225         sepOff( os );
     221        sepOff( os );                                                                           // prepare for next line
    226222        return os;
    227223} // endl
Note: See TracChangeset for help on using the changeset viewer.