aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorax006ho <j.hoffmann@fh-aachen.de>2018-11-09 22:59:50 +0100
committerax006ho <j.hoffmann@fh-aachen.de>2018-11-09 22:59:50 +0100
commit4a885813e53b2f3a2112a66c4bfdff2af523066b (patch)
treed09f8c6104cd9e1a70edae6ab96990cdb87ec152
parent9c3ede1a9f633a34fc28281d1a0bce3173f4f275 (diff)
downloadlistings-4a885813e53b2f3a2112a66c4bfdff2af523066b.tar.gz
listings-4a885813e53b2f3a2112a66c4bfdff2af523066b.tar.bz2
added tests concerning extendedchars
-rw-r--r--testing/keyval/extendedchars/Makefile36
-rw-r--r--testing/keyval/extendedchars/extendedchars_00.tex47
-rw-r--r--testing/keyval/extendedchars/listings.cfg104
-rw-r--r--testing/keyval/extendedchars/msg.c27
-rw-r--r--testing/keyval/extendedchars/sshd.txt15
5 files changed, 229 insertions, 0 deletions
diff --git a/testing/keyval/extendedchars/Makefile b/testing/keyval/extendedchars/Makefile
new file mode 100644
index 0000000..7bd1ece
--- /dev/null
+++ b/testing/keyval/extendedchars/Makefile
@@ -0,0 +1,36 @@
+### Makefile ---
+#
+# This file tests the extendedchars key listings package.
+#
+# (c) 2018 Jobst Hoffmann
+#
+# This file is distributed under the terms of the LaTeX Project Public
+# License from CTAN archives in directory macros/latex/base/lppl.txt.
+# Either version 1.3c or, at your option, any later version.
+
+# remember:
+# $<: first element of list of dependees
+# $^: list of (all) dependees
+# $@: target
+
+SOURCES = \
+ extendedchars_00.tex \
+
+.PHONY: all echo
+
+.SUFFIXES: .pdf .tex
+
+all: ${SOURCES:.tex=.pdf}
+
+extendedchars_00.pdf: extendedchars_00.tex listings.cfg listings.sty
+ pdflatex $<
+
+##################
+## common settings
+
+ifneq "$(wildcard ../Makefile.common)" ""
+include ../Makefile.common # the list of the local targets
+ # generated by hand
+endif
+
+### Makefile ends here ---
diff --git a/testing/keyval/extendedchars/extendedchars_00.tex b/testing/keyval/extendedchars/extendedchars_00.tex
new file mode 100644
index 0000000..0cf4bf4
--- /dev/null
+++ b/testing/keyval/extendedchars/extendedchars_00.tex
@@ -0,0 +1,47 @@
+\documentclass[a4paper, 12pt]{article}
+
+\usepackage{listings}
+
+
+\begin{document}
+
+Ein C-Programm mit sehr speziellem Kommentar:
+
+\begin{lstlisting}
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+Du musst nicht Vietnam oder China bemühen wenn du utf8 willst, dieser
+Satz hier in einem Kommentar würde schon reichen um listings auf die
+Nase fallen zu lassen, sprich ein copy paste von irdendwas mit Umlauten
+oder anderen westlichen Akzenten produziert multi-byte UTF8
+
+Da hast sicher recht, dass mit unicode engines das Problem dann nicht
+mehr existiert da die alle UTF8 chars als tokens sehen, aber bei pdftex
+ist das halt nicht der Fall und auf absehbare Zeit wird das der Standard
+bleiben.
+
+Als unsere Computer noch 8bit code pages benutzten war das auch kein
+Problem aber mittlerweile ist es eins.
+*/
+int main(int argc, char** argv) {
+
+ char* msg = "\
+Man kann natürlich warten bis sich LuaTeX durchsetzt, was vermutlich \
+irgendwann passieren wird, aber ich denk 5-10 Jahre gehen da noch ins Land\
+";
+
+ printf ("%s\n", msg);
+
+}
+\end{lstlisting}
+
+Oder mit einer externen Datei:
+\lstinputlisting{msg.c}
+
+Und noch ganz spezielle Zeichen:
+\lstinputlisting[style=output]{sshd.txt}
+
+
+\end{document} \ No newline at end of file
diff --git a/testing/keyval/extendedchars/listings.cfg b/testing/keyval/extendedchars/listings.cfg
new file mode 100644
index 0000000..4f5128e
--- /dev/null
+++ b/testing/keyval/extendedchars/listings.cfg
@@ -0,0 +1,104 @@
+\RequirePackage{ifpdf}
+\RequirePackage{ifluatex}
+
+\RequirePackage{textcomp}
+\RequirePackage{xcolor}
+\RequirePackage{pmboxdraw}
+\ifpdf%
+ \lstset{extendedchars=true,
+ literate=%
+ {Ö}{{\"O}}1
+ {Ä}{{\"A}}1
+ {Ü}{{\"U}}1
+ {ß}{{\ss}}1
+ {ü}{{\"u}}1
+ {ä}{{\"a}}1
+ {ö}{{\"o}}1
+ % ee: UTF-8 support A
+ {á}{{\'{a}}}1
+ {ã}{{\~{a}}}1
+ {ç}{{\c{c}}}1
+ {é}{{\'e}}1
+ {è}{{\`e}}1
+ {ê}{{\^{e}}}1
+ % be: UTF-8 support A
+ {»}{{\guillemotright}}1
+ {«}{{\guillemotleft}}1
+ {°}{{\ensuremath{^\circ}}}1
+ {§}{{\S}}1 % add more characters,
+ {´}{{\'{}}}1 % if you need them
+ % ee: UTF-8 support A
+ % be: UTF-8 support B
+ {‘}{`}1
+ {’}{'}1
+ {●}{{\(\bullet\)}}1 % the following characters are used
+ {└}{{\textSFii}}1 % by journalctl (\textSF?? symbols
+ {─}{{\textSFx}}1 % come from the pmboxdraw package)
+ %{±}{{\ensuremath{\pm}}}1
+ %{↑}{{\ensuremath{\uparrow}}}1
+ %{π}{{\ensuremath{\pi}}}1
+ {±}{C}1
+ {↑}{A}1
+ {π}{B}1
+ {␣}{\texttt{\char32}}2
+ }
+\fi%
+\def\lstlanguagefiles{lstlang0.sty,lstlang1.sty,%
+ lstlang2.sty,lstlang3.sty}
+\lstset{defaultdialect=[ANSI]C,
+ defaultdialect=[ISO]C++,
+ defaultdialect=[WinXP]command.com,
+ defaultdialect=[08]Fortran,
+ defaultdialect=[5.3]lua,
+ defaultdialect=[gnu]make,
+ defaultdialect=[LaTeX]TeX,
+}
+\lstset{%
+ basicstyle=\small\fontfamily{lmtt}%
+ \fontseries{m}\fontshape{n}\selectfont,
+ % in lmtt bold (b) and medium (m) are hardly to
+ % distinguish, so
+ keywordstyle=\fontfamily{ul9}\fontseries{b}%
+ % replace this ul9 (and all ul9 below)
+ % by lmtt, if luximono is not available
+ \fontshape{n}\selectfont,
+ commentstyle=\small\fontfamily{lmtt}%
+ \fontseries{m}\fontshape{sl}\selectfont,
+ stringstyle=\small\fontfamily{lmtt}%
+ \fontseries{m}\fontshape{it}\selectfont,
+}
+\lstset{%
+ numbers=left,
+ numberstyle=\tiny,
+ stepnumber=5,
+ numbersep=5pt,
+ tabsize=4,
+ keepspaces=true,
+ resetmargins=true,
+ basewidth={0.6em,0.48em},
+ frame=tlb,% the frame is open on the right side
+}
+\newsavebox\hookleftarrowbox%
+\newsavebox\hookrightarrowbox%
+\sbox\hookleftarrowbox{\raisebox{-0.8ex}[0pt][0pt]{%
+ {\color{red}\tiny$\hookleftarrow$}}}%
+\sbox\hookrightarrowbox{\raisebox{0.2ex}[0pt][0pt]{%
+ {\color{red}\tiny$\hookrightarrow$}}}%
+\lstset{%
+ prebreak=\usebox{\hookleftarrowbox},%
+ postbreak=\usebox{\hookrightarrowbox},%
+ breakautoindent=true,%
+ breakindent=120pt,%
+ breaklines=t,%
+ resetmargins=false,%
+}%
+
+\lstdefinestyle{output}{%
+ basicstyle=\small\ttfamily\fontseries{m}\fontshape{n},
+ language={},
+ frame=tb,%
+ backgroundcolor={},%
+ framerule=1pt
+}
+
+\endinput
diff --git a/testing/keyval/extendedchars/msg.c b/testing/keyval/extendedchars/msg.c
new file mode 100644
index 0000000..e085b3e
--- /dev/null
+++ b/testing/keyval/extendedchars/msg.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+Du musst nicht Vietnam oder China bemühen wenn du utf8 willst, dieser
+Satz hier in einem Kommentar würde schon reichen um listings auf die
+Nase fallen zu lassen, sprich ein copy paste von irdendwas mit Umlauten
+oder anderen westlichen Akzenten produziert multi-byte UTF8
+
+Da hast sicher recht, dass mit unicode engines das Problem dann nicht
+mehr existiert da die alle UTF8 chars als tokens sehen, aber bei pdftex
+ist das halt nicht der Fall und auf absehbare Zeit wird das der Standard
+bleiben.
+
+Als unsere Computer noch 8bit code pages benutzten war das auch kein
+Problem aber mittlerweile ist es eins.
+*/
+int main(int argc, char** argv) {
+
+ char* msg = "\
+Man kann natürlich warten bis sich LuaTeX durchsetzt, was vermutlich \
+irgendwann passieren wird, aber ich denk 5-10 Jahre gehen da noch ins Land\
+";
+
+ printf ("%s\n", msg);
+
+}
diff --git a/testing/keyval/extendedchars/sshd.txt b/testing/keyval/extendedchars/sshd.txt
new file mode 100644
index 0000000..0316d1d
--- /dev/null
+++ b/testing/keyval/extendedchars/sshd.txt
@@ -0,0 +1,15 @@
+● sshd.service - OpenSSH server daemon
+ Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
+ Active: active (running) since Fri 2018-11-09 19:57:23 CET; 2h 30min ago
+ Docs: man:sshd(8)
+ man:sshd_config(5)
+ Main PID: 1285 (sshd)
+ Tasks: 1 (limit: 4915)
+ Memory: 2.3M
+ CGroup: /system.slice/sshd.service
+ └─1285 /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc -oMACs=hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512 -oGSSAPIKexAlgorithms=gss-gex-sha1-,gss-group14-sha1- -oKexAlgorithms=curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 -oHostKeyAlgorithms=rsa-sha2-256,ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,rsa-sha2-512,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,ssh-rsa,ssh-rsa-cert-v01@openssh.com -oPubkeyAcceptedKeyTypes=rsa-sha2-256,ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,rsa-sha2-512,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,ssh-rsa,ssh-rsa-cert-v01@openssh.com
+
+Nov 09 19:57:23 thinktwiceIX.tm2.fh-aachen.de systemd[1]: Starting OpenSSH server daemon...
+Nov 09 19:57:23 thinktwiceIX.tm2.fh-aachen.de sshd[1285]: Server listening on 0.0.0.0 port 22.
+Nov 09 19:57:23 thinktwiceIX.tm2.fh-aachen.de sshd[1285]: Server listening on :: port 22.
+Nov 09 19:57:23 thinktwiceIX.tm2.fh-aachen.de systemd[1]: Started OpenSSH server daemon.

Return to:

Send suggestions and report system problems to the System administrator.