%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- 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 : Thu Jan 28 19:01:57 2021 %% Update Count : 494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \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]{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}{\textsf{A}}}\xspace} % Cforall symbolic name \newcommand{\CFA}{\protect\CFAIcon} % safe for section/caption \newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall symbolic name \newcommand{\Celeven}{\textrm{C11}\xspace} % C11 symbolic name \newcommand{\CC}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name \newcommand{\CCeleven}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name \newcommand{\CCfourteen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}14\xspace} % C++14 symbolic name \newcommand{\CCseventeen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name \newcommand{\CCtwenty}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name \newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \makeatletter % 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} \usepackage{pslatex} % reduce size of san serif font \usepackage{relsize} % must be after change to small or selects old size \usepackage{rotating} % 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.5ex \@plus -1ex \@minus -.2ex}{1.75ex \@plus .2ex}{\normalfont\large\bfseries}} \renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex \@plus -1ex \@minus -.2ex}{1.5ex \@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}} % 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}{\@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} % Latin abbreviation \newcommand{\abbrevFont}{\textit} % set empty for no italics \@ifundefined{eg}{ \newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.} \newcommand*{\eg}{% \@ifnextchar{,}{\EG}% {\@ifnextchar{:}{\EG}% {\EG,\xspace}}% }}{}% \@ifundefined{ie}{ \newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.} \newcommand*{\ie}{% \@ifnextchar{,}{\IE}% {\@ifnextchar{:}{\IE}% {\IE,\xspace}}% }}{}% \@ifundefined{etc}{ \newcommand{\ETC}{\abbrevFont{etc}} \newcommand*{\etc}{% \@ifnextchar{.}{\ETC}% {\ETC.\xspace}% }}{}% \@ifundefined{etal}{ \newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}} \newcommand*{\etal}{% \@ifnextchar{.}{\protect\ETAL}% {\protect\ETAL.\xspace}% }}{}% \@ifundefined{viz}{ \newcommand{\VIZ}{\abbrevFont{viz}} \newcommand*{\viz}{% \@ifnextchar{.}{\VIZ}% {\VIZ.\xspace}% }}{}% \makeatother \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{\VPageref}[2][page]{\ifx#1\@empty\else{#1}\nobreakspace\fi\pageref{#2}} \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} \usepackage{calc} % latex arithmetic \makeatletter \newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{#1}}} \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}} \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}} \newlength{\gcolumnposn} % temporary hack because lstlisting does not handle tabs correctly \newlength{\columnposn} \setlength{\gcolumnposn}{2.75in} \setlength{\columnposn}{\gcolumnposn} \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}}}} \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}} \makeatother \newcommand{\CFAStyle}{% \lstset{ columns=fullflexible, basicstyle=\linespread{0.9}\sf, % reduce line spacing and use sanserif font stringstyle=\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 escapechar=§, % LaTeX escape in CFA code §...§ (section symbol), emacs: C-q M-' mathescape=true, % 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{0.6ex}{$\scriptscriptstyle\land\,$}}1 {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1 {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2, }% lstset }% CFAStyle \ifdefined\CFALatin% extra Latin-1 escape characters \lstnewenvironment{cfa}[1][]{ \lstset{ language=CFA, 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-^ % replace/adjust listing characters that look bad in sanserif add to literate={`}{\ttfamily\upshape\hspace*{-0.1ex}`}1 }% lstset \lstset{#1} }{} % inline code ©...© (copyright symbol) emacs: C-q M-) \lstMakeShortInline© % single-character for \lstinline \else% regular ASCI characters \lstnewenvironment{cfa}[1][]{ \lstset{ language=CFA, escapechar=\$, % LaTeX escape in CFA code mathescape=false, % LaTeX math escape in CFA code $...$ moredelim=**[is][\color{red}]{@}{@}, % red highlighting @...@ }% lstset \lstset{#1} }{} % inline code @...@ (at symbol) \lstMakeShortInline@ % single-character for \lstinline \fi% % Local Variables: % % tab-width: 4 % % fill-column: 100 % % End: %