Changeset bfee448 for doc/refrat


Ignore:
Timestamp:
Sep 24, 2015, 9:45:18 AM (9 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, string, with_gc
Children:
20e409e
Parents:
41b3ddd
Message:

fix *predefined* macro and associated sed script

Location:
doc/refrat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/refrat/predefined.sed

    r41b3ddd rbfee448  
    1 /\\begin{predefined}/,/\\end{predefined}/ !d
    2 /\\begin{predefined}/,/\\end{predefined}/ s/\\use{.*}//g
    3 /\\begin{predefined}/ d
    4 /\\end{predefined}/ d
     1/\\predefined/,/\\end{lstlisting}/ !d
     2/\\begin{lstlisting}/,/\\end{lstlisting}/ s/\\use{.*}//g
     3/\\predefined/ d
     4/\\begin{lstlisting}/ d
     5/\\end{lstlisting}/ d
  • doc/refrat/refrat.tex

    r41b3ddd rbfee448  
    3030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    3131
    32 % Specialized macros used in the document.
    33 
     32% Bespoke macros used in the document.
     33
     34\makeatletter
     35% index macros
    3436\newcommand{\italic}[1]{\emph{\hyperpage{#1}}}
    3537\newcommand{\definition}[1]{\textbf{\hyperpage{#1}}}
    3638\newcommand{\see}[1]{\emph{see} #1}
    3739
    38 \makeatletter
    3940% Define some commands that produce formatted index entries suitable for cross-references.
    4041% ``\spec'' produces entries for specifications of entities.  ``\impl'' produces entries for their
     
    5657    \indexentry{#2@{\lstinline$#2$}#1}{\thepage}}}\endgroup\@gtempa
    5758    \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}
    58 \makeatother
    5959%\newcommand{\use}[1]{\index{#1@{\lstinline$#1$}}}
    6060%\newcommand{\impl}[1]{\index{\protect#1@{\lstinline$\protect#1$}|definition}}
    6161
     62% text inline and lowercase index: \Index{Inline and index text}
     63% text inline and as-in index: \Index{Inline and Index text}
     64% text inline but index with different as-is text: \Index[index text]{inline text}
     65\newcommand{\Index}{\@ifstar\@sIndex\@Index}
     66\newcommand{\@Index}[2][\@empty]{\lowercase{\def\temp{#2}}#2\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi}
     67\newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
     68\makeatother
     69
     70% blocks and titles
    6271\newcommand{\define}[1]{\emph{#1\/}\index{#1}}
    6372\newenvironment{rationale}{%
     
    6776}%
    6877\newcommand{\rewrite}{\(\Rightarrow\)}
    69 \newcommand{\rewriterules}{\paragraph{Rewrite Rules}\hskip1em\par\noindent}
    70 \newcommand{\examples}{\paragraph{Examples}\hskip1em\par\noindent}
    71 \newcommand{\semantics}{\paragraph{Semantics}\hskip1em\par\noindent}
    72 \newcommand{\constraints}{\paragraph{Constraints}\hskip1em\par\noindent}
    73 \newenvironment{predefined}{%
    74   \paragraph{Predefined Identifiers}%
    75 %  \begin{code}%
    76 }{%
    77 %  \end{code}
    78 }%
    79 
     78\newcommand{\rewriterules}{\paragraph{Rewrite Rules}~\par\noindent}
     79\newcommand{\examples}{\paragraph{Examples}~\par\noindent}
     80\newcommand{\semantics}{\paragraph{Semantics}~\par\noindent}
     81\newcommand{\constraints}{\paragraph{Constraints}~\par\noindent}
     82\newcommand{\predefined}{\paragraph{Predefined Identifiers}~\par\noindent}
     83
     84% BNF macros
    8085\def\syntax{\paragraph{Syntax}\trivlist\parindent=.5in\item[\hskip.5in]}
    8186\let\endsyntax=\endtrivlist
     
    8691\newcommand{\opt}{$_{opt}$\ }
    8792
     93% adjust varioref package with default "section" and "page" titles, and optional title with faraway page numbers
     94% \VRef{label} => Section 2.7, \VPageref{label} => page 17
     95% \VRef[Figure]{label} => Figure 3.4, \VPageref{label} => page 17
    8896\renewcommand{\reftextfaceafter}{\unskip}
    8997\renewcommand{\reftextfacebefore}{\unskip}
     
    95103\newcommand{\VPageref}[2][page]{\ifx#1\@empty\else{#1}\nobreakspace\fi\pageref{#2}}
    96104
    97 % replace/adjust characters that look bad in sanserif
    98 \makeatletter
    99 \lst@CCPutMacro
    100 \lst@ProcessOther{"2D}{\lst@ttfamily{-{}}{{\ttfamily\upshape -}}} % replace minus
    101 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than
    102 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than
    103 \lst@ProcessOther{"5E}{\raisebox{0.4ex}{$\scriptstyle\land\,$}} % circumflex
    104 \lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
    105 %\lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde
    106 \lst@ProcessOther{"7E}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}} % lower tilde
    107 \@empty\z@\@empty
    108 
    109 \newcommand{\Index}{\@ifstar\@sIndex\@Index}
    110 \newcommand{\@Index}[2][\@empty]{\lowercase{\def\temp{#2}}#2\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi}
    111 \newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
    112 \makeatother
    113 
     105% adjust listings macros
    114106\lstdefinelanguage{CFA}[ANSI]{C}%
    115   {morekeywords={asm,_At,_Atomic,catch,catchResume,choose,_Complex,context,disable,dtype,enable,
    116         fallthru,finally,forall,ftype,_Imaginary,lvalue,restrict,throw,throwResume,try,type,},
    117 }
     107{morekeywords={asm,_At,_Atomic,catch,catchResume,choose,_Complex,context,disable,dtype,enable,
     108fallthru,finally,forall,ftype,_Imaginary,lvalue,restrict,throw,throwResume,try,type,},
     109}%
    118110
    119111\lstset{
     
    129121showtabs=true,
    130122tab=,
    131 }
     123}%
     124
     125\makeatletter
     126% replace/adjust listings characters that look bad in sanserif
     127\lst@CCPutMacro
     128\lst@ProcessOther{"2D}{\lst@ttfamily{-{}}{{\ttfamily\upshape -}}} % replace minus
     129\lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than
     130\lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than
     131\lst@ProcessOther{"5E}{\raisebox{0.4ex}{$\scriptstyle\land\,$}} % replace circumflex
     132\lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
     133\lst@ProcessOther{"7E}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}} % replace tilde
     134%\lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde
     135\@empty\z@\@empty
     136\makeatother
    132137
    133138\setcounter{secnumdepth}{3}     % number subsubsections
     
    174179
    175180The manual deliberately imitates the ordering of the {\c11} standard (although the section numbering
    176 differs). Unfortunately, this means that the manual contains more ``forward references'' than
    177 usual, and that it will be hard to follow if the reader does not have a copy of the {\c11} standard
    178 near-by. For a gentle introduction to \CFA, see the companion document ``An Overview of
    179 \CFA'' \cite{Ditchfield96:Overview}.
     181differs). Unfortunately, this means the manual contains more ``forward references'' than usual,
     182making it harder to follow if the reader does not have a copy of the {\c11} standard. For a simple
     183introduction to \CFA, see the companion document ``An Overview of \CFA''
     184\cite{Ditchfield96:Overview}.
    180185
    181186\begin{rationale}
     
    201206
    202207\section{Notation}
    203 The syntax notation used in this document is the same as is used in the {\c11} standard, with one
    204 exception: ellipsis in the definition of a nonterminal, as in ``\emph{declaration:} \ldots'',
    205 indicates that these rules extend a previous definition, which occurs in this document or in the
    206 {\c11} standard.
     208The syntax notation used in this document is the same as in the {\c11} standard, with one exception:
     209ellipsis in the definition of a nonterminal, as in ``\emph{declaration:} \ldots'', indicates that
     210these rules extend a previous definition, which occurs in this document or in the {\c11} standard.
    207211
    208212
     
    651655
    652656\begin{rationale}
    653 The use of ``\lstinline$?$'' in identifiers means that some C programs are not \CFA programs.
    654 For instance, the sequence of characters ``\lstinline$(i < 0)?--i:i$'' is legal in a C program, but
    655 a \CFA compiler will detect a syntax error because it will treat ``\lstinline$?--$'' as an
    656 identifier, not as the two tokens ``\lstinline$?$'' and ``\lstinline$--$''.
     657The use of ``\lstinline$?$'' in identifiers means that some C programs are not \CFA programs.  For
     658instance, the sequence of characters ``\lstinline$(i < 0)?--i:i$'' is legal in a C program, but a
     659\CFA compiler detects a syntax error because it treats ``\lstinline$?--$'' as an identifier, not
     660as the two tokens ``\lstinline$?$'' and ``\lstinline$--$''.
    657661\end{rationale}
    658662
     
    796800\end{syntax}
    797801
    798 \paragraph{Predefined Identifiers}%
     802\predefined
    799803\begin{lstlisting}
    800804const int 1;@\use{1}@
     
    892896\subsubsection{Array subscripting}
    893897
     898\predefined
    894899\begin{lstlisting}
    895900forall( type T ) lvalue T ?[?]( T *, ptrdiff_t );@\use{ptrdiff_t}@
     
    11321137\subsubsection{Postfix increment and decrement operators}
    11331138
     1139\predefined
    11341140\begin{lstlisting}
    11351141_Bool ?++( volatile _Bool * ),
     
    14641470\subsubsection{Prefix increment and decrement operators}
    14651471
     1472\predefined
    14661473\begin{lstlisting}
    14671474_Bool ++?( volatile _Bool * ),
     
    16481655\subsubsection{Address and indirection operators}
    16491656
     1657\predefined
    16501658\begin{lstlisting}
    16511659forall( type T ) lvalue T *?( T * );
     
    16831691\subsubsection{Unary arithmetic operators}
    16841692
     1693\predefined
    16851694\begin{lstlisting}
    16861695int
     
    18911900\end{lstlisting}
    18921901
     1902\predefined
    18931903\begin{lstlisting}
    18941904int?*?( int, int ),
     
    20342044\end{lstlisting}
    20352045
     2046\predefined
    20362047\begin{lstlisting}
    20372048int?+?( int, int ),
     
    21742185\end{lstlisting}
    21752186
     2187\predefined
    21762188\begin{lstlisting}
    21772189int ?<<?( int, int ),
     
    22242236\end{lstlisting}
    22252237
     2238\predefined
    22262239\begin{lstlisting}
    22272240int ?<?( int, int ),
     
    23022315\end{lstlisting}
    23032316
     2317\predefined
    23042318\begin{lstlisting}
    23052319int ?==?( int, int ),
     
    24192433\end{lstlisting}
    24202434
     2435\predefined
    24212436\begin{lstlisting}
    24222437int ?&?( int, int );
     
    24522467\end{lstlisting}
    24532468
     2469\predefined
    24542470\begin{lstlisting}
    24552471int ?^?( int, int );
     
    24852501\end{lstlisting}
    24862502
     2503\predefined
    24872504\begin{lstlisting}
    24882505int ?|?( int, int );
     
    27162733\subsubsection{Simple assignment}
    27172734
     2735\predefined
    27182736\begin{lstlisting}
    27192737_Bool
     
    30033021\subsubsection{Compound assignment}
    30043022
     3023\predefined
    30053024\begin{lstlisting}
    30063025forall( type T ) T
Note: See TracChangeset for help on using the changeset viewer.