-
Notifications
You must be signed in to change notification settings - Fork 65
/
openmp.sty
687 lines (576 loc) · 25.8 KB
/
openmp.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
% This is openmp.sty, the preamble and style definitions for the OpenMP specification.
% This is an include file. Please see the main file for more information.
%
% When editing this file:
%
% 1. To change formatting, appearance, or style, please edit openmp.sty.
%
% 2. Custom commands and macros are defined in openmp.sty.
%
% 3. Be kind to other editors -- keep a consistent style by copying-and-pasting to
% create new content.
%
% 4. We use semantic markup, e.g. (see openmp.sty for a full list):
% \code{} % for bold monospace keywords, code, operators, etc.
% \plc{} % for italic placeholder names, grammar, etc.
%
% 5. Other recommendations:
% Use the convenience macros defined in openmp.sty for the minor headers
% such as Comments, Syntax, etc.
%
% To keep items together on the same page, prefer the use of
% \begin{samepage}.... Avoid \parbox for text blocks as it interrupts line numbering.
% When possible, avoid \filbreak, \pagebreak, \newpage, \clearpage unless that's
% what you mean. Use \needspace{} cautiously for troublesome paragraphs.
%
% Avoid absolute lengths and measures in this file; use relative units when possible.
% Vertical space can be relative to \baselineskip or ex units. Horizontal space
% can be relative to \linewidth or em units.
%
% Prefer \emph{} to italicize terminology, e.g.:
% This is a \emph{definition}, not a placeholder.
% This is a \plc{var-name}.
%
% Quick list of the environments, commands and macros supported. Search below for more details.
%
% \binding % makes header of the same name
% \comments
% \constraints
% \crossreferences
% \descr
% \effect
% \format
% \restrictions
% \summary
% \syntax
%
% \code{} % monospace, bold
% \plc{} % for any kind of placeholder: italic
% \begin{codepar} % for blocks of verbatim code: monospace, bold
% \begin{boxedcode} % outlined verbatim code for syntax definitions, prototypes, etc.
% \begin{indentedcodelist} % used with,e.g., "where clause is one of the following:"
%
% \specref{} % formats the cross-reference "Section X on page Y"
%
% \begin{note} % black horizontal rule for Notes
% \end{note}
%
% \begin{cspecific} % blue horizontal rule for C-specific text
% \end{cspecific}
%
% \begin{cppspecific} % blue horizontal rule for C++ -specific text
% \end{cppspecific}
%
% \begin{ccppspecific} % blue horizontal rule for C/C++ -specific text
% \end{ccppspecific}
%
% \begin{fortranspecific} % blue horizontal rule for Fortran-specific text
% \end{fortranspecific}
%
% \glossaryterm % for use in formatting glossary entries
% \glossarydefstart
% \glossarydefend
%
% \compactitem % single-spaced itemized lists for the Examples doc
% \cexample % C/C++ code example for the Examples doc
% \fexample % Fortran code example for the Examples doc
\usepackage{comment} % allow use of \begin{comment}
\usepackage{ifpdf,ifthen} % allow conditional tests in LaTeX definitions
\usepackage{makecell} % Allows common formatting in cells with \thread & \makecell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document data
%
\author{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{courier}
\usepackage{helvet}
\usepackage[utf8]{inputenc}
% Main body serif font:
\usepackage{tgtermes}
\usepackage[T1]{fontenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Graphic elements
\usepackage{graphicx}
\usepackage{framed} % for making boxes with \begin{framed}
\usepackage{tikz} % for flow charts, diagrams, arrows
\usepackage{subcaption} % For subfigure
\usepackage{float} % To fix location of figure: \begin{figure}[H] for no float
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page formatting
%
% The PDF and book version need different margin spaces. The bookbuild
% macro is set by the build system (see Makefile) to determine whether
% we are building the PDF or the print-on-demand book version of the spec.
%
\ifdefined\bookbuild
% we are building the book version of the spec, so we need to have a bit
% more margin for the publisher to print
\usepackage[paperwidth=8in, paperheight=10in,
top=1.25in, bottom=1.5in, left=1.65in, right=0.85in]{geometry}
\setlength{\oddsidemargin}{0.875in}
\setlength{\evensidemargin}{0.385in}
\else
% we are building the PDF version of the spec, so we can use the default
% margins
\usepackage[paperwidth=7.5in, paperheight=9in,
top=0.75in, bottom=1.0in, left=1.4in, right=0.6in]{geometry}
\setlength{\oddsidemargin}{0.45in}
\setlength{\evensidemargin}{0.185in}
\fi
\usepackage{changepage} % allows left/right-page margin readjustments
\raggedbottom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Paragraph formatting
\usepackage{setspace} % allows use of \singlespacing, \onehalfspacing
\usepackage{needspace} % allows use of \needspace to keep lines together
\usepackage{parskip} % removes paragraph indenting
\raggedright
\usepackage[raggedrightboxes]{ragged2e} % is this needed?
\lefthyphenmin=60 % only hyphenate if the left part is >= this many chars
\righthyphenmin=60 % only hyphenate if the right part is >= this many chars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bulleted (itemized) lists
% Align bullets with section header
% Align text left
% Small bullets
% \compactitem for single-spaced lists (used in the Examples doc)
\usepackage{enumitem} % for setting margins on lists
\setlist{leftmargin=*} % don't indent bullet items
\renewcommand{\labelitemi}{{\normalsize$\bullet$}} % bullet size
% There is a \compactitem defined in package parlist (and perhaps others), however,
% we'll define our own version of compactitem in terms of package enumitem that
% we already use:
\newenvironment{compactitem}
{\begin{itemize}[itemsep=-1.2ex]}
{\end{itemize}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tables
% This allows tables to flow across page breaks, headers on each new page, etc.
\usepackage{supertabular}
\usepackage{caption}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Line numbering
\usepackage[pagewise]{lineno} % for line numbers on left side of the page
\pagewiselinenumbers
\setlength\linenumbersep{6em}
\renewcommand\linenumberfont{\normalfont\small\sffamily}
\nolinenumbers % start with line numbers off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Footers
\usepackage{fancyhdr} % makes right/left footers
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\cfoot{}
\renewcommand{\headrulewidth}{0pt}
% Left side on even pages:
% This requires that \footerText be defined in the main document:
\fancyfoot[LE]{\bfseries \thepage \mdseries \hspace{2em} \footerText}
\fancyhfoffset[E]{4em}
% Right side on odd pages:
\fancyfoot[RO]{\mdseries \leftmark \hspace{2em} \bfseries \thepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section header format - we use four levels: \chapter \section \subsection \subsubsection.
\usepackage{titlesec} % format headers with \titleformat{}
\usepackage{tocloft}
% Format and spacing for chapter, section, subsection, and subsubsection headers:
\setcounter{secnumdepth}{4} % show numbers down to subsubsection level
\titleformat{\chapter}[hang]%
{\normalfont\sffamily\upshape\Huge\bfseries\fontsize{20}{20}\selectfont}%
{\thechapter}{0.5em}{}
\titlespacing{\chapter}{0ex}{0em plus 1em minus 1em}{2em plus 1em minus 0em}[10em]
\titleformat{\section}[hang]{\huge\bfseries\sffamily\fontsize{16}{16}\selectfont}{\thesection}{0.5em}{}
\titlespacing{\section}{0em}{3em plus 1em minus 1em}{1em plus 0.5em minus 0em}[10em]
\titleformat{\subsection}[hang]{\LARGE\bfseries\sffamily\fontsize{14}{14}\selectfont}{\thesubsection}{0.5em}{}
\titlespacing{\subsection}{0em}{3em plus 1em minus 1em}{0.75em plus 0.5em minus 0em}[10em]
\titleformat{\subsubsection}[hang]{\needspace{1\baselineskip}%
\Large\bfseries\sffamily\fontsize{12}{12}\selectfont}{\thesubsubsection}{0.5em}{}
\titlespacing{\subsubsection}{0em}{3em plus 1em minus 1em}{0.5em plus 0.5em minus 0em}[10em]
\setlength{\cftbeforetoctitleskip}{1.0ex}
\setlength{\cftaftertoctitleskip}{3.0ex}
\setlength{\cftbeforeloftitleskip}{1.0ex}
\setlength{\cftafterloftitleskip}{3.0ex}
\setlength{\cftbeforelottitleskip}{1.0ex}
\setlength{\cftafterlottitleskip}{3.0ex}
\renewcommand{\cftchapaftersnum}{}
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.1em}{3.4em}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros for minor headers: Summary, Syntax, Description, etc.
% These headers are defined in terms of \paragraph
\titleformat{\paragraph}[block]{\large\bfseries\sffamily\fontsize{11}{11}\selectfont}{}{}{}
\titlespacing{\paragraph}{0em}{1.5em plus 0.55em minus 0.5em}{0.0em plus 0.55em minus 0.0em}
% Use one of the convenience macros below, or \littleheader{} for an arbitrary header
\newcommand{\littleheader}[1] {\paragraph*{#1}}
\newcommand{\binding} {\littleheader{Binding}}
\newcommand{\comments} {\littleheader{Comments}}
\newcommand{\constraints} {\littleheader{Constraints on Arguments}}
\newcommand{\crossreferences} {\littleheader{Cross References}}
\newcommand{\descr} {\littleheader{Description}}
\newcommand{\effect} {\littleheader{Effect}}
\newcommand{\format} {\littleheader{Format}}
\newcommand{\restrictions} {\littleheader{Restrictions}}
\newcommand{\summary} {\littleheader{Summary}}
\newcommand{\syntax} {\littleheader{Syntax}}
\usepackage{scrlayer}
\DeclareNewLayer[foreground,textarea,contents={
\phantom{a}
\emph{This page intentionally left blank}
}
]{intentionally.text}
\DeclareNewPageStyleByLayers{intentionally}{intentionally.text}
\renewcommand{\cleardoublepage}{\cleardoubleoddpageusingstyle{intentionally}}
\newcommand{\chapdirname}{}
\newcommand{\cchapter}[2] {\cleardoublepage\chapter{#1}%
\renewcommand{\chapdirname}{#2}}
\newcommand{\bchapter}[1] {\chapter*{#1}%
\addcontentsline{toc}{chapter}{\protect\numberline{}#1}}
%\newcommand{\sinput}[1] {\input{\chapdirname/#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code and placeholder semantic tagging.
%
% When possible, prefer semantic tags instead of typographic tags. The
% following semantics tags are defined here:
%
% \code{} % for bold monospace keywords, code, operators, etc.
% \plc{} % for italic placeholder names, grammar, etc.
%
% For function prototypes or other code snippets, you can use \code{} as
% the outer wrapper, and use \plc{{} inside. Example:
%
% \code{\#pragma omp directive ( \plc{some-placeholder-identifier} :}
%
% To format text in italics for emphasis (rather than text as a placeholder),
% use the generic \emph{} command. Example:
%
% This sentence \emph{emphasizes some non-placeholder words}.
% Enable \alltt{} for formatting blocks of code:
\usepackage{alltt}
\usepackage{toolbox} % for \toolboxReplace
% This sets the default \code{} font to tt (monospace) and bold:
\newcommand\code[1]{\texttt{\textbf{#1}}}
\newcommand\scode[1]{\protect\textbf{\protect\texttt{\protect\detokenize{#1}}}}
% This defines the \plc{} placeholder font to be tt normal slanted:
\newcommand\plc[1]{\textrm{\textmd{\itshape{#1}}}}
\newcommand\splc[1]{\protect\textit{\protect\textrm{\protect\detokenize{#1}}}}
% This is an updated set of macros for code style work
% kcode - keywords, vcode - value, bcode - base language,
% pvar - variables, pout - program outputs
\protected\def\DoReplaceU#1{\def\utexttmp{#1}%
\toolboxReplace{_}{\_}\utexttmp\utexttmp}
\protected\def\myreplacedmt#1#2{\def\stexttmp{#1}%
\toolboxReplace{_}{\_}\stexttmp%
\toolboxReplace{ }{\rmfamily{ }\ttfamily#2}\stexttmp%
{\ttfamily#2\stexttmp}}
\newcommand\kcode[1]{\myreplacedmt{#1}{\bfseries\upshape}}
\newcommand\vcode[1]{\myreplacedmt{#1}{\mdseries\upshape}}
\newcommand\bcode[1]{\kcode{#1}}
\newcommand\ucode[1]{\myreplacedmt{#1}{\mdseries\slshape}}
\newcommand\pvar[1]{\ucode{#1}}
\newcommand\pout[1]{\vcode{#1}}
\newcommand\docref[1]{\textrm{\mdseries\itshape{#1}}}
\newcommand\example[1]{\splc{#1}}
\newcommand\examplesrepo{https://github.com/OpenMP/Examples}
\newcommand\examplestree[2]{\href{\examplesrepo/tree/v#1}{#2}}
\newcommand\examplesref[1]{\examplestree{#1}{#1}}
\newcommand\examplesblob[1]{\href{\examplesrepo/blob/#1}{#1}}
% Environment for a paragraph of literal code, single-spaced, no outline, no indenting:
\usepackage{listings}
\lstnewenvironment{codepar}{%
}{}
%\newenvironment{codepar}[1]
%{\begin{alltt}\bfseries #1}
%{\end{alltt}}
% For blocks of code inside a box frame:
\lstnewenvironment{boxedcode}{%
\lstset{framesep=1.2ex,frame=l,framerule=3pt,
backgroundcolor=\color{white!90!black}}}{}
\lstnewenvironment{boxeducode}{%
\lstset{framesep=1.2ex,frame=l,framerule=3pt,
basicstyle=\ttfamily\mdseries\slshape,
backgroundcolor=\color{white!90!black}}}{}
%\newenvironment{boxedcode}[1]
%{\vspace{0.25em plus 5em minus %0.25em}\begin{framed}\begin{minipage}[t]{\textwidth}\begin{alltt}\bfseries #1}
%{\end{alltt}\end{minipage}\end{framed}\vspace{0.25em plus 5em minus 0.25em}}
% This sets the margins in the framed box:
\setlength{\FrameSep}{0.6em}
% For indented lists of verbatim code at a relaxed line spacing,
% e.g., for use after "where clause is one of the following:"
\usepackage{setspace}
\lstnewenvironment{indentedcodelist}{%
\lstset{xleftmargin=0.25in}}{}
%\newenvironment{indentedcodelist}{%
%\begin{adjustwidth}{0.25in}{}\vspace{-0.2\baselineskip}\begin{spacing}{1.2}\beg%in{alltt}\bfseries}
% {\end{alltt}\end{spacing}\vspace{-0.2\baselineskip}\end{adjustwidth}}
\lstdefinestyle{openmp}{
showstringspaces=false,
basicstyle=\ttfamily\bfseries,
linewidth=.99\linewidth,
xleftmargin=0.01\linewidth,
columns=fullflexible,
keepspaces=true,
escapechar=@,
belowskip=\smallskipamount,
aboveskip=\smallskipamount,
morecomment=[l][\color{red}\sout]{\%DIF\ <}, % deleted empty lines
morecomment=[l][\color{blue}\uwave]{\%DIF\ >}, % added empty lines
moredelim=[il][\color{red}\sout]{\%DIF\ <\ }, % deleted lines
moredelim=[il][\color{blue}\uwave]{\%DIF\ >\ }, % added lines
moredelim=**[is][\rmfamily\mdseries\itshape]{\\plc\{}{\}},
moredelim=**[is][\textsubscript]{\\textsubscript\{}{\}},
moredelim=**[is][]{\\textnormal\{}{\}},
moredelim=**[is][\rmfamily\mdseries\itshape]{\\textsl\{}{\}},
moredelim=**[is][\ttfamily\mdseries\slshape]{\\ucode\{}{\}},
moredelim=**[is][\ttfamily\bfseries\upshape]{\\kcode\{}{\}},
moredelim=**[is][]{\\code\{}{\}},
moredelim=**[is][]{\\scode\{}{\}},
moredelim=*[is][\color{red}\sout]{*!----}{----!*},
moredelim=*[is][\color{blue}\uwave]{*!++++}{++++!*},
moredelim=**[is][\mdseries\rmfamily]{\\text\{}{\}},
}
\lstset{style=openmp}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros for the black and blue lines and arrows delineating language-specific
% and notes sections. Example:
%
% \fortranspecificstart
% This is text that applies to Fortran.
% \fortranspecificend
% local parameters for use \linewitharrows and \notelinewitharrows:
\newlength{\sbsz}\setlength{\sbsz}{0.05in} % size of arrows
\newlength{\sblw}\setlength{\sblw}{1.35pt} % line width (thickness)
\newlength{\sbtw} % text width
\newlength{\sblen} % total width of horizontal rule
\newlength{\sbht} % height of arrows
\newlength{\sbhadj} % vertical adjustment for aligning arrows with the line
\newlength{\sbns}\setlength{\sbns}{7\baselineskip} % arg for \needspace for downward arrows
% \notelinewitharrows is a helper command that makes a black Note marker:
% arg 1 = 1 or -1 for up or down arrows
% arg 2 = solid or dashed or loosely dashed, etc.
\newcommand{\notelinewitharrows}[2]{%
\needspace{0.1\baselineskip}%
\vbox{\begin{tikzpicture}%
\setlength{\sblen}{\linewidth}%
\setlength{\sbht}{#1\sbsz}\setlength{\sbht}{1.4\sbht}%
\setlength{\sbhadj}{#1\sblw}\setlength{\sbhadj}{0.25\sbhadj}%
\filldraw (\sblen, 0) -- (\sblen - \sbsz, \sbht) -- (\sblen - 2\sbsz, 0) -- (\sblen, 0);
\draw[line width=\sblw, #2] (2\sbsz - \sblw, \sbhadj) -- (\sblen - 2\sbsz + \sblw, \sbhadj);
\filldraw (0, 0) -- (\sbsz, \sbht) -- (0 + 2\sbsz, 0) -- (0, 0);
\end{tikzpicture}}}
% \linewitharrows is a helper command that makes a blue horizontal line, up or down arrows, and some text:
% arg 1 = 1 or -1 for up or down arrows
% arg 2 = solid or dashed or loosely dashed, etc.
% arg 3 = text
% arg 4 = text width
\newcommand{\linewitharrows}[4]{%
\needspace{0.1\baselineskip}%
\vbox to 1\baselineskip {\begin{tikzpicture}%
\setlength{\sbtw}{#4}%
\setlength{\sblen}{\linewidth}%
\setlength{\sbht}{#1\sbsz}\setlength{\sbht}{1.4\sbht}%
\setlength{\sbhadj}{#1\sblw}\setlength{\sbhadj}{0.25\sbhadj}%
\filldraw[color=blue!40] (\sblen, 0) -- (\sblen - \sbsz, \sbht) -- (\sblen - 2\sbsz, 0) -- (\sblen, 0);
\draw[line width=\sblw, color=blue!40, #2] (2\sbsz - \sblw, \sbhadj) -- (0.5\sblen - 0.5\sbtw, \sbhadj);
\draw[line width=\sblw, color=blue!40, #2] (0.5\sblen + 0.5\sbtw, \sbhadj) -- (\sblen - 2\sbsz + \sblw, \sbhadj);
\filldraw[color=blue!40] (0, 0) -- (\sbsz, \sbht) -- (0 + 2\sbsz, 0) -- (0, 0);
\node[color=blue!90] at (0.5\sblen, 0) {\large \textsf{\textup{#3}}};
\end{tikzpicture}}}
\newcommand{\VSPb}{\vspace{0.5ex plus 5ex minus 0.25ex}}
\newcommand{\VSPa}{\vspace{0.25ex plus 5ex minus 0.25ex}}
% remove language marker definition if either ccpp or fortran is undefined
\ifthenelse{\boolean{ccpp}\and\boolean{fortran}}{}%
{\renewcommand{\linewitharrows}[4]{\par}}
\newcommand{\langselect}{}
\ifccpp\else\renewcommand{\langselect}{Fortran~}\fi
\iffortran\else\renewcommand{\langselect}{C/C++~}\fi
% C
\ifccpp
\newenvironment{cspecific}[1][0ex]{\vspace{#1}\cspecificstart\vspace{-#1}}{\cspecificend}
\else
\excludecomment{cspecific}
\fi
\newcommand{\cspecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C}{3em}}
\newcommand{\cspecificend}{\linewitharrows{1}{solid}{C}{3em}\bigskip}
% C/C++
\ifccpp
\newenvironment{ccppspecific}[1][0ex]{\vspace{#1}\ccppspecificstart\vspace{-#1}}{\ccppspecificend}
\else
\excludecomment{ccppspecific}
\fi
\newcommand{\ccppspecificstart}{\VSPb\linewitharrows{-1}{solid}{C / C++}{6em}\VSPa}
\newcommand{\ccppspecificend}{\VSPb\linewitharrows{1}{solid}{C / C++}{6em}\VSPa}
% C++
\ifccpp
\newenvironment{cppspecific}[1][0ex]{\vspace{#1}\cppspecificstart\vspace{-#1}}{\cppspecificend}
\else
\excludecomment{cppspecific}
\fi
\newcommand{\cppspecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C++}{6em}}
\newcommand{\cppspecificend}{\linewitharrows{1}{solid}{C++}{6em}\bigskip}
% C90
\newenvironment{cNinetyspecific}{\cNinetyspecificstart}{\cNinetyspecificend}
\newcommand{\cNinetyspecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C90}{4em}}
\newcommand{\cNinetyspecificend}{\linewitharrows{1}{solid}{C90}{4em}\bigskip}
% C99
\newenvironment{cNinetyNinespecific}{\cNinetyNinespecificstart}{\cNinetyNinespecificend}
\newcommand{\cNinetyNinespecificstart}{\needspace{\sbns}\linewitharrows{-1}{solid}{C99}{4em}}
\newcommand{\cNinetyNinespecificend}{\linewitharrows{1}{solid}{C99}{4em}\bigskip}
% Fortran
\iffortran
\newenvironment{fortranspecific}[1][0ex]{\vspace{#1}\fortranspecificstart\vspace{-#1}}{\fortranspecificend}
\else
\excludecomment{fortranspecific}
\fi
\newcommand{\fortranspecificstart}{\VSPb\linewitharrows{-1}{solid}{Fortran}{6em}\VSPa}
\newcommand{\fortranspecificend}{\VSPb\linewitharrows{1}{solid}{Fortran}{6em}\VSPa}
% Note
\newenvironment{note}{\notestart}{\noteend}
\newcommand{\notestart}{\VSPb\notelinewitharrows{-1}{solid}\VSPa}
\newcommand{\noteend}{\VSPb\notelinewitharrows{1}{solid}\VSPa}
% convenience macro for formatting the word "Note:" at the beginning of note blocks:
\newcommand{\noteheader}{{\textrm{\textsf{\textbf\textup\normalsize{{{{Note }}}}}}}}
% blue line floater at top of a page for "Name (cont.)"
\newcommand{\topmarker}[1]{%
\begin{figure}[t!]
\linewitharrows{-1}{dashed}{#1 (cont.)}{8em}
\end{figure}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glossary formatting
\newcommand{\glossaryterm}[1]{\needspace{1ex}
\begin{adjustwidth}{-0.75in}{0.0in}
\nolinenumbers\parbox[b][-0.95\baselineskip][t]{1.4in}{\flushright \textbf{#1}}
\end{adjustwidth}\linenumbers}
\newcommand{\glossarydefstart}{
\begin{adjustwidth}{0.79in}{0.0in}}
\newcommand{\glossarydefend}{
\end{adjustwidth}\vspace{-1.5\baselineskip}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indexing and Table of Contents
\usepackage{makeidx}
\usepackage[nodotinlabels]{titletoc} % required for its [nodotinlabels] option
% Clickable links in TOC and index:
\usepackage[hyperindex=true,linktocpage=true]{hyperref}
\hypersetup{
bookmarksnumbered = true,
bookmarksopen = false,
colorlinks = true, % Colors links instead of red boxes
urlcolor = blue, % Color for external links
linkcolor = blue % Color for internal links
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Formats a cross reference label as "Section X on page Y".
\newcommand{\nspecref}[2]{#1~\ref{#2} on page~\pageref{#2}}
\newcommand{\specref}[1]{\nspecref{Section}{#1}}
% For caption for supertabular and figure, by yanyh15
\captionsetup[table]{labelfont={sf,sc,bf},textfont=normalfont,singlelinecheck=off,labelformat=simple,labelsep=colon,aboveskip=00pt,belowskip=10pt}
\captionsetup[figure]{labelfont={sf,sc,bf},textfont=normalfont,singlelinecheck=off,labelformat=simple,labelsep=colon}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code example formatting for the Examples document
% This defines:
% \cexample formats blue markers, caption, and code for C examples
% \cppexample formats blue markers, caption, and code for C++ examples
% \fexample formats blue markers, caption, and code for Fortran (fixed) examples
% \ffreeexample formats blue markers, caption, and code for Fortran90 (free) examples
\usepackage{color,fancyvrb} % for \VerbatimInput
\usepackage{xargs} % for optional args
\renewcommand\theFancyVerbLine{\normalfont\footnotesize\sffamily S-\arabic{FancyVerbLine}}
\newcommand{\escstr}[1]{\DoReplaceU{#1}}
\newcommandx*\verlabel[2][1=]{(\code{\small{}#1omp\_#2})}
\newcommand{\exampleheader}[6]{%
\ifthenelse{ \equal{#1}{} }{
\def\cname{#2}
\def\ename\cname
}{
\def\cname{#1.#2.#3}
% Use following line for old numbering
% \def\ename{\thechapter.#2.#3}
% Use following for mneumonics
\def\ename{\escstr{#1}.\escstr{#2}.#3}
}
\newcount\cnt
\cnt=#4
\ifthenelse{ \equal{#5}{0} }{}{\global\advance\cnt by #5}
\def\cverno{\ref{ex_vtag:\cname}}
\ifthenelse{ \equal{\cverno}{pre_3.0} }{\def\cverno{}}{}
\ifthenelse{ \equal{\cverno}{??} }{\def\cverno{#6}}{}
\def\stagcnt{\pageref{ex_vtag:\cname}}
\ifthenelse{ \equal{\cverno}{} }{
\global\advance\cnt by 1
\def\vername{\;\;\verlabel[pre\_]{3.0}}
}{
\def\myver##1{\toolboxSplitAt{##1}{_}\lefttext\righttext
\lefttext\toolboxIfElse{\ifx\righttext\undefined}%
{\global\advance\cnt by 1}{\expandafter{\righttext}}}
\def\vername{\;\;\verlabel{\myver{\cverno}}}
}
\def\fcnt{\the\cnt}
% \def\fcnt{\stagcnt}
\noindent
\underline{\hypertarget{ex:\cname}{\textit{Example \ename}}\vername}
%\vspace*{-3mm}
\code{\VerbatimInput[numbers=left,numbersep=5ex,firstnumber=1,firstline=\fcnt,fontsize=\small]%
{\chapdirname/sources/\cname}}
}
\newcommandx*\cnexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{c}{7}{#4}{#1}
}
\newcommandx*\cppnexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{cpp}{7}{#4}{#1}
}
\newcommandx*\fnexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{f}{5}{#4}{#1}
}
\newcommandx*\ffreenexample[4][1=,4=0]{%
\exampleheader{#2}{#3}{f90}{5}{#4}{#1}
}
\newcommandx*\srcnexample[5][1=,5=0]{%
\exampleheader{#2}{#3}{#4}{0}{#5}{#1}
}
\newcommandx*\cexample[4][1=,4=0]{%
\ifccpp
\needspace{5\baselineskip}\begin{ccppspecific}
\cnexample[#1]{#2}{#3}[#4]
\end{ccppspecific}
\fi
}
\newcommandx*\cppexample[4][1=,4=0]{%
\ifccpp
\needspace{5\baselineskip}\begin{cppspecific}
\cppnexample[#1]{#2}{#3}[#4]
\end{cppspecific}
\fi
}
\newcommandx*\fexample[4][1=,4=0]{%
\iffortran
\needspace{5\baselineskip}
\begin{fortranspecific}
\fnexample[#1]{#2}{#3}[#4]
\end{fortranspecific}
\fi
}
\newcommandx*\ffreeexample[4][1=,4=0]{%
\iffortran
\needspace{5\baselineskip}
\begin{fortranspecific}
\ffreenexample[#1]{#2}{#3}[#4]
\end{fortranspecific}
\fi
}
\newcommandx*\hexentry[4][1=c,3=]{%
\hyperlink{ex:#2.#1}{\splc{#2.#1}}%
\ifthenelse{ \equal{#3}{} }{}{,~\hyperlink{ex:#2.#3}{\plc{#3}}}%
& #4%:~\splc{same name}
}
\newcommandx*\hexmentry[5][1=c,3=]{%
\hyperlink{ex:#2.#1}{\splc{#2.#1}}%
\ifthenelse{ \equal{#3}{} }{}{,~\hyperlink{ex:#2.#3}{\plc{#3}}}%
& #4:~\splc{#5.#1}\ifthenelse{ \equal{#3}{} }{}{,~\plc{#3}}
}
% Set default fonts:
\rmfamily\mdseries\upshape\normalsize
% This is the end of openmp.sty of the OpenMP specification.