%% This is file `bfh-layout-listings.cfg' version 2.2.1 (2024-03-11),
%% it is part of
%% BFH-CI -- Corporate Design for Bern University of Applied Sciences
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2021–2024 by
%%      Marei Peischl <marei@peitex.de>
%%      Andreas Habegger <andreas.habegger@bfh.ch>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%%   Marei Peischl <bfh-ci@peitex.de>
%%   Andreas Habegger <andreas.habegger@bfh.ch>
%%
%% The development respository can be found at
%% https://gitlab.ti.bfh.ch/bfh-latex/bfh-ci/
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\ProvidesFile{bfh-layout-listings.cfg}[2024-03-11 v2.2.1 listings configuration for bfhlayout]
\RequirePackage{bfhcolors}
%% Hack to fix issue with float env used in listings package
%% ref. : https://tex.stackexchange.com/questions/51867/koma-warning-about-toc
\RequirePackage{scrhack}
\RequirePackage{listings}
%%
\lstloadlanguages{[ANSI]C,C++,Matlab,[LaTeX]TeX,bash,python}
%%
%% ----- code highliting colors
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolor}{rgb}{0.95,0.95,0.92}
%%
\definecolor{datatype}{rgb}{0.58,0,0.82}
\definecolor{decision}{rgb}{0.5,0.5,0.5}
\definecolor{memory}{rgb}{0,0.6,0}
\definecolor{special}{rgb}{0,0.6,0.6}
%%
%% ----- extend listing directory
%%
\lstdefinelanguage{VHDL}{
   morekeywords={
     library,use,all,entity,is,port,in,out,end,architecture,of,
     begin,and,type,when,else,select,with,others,else,if,elsif,
     signal,variable,std_logic,std_logic_vector,after,
   },
   morecomment=[l]--
}
%% -- Fixed width typewriter font for code and sans-serif font for comments in listings
\lstset{%
   basicstyle=\ttfamily\selectfont,
   commentstyle=\sffamily\itshape\selectfont\color{codegreen},
   keywordstyle=\bfseries\selectfont,
   stringstyle=\color{codepurple},
   directivestyle={\color{red}},
   extendedchars=true,
   showstringspaces=true,
   columns=fixed, % columns in the source code are respected
   aboveskip=\smallskipamount,
   belowskip=\smallskipamount
}%
%%
%% ------ BFH listing style definitions
%%
\lstdefinestyle{linebreaks}{%
   breaklines,
   breakatwhitespace,
   numbers=none
}%
%%
\lstdefinestyle{frame}{%
   style=linebreaks,
   basicstyle=\scriptsize\ttfamily\selectfont,
   numbers=left,
   numberstyle=\color{BFH-Gray!80},
   xleftmargin={4pt},
   captionpos=b,
   frame=trbl,
   frameround=tttt,
   framesep=1mm,
   basewidth=.5em,
   framerule=0pt,
   backgroundcolor=\color{BFH-Gray!10},
   rulecolor=\color{BFH-Gray!80},
   abovecaptionskip=\medskipamount,
   belowcaptionskip=\medskipamount
}%
%%
\lstdefinestyle{float}{%
   style=frame,
   float=tp
}%
%%
%% ------ language specific pre-defines
%%
\lstdefinestyle{bfh-c}{%
   language=C,
   style=frame,
   emph={printf,srand,scanf},
   emphstyle=\bfseries\selectfont,
}%
%%
\lstdefinestyle{bfh-cpp}{%
   language=C++,
   style=frame,
   emph={cout,std,::,endl,cin},
   emphstyle=\bfseries\selectfont,
}%
%%
\lstdefinestyle{bfh-vhdl}{%
   style=frame,
   language=VHDL,
}%
%% default
\lstset{
   style=float,
}%


\endinput