From 2344cb8ba621f8c56a134c1abd7e9b90efba6345 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 24 Jan 2011 00:28:42 +0000
Subject: ifplatform (24jan11)

git-svn-id: svn://tug.org/texlive/trunk@21156 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/ifplatform/ifplatform.dtx         | 53 ++++++++++++++++------
 1 file changed, 39 insertions(+), 14 deletions(-)

(limited to 'Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx')

diff --git a/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx b/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
index 273f71e804c..4b6edfbe0e9 100644
--- a/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
+++ b/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
@@ -5,15 +5,17 @@
 %<*readme>
 ______________________
 The IFPLATFORM package
-v0.3a       2009/09/10
+v0.4        2010/10/22
 
 This package uses heuristics to establish whether
 the document is being processed on Windows or a *NIX
 platform (Mac OS X, Linux, etc.).
 
-Shell escape is required to differentiate different *NIX platforms.
+Except if you're using LuaTeX where this information
+is already known. Otherwise, shell escape is required
+to differentiate different *NIX platforms.
 
-Booleans provided are: 
+Booleans provided are:
  - ifwindows
  - iflinux
  - ifmacosx
@@ -25,7 +27,8 @@ expands to a string of the platform name.
 Will Robertson         wspr 81 at gmail dot com
 Johannes Große
 
-Copyright 2007, 2009 Will Robertson
+Copyright 2007-2010 Will Robertson
+Copyright 2007      Johannes Große
 Distributed under the LaTeX Project Public License
 %</readme>
 %<*internal>
@@ -36,12 +39,12 @@ Distributed under the LaTeX Project Public License
 \input docstrip.tex
 \keepsilent
 \preamble
-  _________________________________________________________
-  Copyright (C) 2007, 2009  Will Robertson & Johannes Große
+  ________________________________________________________
+  Copyright (C) 2007-2010  Will Robertson & Johannes Große
   License information appended.
 \endpreamble
 \postamble
-Copyright (C) 2007, 2009 by Will Robertson & Johannes Große
+Copyright (C) 2007-2010 by Will Robertson & Johannes Große
 
 Distributable under the LaTeX Project Public License,
 version 1.3c or higher (your choice). The latest version of
@@ -73,10 +76,10 @@ This work consists of the file  ifplatform.dtx
 \CodelineIndex
 \RecordChanges
 %\OnlyDescription
-\usepackage{array,booktabs,color,enumitem,geometry,microtype}
+\usepackage{array,booktabs,color,enumitem,geometry,hologo,microtype}
 \usepackage[sc,osf]{mathpazo}
 \usepackage[colorlinks]{hyperref}
-\geometry{a5paper,left=3.05cm,right=2cm}
+\geometry{b5paper}
 \linespread{1.1}       % A bit more space between lines
 \frenchspacing         % Remove ugly extra space after punctuation
 \definecolor{niceblue}{rgb}{0.2,0.4,0.8}
@@ -138,7 +141,9 @@ This work consists of the file  ifplatform.dtx
 %
 % \cs{ifshellescape} is provided as a conditional to test whether
 % shell escape is active or not. (Note: new versions of pdf\/\TeX\ 
-% allow you to query shell escape with \verb|\ifnum\pdfshellescape>0|\,.)
+% allow you to query shell escape with \verb|\ifnum\pdfshellescape>0|\,,
+% and the \pkg{pdftexcmds} provides the wrapper \cs{pdf@shellescape}
+% which works with \hologo{XeTeX}, \hologo{pdfTeX}, and \hologo{LuaTeX}.)
 %
 % Also, the \cmd\platformname\ command is defined to expand to a 
 % macro that represents the operating system. Default definitions are 
@@ -218,22 +223,24 @@ This work consists of the file  ifplatform.dtx
 % appear to be neither.\end{quote}
 % then I'd dearly like to know how it happened. It should 
 % never occur, as far as I know.
+% (Update: in previous versions of this package, this message appeared when running under \hologo{LuaTeX}.)
 % \end{itemize}
 % Keep these points in mind and you'll never run into trouble.
 % I hope you won't run into trouble in any case.
 %
-% \StopEventually{\clearpage\PrintIndex}
+% \clearpage
+% \StopEventually{\PrintIndex}
 % \section{Implementation}
 %\iffalse
 %<*package>
 %\fi
 %    \begin{macrocode}
 \ProvidesPackage{ifplatform}
-  [2009/09/10 v0.3a  Testing for the operating system]
+  [2010/10/22 v0.4  Testing for the operating system]
 %    \end{macrocode}
 % Packages required: (thanks Heiko)
 %    \begin{macrocode}
-\RequirePackage{pdftexcmds,catchfile}
+\RequirePackage{pdftexcmds,catchfile,ifluatex}
 %    \end{macrocode}
 % Conditionals we provide:
 %    \begin{macrocode}
@@ -275,10 +282,12 @@ This work consists of the file  ifplatform.dtx
 \ifnum\pdf@shellescape=1\relax
   \shellescapetrue
 \else
+  \ifluatex\else
   \PackageWarningNoLine{ifplatform}{^^J \space\space\space
     shell escape is disabled,
     so I can only detect \@backslashchar ifwindows%
   }
+  \fi
 \fi
 %    \end{macrocode}
 % \end{macro}
@@ -291,7 +300,22 @@ This work consists of the file  ifplatform.dtx
   }%
 }
 %    \end{macrocode}
-% Test for the null files of Windows and *nix. In a normal situation, this is all we need to do:
+% Now the platform test. In Lua\TeX\ this is straightforward:
+%    \begin{macrocode}
+\ifluatex
+  \csname\directlua{
+      if os.type == "unix" then 
+        tex.sprint("@ip@nix@true")
+      elseif os.type == "windows" then
+        tex.sprint("windowstrue")
+      end
+    }\endcsname
+\else
+%    \end{macrocode}
+% Otherwise we need to 
+% test for the null files of Windows and *nix.
+% (This doesn't work at all in LuaTeX. Not sure why; haven't looked.)
+% In a normal situation, this is all we need to do:
 %    \begin{macrocode}
 \IfFileExists{nul:}{\@ip@nix@false}{\@ip@nix@true}
 \IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
@@ -364,6 +388,7 @@ This work consists of the file  ifplatform.dtx
     \fi
   \fi
 \fi
+\fi
 %    \end{macrocode}
 % Needed below:
 %    \begin{macrocode}
-- 
cgit v1.2.3

