Changeset df24d37


Ignore:
Timestamp:
Apr 26, 2021, 4:37:36 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
edc6ea2
Parents:
5456537
Message:

Andrew MMath: Switch from common.tex to cfalab.sty. Still work to do but it is almost everything I had before.

Location:
doc/theses/andrew_beach_MMath
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/cfalab.sty

    r5456537 rdf24d37  
    1010
    1111% Other packages required.
     12%
     13% Access to new basic LaTeX tools and other low level commands.
    1214\RequirePackage{etoolbox}
     15% Code formatting tools and environments.
    1316\RequirePackage{listings}
     17% Automatically adds spaces.
    1418\RequirePackage{xspace}
     19% Improved reference tools.
     20\RequirePackage[nospace]{varioref}
    1521
    1622% Symbols: All symbols are zero argument robust commands with special rules
     
    2834\newsymbolcmd\CFA{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}}
    2935% C++ with kerning. (No standard number support.)
    30 \newsymbolcmd\CPP{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}
     36\newsymbolcmd\Cpp{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}
    3137
    32 % This is executed very early in the \begin{document} code.
     38% This is executed very early in the \begin{document} code, before the
     39% document's contents but after packages are loaded.
    3340\AtEndPreamble{
    3441  \@ifpackageloaded{hyperref}{
     
    3643    \pdfstringdefDisableCommands{
    3744      \def\CFA{CFA}
    38       \def\CPP{C++}
     45      \def\Cpp{C++}
     46      \def\lstinline{}
    3947    }
    4048  }{}
    4149}
     50
     51% \colour{<colour>}{<text>}
     52% Just \colour but using the LaTeX style instead of TeX style command.
     53\newcommand*\colour[2]{{\color{#1}#2}}
     54
     55% \code*{<code>}
     56% Use the listings package to format a snipit of <code>.
     57\newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}}
     58\newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}}
     59\newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}}
     60\newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}}
     61
     62\lstnewenvironment{cfa}[1][]{\lstset{language=CFA}\lstset{#1}}{}
     63
     64% \settextunderscore{(new|old)}
     65% Redefines the underscore either as a new repersentation or the old one.
     66% Not that some other packages (ex. hyperref) can override this. Set it up
     67% after loading them.
     68\let\cfalab@textunderscore@old=\textunderscore
     69\newcommand\cfalab@textunderscore@new{%
     70    \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
     71\newcommand\settextunderscore[1]{%
     72    \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
    4273
    4374% The CFA listings language. Based off of ANCI C and including GCC extensions.
     
    6899}
    69100
    70 % \code*[<escape character>]{<code>}
    71 %     Use the listings package to format a snipit of <code>.
    72 %     The <escape character> must be a character that does not appear in
    73 %     <code> and defaults to a backtick.
    74 \newcommand*\codeC[2][\`]{\lstinline[language=C]#1#2#1}
    75 \newcommand*\codeCFA[2][\`]{\lstinline[language=CFA]#1#2#1}
     101% common.tex Compatablity ===================================================
     102% Below this line is for compatability with the old common.tex file.
    76103
    77 % \settextunderscore{(new|old)}
    78 %     Redefines the underscore either as a new repersentation or the old one.
    79 %     Not that some other packages (ex. hyperref) can override this. Set it
    80 %     up after loading them.
    81 \let\cfalab@textunderscore@old=\textunderscore
    82 \newcommand\cfalab@textunderscore@new{%
    83     \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
    84 \newcommand\settextunderscore[1]{%
    85     \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
     104\newcommand{\CFAStyle}{%
     105  \lstset{
     106    columns=fullflexible,
     107    % reduce line spacing and use sanserif font
     108    basicstyle=\linespread{0.9}\sf,
     109    % use typewriter font
     110    stringstyle=\tt,
     111    tabsize=5,
     112    % indent code to paragraph indentation
     113    %xleftmargin=\parindentlnth,
     114    % Allow ASCII characters in the range 128-255.
     115    extendedchars=true,
     116    % This allows you to use "math mode" to insert LaTeX into the code.
     117    % Use \( and \) if you need to insert math mode inside that code.
     118    escapechar=\$,
     119    % LaTeX math escape in CFA code $...$
     120    mathescape=false,
     121    keepspaces=true,
     122    % do not show spaces with cup
     123    showstringspaces=false,
     124    % show blank lines at end of code
     125    showlines=true,
     126    aboveskip=4pt,                          % spacing above/below code block
     127    belowskip=0pt,
     128    % numbering style
     129    numberstyle=\footnotesize\sf,
     130    % replace/adjust listing characters that look bad in sanserif
     131    literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
     132      {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     133      {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
     134      {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2
     135      {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
     136  }
     137}
     138
     139\newcommand{\abbrevFont}{\textit}           % set empty for no italics
     140\@ifundefined{eg}{
     141\newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
     142\newcommand*{\eg}{%
     143    \@ifnextchar{,}{\EG}%
     144        {\@ifnextchar{:}{\EG}%
     145            {\EG,\xspace}}%
     146}}{}%
     147\@ifundefined{ie}{
     148\newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
     149\newcommand*{\ie}{%
     150    \@ifnextchar{,}{\IE}%
     151        {\@ifnextchar{:}{\IE}%
     152            {\IE,\xspace}}%
     153}}{}%
     154\@ifundefined{etc}{
     155\newcommand{\ETC}{\abbrevFont{etc}}
     156\newcommand*{\etc}{%
     157    \@ifnextchar{.}{\ETC}%
     158        {\ETC.\xspace}%
     159}}{}%
     160\@ifundefined{etal}{
     161\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
     162\newcommand*{\etal}{%
     163    \@ifnextchar{.}{\protect\ETAL}%
     164        {\protect\ETAL.\xspace}%
     165}}{}%
     166\@ifundefined{viz}{
     167\newcommand{\VIZ}{\abbrevFont{viz}}
     168\newcommand*{\viz}{%
     169    \@ifnextchar{.}{\VIZ}%
     170        {\VIZ.\xspace}%
     171}}{}%
    86172
    87173\endinput
  • doc/theses/andrew_beach_MMath/existing.tex

    r5456537 rdf24d37  
    1616to be defined~\cite{Moss18}.
    1717\begin{cfa}
    18 char i; int i; double i;                        $\C[3.75in]{// variable overload}$
    19 int f(); double f();                            $\C{// return overload}$
    20 void g( int ); void g( double );        $\C{// parameter overload}\CRT$
     18char i; int i; double i;
     19int f(); double f();
     20void g( int ); void g( double );
    2121\end{cfa}
    2222This feature requires name mangling so the assembly symbols are unique for
  • doc/theses/andrew_beach_MMath/features.tex

    r5456537 rdf24d37  
    2020\subparagraph{Raise}
    2121The raise is the starting point for exception handling. It marks the beginning
    22 of exception handling by \newterm{raising} an excepion, which passes it to
     22of exception handling by raising an excepion, which passes it to
    2323the EHM.
    2424
     
    235235Both traits ensure a pair of types are an exception type and its virtual table
    236236and defines one of the two default handlers. The default handlers are used
    237 as fallbacks and are discussed in detail in \VRef{s:ExceptionHandling}.
     237as fallbacks and are discussed in detail in \vref{s:ExceptionHandling}.
    238238
    239239However, all three of these traits can be tricky to use directly.
     
    351351for particular exception type.
    352352The global default termination handler performs a cancellation
    353 \see{\VRef{s:Cancellation}} on the current stack with the copied exception.
     353(see \vref{s:Cancellation}) on the current stack with the copied exception.
    354354
    355355\subsection{Resumption}
     
    426426
    427427\subsubsection{Resumption Marking}
     428\label{s:ResumptionMarking}
    428429A key difference between resumption and termination is that resumption does
    429430not unwind the stack. A side effect that is that when a handler is matched
  • doc/theses/andrew_beach_MMath/future.tex

    r5456537 rdf24d37  
    110110\section{Zero-Cost Try}
    111111\CFA does not have zero-cost try-statements because the compiler generates C
    112 code rather than assembler code \see{\VPageref{p:zero-cost}}. When the compiler
     112code rather than assembler code (see \vpageref{p:zero-cost}). When the compiler
    113113does create its own assembly (or LLVM byte-code), then zero-cost try-statements
    114114are possible. The downside of zero-cost try-statements is the LSDA complexity,
  • doc/theses/andrew_beach_MMath/implement.tex

    r5456537 rdf24d37  
    99% Virtual table rules. Virtual tables, the pointer to them and the cast.
    1010While the \CFA virtual system currently has only one public feature, virtual
    11 cast \see{\VPageref{p:VirtualCast}}, substantial structure is required to
    12 support it, and provide features for exception handling and the standard
    13 library.
     11cast (see the virtual cast feature \vpageref{p:VirtualCast}),
     12substantial structure is required to support it,
     13and provide features for exception handling and the standard library.
    1414
    1515\subsection{Virtual Type}
     
    215215\subsection{libunwind Usage}
    216216Libunwind, accessed through @unwind.h@ on most platforms, is a C library that
    217 provides \CC-style stack-unwinding. Its operation is divided into two phases:
     217provides \Cpp-style stack-unwinding. Its operation is divided into two phases:
    218218search and cleanup. The dynamic target search -- phase 1 -- is used to scan the
    219219stack and decide where unwinding should stop (but no unwinding occurs). The
     
    291291@_UA_FORCE_UNWIND@ specifies a forced unwind call. Forced unwind only performs
    292292the cleanup phase and uses a different means to decide when to stop
    293 \see{\VRef{s:ForcedUnwind}}.
     293(see \vref{s:ForcedUnwind}).
    294294\end{enumerate}
    295295
     
    400400
    401401Termination exceptions use libunwind heavily because it matches the intended
    402 use from \CC exceptions closely. The main complication for \CFA is that the
     402use from \Cpp exceptions closely. The main complication for \CFA is that the
    403403compiler generates C code, making it very difficult to generate the assembly to
    404404form the LSDA for try blocks or destructors.
     
    509509
    510510% Recursive Resumption Stuff:
    511 Search skipping \see{\VPageref{p:searchskip}}, which ignores parts of the stack
     511Search skipping (see \vpageref{s:ResumptionMarking}), which ignores parts of
     512the stack
    512513already examined, is accomplished by updating the front of the list as the
    513514search continues. Before the handler at a node is called the head of the list
     
    554555Cancellation also uses libunwind to do its stack traversal and unwinding,
    555556however it uses a different primary function @_Unwind_ForcedUnwind@. Details
    556 of its interface can be found in the \VRef{s:ForcedUnwind}.
     557of its interface can be found in the \vref{s:ForcedUnwind}.
    557558
    558559The first step of cancellation is to find the cancelled stack and its type:
  • doc/theses/andrew_beach_MMath/uw-ethesis.tex

    r5456537 rdf24d37  
    6666% Tip: Photographs should be cropped and compressed so as not to be too large.
    6767
    68 % To create a PDF output that is optimized for double-sided printing:
    69 % 1) comment-out the \documentclass statement in the preamble below, and
    70 %    un-comment the second \documentclass line.
    71 % 2) change the value assigned below to the boolean variable "PrintVersion"
    72 %    from "false" to "true".
    73 
    7468% ======================================================================
    7569%   D O C U M E N T   P R E A M B L E
     
    8781}
    8882
    89 % Some LaTeX commands I define for my own nomenclature.
    90 % If you have to, it's easier to make changes to nomenclature once here than
    91 % in a million places throughout your thesis!
    92 \newcommand{\package}[1]{\textbf{#1}} % package names in bold text
    93 \newcommand{\cmmd}[1]{\textbackslash\texttt{#1}} % command name in tt font
    94 \newcommand{\href}[1]{#1} % does nothing, but defines the command so the
     83%
     84\newcommand{\href}[1]{#1}
     85% Does nothing, but defines the command so the
    9586% print-optimized version will ignore \href tags (redefined by hyperref pkg).
    9687% Anything defined here may be redefined by packages added below...
     
    10798% Adds todos (Must be included after comment.)
    10899\usepackage{todonotes}
     100% cfa macros used in the document
     101\usepackage{cfalab}
    109102
    110103% Hyperlinks make it very easy to navigate an electronic document.
     
    208201\makeglossaries
    209202
    210 % cfa macros used in the document
    211 %\usepackage{cfalab}
    212 % I'm going to bring back eventually.
    213 \makeatletter
    214 % Combines all \CC* commands:
    215 \newrobustcmd*\Cpp[1][\xspace]{\cfalab@Cpp#1}
    216 \newcommand\cfalab@Cpp{C\kern-.1em\hbox{+\kern-.25em+}}
    217 % Optional arguments do not work with pdf string. (Some fix-up required.)
    218 \pdfstringdefDisableCommands{\def\Cpp{C++}}
    219 
    220 % Wrappers for inline code snippits.
    221 \newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}}
    222 \newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}}
    223 \newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}}
    224 \newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}}
    225 
    226 % Colour text, formatted in LaTeX style instead of TeX style.
    227 \newcommand*\colour[2]{{\color{#1}#2}}
    228 \makeatother
    229 
    230 \input{common}
     203\lstMakeShortInline@
     204
    231205% CFA code-style for all languages
    232206\CFAStyle
Note: See TracChangeset for help on using the changeset viewer.