%%
%% This is file `code39.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% barcodes.dtx  (with options: `code39mac')
%% As this is a generated file, you may perhaps not want to edit it.
%% This file belongs to the barcode package.
%% It may be of no great use without the rest of the barcode package.
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%%% ====================================================================
%%%  @TeX-file{
%%%     author          = "Peter Willadt",
%%%     version         = "1",
%%%     date            = "16 August 1997",
%%%     time            = "10:00:00 GMT",
%%%     filename        = "code39.tex",
%%%     address         = "Peter Willadt
%%%                        75177 Pforzheim
%%%                        Germany",
%%%     email           = "Willadt@t-online.de",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "Barcode, Code39, TeX",
%%%     abstract        = "This file contains macros to support the inclusion
%%%                        of code 39 barcode in TeX documents.",
%%%  }
%%% ====================================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This code supports barcodes in Code 39
%% Usage:
%%  For alphanumerical barcodes:
%%   \begincodethirtynine followed by
%%   the stuff to code,
%%   ended with \endcodethirtynine
%%  For numerical only code:
%%   modify the code for pharamceuticals
%%  For german pharmaceutics:
%%   \pzncode1234562@ when 1234562 is the
%%   number to be coded as -1234562.
%%   this will also verify the checksum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This file may be freely used without any
%% further permission.
%% It comes with absolutely no warranty.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% this is the common stuff
\newdimen\dick
\newdimen\duenn
\newdimen\duennbar
\newdimen\dickbar
\newdimen\antibleed
\dick=1mm
\duenn=0.5mm
\antibleed=0mm
\dickbar=\dick
\advance\dickbar by -\antibleed
\duennbar=\duenn
\advance\duennbar by -\antibleed
\def\b{\vrule width\duennbar}
\def\B{\vrule width\dickbar}
\def\s{\hskip\duenn\hskip\antibleed}
\def\S{\hskip\dick\hskip\antibleed}
%%
 \def\tnzero{\b\s\b\S\B\s\B\s\b\s}
  \def\tnone{\B\s\b\S\b\s\b\s\B\s}
  \def\tntwo{\b\s\B\S\b\s\b\s\B\s}
\def\tnthree{\B\s\B\S\b\s\b\s\b\s}
 \def\tnfour{\b\s\b\S\B\s\b\s\B\s}
 \def\tnfive{\B\s\b\S\B\s\b\s\b\s}
  \def\tnsix{\b\s\B\S\B\s\b\s\b\s}
\def\tnseven{\b\s\b\S\b\s\B\s\B\s}
\def\tneight{\B\s\b\S\b\s\B\s\b\s}
 \def\tnnine{\b\s\B\S\b\s\B\s\b\s}
 \def\tninestart{\b\S\b\s\B\s\B\s\b\s}
 \def\tnineminus{\b\S\b\s\b\s\B\s\B\s}
  \def\tnineplus{\b\S\b\s\b\S\b\S\b\s}
\def\tninedollar{\b\S\b\S\b\S\b\s\b\s}
 \def\tnineslash{\b\S\b\S\b\s\b\S\b\s}
   \def\tninedot{\B\S\b\s\b\s\B\s\b\s}
\def\tninepercnt{\b\s\b\S\b\S\b\S\b\s}
 \def\tninespace{\b\S\B\s\b\s\B\s\b\s}
\def\tninelettera{\B\s\b\s\b\S\b\s\B\s}
\def\tnineletterb{\b\s\B\s\b\S\b\s\B\s}
\def\tnineletterc{\B\s\B\s\b\S\b\s\b\s}
\def\tnineletterd{\b\s\b\s\B\S\b\s\B\s}
\def\tninelettere{\B\s\b\s\B\S\b\s\b\s}
\def\tnineletterf{\b\s\B\s\B\S\b\s\b\s}
\def\tnineletterg{\b\s\b\s\b\S\B\s\B\s}
\def\tnineletterh{\B\s\b\s\b\S\B\s\b\s}
\def\tnineletteri{\b\s\B\s\b\S\B\s\b\s}
\def\tnineletterj{\b\s\b\s\B\S\B\s\b\s}
\def\tnineletterk{\B\s\b\s\b\s\b\S\B\s}
\def\tnineletterl{\b\s\B\s\b\s\b\S\B\s}
\def\tnineletterm{\B\s\B\s\b\s\b\S\b\s}
\def\tninelettern{\b\s\b\s\B\s\b\S\B\s}
\def\tninelettero{\B\s\b\s\B\s\b\S\b\s}
\def\tnineletterp{\b\s\B\s\B\s\b\S\b\s}
\def\tnineletterq{\b\s\b\s\b\s\B\S\B\s}
\def\tnineletterr{\B\s\b\s\b\s\B\S\b\s}
\def\tnineletters{\b\s\B\s\b\s\B\S\b\s}
\def\tninelettert{\b\s\b\s\B\s\B\S\b\s}
\def\tnineletteru{\B\S\b\s\b\s\b\s\B\s}
\def\tnineletterv{\b\S\B\s\b\s\b\s\B\s}
\def\tnineletterw{\B\S\B\s\b\s\b\s\b\s}
\def\tnineletterx{\b\S\b\s\B\s\b\s\B\s}
\def\tninelettery{\B\S\b\s\B\s\b\s\b\s}
\def\tnineletterz{\b\S\B\s\B\s\b\s\b\s}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% this is the code for 39 mode
\def\activatethemall{
\catcode`\A=\active \catcode`\B=\active
\catcode`\C=\active \catcode`\D=\active
\catcode`\E=\active \catcode`\F=\active
\catcode`\G=\active \catcode`\H=\active
\catcode`\I=\active \catcode`\J=\active
\catcode`\K=\active \catcode`\L=\active
\catcode`\M=\active \catcode`\N=\active
\catcode`\O=\active \catcode`\P=\active
\catcode`\Q=\active \catcode`\R=\active
\catcode`\S=\active \catcode`\T=\active
\catcode`\U=\active \catcode`\V=\active
\catcode`\W=\active \catcode`\X=\active
\catcode`\Y=\active \catcode`\Z=\active
\catcode`+=\active \catcode`-=\active
\catcode`\_=\active \catcode`.=\active
\catcode`\$=\active \catcode`\%=\active
\catcode`\/=\active
\catcode`\0=\active \catcode`\1=\active
\catcode`\2=\active \catcode`\3=\active
\catcode`\4=\active \catcode`\5=\active
\catcode`\6=\active \catcode`\7=\active
\catcode`\8=\active \catcode`\9=\active
}
{\activatethemall
\gdef\begincodethirtynine{
\bgroup\activatethemall\strut\tninestart
\letA=\tninelettera \letB=\tnineletterb
\letC=\tnineletterc \letD=\tnineletterd
\letE=\tninelettere \letF=\tnineletterf
\letG=\tnineletterg \letH=\tnineletterh
\letI=\tnineletteri \letJ=\tnineletterj
\letK=\tnineletterk \letL=\tnineletterl
\letM=\tnineletterm \letN=\tninelettern
\letO=\tninelettero \letP=\tnineletterp
\letQ=\tnineletterq \letR=\tnineletterr
\letS=\tnineletters \letT=\tninelettert
\letU=\tnineletteru \letV=\tnineletterv
\letW=\tnineletterw \letX=\tnineletterx
\letY=\tninelettery \letZ=\tnineletterz
\let+=\tnineplus \let-=\tnineminus
\let_=\tninespace \let.=\tninedot
\let$=\tninedollar \let%=\tninepercnt
\let/=\tnineslash
\let0=\tnzero \let1=\tnone
\let2=\tntwo \let3=\tnthree
\let4=\tnfour \let5=\tnfive
\let6=\tnsix \let7=\tnseven
\let8=\tneight \let9=\tnnine
}
}
\def\endcodethirtynine{
\tninestart\egroup
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% this code is used for german pharmaceutics
\newcount\ziffern
\newcount\checksum
\newcount\multreg
\def\tndigit#1{%
  \ifcase#1\tnzero\or\tnone%
    \or\tntwo\or\tnthree%
    \or\tnfour\or\tnfive%
    \or\tnsix\or\tnseven%
    \or\tneight\or\tnnine%
    \fi}
\def\endtncode{%
  \tninestart%
  \ifnum\ziffern=9
    \else\message{wrong digit count}
  \fi%
  \ifnum\checksum=0
    \else\message{wrong checksum}
  \fi%
  \egroup}
\def\nexttn#1{%
  \advance\ziffern by1
  \if@#1\let\next\endtncode
   \else
   \tndigit#1%
   \ifnum\ziffern=8
    \multreg=\checksum
    \divide\multreg by 11
    \multiply\multreg by 11
    \advance\checksum by-\multreg
    \multreg=#1
    \advance\checksum by-\multreg
    \ifnum\checksum=10
        \checksum=0
    \fi
   \else
    \multreg=#1
    \multiply\multreg by\ziffern
    \advance\checksum by\multreg
   \fi%
  \fi%
  \next}
\def\pzncode{
  \bgroup
  \let\next\nexttn
  \ziffern=1\checksum=0\multreg=0
  \strut
  \tninestart\tnineminus%
  \next%
}
\endinput
%%
%% End of file `code39.tex'.
