listings.ins 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. %%
  2. %% This file generates files required to use the listings package.
  3. %% At your command prompt write
  4. %%
  5. %% tex listings.ins
  6. %%
  7. %%
  8. %% (w)(c) 1996--1999,2002 Carsten Heinz
  9. %%
  10. %% This file is distributed under the terms of the LaTeX Project Public
  11. %% License from CTAN archives in directory macros/latex/base/lppl.txt.
  12. %% Either version 1.0 or, at your option, any later version.
  13. %%
  14. %% This file is completely free and comes without any warranty.
  15. %%
  16. %% Permission is granted to change this file. You are not allowed to
  17. %% distribute any changed version of this file unless you rename it.
  18. %%
  19. \input docstrip
  20. \preamble
  21. \endpreamble
  22. \usedir{tex/latex/listings}
  23. \keepsilent
  24. \askforoverwritefalse
  25. %
  26. % generate base package
  27. %
  28. \generate{
  29. \file{listings.sty}{\from{listings.dtx}{kernel}}
  30. \file{lstmisc.sty}{\from{listings.dtx}{misc,0.21}}
  31. \file{lstdoc.sty}{\from{listings.dtx}{doc}}
  32. \file{lstdrvrs.ins}{\from{lstdrvrs.dtx}{install}}
  33. \file{listings.cfg}{\from{lstdrvrs.dtx}{config}}
  34. }
  35. %
  36. % generate dummy patch if necessary
  37. %
  38. \newif\ifdummypatch
  39. \def\lstinsIfFileExists#1#2#3{% <filename><pre-input><post-input>
  40. \openin\inputcheck #1\relax
  41. \ifeof\inputcheck\else
  42. \closein\inputcheck
  43. #2%
  44. \@@input #1
  45. #3%
  46. \fi}
  47. \def\ProvidesFile#1[#2]{\def\lstpatch{#2}\endinput}
  48. \def\lstinsCheckVersion#1 #2{%
  49. \ifx #2v\dummypatchtrue \expandafter\lstinsGobbleNil \fi
  50. \afterassignment\lstinsCheckVersion@ \count\z@#2}
  51. \def\lstinsCheckVersion@.{%
  52. \afterassignment\lstinsGobbleNil \count\tw@}
  53. \def\lstinsGobbleNil#1\@nil{%
  54. \ifdummypatch\else
  55. \edef\patchversion{\the\count\z@.\the\count\tw@}%
  56. \ifx\lstversion\patchversion\else
  57. \dummypatchtrue
  58. \fi
  59. \fi}
  60. \Msg{checking listings version ...}
  61. \lstinsIfFileExists{listings.sty}
  62. {\def\NeedsTeXFormat#1{\endinput}}
  63. {\let\lstversion\fileversion
  64. \lstinsIfFileExists{lstpatch.sty}%
  65. {\let\fileversion\@undefined}%
  66. {\ifx\fileversion\@undefined
  67. \expandafter\lstinsCheckVersion\lstpatch\@nil
  68. \fi}%
  69. }
  70. \ifdummypatch
  71. \generate{\file{lstpatch.sty}{\from{listings.dtx}{patch}}}
  72. \fi
  73. %
  74. % generate language driver files
  75. %
  76. \batchinput{lstdrvrs.ins}
  77. \Msg{*}
  78. \Msg{* You probably need to move all created `.sty' and `.cfg'}
  79. \Msg{* files into a directory searched by TeX.}
  80. \Msg{*}
  81. \Msg{* And don't forget to refresh your filename database}
  82. \Msg{* if your TeX distribution uses such a database.}
  83. \Msg{*}
  84. \endbatchfile