%%% File Hexdump.sty %%% Reads an ASCII hexdump file and puts it formated into %%% the document %%% %%% Author : Thomas Hillebrand (thillebrand@my-deja.com) %%% Date : 04/17/2000 %%% Version: 0.1 %%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{hexdump}[2000/21/06 v0.1 format hexdumps] % % Test weather the package 'moreverb.sty' is loaded % \RequirePackage{moreverb} % % % Dump title, defaults to 'Dump' % The command \dumpname{} sets the title of the dump % \newcommand{\dump@head}{Dump} % Default title is 'Dump' \newcommand{\dumpname}[1]{\renewcommand{\dump@head}{#1}} % % Set the fontsize, default is \scriptsize, % use \dumpfontsize{} to change it % \newcommand{\dump@font@size}{\scriptsize} \newcommand{\dumpfontsize}[1]{\renewcommand{\dump@font@size}{#1}} % % Calculate the width % \newlength{\dumpwidth} % Variable for textwidth \settowidth{\dumpwidth}% {\dump@font@size\texttt{00000000\space\space{}FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FFFFFFFFFFFFFFFF}} % The double \space puts two spaces between address and values % % Define new counter, arabic numbers % reset counter, if chapter changes % \newcounter{dumpcount}[chapter] \renewcommand{\thedumpcount}{\thechapter.\arabic{dumpcount}\space} % % Now to the page 'list of dumps' % Set titleword with \dumptocname, this is used for the lod page. % \newcommand{\dump@word}{directory} \newcommand{\dumptocname}[1]{\renewcommand{\dump@word}{#1}} % % Define own list of dumps, use \listofdumps % First let's define the top line of the list of dumps % then define an entry in the lod file \newcommand{\listofdumps}{\chapter*{\dump@head\dump@word}\@starttoc{lod}} \newcommand{\dcaption}[1]{\addcontentsline{lod}{table}% {\protect\numberline{\thedumpcount}#1}#1} % % Now to the main thing: the dump itself. % Define \inputdump{}{} % command to read hex-dump file and put it formatted into document % Parameter #1 : Floatposition - this is optional % Parameter #2 : Filename % Parameter #3 : Caption % % A label is also defined: use \ref{dumpname:filename} (see example). % \newcommand{\inputdump}[3][htbp]{% \begin{table}[#1] \begin{center} \begin{minipage}{\dumpwidth} \refstepcounter{dumpcount} \rule[0.1\baselineskip]{\dumpwidth}{.8pt} \dump@head \space \thedumpcount{}:\space\dcaption{#3} \label{\dump@head:#2} % Label contains title and filename \newline \rule[0.33\baselineskip]{\dumpwidth}{.8pt} \ttfamily\dump@font@size \verbatimtabinput{#2} \rule[0.75\baselineskip]{\dumpwidth}{.8pt} \end{minipage} \end{center} \end{table} } % end newcommand % % End of file hexdump.sty % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Here's a sample tex file % %\documentclass{book} %\usepackage{hexdump} % %\dumpsize{\tiny} % will give _very_ small dumps, better use default setting %\dumptocname{directoy} %\dumpname{Dump} % %\begin{document} %\listofdumps % the title will be 'Dumpdirectory', see above % %\capter{Bar} % %\inputdump{test.hex} % assumed that file test.hex contains the dump % %The dump is shown in dump \ref{Dump:test.hex}. %\end{document} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Now to the legal stuff: % % Copyright (c) Thomas Hillebrand 2000 % % Usage of this file is unlimited, but I guarantee for nothing - except % that it uses space on your harddisk. As usual, use this file at your % own risk. % % You are encouraged to modify this file, but please be so kind to e-mail % me your modifications. Maybe they are included in the next release... %