[b52d900] | 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 2 | %%
|
---|
| 3 | %% Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
---|
| 4 | %%
|
---|
| 5 | %% The contents of this file are covered under the licence agreement in the
|
---|
| 6 | %% file "LICENCE" distributed with Cforall.
|
---|
| 7 | %%
|
---|
| 8 | %% common.tex --
|
---|
| 9 | %%
|
---|
| 10 | %% Author : Peter A. Buhr
|
---|
| 11 | %% Created On : Sat Apr 9 10:06:17 2016
|
---|
| 12 | %% Last Modified By : Peter A. Buhr
|
---|
[9724df0] | 13 | %% Last Modified On : Mon Jun 20 09:35:20 2016
|
---|
| 14 | %% Update Count : 178
|
---|
[b52d900] | 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 16 |
|
---|
[e55ca05] | 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 18 |
|
---|
[e229c22] | 19 | \setlength{\textheight}{9in}
|
---|
| 20 | %\oddsidemargin 0.0in
|
---|
| 21 | \renewcommand{\topfraction}{0.8} % float must be greater than X of the page before it is forced onto its own page
|
---|
| 22 | \renewcommand{\bottomfraction}{0.8} % float must be greater than X of the page before it is forced onto its own page
|
---|
| 23 | \renewcommand{\floatpagefraction}{0.8} % float must be greater than X of the page before it is forced onto its own page
|
---|
| 24 | \renewcommand{\textfraction}{0.0} % the entire page maybe devoted to floats with no text on the page at all
|
---|
[9724df0] | 25 |
|
---|
| 26 | \lefthyphenmin=4
|
---|
| 27 | \righthyphenmin=4
|
---|
| 28 |
|
---|
[e229c22] | 29 | \usepackage{pslatex} % reduce size of san serif font
|
---|
| 30 |
|
---|
[9724df0] | 31 | \usepackage[ignoredisplayed]{enumitem} % do not affect trivlist
|
---|
| 32 | \setlist{labelsep=1ex}% global
|
---|
| 33 | \setlist[itemize]{topsep=0.5ex,parsep=0.25ex,itemsep=0.25ex,listparindent=\parindent,leftmargin=\parindent}% global
|
---|
| 34 | \setlist[itemize,1]{label=\textbullet}% local
|
---|
| 35 | %\renewcommand{\labelitemi}{{\raisebox{0.25ex}{\footnotesize$\bullet$}}}
|
---|
| 36 | \setlist[enumerate]{listparindent=\parindent}% global
|
---|
| 37 | \setlist[enumerate,2]{leftmargin=\parindent,labelsep=*,align=parleft,label=\alph*.}% local
|
---|
| 38 | \setlist[description]{listparindent=\parindent,leftmargin=\parindent,labelsep=*}
|
---|
| 39 |
|
---|
[e55ca05] | 40 | % Names used in the document.
|
---|
| 41 |
|
---|
[e945826] | 42 | \newcommand{\CFA}{C$\mathbf\forall$\xspace} % set language symbolic name
|
---|
| 43 | \newcommand{\CFL}{Cforall\xspace} % set language text name
|
---|
[9724df0] | 44 | \newcommand{\CC}{\rm C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name
|
---|
[e55ca05] | 45 | \def\c11{ISO/IEC C} % C11 name (cannot have numbers in latex command name)
|
---|
| 46 |
|
---|
| 47 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
| 48 |
|
---|
| 49 | \makeatletter
|
---|
[9724df0] | 50 | % parindent is relative, i.e., toggled on/off in environments like itemize, so store the value for
|
---|
| 51 | % use rather than use \parident directly.
|
---|
| 52 | \newlength{\parindentlnth}
|
---|
| 53 | \setlength{\parindentlnth}{\parindent}
|
---|
[e229c22] | 54 |
|
---|
[e55ca05] | 55 | % allow escape sequence in lstinline
|
---|
| 56 | %\usepackage{etoolbox}
|
---|
| 57 | %\patchcmd{\lsthk@TextStyle}{\let\lst@DefEsc\@empty}{}{}{\errmessage{failed to patch}}
|
---|
| 58 |
|
---|
[45576af9] | 59 | \usepackage{pslatex} % reduce size of san serif font
|
---|
[e945826] | 60 | \usepackage{relsize} % must be after change to small or selects old size
|
---|
[e55ca05] | 61 |
|
---|
| 62 | % reduce size of chapter/section titles
|
---|
| 63 | \def\@makechapterhead#1{%
|
---|
| 64 | \vspace*{50\p@}%
|
---|
| 65 | {\parindent \z@ \raggedright \normalfont
|
---|
| 66 | \ifnum \c@secnumdepth >\m@ne
|
---|
| 67 | \large\bfseries \@chapapp\space \thechapter
|
---|
| 68 | \par\nobreak
|
---|
| 69 | \vskip 5\p@
|
---|
| 70 | \fi
|
---|
| 71 | \interlinepenalty\@M
|
---|
| 72 | \Large \bfseries #1\par\nobreak
|
---|
| 73 | \vskip 50\p@
|
---|
| 74 | }}
|
---|
| 75 | \def\@makeschapterhead#1{%
|
---|
| 76 | \vspace*{50\p@}%
|
---|
| 77 | {\parindent \z@ \raggedright
|
---|
| 78 | \normalfont
|
---|
| 79 | \interlinepenalty\@M
|
---|
| 80 | \Large \bfseries #1\par\nobreak
|
---|
| 81 | \vskip 50\p@
|
---|
| 82 | }}
|
---|
[45576af9] | 83 | \renewcommand\section{\@startsection{section}{1}{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}{1.75ex \@plus .2ex}{\normalfont\large\bfseries}}
|
---|
[8bc4ef8] | 84 | \renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex \@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
|
---|
[e55ca05] | 85 | \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.5ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
|
---|
| 86 | \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.0ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries}}
|
---|
| 87 |
|
---|
| 88 | % index macros
|
---|
| 89 | \newcommand{\italic}[1]{\emph{\hyperpage{#1}}}
|
---|
| 90 | \newcommand{\definition}[1]{\textbf{\hyperpage{#1}}}
|
---|
| 91 | \newcommand{\see}[1]{\emph{see} #1}
|
---|
| 92 |
|
---|
| 93 | % Define some commands that produce formatted index entries suitable for cross-references.
|
---|
| 94 | % ``\spec'' produces entries for specifications of entities. ``\impl'' produces entries for their
|
---|
| 95 | % implementations, and ``\use'' for their uses.
|
---|
| 96 |
|
---|
| 97 | % \newcommand{\bold}[1]{{\bf #1}}
|
---|
| 98 | % \def\spec{\@bsphack\begingroup
|
---|
| 99 | % \def\protect##1{\string##1\space}\@sanitize
|
---|
| 100 | % \@wrxref{|bold}}
|
---|
| 101 | \def\impl{\@bsphack\begingroup
|
---|
| 102 | \def\protect##1{\string##1\space}\@sanitize
|
---|
| 103 | \@wrxref{|definition}}
|
---|
| 104 | \newcommand{\indexcode}[1]{{\lstinline$#1$}}
|
---|
| 105 | \def\use{\@bsphack\begingroup
|
---|
| 106 | \def\protect##1{\string##1\space}\@sanitize
|
---|
| 107 | \@wrxref{|hyperpage}}
|
---|
| 108 | \def\@wrxref#1#2{\let\thepage\relax
|
---|
| 109 | \xdef\@gtempa{\write\@indexfile{\string
|
---|
| 110 | \indexentry{#2@{\lstinline$#2$}#1}{\thepage}}}\endgroup\@gtempa
|
---|
| 111 | \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}
|
---|
| 112 | %\newcommand{\use}[1]{\index{#1@{\lstinline$#1$}}}
|
---|
| 113 | %\newcommand{\impl}[1]{\index{\protect#1@{\lstinline$\protect#1$}|definition}}
|
---|
| 114 |
|
---|
| 115 | % inline text and lowercase index: \Index{inline and lowercase index text}
|
---|
| 116 | % inline text and as-in index: \Index[as-is index text]{inline text}
|
---|
| 117 | % inline text but index with different as-is text: \Index[index text]{inline text}
|
---|
| 118 | \newcommand{\Index}{\@ifstar\@sIndex\@Index}
|
---|
| 119 | \newcommand{\@Index}[2][\@empty]{\lowercase{\def\temp{#2}}#2\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi}
|
---|
| 120 | \newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
|
---|
[e945826] | 121 |
|
---|
| 122 | \newcommand{\Indexc}[1]{\lstinline$#1$\index{#1@\lstinline$#1$}}
|
---|
[8bc4ef8] | 123 | \newcommand{\indexc}[1]{\index{#1@\lstinline$#1$}}
|
---|
[e55ca05] | 124 |
|
---|
| 125 | \newcommand{\newtermFontInline}{\emph}
|
---|
| 126 | \newcommand{\newterm}{\@ifstar\@snewterm\@newterm}
|
---|
| 127 | \newcommand{\@newterm}[2][\@empty]{\lowercase{\def\temp{#2}}{\newtermFontInline{#2}}\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi}
|
---|
| 128 | \newcommand{\@snewterm}[2][\@empty]{{\newtermFontInline{#2}}\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
|
---|
| 129 | \makeatother
|
---|
| 130 |
|
---|
| 131 | \newenvironment{quote2}{%
|
---|
[45576af9] | 132 | \list{}{\lstset{resetmargins=true,aboveskip=0pt,belowskip=0pt}\topsep=4pt\parsep=0pt\leftmargin=\parindent\rightmargin\leftmargin}%
|
---|
[e55ca05] | 133 | \item\relax
|
---|
| 134 | }{%
|
---|
| 135 | \endlist
|
---|
| 136 | }% quote2
|
---|
| 137 | \newenvironment{rationale}{%
|
---|
[9724df0] | 138 | \begin{quote2}\noindent$\Box$\enspace
|
---|
[e55ca05] | 139 | }{%
|
---|
[9724df0] | 140 | \hfill\enspace$\Box$\end{quote2}
|
---|
[e55ca05] | 141 | }%
|
---|
| 142 |
|
---|
| 143 | % blocks and titles
|
---|
| 144 | \newcommand{\define}[1]{\emph{#1\/}\index{#1}}
|
---|
| 145 | \newcommand{\rewriterules}{\paragraph{Rewrite Rules}~\par\noindent}
|
---|
| 146 | \newcommand{\examples}{\paragraph{Examples}~\par\noindent}
|
---|
| 147 | \newcommand{\semantics}{\paragraph{Semantics}~\par\noindent}
|
---|
| 148 | \newcommand{\constraints}{\paragraph{Constraints}~\par\noindent}
|
---|
| 149 | \newcommand{\predefined}{\paragraph{Predefined Identifiers}~\par\noindent}
|
---|
| 150 |
|
---|
| 151 | % BNF macros
|
---|
[9724df0] | 152 | \newenvironment{syntax}{
|
---|
| 153 | \paragraph{Syntax}
|
---|
| 154 | \begin{quote2}
|
---|
| 155 | \begin{description}[noitemsep,leftmargin=\parindentlnth]
|
---|
| 156 | }{
|
---|
| 157 | \end{description}
|
---|
| 158 | \end{quote2}
|
---|
| 159 | }
|
---|
| 160 | % \def\syntax{\paragraph{Syntax}\trivlist\parindent=.5in\item[\hskip.5in]}
|
---|
| 161 | %\let\endsyntax=\endtrivlist
|
---|
| 162 | \newcommand{\lhs}[1]{\item[\emph{#1:}\index{#1@{\emph{#1}}|italic}]~\ignorespaces}
|
---|
| 163 | \newcommand{\oldlhs}[1]{\item[\emph{#1:}\index{#1@{\emph{#1}}|italic}~\dots]~}
|
---|
| 164 | \newcommand{\rhs}{\hfil\newline}
|
---|
| 165 | \newcommand{\nonterm}[1]{\emph{#1}\index{#1@{\emph{#1}}|italic}}
|
---|
[e55ca05] | 166 | \newcommand{\opt}{$_{opt}$\ }
|
---|
| 167 |
|
---|
| 168 | % adjust varioref package with default "section" and "page" titles, and optional title with faraway page numbers
|
---|
| 169 | % \VRef{label} => Section 2.7, \VPageref{label} => page 17
|
---|
| 170 | % \VRef[Figure]{label} => Figure 3.4, \VPageref{label} => page 17
|
---|
| 171 | \renewcommand{\reftextfaceafter}{\unskip}
|
---|
| 172 | \renewcommand{\reftextfacebefore}{\unskip}
|
---|
| 173 | \renewcommand{\reftextafter}{\unskip}
|
---|
| 174 | \renewcommand{\reftextbefore}{\unskip}
|
---|
| 175 | \renewcommand{\reftextfaraway}[1]{\unskip, p.~\pageref{#1}}
|
---|
| 176 | \renewcommand{\reftextpagerange}[2]{\unskip, pp.~\pageref{#1}--\pageref{#2}}
|
---|
| 177 | \newcommand{\VRef}[2][Section]{\ifx#1\@empty\else{#1}\nobreakspace\fi\vref{#2}}
|
---|
| 178 | \newcommand{\VPageref}[2][page]{\ifx#1\@empty\else{#1}\nobreakspace\fi\pageref{#2}}
|
---|
| 179 |
|
---|
| 180 | % Go programming language
|
---|
| 181 | \lstdefinelanguage{Golang}{
|
---|
| 182 | morekeywords=[1]{package,import,func,type,struct,return,defer,panic, recover,select,var,const,iota,},%
|
---|
| 183 | morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16, int32,int64,
|
---|
| 184 | bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},%
|
---|
| 185 | morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false, delete,append,real,imag,complex,chan,},%
|
---|
| 186 | morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if, else,default,},%
|
---|
| 187 | morekeywords=[5]{Println,Printf,Error,},%
|
---|
| 188 | sensitive=true,%
|
---|
| 189 | morecomment=[l]{//},%
|
---|
| 190 | morecomment=[s]{/*}{*/},%
|
---|
| 191 | morestring=[b]',%
|
---|
| 192 | morestring=[b]",%
|
---|
| 193 | morestring=[s]{`}{`},%
|
---|
| 194 | }
|
---|
| 195 |
|
---|
| 196 | % CFA programming language, based on ANSI C
|
---|
| 197 | \lstdefinelanguage{CFA}[ANSI]{C}{
|
---|
| 198 | morekeywords={_Alignas,_Alignof,__alignof,__alignof__,asm,__asm,__asm__,_At,_Atomic,__attribute,__attribute__,auto,
|
---|
| 199 | _Bool,catch,catchResume,choose,_Complex,__complex,__complex__,__const,__const__,disable,dtype,enable,__extension__,
|
---|
| 200 | fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,__label__,lvalue,_Noreturn,otype,restrict,_Static_assert,
|
---|
| 201 | _Thread_local,throw,throwResume,trait,try,typeof,__typeof,__typeof__,},
|
---|
| 202 | }%
|
---|
| 203 |
|
---|
| 204 | \lstset{
|
---|
| 205 | language=CFA,
|
---|
| 206 | columns=flexible,
|
---|
[45576af9] | 207 | basicstyle=\linespread{0.9}\sf,
|
---|
[8bc4ef8] | 208 | stringstyle=\tt,
|
---|
[e55ca05] | 209 | tabsize=4,
|
---|
[9724df0] | 210 | xleftmargin=\parindentlnth,
|
---|
[e945826] | 211 | extendedchars=true,
|
---|
| 212 | escapechar=§,
|
---|
[e55ca05] | 213 | mathescape=true,
|
---|
| 214 | keepspaces=true,
|
---|
| 215 | showstringspaces=false,
|
---|
| 216 | showlines=true,
|
---|
[8bc4ef8] | 217 | aboveskip=4pt,
|
---|
[45576af9] | 218 | belowskip=3pt,
|
---|
[e945826] | 219 | moredelim=**[is][\color{red}]{®}{®}, % red highlighting
|
---|
[45576af9] | 220 | moredelim=**[is][\color{blue}]{ß}{ß}, % blue highlighting
|
---|
| 221 | moredelim=**[is][\color{OliveGreen}]{¢}{¢}, % green highlighting
|
---|
[e945826] | 222 | moredelim=[is][\lstset{keywords={}}]{¶}{¶}, % temporarily turn off keywords
|
---|
[45576af9] | 223 | % replace/adjust listing characters that look bad in sanserif
|
---|
| 224 | literate={-}{\raisebox{-0.15ex}{\texttt{-}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
|
---|
| 225 | {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {_}{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
|
---|
| 226 | {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {...}{$\dots$}2,
|
---|
[e55ca05] | 227 | }%
|
---|
| 228 |
|
---|
[0638c44] | 229 | \lstMakeShortInline© % single-character for \lstinline
|
---|
| 230 |
|
---|
[e55ca05] | 231 | % Local Variables: %
|
---|
| 232 | % tab-width: 4 %
|
---|
| 233 | % fill-column: 100 %
|
---|
| 234 | % End: %
|
---|