source: doc/papers/concurrency/style/cfa-format.tex @ d5ccbe9

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since d5ccbe9 was d5ccbe9, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

modify for SPE macros

  • Property mode set to 100644
File size: 8.1 KB
Line 
1%\usepackage[usenames,dvipsnames]{xcolor}
2\usepackage{listings}
3\usepackage{inconsolata}
4
5\definecolor{basicCol}{HTML}{000000}
6\definecolor{commentCol}{HTML}{000000}
7\definecolor{stringCol}{HTML}{000000}
8\definecolor{keywordCol}{HTML}{000000}
9\definecolor{identifierCol}{HTML}{000000}
10
11% from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
12\lstdefinelanguage{sml} {
13  morekeywords= {
14    EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before, bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor, handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op, open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature, string, struct, structure, substring, then, true, type, unit, val, vector, where, while, with, withtype, word
15  },
16  morestring=[b]",
17  morecomment=[s]{(*}{*)},
18}
19
20\lstdefinelanguage{D}{
21  % Keywords
22  morekeywords=[1]{
23    abstract, alias, align, auto, body, break, cast, catch, class, const,
24    continue, debug, delegate, delete, deprecated, do, else, enum, export,
25    false, final, finally, for, foreach, foreach_reverse, function, goto, if,
26    immutable, import, in, inout, interface, invariant, is, lazy, macro, mixin,
27    module, new, nothrow, null, out, override, package, pragma, private,
28    protected, public, pure, ref, return, shared, static, struct, super,
29    switch, synchronized, template, this, throw, true, try, typedef, typeid,
30    typeof, union, unittest, volatile, while, with
31  },
32  % Special identifiers, common functions
33  morekeywords=[2]{enforce},
34  % Ugly identifiers
35  morekeywords=[3]{
36    __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
37    __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
38    _arguments, _ctor, _dtor
39  },
40  % Basic types
41  morekeywords=[4]{
42     byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void,
43     bool, bit, float, double, real, ushort, int, uint, long, ulong, float,
44     char, wchar, dchar, string, wstring, dstring, ireal, ifloat, idouble,
45     creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t, equals_t, hash_t
46  },
47  % Strings
48  morestring=[b]{"},
49  morestring=[b]{'},
50  morestring=[b]{`},
51  % Comments
52  comment=[l]{//},
53  morecomment=[s]{/*}{*/},
54  morecomment=[s][\color{blue}]{/**}{*/},
55  morecomment=[n]{/+}{+/},
56  morecomment=[n][\color{blue}]{/++}{+/},
57  % Options
58  sensitive=true
59}
60
61\lstdefinelanguage{rust}{
62  % Keywords
63  morekeywords=[1]{
64    abstract, alignof, as, become, box,
65    break, const, continue, crate, do,
66    else, enum, extern, false, final,
67    fn, for, if, impl, in,
68    let, loop, macro, match, mod,
69    move, mut, offsetof, override, priv,
70    proc, pub, pure, ref, return,
71    Self, self, sizeof, static, struct,
72    super, trait, true,  type, typeof,
73    unsafe, unsized, use, virtual, where,
74    while, yield
75  },
76  % Strings
77  morestring=[b]{"},
78  % Comments
79  comment=[l]{//},
80  morecomment=[s]{/*}{*/},
81  % Options
82  sensitive=true
83}
84
85\lstdefinelanguage{pseudo}{
86        morekeywords={string,uint,int,bool,float},%
87        sensitive=true,%
88        morecomment=[l]{//},%
89        morecomment=[s]{/*}{*/},%
90        morestring=[b]',%
91        morestring=[b]",%
92        morestring=[s]{`}{`},%
93}%
94
95\newcommand{\KWC}{K-W C\xspace}
96
97\lstdefinestyle{pseudoStyle}{
98  escapeinside={@@},
99  basicstyle=\linespread{0.9}\sf\footnotesize,          % reduce line spacing and use typewriter font
100  keywordstyle=\bfseries\color{blue},
101  keywordstyle=[2]\bfseries\color{Plum},
102  commentstyle=\itshape\color{OliveGreen},                  % green and italic comments
103  identifierstyle=\color{identifierCol},
104  stringstyle=\sf\color{Mahogany},                                % use sanserif font
105  mathescape=true,
106  columns=fixed,
107  aboveskip=4pt,                                  % spacing above/below code block
108  belowskip=3pt,
109  keepspaces=true,
110  tabsize=4,
111  % frame=lines,
112  literate=,
113  showlines=true,                                 % show blank lines at end of code
114  showspaces=false,
115  showstringspaces=false,
116  escapechar=\$,
117  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
118  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
119  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
120  % moredelim=** allows cumulative application
121}
122
123\lstdefinestyle{defaultStyle}{
124  escapeinside={@@},
125  basicstyle=\linespread{0.9}\tt\footnotesize,          % reduce line spacing and use typewriter font
126  keywordstyle=\bfseries\color{blue},
127  keywordstyle=[2]\bfseries\color{Plum},
128  commentstyle=\itshape\color{OliveGreen},                  % green and italic comments
129  identifierstyle=\color{identifierCol},
130  stringstyle=\sf\color{Mahogany},                                % use sanserif font
131  mathescape=true,
132  columns=fixed,
133  aboveskip=4pt,                                  % spacing above/below code block
134  belowskip=3pt,
135  keepspaces=true,
136  tabsize=4,
137  % frame=lines,
138  literate=,
139  showlines=true,                                 % show blank lines at end of code
140  showspaces=false,
141  showstringspaces=false,
142  escapechar=\$,
143  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
144  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
145  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
146  % moredelim=** allows cumulative application
147}
148
149\lstdefinestyle{cfaStyle}{
150  escapeinside={@@},
151  basicstyle=\linespread{0.9}\sf,               % reduce line spacing and use typewriter font
152%  keywordstyle=\bfseries\color{blue},
153  keywordstyle=[2]\bfseries\color{red},
154%  commentstyle=\sf\itshape\color{OliveGreen},            % green and italic comments
155  identifierstyle=\color{identifierCol},
156%  stringstyle=\sf\color{Mahogany},                               % use sanserif font
157  stringstyle=\tt,                                                                              % use typewriter font
158  mathescape=true,
159  columns=fixed,
160  aboveskip=4pt,                                  % spacing above/below code block
161  belowskip=3pt,
162  keepspaces=true,
163  tabsize=4,
164  % frame=lines,
165  literate=,
166  showlines=true,                                 % show blank lines at end of code
167  showspaces=false,
168  showstringspaces=false,
169  escapechar=\$,
170  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
171  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
172  morekeywords=[2]{accept, signal, signal_block, wait, waitfor},
173}
174
175\lstMakeShortInline[basewidth=0.5em,breaklines=true,basicstyle=\normalsize\ttfamily\color{basicCol}]% single-character for \lstinline
176
177\lstnewenvironment{ccode}[1][]{
178  \lstset{
179    language = C,
180    style=defaultStyle,
181    captionpos=b,
182    #1
183  }
184}{}
185
186\lstnewenvironment{cfacode}[1][]{
187  \lstset{
188    language = CFA,
189    style=cfaStyle,
190    captionpos=b,
191    #1
192  }
193}{}
194
195\lstnewenvironment{pseudo}[1][]{
196  \lstset{
197    language = pseudo,
198    style=pseudoStyle,
199    captionpos=b,
200    #1
201  }
202}{}
203
204\lstnewenvironment{cppcode}[1][]{
205  \lstset{
206    language = c++,
207    style=defaultStyle,
208    captionpos=b,
209    #1
210  }
211}{}
212
213\lstnewenvironment{ucppcode}[1][]{
214  \lstset{
215    language = c++,
216    style=defaultStyle,
217    captionpos=b,
218    #1
219  }
220}{}
221
222\lstnewenvironment{javacode}[1][]{
223  \lstset{
224    language = java,
225    style=defaultStyle,
226    captionpos=b,
227    #1
228  }
229}{}
230
231\lstnewenvironment{scalacode}[1][]{
232  \lstset{
233    language = scala,
234    style=defaultStyle,
235    captionpos=b,
236    #1
237  }
238}{}
239
240\lstnewenvironment{smlcode}[1][]{
241  \lstset{
242    language = sml,
243    style=defaultStyle,
244    captionpos=b,
245    #1
246  }
247}{}
248
249\lstnewenvironment{dcode}[1][]{
250  \lstset{
251    language = D,
252    style=defaultStyle,
253    captionpos=b,
254    #1
255  }
256}{}
257
258\lstnewenvironment{rustcode}[1][]{
259  \lstset{
260    language = rust,
261    style=defaultStyle,
262    captionpos=b,
263    #1
264  }
265}{}
266
267\lstnewenvironment{gocode}[1][]{
268  \lstset{
269    language = Golang,
270    style=defaultStyle,
271    captionpos=b,
272    #1
273  }
274}{}
275
276\newcommand{\zero}{\lstinline{zero_t}\xspace}
277\newcommand{\one}{\lstinline{one_t}\xspace}
278\newcommand{\ateq}{\lstinline{\@=}\xspace}
279\newcommand{\code}[1]{\lstinline[language=CFA,style=cfaStyle]{#1}}
280\newcommand{\pscode}[1]{\lstinline[language=pseudo,style=pseudoStyle]{#1}}
Note: See TracBrowser for help on using the repository browser.