%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo %% %% The contents of this file are covered under the licence agreement in the %% file "LICENCE" distributed with Cforall. %% %% common.tex -- %% %% Author : Peter A. Buhr %% Created On : Sat Apr 9 10:06:17 2016 %% Last Modified By : Peter A. Buhr %% Last Modified On : Sun Feb 25 23:30:09 2024 %% Update Count : 645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \setlength{\textheight}{9in} %\oddsidemargin 0.0in \renewcommand{\topfraction}{0.8} % float must be greater than X of the page before it is forced onto its own page \renewcommand{\bottomfraction}{0.8} % float must be greater than X of the page before it is forced onto its own page \renewcommand{\floatpagefraction}{0.8} % float must be greater than X of the page before it is forced onto its own page \renewcommand{\textfraction}{0.0} % the entire page maybe devoted to floats with no text on the page at all \lefthyphenmin=4 % hyphen only after 4 characters \righthyphenmin=4 \usepackage[ignoredisplayed]{enumitem} % do not affect trivlist \setlist{labelsep=1ex}% global \setlist[itemize]{topsep=0.5ex,parsep=0.25ex,itemsep=0.25ex,listparindent=\parindent,leftmargin=\parindent}% global \setlist[itemize,1]{label=\textbullet}% local %\renewcommand{\labelitemi}{{\raisebox{0.25ex}{\footnotesize$\bullet$}}} \setlist[enumerate]{topsep=0.5ex,parsep=0.25ex,itemsep=0.25ex,listparindent=\parindent}% global \setlist[enumerate,2]{leftmargin=\parindent,labelsep=*,align=parleft,label=\alph*.}% local \setlist[description]{topsep=0.5ex,itemsep=0pt,listparindent=\parindent,leftmargin=\parindent,labelsep=1.5ex} % Names used in the document. \usepackage{xspace} \newcommand{\CFAIcon}{\textsf{C\raisebox{\depth}{\rotatebox{180}A}}} % Cforall icon \newcommand{\CFA}{\protect\CFAIcon\xspace} % CFA symbolic name \newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall non-icon name \newcommand{\Celeven}{\textrm{C1\hspace*{-0.4ex}1}\xspace} % C11 symbolic name \newcommand{\CCIcon}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}} % C++ icon % numbers disallowed in latex variables names => use number names \newcommand{\CCeleven}{\protect\CCIcon{1\hspace*{-0.4ex}1}\xspace} % C++11 symbolic name \newcommand{\CCfourteen}{\protect\CCIcon{14}\xspace} % C++14 symbolic name \newcommand{\CCseventeen}{\protect\CCIcon{17}\xspace} % C++17 symbolic name \newcommand{\CCtwenty}{\protect\CCIcon{20}\xspace} % C++20 symbolic name \newcommand{\CC}[1][]{\protect\CCIcon{#1}\xspace} % C++ symbolic name \newcommand{\Cpp}[1][]{\CC{#1}} % C++ synonym \newcommand{\Csharp}{C\raisebox{-0.7ex}{\relsize{2}$^\sharp$}\xspace} % C# symbolic name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[scaled=0.85]{helvet} % descent Helvetica font and scale to times size \usepackage[T1]{fontenc} \usepackage{relsize} % must be after change to small or selects old size \usepackage{rotating} \usepackage{calc} % latex arithmetic % remove special-character warning in PDF side-bar names \@ifpackageloaded{hyperref}{ \pdfstringdefDisableCommands{ \def\CFA{\CFL} \def\Celeven{C11\xspace} \def\CC{C++\xspace} \def\CCeleven{C++11\xspace} \def\CCfourteen{C++14\xspace} \def\CCseventeen{C++17\xspace} \def\CCtwenty{C++20\xspace} \def\Csharp{C\#\xspace} \def\lstinline{\xspace}% must use {} as delimiters, e.g., \lstinline{...} }{} } % parindent is relative, i.e., toggled on/off in environments like itemize, so store the value for % use rather than use \parident directly. \newlength{\parindentlnth} \setlength{\parindentlnth}{\parindent} % reduce size of chapter/section titles \def\@makechapterhead#1{% \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \large\bfseries \@chapapp\space \thechapter \par\nobreak \vskip 5\p@ \fi \interlinepenalty\@M \Large \bfseries #1\par\nobreak \vskip 50\p@ }} \def\@makeschapterhead#1{% \vspace*{50\p@}% {\parindent \z@ \raggedright \normalfont \interlinepenalty\@M \Large \bfseries #1\par\nobreak \vskip 50\p@ }} \renewcommand\section{\@startsection{section}{1}{\z@}{-3.0ex \@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\large\bfseries}} \renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-2.75ex \@plus -1ex \@minus -.2ex}{1.25ex \@plus .2ex}{\normalfont\normalsize\bfseries}} \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.5ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}} \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.0ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries}} \renewcommand\subparagraph{\@startsection{subparagraph}{4}{\z@}{-1.5ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries\itshape}} % index macros \newcommand{\italic}[1]{\emph{\hyperpage{#1}}} \newcommand{\Definition}[1]{\textbf{\hyperpage{#1}}} \newcommand{\see}[1]{(see #1)} % Define some commands that produce formatted index entries suitable for cross-references. % ``\spec'' produces entries for specifications of entities. ``\impl'' produces entries for their % implementations, and ``\use'' for their uses. % \newcommand{\bold}[1]{{\bf #1}} % \def\spec{\@bsphack\begingroup % \def\protect##1{\string##1\space}\@sanitize % \@wrxref{|bold}} \def\impl{\@bsphack\begingroup \def\protect##1{\string##1\space}\@sanitize \@wrxref{|Definition}} \newcommand{\indexcode}[1]{{\lstinline$#1$}} \def\use{\@bsphack\begingroup \def\protect##1{\string##1\space}\@sanitize \@wrxref{|hyperpage}} \def\@wrxref#1#2{\let\thepage\relax \xdef\@gtempa{\write\@indexfile{\string \indexentry{#2@{\lstinline$#2$}#1}{\thepage}}}\endgroup\@gtempa \if@nobreak \ifvmode\nobreak\fi\fi\@esphack} %\newcommand{\use}[1]{\index{#1@{\lstinline$#1$}}} %\newcommand{\impl}[1]{\index{\protect#1@{\lstinline$\protect#1$}|Definition}} % inline text and lowercase index: \Index{inline and lowercase index text} \newcommand{\Index}{\@ifstar\@sIndex\@Index} % inline text and as-in index: \Index[as-is index text]{inline text} \newcommand{\@Index}[2][\@empty]{\lowercase{\def\temp{#2}}#2\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi} % inline text but index with different as-is text: \Index[index text]{inline text} \newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi} % inline text and code index (cannot use ©) \newcommand{\Indexc}[2][\@empty]{\lstinline[#1]$#2$\index{#2@\lstinline[#1]$#2$}} % code index (cannot use ©) \newcommand{\indexc}[2][\@empty]{\index{#2@\lstinline[#1]$#2$}} % Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}. % The option parameter provides an index term different from the new term, e.g., \newterm[\texttt{abc}]{abc} % The star version does not lowercase the index information, e.g., \newterm*{IBM}. \newcommand{\newtermFontInline}{\emph} \newcommand{\newterm}{\protect\@ifstar\@snewterm\@newterm} \newcommand{\@newterm}[2][\@empty]{\lowercase{\def\temp{#2}}{\newtermFontInline{#2}}\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi} \newcommand{\@snewterm}[2][\@empty]{{\newtermFontInline{#2}}\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi} % \snake{} % Improves writing of snake case (or any convention that uses _) by allowing % line breaks after _. Disables commands inside the block and formats the % identifier to look like code. \newcommand*\snake[1]{\snakefont{\expandafter\snake@next\detokenize{#1}\@nil}} % \snakefont{} % Command used by \snake, you may renew the command to change its formating. \newcommand*\snakefont[1]{\LstBasicStyle{#1}} % Thanks Manuel of TeX Stack exchange. (I got the base pattern from one of % their answers.) Note: \@nil should never be defined. \newcommand*\snake@next[1]{\ifx\@nil#1\else \expandafter\ifx\string_#1\string_\allowbreak\else#1\fi \expandafter\snake@next\fi } % \lang{}{} % Use the listings package to format the snipit of in . \newcommand{\lang}[2]{\lstinline[language=#1]{#2}} % Latin abbreviation \newcommand{\abbrevFont}{\textit} % set empty for no italics % If not followed by a comma or colon, add a comma. \newcommand{\CheckCommaColon}{\@ifnextchar{,}{}{\@ifnextchar{:}{}{,\xspace}}} % If not followed by a period, add a period. \newcommand{\CheckPeriod}{\@ifnextchar{.}{}{.\xspace}} \newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.} \newcommand{\eg}{\EG\CheckCommaColon} \newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.} \newcommand{\ie}{\IE\CheckCommaColon} \newcommand{\ETC}{\abbrevFont{etc}} \newcommand{\etc}{\ETC\CheckPeriod} \newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}} \newcommand{\etal}{\ETAL\CheckPeriod} \newcommand{\VIZ}{\abbrevFont{viz}} \newcommand{\viz}{\VIZ\CheckPeriod} \newcommand{\VS}{\abbrevFont{vs}} \newcommand{\vs}{\VS\CheckPeriod} \newenvironment{cquote}{% \list{}{\lstset{resetmargins=true,aboveskip=0pt,belowskip=0pt}\topsep=4pt\parsep=0pt\leftmargin=\parindentlnth\rightmargin\leftmargin}% \item\relax }{% \endlist }% cquote \newenvironment{rationale}{% \begin{cquote}\noindent$\Box$\enspace }{% \hfill\enspace$\Box$\end{cquote} }% % blocks and titles \newcommand{\define}[1]{\emph{#1\/}\index{#1}} \newcommand{\rewriterules}{\paragraph{Rewrite Rules}~\par\noindent} \newcommand{\examples}{\paragraph{Examples}~\par\noindent} \newcommand{\semantics}{\paragraph{Semantics}~\par\noindent} \newcommand{\constraints}{\paragraph{Constraints}~\par\noindent} \newcommand{\predefined}{\paragraph{Predefined Identifiers}~\par\noindent} % BNF macros \newenvironment{syntax}{ \paragraph{Syntax} \begin{cquote} \begin{description}[noitemsep,leftmargin=\parindentlnth] }{ \end{description} \end{cquote} } % \def\syntax{\paragraph{Syntax}\trivlist\parindent=.5in\item[\hskip.5in]} %\let\endsyntax=\endtrivlist \newcommand{\lhs}[1]{\item[\emph{#1:}\index{#1@{\emph{#1}}|italic}]~\ignorespaces} \newcommand{\oldlhs}[1]{\item[\emph{#1:}\index{#1@{\emph{#1}}|italic}~\dots]~} \newcommand{\rhs}{\hfil\newline} \newcommand{\nonterm}[1]{\emph{#1}\index{#1@{\emph{#1}}|italic}} \newcommand{\opt}{$_{opt}$\ } \usepackage{varioref} % extended references % adjust varioref package with default "section" and "page" titles, and optional title with faraway page numbers % \VRef{label} => Section 2.7, \VPageref{label} => page 17 % \VRef[Figure]{label} => Figure 3.4, \VPageref{label} => page 17 \renewcommand{\reftextfaceafter}{\unskip} \renewcommand{\reftextfacebefore}{\unskip} \renewcommand{\reftextafter}{\unskip} \renewcommand{\reftextbefore}{\unskip} \renewcommand{\reftextfaraway}[1]{\unskip, p.~\pageref{#1}} \renewcommand{\reftextpagerange}[2]{\unskip, pp.~\pageref{#1}--\pageref{#2}} \newcommand{\VRef}[2][Section]{\ifx#1\@empty\else{#1}\nobreakspace\fi\vref{#2}} \newcommand{\VRefrange}[3][Sections]{\ifx#1\@empty\else{#1}\nobreakspace\fi\vrefrange{#2}{#3}} \newcommand{\VPageref}[2][page]{\ifx#1\@empty\else{#1}\nobreakspace\fi\pageref{#2}} \newcommand{\VPagerefrange}[3][pages]{\ifx#1\@empty\else{#1}\nobreakspace\fi\pageref{#2}{#3}} \let\Oldthebibliography\thebibliography \renewcommand\thebibliography[1]{ \Oldthebibliography{#1} \setlength{\parskip}{0pt} % reduce vertical spacing between references \setlength{\itemsep}{5pt plus 0.3ex} }% \usepackage{listings} % format program code \usepackage{lstlang} \newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{#1}}} \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}} \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}} \newcommand{\LstStringStyle}[1]{{\lst@basicstyle{\lst@stringstyle{#1}}}} \newcommand{\LstNumberStyle}[1]{{\lst@basicstyle{\lst@numberstyle{#1}}}} \newlength{\gcolumnposn} % temporary hack because lstlisting does not handle tabs correctly \newlength{\columnposn} \setlength{\gcolumnposn}{3in} \setlength{\columnposn}{\gcolumnposn} \newcommand{\setgcolumn}[1]{\global\gcolumnposn=#1\global\columnposn=\gcolumnposn} \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\LstCommentStyle{#2}}} \newcommand{\CD}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\LstBasicStyle{#2}}} \newcommand{\CRT}{\global\columnposn=\gcolumnposn} % allow escape sequence in lstinline %\usepackage{etoolbox} %\patchcmd{\lsthk@TextStyle}{\let\lst@DefEsc\@empty}{}{}{\errmessage{failed to patch}} % allow adding to lst literate \def\addToLiterate#1{\protect\edef\lst@literate{\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}} \lst@Key{add to literate}{}{\addToLiterate{#1}} \newcommand{\CFAStyle}{% \lstset{ columns=fullflexible, basicstyle=\linespread{0.9}\sf, % reduce line spacing and use sanserif font stringstyle=\small\tt, % use typewriter font tabsize=5, % N space tabbing xleftmargin=\parindentlnth, % indent code to paragraph indentation extendedchars=true, % allow ASCII characters in the range 128-255 mathescape=false, % disable LaTeX math escape in CFA code $...$ keepspaces=true, % showstringspaces=false, % do not show spaces with cup showlines=true, % show blank lines at end of code aboveskip=4pt, % spacing above/below code block belowskip=2pt, numberstyle=\footnotesize\sf, % numbering style % replace/adjust listing characters that look bad in sanserif literate= % {-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 {-}{\raisebox{-1pt}{\ttfamily-}}1 {^}{\raisebox{0.6ex}{\(\scriptstyle\land\,\)}}1 {~}{\raisebox{0.3ex}{\(\scriptstyle\sim\,\)}}1 {'}{\ttfamily'\hspace*{-0.4ex}}1 {`}{\ttfamily\upshape\hspace*{-0.3ex}`}1 {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 % {->}{\raisebox{-1pt}{\texttt{-}}\kern-0.1ex\textgreater}2, }% lstset }% CFAStyle \ifdefined\CFALatin% extra Latin-1 escape characters \lstnewenvironment{cfa}[1][]{% necessary \lstset{ language=CFA, escapechar=§, % LaTeX escape in CFA code §...§ (section symbol), emacs: C-q M-' moredelim=**[is][\color{red}]{®}{®}, % red highlighting ®...® (registered trademark symbol) emacs: C-q M-. %moredelim=**[is][\color{blue}]{ß}{ß}, % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_ %moredelim=**[is][\color{OliveGreen}]{¢}{¢}, % green highlighting ¢...¢ (cent symbol) emacs: C-q M-" %moredelim=[is][\lstset{keywords={}}]{¶}{¶}, % keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^ }% lstset \lstset{#1}% necessary }{} % inline code ©...© (copyright symbol) emacs: C-q M-) \lstMakeShortInline© % single-character for \lstinline \else% regular ASCI characters \lstnewenvironment{cfa}[1][]{% necessary \lstset{ language=CFA, escapechar=\$, % LaTeX escape in CFA code moredelim=**[is][\color{red}]{@}{@}, % red highlighting @...@ }% lstset \lstset{#1}% necessary }{} % inline code @...@ (at symbol) \lstMakeShortInline@ % single-character for \lstinline \fi% % Local Variables: % % tab-width: 4 % % fill-column: 100 % % End: %