Changes in / [cfcbd03:8514bcf8]


Ignore:
Location:
doc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.sty

    rcfcbd03 r8514bcf8  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Sep 29 16:48:59 2023
    14 %% Update Count     : 587
     13%% Last Modified On : Sun Jul 16 08:28:52 2023
     14%% Update Count     : 586
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    272272\setlength{\gcolumnposn}{2.75in}
    273273\setlength{\columnposn}{\gcolumnposn}
    274 \newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn}
    275274\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
    276275\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
     
    303302literate=
    304303  {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
    305   {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
     304  {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    306305  {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1
    307306  {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1
  • doc/LaTeXmacros/common.tex

    rcfcbd03 r8514bcf8  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Sep 29 16:49:02 2023
    14 %% Update Count     : 590
     13%% Last Modified On : Fri Jul 21 09:02:00 2023
     14%% Update Count     : 576
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    275275\setlength{\gcolumnposn}{2.75in}
    276276\setlength{\columnposn}{\gcolumnposn}
    277 \newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn}
    278277\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
    279278\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
     
    302301showlines=true,                                                 % show blank lines at end of code
    303302aboveskip=4pt,                                                  % spacing above/below code block
    304 belowskip=2pt,
     303belowskip=0pt,
    305304numberstyle=\footnotesize\sf,                   % numbering style
    306305% replace/adjust listing characters that look bad in sanserif
    307306literate=
    308307  {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
    309   {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
     308  {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    310309  {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1
    311310  {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1
  • doc/LaTeXmacros/lstlang.sty

    rcfcbd03 r8514bcf8  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Thu Sep 21 08:40:05 2023
    11 %% Update Count     : 31
     10%% Last Modified On : Tue May  2 08:52:35 2023
     11%% Update Count     : 30
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    134134        morekeywords={
    135135                _Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _Catch, _CatchResume, _CorActor, _Cormonitor, _Coroutine,
    136                 _Disable, _Else, _Enable, _Event, _Exception, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
     136                _Disable, _Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
    137137                _Resume, _ResumeTop, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
    138138}
  • doc/bibliography/pl.bib

    rcfcbd03 r8514bcf8  
    41134113    title       = {High-Performance Extended Actors},
    41144114    journal     = spe,
    4115     year        = 2023,
    4116     month       = sep,
    4117     note        = {\url{https://onlinelibrary.wiley.com/doi/pdf/10.1002/spe.3262}}
     4115    year        = 2022,
     4116    note        = {submitted July 2022},
    41184117}
    41194118
  • doc/user/user.tex

    rcfcbd03 r8514bcf8  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat Sep 30 22:46:19 2023
    14 %% Update Count     : 5658
     13%% Last Modified On : Thu Sep 28 22:40:52 2023
     14%% Update Count     : 5578
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    6565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    6666
     67\setlength{\gcolumnposn}{3in}
    6768\CFAStyle                                                                                               % use default CFA format-style
    68 \setgcolumn{2.25in}
    6969%\lstset{language=CFA}                                                                  % CFA default lnaguage
    7070\lstnewenvironment{C++}[1][]                            % use C++ style
     
    537537Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism:
    538538\begin{cfa}
    539 int ®``®coroutine = 3;                                  $\C{// make keyword an identifier}$
     539int ®``®coroutine = 3; $\C{// make keyword an identifier}$
    540540double ®``®forall = 3.5;
    541541\end{cfa}
     
    547547\begin{cfa}
    548548// include file uses the CFA keyword "with".
    549 #if ! defined( with )                                   $\C{// nesting ?}$
    550 #define with ®``®with                                   $\C{// make keyword an identifier}$
     549#if ! defined( with )                                                   $\C{// nesting ?}$
     550#define with ®``®with                                                   $\C{// make keyword an identifier}$
    551551#define __CFA_BFD_H__
    552552#endif
    553 $\R{\#include\_next} <bfdlink.h>$               $\C{// must have internal check for multiple expansion}$
     553$\R{\#include\_next} <bfdlink.h>$                               $\C{// must have internal check for multiple expansion}$
    554554#if defined( with ) && defined( __CFA_BFD_H__ ) $\C{// reset only if set}$
    555555#undef with
     
    566566Numeric constants are extended to allow \Index{underscore}s\index{constant!underscore} as a separator, \eg:
    567567\begin{cfa}
    568 2®_®147®_®483®_®648;                                    $\C{// decimal constant}$
    569 56®_®ul;                                                                $\C{// decimal unsigned long constant}$
    570 0®_®377;                                                                $\C{// octal constant}$
    571 0x®_®ff®_®ff;                                                   $\C{// hexadecimal constant}$
    572 0x®_®ef3d®_®aa5c;                                               $\C{// hexadecimal constant}$
    573 3.141®_®592®_®654;                                              $\C{// floating constant}$
    574 10®_®e®_®+1®_®00;                                               $\C{// floating constant}$
    575 0x®_®ff®_®ff®_®p®_®3;                                   $\C{// hexadecimal floating}$
    576 0x®_®1.ffff®_®ffff®_®p®_®128®_®l;               $\C{// hexadecimal floating long constant}$
     5682®_®147®_®483®_®648; $\C{// decimal constant}$
     56956®_®ul; $\C{// decimal unsigned long constant}$
     5700®_®377; $\C{// octal constant}$
     5710x®_®ff®_®ff; $\C{// hexadecimal constant}$
     5720x®_®ef3d®_®aa5c; $\C{// hexadecimal constant}$
     5733.141®_®592®_®654; $\C{// floating constant}$
     57410®_®e®_®+1®_®00; $\C{// floating constant}$
     5750x®_®ff®_®ff®_®p®_®3; $\C{// hexadecimal floating}$
     5760x®_®1.ffff®_®ffff®_®p®_®128®_®l; $\C{// hexadecimal floating long constant}$
    577577L®_®$"\texttt{\textbackslash{x}}$®_®$\texttt{ff}$®_®$\texttt{ee}"$; $\C{// wide character constant}$
    578578\end{cfa}
     
    604604
    605605There are exponentiation operators for integral and floating types, including the builtin \Index{complex} types.
    606 Integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication ($O(\log y)$ multiplies or shifting if the exponent is 2).
     606Integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication\footnote{The multiplication computation is $O(\log y)$.} (or shifting if the exponent is 2).
    607607Overflow for a large exponent or negative exponent returns zero.
    608608Floating exponentiation\index{exponentiation!floating} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the exponent cannot be negative.
    609609\begin{cfa}
    610 sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi);
     610sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1
     611           | (1.0f+2.0fi) ®\® (3.0f+2.0fi);
    6116121 1 256 -64 125 ®0® 3273344365508751233 ®0® ®0® -0.015625 18.3791736799526 0.264715-1.1922i
    612613\end{cfa}
     
    621622T ?®\®?( T ep, unsigned long int y );
    622623\end{cfa}
    623 A user type ©T© must define multiplication, one (©1©), and ©*©.
     624The user type ©T© must define multiplication, one (©1©), and ©*©.
    624625
    625626
     
    635636Declarations in the \Indexc{do}-©while© condition are not useful because they appear after the loop body.}
    636637\begin{cfa}
    637 if ( ®int x = f()® ) ...                        $\C{// x != 0}$
    638 if ( ®int x = f(), y = g()® ) ...       $\C{// x != 0 \&\& y != 0}$
     638if ( ®int x = f()® ) ... $\C{// x != 0}$
     639if ( ®int x = f(), y = g()® ) ... $\C{// x != 0 \&\& y != 0}$
    639640if ( ®int x = f(), y = g(); x < y® ) ... $\C{// relational expression}$
    640641if ( ®struct S { int i; } x = { f() }; x.i < 4® ) $\C{// relational expression}$
    641642
    642 while ( ®int x = f()® ) ...                     $\C{// x != 0}$
     643while ( ®int x = f()® ) ... $\C{// x != 0}$
    643644while ( ®int x = f(), y = g()® ) ... $\C{// x != 0 \&\& y != 0}$
    644645while ( ®int x = f(), y = g(); x < y® ) ... $\C{// relational expression}$
     
    654655\label{s:caseClause}
    655656
    656 C restricts a \Indexc{case} clause in \Indexc{switch} statement to a single value.
    657 For multiple ©case© clauses prefixing a statement within the ©switch© statement, it is necessary to have multiple ©case© clauses rather than multiple values.
     657C restricts the \Indexc{case} clause of a \Indexc{switch} statement to a single value.
     658For multiple ©case© clauses associated with the same statement, it is necessary to have multiple ©case© clauses rather than multiple values.
    658659Requiring a ©case© clause for each value is not in the spirit of brevity normally associated with C.
    659660Therefore, the ©case© clause is extended with a list of values.
    660661\begin{cquote}
    661662\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    662 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      \\
     663\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     664\begin{cfa}
     665switch ( i ) {
     666  case ®1, 3, 5®:
     667        ...
     668  case ®2, 4, 6®:
     669        ...
     670}
     671\end{cfa}
     672&
    663673\begin{cfa}
    664674switch ( i ) {
     
    671681&
    672682\begin{cfa}
    673 switch ( i ) {
    674   case ®1, 3, 5®:
    675         ...
    676   case ®2, 4, 6®:
    677         ...
    678 }
    679 \end{cfa}
    680 &
    681 \begin{cfa}
    682683
    683684// odd values
     
    689690\end{tabular}
    690691\end{cquote}
    691 In addition, subranges are allowed to specify case values.
    692 \begin{cquote}
    693 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{\hspace{2em}}l@{}}
    694 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{©gcc©}}     \\
     692In addition, subranges are allowed to specify case values.\footnote{
     693gcc has the same mechanism but awkward syntax, \lstinline{2 ...42}, because a space is required after a number, otherwise the period is a decimal point.}
    695694\begin{cfa}
    696695switch ( i ) {
    697   case 1: case 2: case 3: case 4:
     696  case ®1~5:® $\C{// 1, 2, 3, 4, 5}$
    698697        ...
    699   case 10: case 11: case 12: case 13:
     698  case ®10~15:® $\C{// 10, 11, 12, 13, 14, 15}$
    700699        ...
    701700}
    702701\end{cfa}
    703 &
    704 \begin{cfa}
    705 switch ( i ) {
    706   case ®1~4:®
    707         ...
    708   case ®10~13:®
    709         ...
    710 }
    711 \end{cfa}
    712 &
    713 \begin{cfa}
    714 switch ( i ) {
    715   case 1$\R{\textvisiblespace}$®...®4:
    716         ...
    717   case 10$\R{\textvisiblespace}$®...®13:
    718         ...
    719 }
    720 \end{cfa}
    721 &
    722 \begin{cfa}
    723 
    724 // 1, 2, 3, 4
    725 
    726 // 10, 11, 12, 13
    727 
    728 
    729 \end{cfa}
    730 \end{tabular}
    731 \end{cquote}
    732 While ©gcc© has the same range mechanism, it has an awkward syntax, ©2©\R{\textvisiblespace}©...42©, because a space is required after a number, otherwise the period is a decimal point.
    733 
    734 \CFA also allows lists of subranges.
     702Lists of subranges are also allowed.
    735703\begin{cfa}
    736704case ®1~5, 12~21, 35~42®:
     
    803771This situation is better handled by a list of case values \see{\VRef{s:caseClause}}.
    804772While fall-through itself is not a problem, the problem occurs when fall-through is the default, as this semantics is unintuitive to many programmers and is different from most programming languages with a ©switch© statement.
    805 Hence, default fall-through semantics results in a many programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.
     773Hence, default fall-through semantics results in a large number of programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.
    806774
    807775\item
     
    880848and there is only a medium amount of fall-through from one ©case© clause to the next, and most of these result from a list of case values executing common code, rather than a sequence of case actions that compound.
    881849\end{itemize}
    882 These observations put into perspective the \CFA changes to the ©switch© statement.
     850These observations put into perspective the \CFA changes to the ©switch©.
    883851\begin{enumerate}
    884852\item
     
    922890\begin{cfa}
    923891switch ( x ) {
    924         ®int i = 0;®                                            $\C{// allowed only at start}$
     892        ®int i = 0;® $\C{// allowed only at start}$
    925893  case 0:
    926894        ...
    927         ®int j = 0;®                                            $\C{// disallowed}$
     895        ®int j = 0;® $\C{// disallowed}$
    928896  case 1:
    929897        {
    930                 ®int k = 0;®                                    $\C{// allowed at different nesting levels}$
     898                ®int k = 0;® $\C{// allowed at different nesting levels}$
    931899                ...
    932           ®case 2:®                                                     $\C{// disallow case in nested statements}$
     900          ®case 2:® $\C{// disallow case in nested statements}$
    933901        }
    934902  ...
     
    941909
    942910The \Indexc{fallthrough} clause may be non-terminating within a \Indexc{case} clause or have a target label to common code from multiple case clauses.
    943 \begin{cquote}
     911\begin{center}
    944912\begin{tabular}{@{}lll@{}}
    945913\begin{cfa}
     
    991959\end{cfa}
    992960\end{tabular}
    993 \end{cquote}
     961\end{center}
    994962The target label must be below the \Indexc{fallthrough} and may not be nested in a control structure, and
    995963the target label must be at the same or higher level as the containing \Indexc{case} clause and located at
     
    998966
    999967\begin{figure}
    1000 \begin{tabular}{@{}l@{\hspace{50pt}}|l@{}}
    1001 \multicolumn{1}{@{}c@{\hspace{50pt}}|}{loop control} & \multicolumn{1}{c@{}}{output} \\
     968\begin{tabular}{@{}l@{\hspace{40pt}}|l@{}}
     969\multicolumn{1}{@{}c@{\hspace{40pt}}|}{loop control} & \multicolumn{1}{c@{}}{output} \\
    1002970\hline
    1003971\begin{cfa}
     
    11171085The \Indexc{for}, \Indexc{while}, and \Indexc{do} loop-control allow an empty conditional, which implies a comparison value of ©1© (true).
    11181086\begin{cfa}
    1119 while ( ®/* empty */®  )                                $\C{// while ( true )}$
    1120 for ( ®/* empty */®  )                                  $\C{// for ( ; true; )}$
    1121 do ... while ( ®/* empty */®  )                 $\C{// do ... while ( true )}$
     1087while ( ®/*empty*/®  )                  $\C{// while ( true )}$
     1088for ( ®/*empty*/®  )                    $\C{// for ( ; true; )}$
     1089do ... while ( ®/*empty*/®  )    $\C{// do ... while ( true )}$
    11221090\end{cfa}
    11231091
     
    11491117If no type is specified for the loop index, it is the type of the high value H (when the low value is implicit) or the low value L.
    11501118\begin{cfa}
    1151 for ( ®5® )                                                             $\C{// typeof(5) anonymous-index; 5 is high value}$
    1152 for ( i; ®1.5® ~ 5.5 )                                  $\C{// typeof(1.5) i; 1.5 is low value}$
    1153 for ( ®int i®; 0 ~ 10 ~ 2 )                             $\C{// int i; type is explicit}$
     1119for ( ®5® )                                             $\C{// typeof(5) anonymous-index; 5 is high value}$
     1120for ( i; ®1.5® ~ 5.5 )                  $\C{// typeof(1.5) i; 1.5 is low value}$
     1121for ( ®int i®; 0 ~ 10 ~ 2 )             $\C{// int i; type is explicit}$
    11541122\end{cfa}
    11551123
     
    11591127H is implicit up-to exclusive range [0,H\R{)}.
    11601128\begin{cfa}
    1161 for ( ®5® )                                                             $\C{// for ( typeof(5) i; i < 5; i += 1 )}$
     1129for ( ®5® )                                             $\C{// for ( typeof(5) i; i < 5; i += 1 )}$
    11621130\end{cfa}
    11631131\item
    11641132©~=© H is implicit up-to inclusive range [0,H\R{]}.
    11651133\begin{cfa}
    1166 for ( ®~=® 5 )                                                  $\C{// for ( typeof(5) i; i <= 5; i += 1 )}$
     1134for ( ®~=® 5 )                                  $\C{// for ( typeof(5) i; i <= 5; i += 1 )}$
    11671135\end{cfa}
    11681136\item
    11691137L ©~©\index{~@©~©} H is explicit up-to exclusive range [L,H\R{)}.
    11701138\begin{cfa}
    1171 for ( 1 ®~® 5 )                                                 $\C{// for ( typeof(1) i = 1; i < 5; i += 1 )}$
     1139for ( 1 ®~® 5 )                                 $\C{// for ( typeof(1) i = 1; i < 5; i += 1 )}$
    11721140\end{cfa}
    11731141\item
    11741142L ©~=©\index{~=@©~=©} H is explicit up-to inclusive range [L,H\R{]}.
    11751143\begin{cfa}
    1176 for ( 1 ®~=® 5 )                                                $\C{// for ( typeof(1) i = 1; i <= 5; i += 1 )}$
     1144for ( 1 ®~=® 5 )                                        $\C{// for ( typeof(1) i = 1; i <= 5; i += 1 )}$
    11771145\end{cfa}
    11781146\item
    11791147L ©-~©\index{-~@©-~©} H is explicit down-to exclusive range [H,L\R{)}, where L and H are implicitly interchanged to make the range down-to.
    11801148\begin{cfa}
    1181 for ( 1 ®-~® 5 )                                                $\C{// for ( typeof(1) i = 5; i > 0; i -= 1 )}$
     1149for ( 1 ®-~® 5 )                                        $\C{// for ( typeof(1) i = 5; i > 0; i -= 1 )}$
    11821150\end{cfa}
    11831151\item
    11841152L ©-~=©\index{-~=@©-~=©} H is explicit down-to inclusive range [H,L\R{]}, where L and H are implicitly interchanged to make the range down-to.
    11851153\begin{cfa}
    1186 for ( 1 ®-~=® 5 )                                               $\C{// for ( typeof(1) i = 5; i >= 0; i -= 1 )}$
     1154for ( 1 ®-~=® 5 )                                       $\C{// for ( typeof(1) i = 5; i >= 0; i -= 1 )}$
    11871155\end{cfa}
    11881156\item
    11891157©@© means put nothing in this field.
    11901158\begin{cfa}
    1191 for ( i; 1 ~ ®@® ~ 2 )                                  $\C{// for ( typeof(1) i = 1; \R{/* empty */}; i += 2 )}$
    1192 for ( i; 1 ~ 10 ~ ®@® )                                 $\C{// for ( typeof(1) i = 1; i < 10; \R{/* empty */} )}$
    1193 for ( i; 1 ~ ®@® ~ ®@® )                                $\C{// for ( typeof(1) i = 1; /*empty*/; \R{/* empty */} )}$
     1159for ( i; 1 ~ ®@® ~ 2 )                  $\C{// for ( typeof(1) i = 1; \R{/* empty */}; i += 2 )}$
     1160for ( i; 1 ~ 10 ~ ®@® )                 $\C{// for ( typeof(1) i = 1; i < 10; \R{/* empty */} )}$
     1161for ( i; 1 ~ ®@® ~ ®@® )                $\C{// for ( typeof(1) i = 1; /*empty*/; \R{/* empty */} )}$
    11941162\end{cfa}
    11951163L cannot be elided for the up-to range, \lstinline{@ ~ 5}, and H for the down-to range, \lstinline{1 -~ @}, because then the loop index is uninitialized.
     
    11981166©:© means low another index.
    11991167\begin{cfa}
    1200 for ( i; 5 ®:® j; 2 ~ 12 ~ 3 )                  $\C{// for ( typeof(i) i = 1, j = 2; i < 5 \&\& j < 12; i += 1, j += 3 )}$
     1168for ( i; 5 ®:® j; 2 ~ 12 ~ 3 )          $\C{// for ( typeof(i) i = 1, j = 2; i < 5 \&\& j < 12; i += 1, j += 3 )}$
    12011169\end{cfa}
    12021170\end{itemize}
    12031171\R{Warning}: specifying the down-to range maybe unexpected because the loop control \emph{implicitly} switches the L and H values (and toggles the increment/decrement for I):
    12041172\begin{cfa}
    1205 for ( i; 1 ~ 10 )                                               ${\C{// up range}$
    1206 for ( i; 1 -~ 10 )                                              ${\C{// down range}$
    1207 for ( i; ®10 -~ 1® )                                    ${\C{// \R{WRONG down range!}}}$
     1173for ( i; 1 ~ 10 )       ${\C[1.5in]{// up range}$
     1174for ( i; 1 -~ 10 )      ${\C{// down range}$
     1175for ( i; ®10 -~ 1® )    ${\C{// \R{WRONG down range!}}\CRT}$
    12081176\end{cfa}
    12091177The reason for this semantics is that the range direction can be toggled by adding/removing the minus, ©'-'©, versus interchanging the L and H expressions, which has a greater chance of introducing errors.
     
    12221190
    12231191\begin{figure}
     1192\centering
    12241193\begin{lrbox}{\myboxA}
    1225 \begin{cfa}[tabsize=4]
     1194\begin{cfa}[tabsize=3]
    12261195®Compound:® {
    12271196        ®Try:® try {
     
    12531222
    12541223\begin{lrbox}{\myboxB}
    1255 \begin{cfa}[tabsize=4]
     1224\begin{cfa}[tabsize=3]
    12561225{
    12571226
     
    12821251\end{lrbox}
    12831252
    1284 \subfloat[C]{\label{f:CFAFibonacciGen}\usebox\myboxB}
     1253\subfloat[\CFA]{\label{f:CFibonacci}\usebox\myboxA}
    12851254\hspace{3pt}
    12861255\vrule
    12871256\hspace{3pt}
    1288 \subfloat[\CFA]{\label{f:CFibonacci}\usebox\myboxA}
     1257\subfloat[C]{\label{f:CFAFibonacciGen}\usebox\myboxB}
    12891258\caption{Multi-level Exit}
    12901259\label{f:MultiLevelExit}
     
    13201289int a[10];
    13211290\end{cfa}
    1322 \begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{3em}}l@{}}
     1291\begin{tabular}{@{}lll@{}}
    13231292\begin{cfa}
    13241293
     
    13611330Grouping heterogeneous data into an \newterm{aggregate} (structure/union) is a common programming practice, and aggregates may be nested:
    13621331\begin{cfa}
    1363 struct Person {                                                 $\C{// aggregate}$
    1364         struct Name {                                           $\C{// nesting}$
    1365                 char first[20], last[20];
    1366         } name;
    1367         struct Address {                                        $\C{// nesting}$
    1368                 ...
    1369         } address;
     1332struct Person {                                                         $\C{// aggregate}$
     1333        struct Name { char first[20], last[20]; } name $\C{// nesting}$
     1334        struct Address { ... } address                  $\C{// nesting}$
    13701335        int sex;
    13711336};
     
    13741339\begin{cfa}
    13751340Person p
    1376 ®p.®name; ®p.®address; ®p.®sex;                 $\C{// access containing fields}$
     1341®p.®name; ®p.®address; ®p.®sex; $\C{// access containing fields}$
    13771342\end{cfa}
    13781343which extends to multiple levels of qualification for nested aggregates and multiple aggregates.
     
    13891354\begin{cfa}
    13901355struct S {
    1391         struct $\R{\LstCommentStyle{/* unnamed */}}$  { int g,  h; } __attribute__(( aligned(64) ));
     1356        struct $\R{\LstCommentStyle{/* unnamed */}}$ { int g,  h; } __attribute__(( aligned(64) ));
    13921357        int tag;
    1393         union $\R{\LstCommentStyle{/* unnamed */}}$  {
     1358        union $\R{\LstCommentStyle{/* unnamed */}}$ {
    13941359                struct { char c1,  c2; } __attribute__(( aligned(128) ));
    13951360                struct { int i1,  i2; };
     
    14051370struct S {
    14061371        char ®c®;   int ®i®;   double ®d®;
    1407         void f( /* S * this */ ) {                      $\C{// implicit ``this'' parameter}$
    1408                 ®c®;   ®i®;   ®d®;                              $\C{// this->c; this->i; this->d;}$
     1372        void f( /* S * this */ ) {                              $\C{// implicit ``this'' parameter}$
     1373                ®c®;   ®i®;   ®d®;                                      $\C{// this->c; this->i; this->d;}$
    14091374        }
    14101375}
     
    14141379\begin{cfa}
    14151380struct T {
    1416         char ®m®;   int ®i®;   double ®n®;      $\C{// derived class variables}$
     1381        char ®m®;   int ®i®;   double ®n®;              $\C{// derived class variables}$
    14171382};
    14181383struct S : public T {
    1419         char ®c®;   int ®i®;   double ®d®;      $\C{// class variables}$
     1384        char ®c®;   int ®i®;   double ®d®;              $\C{// class variables}$
    14201385        void g( double ®d®, T & t ) {
    1421                 d;   ®t®.m;   ®t®.i;   ®t®.n;   $\C{// function parameter}$
    1422                 c;   i;   ®this->®d;   ®S::®d;  $\C{// class S variables}$
    1423                 m;   ®T::®i;   n;                               $\C{// class T variables}$
     1386                d;   ®t®.m;   ®t®.i;   ®t®.n;           $\C{// function parameter}$
     1387                c;   i;   ®this->®d;   ®S::®d;          $\C{// class S variables}$
     1388                m;   ®T::®i;   n;                                       $\C{// class T variables}$
    14241389        }
    14251390};
     
    14311396Hence, the qualified fields become variables with the side-effect that it is simpler to write, easier to read, and optimize field references in a block.
    14321397\begin{cfa}
    1433 void f( S & this ) ®with ( this )® {    $\C{// with statement}$
    1434         ®c®;   ®i®;   ®d®;                                      $\C{// this.c, this.i, this.d}$
     1398void f( S & this ) ®with ( this )® {            $\C{// with statement}$
     1399        ®c®;   ®i®;   ®d®;                                              $\C{// this.c, this.i, this.d}$
    14351400}
    14361401\end{cfa}
    14371402with the generality of opening multiple aggregate-parameters:
    14381403\begin{cfa}
    1439 void g( S & s, T & t ) ®with ( s, t )® {$\C{// multiple aggregate parameters}$
    1440         c;   ®s.®i;   d;                                        $\C{// s.c, s.i, s.d}$
    1441         m;   ®t.®i;   n;                                        $\C{// t.m, t.i, t.n}$
     1404void g( S & s, T & t ) ®with ( s, t )® {        $\C{// multiple aggregate parameters}$
     1405        c;   ®s.®i;   d;                                                $\C{// s.c, s.i, s.d}$
     1406        m;   ®t.®i;   n;                                                $\C{// t.m, t.i, t.n}$
    14421407}
    14431408\end{cfa}
     
    14621427struct R { int ®i®; int j; double ®m®; } r, w;
    14631428with ( r, q ) {
    1464         j + k;                                                          $\C{// unambiguous, r.j + q.k}$
    1465         m = 5.0;                                                        $\C{// unambiguous, q.m = 5.0}$
    1466         m = 1;                                                          $\C{// unambiguous, r.m = 1}$
    1467         int a = m;                                                      $\C{// unambiguous, a = r.i }$
    1468         double b = m;                                           $\C{// unambiguous, b = q.m}$
    1469         int c = r.i + q.i;                                      $\C{// disambiguate with qualification}$
    1470         (double)m;                                                      $\C{// disambiguate with cast}$
     1429        j + k;                                                                  $\C{// unambiguous, r.j + q.k}$
     1430        m = 5.0;                                                                $\C{// unambiguous, q.m = 5.0}$
     1431        m = 1;                                                                  $\C{// unambiguous, r.m = 1}$
     1432        int a = m;                                                              $\C{// unambiguous, a = r.i }$
     1433        double b = m;                                                   $\C{// unambiguous, b = q.m}$
     1434        int c = r.i + q.i;                                              $\C{// disambiguate with qualification}$
     1435        (double)m;                                                              $\C{// disambiguate with cast}$
    14711436}
    14721437\end{cfa}
     
    14761441\begin{cfa}
    14771442with ( r ) {
    1478         i;                                                                      $\C{// unambiguous, r.i}$
     1443        i;                                                                              $\C{// unambiguous, r.i}$
    14791444        with ( q ) {
    1480                 i;                                                              $\C{// unambiguous, q.i}$
     1445                i;                                                                      $\C{// unambiguous, q.i}$
    14811446        }
    14821447}
     
    14851450A cast can also be used to disambiguate among overload variables in a ©with© \emph{expression}:
    14861451\begin{cfa}
    1487 with ( w ) { ... }                                              $\C{// ambiguous, same name and no context}$
    1488 with ( (Q)w ) { ... }                                   $\C{// unambiguous, cast}$
     1452with ( w ) { ... }                                                      $\C{// ambiguous, same name and no context}$
     1453with ( (Q)w ) { ... }                                           $\C{// unambiguous, cast}$
    14891454\end{cfa}
    14901455Because there is no left-side in the ©with© expression to implicitly disambiguate between the ©w© variables, it is necessary to explicitly disambiguate by casting ©w© to type ©Q© or ©R©.
     
    14931458\begin{cfa}
    14941459void f( S & s, char c ) with ( s ) {
    1495         ®s.c = c;®  i = 3;  d = 5.5;            $\C{// initialize fields}$
     1460        ®s.c = c;®  i = 3;  d = 5.5;                    $\C{// initialize fields}$
    14961461}
    14971462\end{cfa}
     
    14991464To solve this problem, parameters \emph{not} explicitly opened are treated like an initialized aggregate:
    15001465\begin{cfa}
    1501 struct Params {                                                 $\C{// s explicitly opened so S \& s elided}$
     1466struct Params {                                                         $\C{// s explicitly opened so S \& s elided}$
    15021467        char c;
    15031468} params;
     
    15181483Transfer of control can be local, within a routine, or non-local, among routines.
    15191484Non-local transfer can cause stack unwinding, \ie non-local routine termination, depending on the kind of raise.
    1520 
    1521 Currently, \CFA uses macros ©ExceptionDecl© and ©ExceptionInst© to declare and instantiate an exception.
    1522 \begin{cfa}
    1523 #include <Exception.hfa>
    1524 ®ExceptionDecl®( E,             // must be global scope
    1525         ... // exception fields
    1526 );
    1527 try {
    1528         ...
    1529         if ( ... ) ®throwResume® ®ExceptionInst®( E, /* intialization */ );
    1530         if ( ... ) ®throw® ®ExceptionInst®( E, /* intialization */ );
    1531         ...
    1532 } ®catchResume®( E * ) { // must be pointer
    1533         ...
    1534 } catch( E * ) {
    1535         ...
    1536 }
    1537 \end{cfa}
    1538 
    15391485\begin{cfa}
    15401486exception_t E {}; $\C{// exception type}$
     
    15451491try {
    15461492        f(...);
    1547 } catch( E e ; $boolean-predicate$ ) {  $\C{// termination handler}$
     1493} catch( E e ; $boolean-predicate$ ) {          $\C{// termination handler}$
    15481494        // recover and continue
    15491495} catchResume( E e ; $boolean-predicate$ ) { $\C{// resumption handler}$
     
    15571503The ©catch© and ©catchResume© handlers may appear in any oder.
    15581504However, the ©finally© clause must appear at the end of the ©try© statement.
    1559 
    1560 
    1561 \section{Non-local Exception}
    1562 
    1563 \begin{cfa}
    1564 void main() {
    1565         try {
    1566                 _Enable {
    1567                         ... resume(); ...
    1568                 }
    1569         } ®catchResume®( E & ) { // should be reference
    1570                 ...
    1571         } catch( E & ) {
    1572                 ...
    1573         }
    1574 }
    1575 \end{cfa}
    15761505
    15771506
     
    16391568\begin{cquote}
    16401569\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1641 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1570\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1571\begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]
     1572#[5] *# ®int® x1;
     1573#* [5]# ®int® x2;
     1574#[* [5] int]# f®( int p )®;
     1575\end{cfa}
     1576&
    16421577\begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]
    16431578®int® #*# x1 #[5]#;
    16441579®int® #(*#x2#)[5]#;
    16451580#int (*#f®( int p )®#)[5]#;
    1646 \end{cfa}
    1647 &
    1648 \begin{cfa}[moredelim={**[is][\color{blue}]{\#}{\#}}]
    1649 #[5] *# ®int® x1;
    1650 #* [5]# ®int® x2;
    1651 #[* [5] int]# f®( int p )®;
    16521581\end{cfa}
    16531582\end{tabular}
     
    16591588\begin{cquote}
    16601589\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1661 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1590\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1591\begin{cfa}
     1592®*® int x, y;
     1593\end{cfa}
     1594&
    16621595\begin{cfa}
    16631596int ®*®x, ®*®y;
    1664 \end{cfa}
    1665 &
    1666 \begin{cfa}
    1667 ®*® int x, y;
    16681597\end{cfa}
    16691598\end{tabular}
     
    16721601\begin{cquote}
    16731602\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1674 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
    1675 \begin{cfa}
    1676 int ®*®x, y;
    1677 
    1678 \end{cfa}
    1679 &
     1603\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    16801604\begin{cfa}
    16811605®*® int x;
    16821606int y;
     1607\end{cfa}
     1608&
     1609\begin{cfa}
     1610int ®*®x, y;
     1611
    16831612\end{cfa}
    16841613\end{tabular}
     
    16881617\begin{cquote}
    16891618\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    1690 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      \\
     1619\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     1620\begin{cfa}
     1621[ 5 ] int z;
     1622[ 5 ] * char w;
     1623* [ 5 ] double v;
     1624struct s {
     1625        int f0:3;
     1626        * int f1;
     1627        [ 5 ] * int f2;
     1628};
     1629\end{cfa}
     1630&
    16911631\begin{cfa}
    16921632int z[ 5 ];
     
    17011641&
    17021642\begin{cfa}
    1703 [ 5 ] int z;
    1704 [ 5 ] * char w;
    1705 * [ 5 ] double v;
    1706 struct s {
    1707         int f0:3;
    1708         * int f1;
    1709         [ 5 ] * int f2;
    1710 };
    1711 \end{cfa}
    1712 &
    1713 \begin{cfa}
    17141643// array of 5 integers
    17151644// array of 5 pointers to char
     
    17271656\begin{cquote}
    17281657\begin{tabular}{@{}l@{\hspace{1em}}l@{\hspace{1em}}l@{}}
    1729 \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}      \\
     1658\multicolumn{1}{c@{\hspace{1em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{1em}}}{\textbf{C}} \\
     1659\begin{cfa}
     1660const * const int x;
     1661const * [ 5 ] const int y;
     1662\end{cfa}
     1663&
    17301664\begin{cfa}
    17311665int const * const x;
    17321666const int (* const y)[ 5 ]
    1733 \end{cfa}
    1734 &
    1735 \begin{cfa}
    1736 const * const int x;
    1737 const * [ 5 ] const int y;
    17381667\end{cfa}
    17391668&
     
    17481677\begin{cquote}
    17491678\begin{tabular}{@{}l@{\hspace{3em}}l@{\hspace{2em}}l@{}}
    1750 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{\CFA}}      \\
     1679\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c@{\hspace{2em}}}{\textbf{C}} \\
     1680\begin{cfa}
     1681extern [ 5 ] int x;
     1682static * const int y;
     1683\end{cfa}
     1684&
    17511685\begin{cfa}
    17521686int extern x[ 5 ];
    17531687const int static * y;
    1754 \end{cfa}
    1755 &
    1756 \begin{cfa}
    1757 extern [ 5 ] int x;
    1758 static * const int y;
    17591688\end{cfa}
    17601689&
     
    17691698\begin{cquote}
    17701699\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1771 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{C}}   & \multicolumn{1}{c}{\textbf{\CFA}}     \\
     1700\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
     1701\begin{cfa}
     1702y = (* int)x;
     1703i = sizeof([ 5 ] * int);
     1704\end{cfa}
     1705&
    17721706\begin{cfa}
    17731707y = (int *)x;
    17741708i = sizeof(int * [ 5 ]);
    1775 \end{cfa}
    1776 &
    1777 \begin{cfa}
    1778 y = (* int)x;
    1779 i = sizeof([ 5 ] * int);
    17801709\end{cfa}
    17811710\end{tabular}
     
    19721901\begin{cquote}
    19731902\begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1974 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{Cy}}  & \multicolumn{1}{c}{\textbf{\CFA}}     \\
    1975 \begin{cfa}
    1976 const int * ®const® * ®const® ccp;
    1977 
    1978 \end{cfa}
    1979 &
     1903\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    19801904\begin{cfa}
    19811905®const® * ®const® * const int ccp;
    19821906®const® & ®const® & const int ccr;
     1907\end{cfa}
     1908&
     1909\begin{cfa}
     1910const int * ®const® * ®const® ccp;
     1911
    19831912\end{cfa}
    19841913\end{tabular}
     
    21412070\begin{cfa}
    21422071int x, &r = ®x®, f( int & p ); $\C{// lvalue variable (int) convert to reference (int \&)}$
    2143 f( ®x® ); $\C{// lvalue variable (int) convert to reference (int \&)}\CRT$
     2072f( ®x® ); $\C{// lvalue variable (int) convert to reference (int \&)}$
    21442073\end{cfa}
    21452074Conversion can restrict a type, where ©cv1© $\le$ ©cv2©, \eg passing an ©int© to a ©const volatile int &©, which has low cost.
     
    87018630\begin{cquote}
    87028631\begin{tabular}{@{}l@{\hspace{\parindentlnth}}|@{\hspace{\parindentlnth}}l@{}}
    8703 \multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{C}}    & \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{\CFA}}        \\
     8632\multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{\CFA}} & \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{C}}   \\
    87048633\hline
     8634\begin{cfa}
     8635#include <gmp.hfa>$\indexc{gmp}$
     8636int main( void ) {
     8637        sout | "Factorial Numbers";
     8638        Int fact = 1;
     8639
     8640        sout | 0 | fact;
     8641        for ( i; 40 ) {
     8642                fact *= i;
     8643                sout | i | fact;
     8644        }
     8645}
     8646\end{cfa}
     8647&
    87058648\begin{cfa}
    87068649#include <gmp.h>$\indexc{gmp.h}$
     
    87138656                ®mpz_mul_ui®( fact, fact, i );
    87148657                ®gmp_printf®( "%d %Zd\n", i, fact );
    8715         }
    8716 }
    8717 \end{cfa}
    8718 &
    8719 \begin{cfa}
    8720 #include <gmp.hfa>$\indexc{gmp}$
    8721 int main( void ) {
    8722         sout | "Factorial Numbers";
    8723         Int fact = 1;
    8724 
    8725         sout | 0 | fact;
    8726         for ( i; 40 ) {
    8727                 fact *= i;
    8728                 sout | i | fact;
    87298658        }
    87308659}
Note: See TracChangeset for help on using the changeset viewer.