[NTG-pdftex] RE: [pdftex] current filename and current filedate ?

Hans Hagen pragma@wxs.nl
Mon, 05 Jan 2004 00:01:59 +0100


At 23:00 04/01/2004, you wrote:

>hi hans:  this would be great news, indeed.  (I liked \include{} because 
>it requires an operating system file system operation, just like current 
>file name/date).  if you are addings this, please add individual filename 
>date/time, too, not just jobdate.  I would also add a "\system{}" macro, 
>instead of a write18 macro, where the output is directly inserted as text 
>into the output stream;  it would be mildly safer than write18, and more 
>functional in most situations.

an option for that could be something:

\openin\tempread=somename.suffix
\pdffiledate\tempread
\pdffilesize\tempread

etc.

This has several advantages: (1) it runs on top of the current file 
mechanism, (2) is can work with the kpse file search library (handy when 
the path is not known) and (3) implementing anything too far from tex's 
internals can be tricky with regards to how it end up in the string pool etc.

With regards to \system{...}, maybe some pipe could be implemented,

\immediate\openin\read18{whatever}

or so ...

>I actually am surprised that this feature still needs a lot of work to 
>work on many different systems.  I would guess Unix systems (including 
>Mac) and Windows machines these days all work pretty much the same way to 
>get datefile /time via a stat() call.  Compilers with Unix+Win 
>compatibility just have to cover 99% of all TeX installation these 
>days.  And, if this feature does not work on a particular system, it won't 
>break the world---just the same as when write18 does not work or when 
>\today outputs the wrong date or no date on a system that does not keep 
>time.  (ok, so they no longer exist.)

it has to with the fact that extension are implemented on top of 25 years 
of accumulated tex code (a mix of pascal and c and libraries); also, tex is 
(and has to be) extremely reliable since it's used all over the world, also 
by non system experts and hackers, so every extension should *work*, i.e. 
in this respect tex is not like the average open source thing, there is so 
much related and derived stuff around, and compatibility is not only a big 
issue here, but also the reason that tex is still around; on the other 
hand, extension are possible and part of the game, so in the end ...


>         -----Original Message-----
>         From: Hans Hagen [mailto:pragma@wxs.nl]
>         Sent: Sun 1/4/2004 1:42 PM
>         To: Welch, Ivo
>         Cc:
>         Subject: Re: [pdftex] current filename and current filedate ?
>
>
>
>         At 02:46 20/12/2003, you wrote:
>
>         >* Programming-wise, it would not be a big step to add two macros for
>         >\currentfile and \currentfiledate.  There is no operating system 
> on which
>         >this would likely be difficult.   Are there any modern C 
> implementations
>         >without a basic Unix-like stat() call?
>
>         Already on the pdftex 'to be implemented in a next release list are'
>
>         \pdfhours
>         \pdfminutes
>         \pdfseconds
>         \pdfmilliseconds
>
>         (needed since \time is too unprecise, which renders it useless 
> for for
>         instance random number generation); so there is no problem for adding
>
>         \pdfjobnamedate
>         \pdfjobnamesize
>         \pdfjobfullpath
>
>         Such extensions may sound trivial but since their implementation is
>         platform independent [which has consequences in many small areas 
> of the
>         source code tree] they end up on to do lists (next major release);
>
>         >* We already have facilities inside latex to get the overall 
> \jobname
>         >(really a filename).  We also already have facilities for the 
> current
>         >date/time.
>
>         hm, \jobname is special in itself, it's also an example of the 
> mess you may
>         end up in: catcodes of tokens in reported filename in this case
>
>         >So, if we can have \write18, \include, and \jobname, 
> \currentfile and
>         >\currentfiledate is not very different.
>
>         what's \include suppose to do?
>
>         Hans
>
>

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------