\input{common}

\lstdefinestyle{defaultStyle}{
    escapeinside={@@},
    %  basicstyle=\linespread{0.9}\tt\footnotesize,		% reduce line spacing and use typewriter font
      basicstyle=\linespread{0.9}\sf,		% reduce line spacing and use typewriter font
    %  keywordstyle=\bfseries\color{blue},
    %  keywordstyle=[2]\bfseries\color{Plum},
    %  commentstyle=\sf\itshape\color{OliveGreen},		  % green and italic comments
    %  identifierstyle=\color{identifierCol},
    %  stringstyle=\sf\color{Mahogany},			          % use sanserif font
      stringstyle=\tt,			          % use sanserif font
      mathescape=true,
    %  columns=fixed,
      columns=fullflexible,
    %  aboveskip=4pt,                                  % spacing above/below code block
    %  belowskip=3pt,
      keepspaces=true,
      tabsize=4,
      % frame=lines,
      literate=,
      showlines=true,                                 % show blank lines at end of code
      showspaces=false,
      showstringspaces=false,
      showlines=true,							% show blank lines at end of code
      escapechar=\$,
      xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
      moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
      morekeywords=[2]{accept, signal, signal_block, wait, waitfor, waituntil},
      abovecaptionskip=5pt,
}

\lstdefinestyle{cfaStyle}{
  escapeinside={@@},
  basicstyle=\linespread{0.9}\sf,		% reduce line spacing and use typewriter font
  stringstyle=\tt,			          % use sanserif font
  mathescape=true,
  columns=fullflexible,
  keepspaces=true,
  tabsize=4,
  literate=,
  showlines=true,                                 % show blank lines at end of code
  showspaces=false,
  showstringspaces=false,
  showlines=true,							% show blank lines at end of code
  escapechar=\$,
  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
  morekeywords=[2]{accept, signal, signal_block, wait, waitfor, waituntil},
  abovecaptionskip=5pt,
}

\lstnewenvironment{cfacode}[1][]{
  \lstset{
    language = CFA,
    style=cfaStyle,
    captionpos=b,
    #1
  }
}{}

\lstnewenvironment{cppcode}[1][]{
  \lstset{
    language = c++,
    style=defaultStyle,
    captionpos=b,
    #1
  }
}{}

\newcommand{\code}[1]{\lstinline[language=CFA,style=cfaStyle]{#1}}
\newcommand{\uC}{$\mu$\CC}

