-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.tex
169 lines (137 loc) · 4.71 KB
/
common.tex
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
% Unix programming in C
% (c) 1999-2017, Martin Beran, Jan Pechanec, Vladimir Kotal
% (janp) notes
%
% pictures
% - create picture in any format, convert to EPS (so that is has
% BoudingBox), e.g. using ImageMagicks ("convert abc.gif abc.eps") and
% include using \includegraphics with a size which makes the image to scale.
% Example for img/examples/circle.eps:
%
% \includegraphics[width=30mm]{circle.eps}
%
include(`macros.m4')
%\documentclass[article]{seminar}
%\documentclass[slidesonly]{seminar}
%\documentclass[a4paper]{seminar}
\usepackage{multicol}
\usepackage{tabularx}
%\input{seminar.bg2}
%\usepackage{seminar}
% color doc: http://en.wikibooks.org/wiki/LaTeX/Colors
% color defs: http://www.w3schools.com/html/html_colors.asp
\usepackage{color}
\definecolor{MyDarkBlue}{RGB}{71,57,146} % BlueViolet
\definecolor{MyDarkRed}{RGB}{139,00,00}
% hyperref docs:
% http://www.tug.org/applications/hyperref/manual.html
% http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
%
\usepackage[bookmarks,breaklinks=true,%
colorlinks=true,linkcolor=MyDarkBlue,urlcolor=MyDarkRed,%
pdftex,%
pdfauthor={Vladimír Kotal, Jan Pechanec},%
pdftitle={Unix programming in C},%
pdfsubject={Materials for the NSWI015 class at MFF-UK},%
pdfkeywords={Unix, programming, C, MFF, MFF-UK},%
pagebackref=true,%
]{hyperref}
\usepackage{url}
% by default \url will use monospaced font. suppress this and use normal font.
\urlstyle{same}
% for strike-through (\sout)
\usepackage[normalem]{ulem}
% cannot use hyperref with this one !
%\usepackage{sem-a4}
% (janp)
\usepackage[czech]{babel}
\usepackage[latin2]{inputenc}
\usepackage[OT1]{fontenc}
% (janp) end
\usepackage{alltt}
\usepackage{graphicx}
%\usepackage{psfrag}
%\usepackage{pstricks} % does not work with colortbl
%\usepackage{colortbl}
%%% Macros %%%
% colored frame around source code path to examples
% which is actually a link
\newcommand{\example}[1]{\fcolorbox{cyan}{white}{\href{https://github.com/devnull-cz/unix-linux-prog-in-c-src/blob/master/#1}{\texttt{#1}}}}
% (janp)
\chardef\clqq=254 \sfcode254=0 \lccode254=0
\chardef\crqq=255 \sfcode255=0 \lccode255=0
%\DeclareRobustCommand\uv[1]{{\leavevmode\clqq#1\crqq}}
\DeclareRobustCommand\uv[1]{{\leavevmode{},,#1''}}
% (janp) end
\renewcommand{\slidelabel}{}
\setlength{\textwidth}{0.9\textwidth}
\newcommand{\sltitle}[1]{{\centering\textbf{\Large #1}
\vskip 2em plus 0pt minus 2em\par}} % Slide title
% bold
\newcommand{\emsl}[1]{\textbf{#1}} % Emphasizing in slides
\newcommand{\emprg}[1]{\emph{\color[rgb]{1,0,0} #1}} % Emphasize in programs
\newcommand{\emblue}[1]{\emph{\color[rgb]{0,0,1} #1}} % emph in blue
% my very important note
\newcommand{\rednote}[1]{\color[rgb]{1,0,0} #1}
\newcommand{\CHECK}[1]{{\color[rgb]{1,0,0} $\star$#1$\star$}} % What should be
% checked
\newenvironment{itemize2} % Itemize with smaller font
{\begin{itemize}\small} {\end{itemize}}
\newsavebox{\boxTMP}
\newcommand{\raisetab}[1]{ % Align first table row with other text
\sbox{\boxTMP}{\begin{tabular}{c}\hline X\\\hline\end{tabular}}
\raisebox{\ht\boxTMP}{#1}}
\newcommand{\funnm}[1] {% Emphasized function name
{\bf #1}}
\newcommand{\funml}[1] { % Multi-line function prototype
\begin{minipage}{\slidewidth}
\vspace{-1ex}\texttt{\begin{tabbing}#1\end{tabbing}}
\end{minipage}}
\newcommand{\bs}{\char92\relax} % TT backslash
% http://tex.stackexchange.com/questions/9363/how-does-one-insert-a-backslash-or-a-tilde-into-latex
\newcommand{\tilda}{\char`\~} % TT tilda
\newtoks\prgcharsI\newtoks\prgcharsII
{\catcode`\_=13\catcode`\&=13\global\prgcharsI={_}\global\prgcharsII={&}}
\def\prgchars{ % Do not require backslashes for these characters often used
% in C program source code
\catcode`\_=13\catcode`\&=13
\expandafter\def\the\prgcharsI{\_}\expandafter\def\the\prgcharsII{\&}}
\centerslidesfalse
\newcounter{topicval}
\newcommand{\slidecontents}[1]{%
\setcounter{topicval}{#1}%
\begin{itemize}
\topic{1}{Introduction, Unix and C, programming tools}
\topic{2}{Basic Unix concepts and conventions, its API}
\topic{3}{Access rights, devices}
\topic{4}{Process manipulation, program execution}
\topic{5}{Signals}
\topic{6}{Process synchronization and interprocess communication}
\topic{7}{Network programming}
\topic{8}{Programming with threads}
\topic{9}{Appendix}
\end{itemize}%
}
\newcommand{\topic}[2]{%
\item\relax
\ifnum #1=\value{topicval}%
\textbf{#2}%
\else
#2%
\fi
}
\begin{document}
\input{intro.m4.tex}
\input{file-api.m4.tex}
\input{user-access.m4.tex}
\input{proc.m4.tex}
\input{signals.m4.tex}
\input{synchro.m4.tex}
\input{network.m4.tex}
\input{threads.m4.tex}
\input{appendix.m4.tex}
\begin{slide}
\centerslidestrue
\sltitle{The End.}
\end{slide}
\end{document}