\outputmode=1
\hoffset= 1in
\voffset=1in

\input luaotfload.sty
\input OTpalatino.tex
\sizexii\rm
\textfont0=\rm
%\textfont1=\it
\input color.tex

\font\ftitle=TexGyrePagella-Bold at 36pt
\font\fchapter=TexGyrePagella-Bold at 24pt
\font\fsection=TexGyrePagella-Bold at 13.5pt
\def\fsubsection{\bf}
\frenchspacing
\def\regularpar{}
\parskip=\medskipamount
\input fenixpar.sty

\def\dots{... }
\chardef\colon=`:
\catcode`:=\active
\def:{\ifhmode\thinspace\fi\colon}
\mathcode`.=\numexpr"7000+`,\relax
\def\%{/\kern-0.2em/}
\let\comment\%
\chardef\{=`\{
\chardef\}=`\}
\chardef\[=`\[
\chardef\]=`\]

\edef\tempa{\everymath{\catcode`_=\the\catcode`\_{}}} \tempa
\catcode`\_=12

\def\sub{\subs 0pt}
\def\subs{\afterassignment\subspread\dimen0=}
\def\subspread#1{\ifvmode\leavevmode\fi\setbox3\hbox spread\dimen0{#1}\hbox{\raise -0.24ex \hbox to0pt{\vrule height0.4pt width\wd3 \hss}\box3}}

\newskip\belowsectionskip
\newskip\belowsubsectionskip
\newskip\belowcasoskip
\belowsectionskip=2.8ex plus 0.5ex minus 0.8ex
\belowsubsectionskip=2.5ex plus 0.5ex minus 0.8ex
\belowcasoskip=1ex plus 0.4ex minus 0.2ex

\let\iffirstchapter\iftrue
\def\chapter#1{
%\vfill\break
\goodbreak\vskip30pt plus 15pt minus 10pt
{\parskip=0pt
\null\vskip 3ex
\centerline{\fchapter #1}
\iffirstchapter\else\write\indice{\noexpand\indchapter{#1}{\the\count0}}\fi
\global\let\iffirstchapter\iffalse
\nobreak\vskip 3 ex plus 1.5 ex minus 0.5 ex	%a esto se le añadirá el skip de \section
\nobreak	%Para anular el -\lastskip
}}

\raggedbottom
%\def\vfillneg{\vskip 0pt plus -1fill}
\def\section#1{\everypar{}
	\vskip-\lastskip \vskip-\parskip
	\vskip4ex plus 1ex minus 1ex{\noindent\fsection #1}
	\write\indice{\noexpand\indsection{#1}{\the\count0}}
	\par\nobreak\vskip-\parskip\nobreak\vskip\belowsectionskip
	\everypar{\regularpar}
}
\def\subsection#1{\everypar{}
	\vskip-\lastskip \vskip-\parskip
	\vskip3.0ex plus 0.8ex minus 0.7ex{\noindent\fsubsection #1}
	\par\nobreak\vskip-\parskip\nobreak\vskip\belowsubsectionskip
	\everypar{\regularpar}
}
\def\caso#1{\everypar{}
	\vskip-\lastskip \vskip-\parskip
	\vskip1.5ex plus 0.4ex minus 0.4ex{\noindent\sub{#1}}
	\par\nobreak\vskip-\parskip\nobreak\vskip\belowcasoskip
	\everypar{\regularpar}
}

\def\indchapter#1#2{\bigskip\hbox to 0.7\hsize{\fsection #1 \leaders\hbox to1em{\hss.\hss}\hfill #2}\nobreak\medskip}
\def\indsection#1#2{\hbox to 0.7\hsize{\indent\rm #1 \hfill}}

\def\blue{\color{0.1,0.1,0.4}}
\def\green{\color{0.1,0.4,0.2}}
\def\darkgreen{\color{0.05,0.2,0.1}}
\def\macrocolor{\color{0.5,0.2,0}}
\def\red{\color{0.8,0,0}}
\def\bb#1{{\bf\blue#1\/}}
\def\str#1{{\red "#1"}}
\def\ustr#1{{\red u"#1"}}
\def\fichero#1{{\blue #1}}
\def\funcion#1{{\it #1\/}}
\def\estructura#1{{\bf #1}}
\def\macro#1{\leavevmode\hbox{\macrocolor\tt #1}}
\def\symbolic#1{{\macrocolor\it #1\/}}
\def\NULL{\macro{NULL}}
\def\true{\symbolic{true}}
\def\false{\symbolic{false}}

\def\narrower{\advance\leftskip\ifnum\parindent<0 -\fi\parindent\relax
						\advance\rightskip\ifnum\parindent<0 -\fi\parindent\relax}
\def\elementobase#1{\par\let\oldpar\par \def\par{\oldpar\nobreak}
\noindent\bb{#1}{\bf\thinspace\{}\par
\narrower \parskip=0pt \rightskip=0pt plus 1fil \parindent=-12pt}

\def\elemento{\elementobase{typedef struct}}
\def\elementocorto{\elementobase{struct}}
\def\endelemento#1{{\nobreak\parskip 0pt \noindent \bf\}\ #1;\par}}

\def\struct{\byte{struct\thinspace\{}{}}
\let\ifbytepar\iffalse
\long\def\byte#1#2{{\par\ifbytepar\nobreak\fi \advance\leftskip12pt \advance\interlinepenalty 200 %
\quitvmode\bb{#1}{\def\tempa{#1}\tt\unless\ifx\tempa\empty\ \fi#2}\nextpar{\let\ifbytpar\iffalse}\let\ifbytepar\iftrue\par}\let\ifbytepar\iffalse}

\long\def\lbyte#1#2#3{{\par\ifbytepar\nobreak\fi \advance\leftskip12pt \advance\interlinepenalty 200 %
	\quitvmode\nextpar{\let\ifbytpar\iffalse}\let\ifbytepar\iftrue
	\vbox{\offinterlineskip\hbox to100pt{\hfil}\hbox{\bb{#1}{\tt\ #2} }}%
	\green \scantokens{#3}\par}\let\ifbytepar\iffalse	%If this comes inside another \byte \ifbytepar may still be true
}

\long\def\explibyte#1#2{\par\quitvmode
	\vbox{\offinterlineskip\hbox to100pt{\hfil}\hbox{{\tt\ #1} }}%
	{\darkgreen \scantokens{\advance\interlinepenalty 200 #2}}\par
}

\newdimen\macrowidth
\newdimen\macrovalwidth
\macrowidth=170pt
\macrovalwidth=50pt
\def\definebyte#1#2#3{\par\quitvmode
	\vbox{\offinterlineskip\hbox to\macrowidth{\hfil}\hbox{\bb{\#define }\macro{#1} }}%
	\vbox{\offinterlineskip\hbox to\macrovalwidth{\hfil}\hbox{\tt #2\ }}%
	{\green\scantokens{\advance\interlinepenalty 200 #3}}\par
}
\def\nobyte#1#2{\par\quitvmode
	\vbox{\offinterlineskip\hbox to100pt{\hfil}\hbox{\tt #1\ }}%
	{\green\scantokens{\advance\interlinepenalty 200 #2}}\par
}

\def\explicacion{\vskip\parskip \parskip=0pt \rightskip=0pt plus 2em \advance\leftskip128pt \parindent=-108pt \let\byte\explibyte}
\def\defines{\vskip\parskip \parskip=0pt \advance\leftskip238pt \parindent=-218pt \let\byte\definebyte}

{\catcode`\^^I=\active \obeylines %
\gdef\code{\advance\leftskip 20pt \parindent=0pt\obeylines \catcode`\^^I=\active \let^^I=\quad \catcode`\&=12 %
\catcode`\[=\the\catcode`\{  \catcode`\]=\the\catcode`\} %
\catcode`\{=12 \catcode`\}=12 %
\def\%##1
{{\rm\green\comment##1^^M}}\tt}%
}
\long\def\*#1*/{{\rm\green/*#1*/}}

{\output={\shipout\box255 \global\advance\count0 1 }
