<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hook for OPEN(FILE=...,DEFAULTFILE=...) in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746403#M4251</link>
    <description>As you have no doubt discovered on your own, Linux is not VMS. Linux has none of the elegant, integrated file system mechanisms that you came to depend on that "just worked". Linux makes you reinvent your own filespec parsing code each time, and there is no standard library or process for doing so. The VMS concept of logical names and their integration into file specifications does not exist in Linux. Windows is somewhat better in this regard, but not even close to what VMS had 30 years ago.&lt;BR /&gt;&lt;BR /&gt;Given that, DEFAULTFILE in ifort is simply a string that is prefixed to what you say in FILE=. If you want a "hook", this is done with a USEROPEN routine - it will at least require you to change the OPEN to specify the USEROPEN keyword and name the routine. Sort of like USEROPEN on VMS, you are passed various items that were specified in the OPEN and you get to do the actual fopen call yourself and return the handle.&lt;BR /&gt;&lt;BR /&gt;I note that the USEROPEN documentation is very much Windows-centric, but it is not documented as Windows-only. I have not yet tried a test case to see what one gets passed on Linux.&lt;BR /&gt;</description>
    <pubDate>Tue, 08 Jan 2008 14:21:10 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2008-01-08T14:21:10Z</dc:date>
    <item>
      <title>Hook for OPEN(FILE=...,DEFAULTFILE=...)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746402#M4250</link>
      <description>The Intel Fortran compiler for Linux assumes that an OPEN DEFAULTFILE
argument contains only a directory name. That is a rather limited
implementation. Is there any hook in the RTL which would allow me to
parse the OPEN FILE and DEFAULTFILE arguments so that I can make up the
actual file specification before OPEN proceeds with the actual open
operation? &lt;I&gt;I do not want to touch the OPEN statement itself in my Fortran code.&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
Some background information:&lt;BR /&gt;
In my code I use various VMS features. In particular I specify only the
file name with the OPEN FILE argument and specify the location and file
type with the OPEN DEFAULTFILE argument. Example:
FILE='WHAT',DEFAULTFILE='WHERE:.TXT'&lt;BR /&gt;
For WHERE I have a logical name defined which points to the actual
device and directory (and maybe node name, too). If nothing else is
defined, OPEN accesses the file WHERE:WHAT.TXT. Now, if someone defines
a logical name WHAT and points that to another file, then that file is
being accessed.&lt;BR /&gt;
&lt;BR /&gt;
In some routines I only specify the file type with DEFAULTFILE to provide a default file type.&lt;BR /&gt;
&lt;BR /&gt;
Right now I am using symbolic links on Linux to access the actual
files. But that is a terrible hack. The symbolic link for the example
above would have to be named WHERE:.TXT/WHAT (oh_deer).&lt;BR /&gt;
&lt;BR /&gt;
I have already written a self-made Linux FUSE based file system which
makes files and directories in a particular directory tree all
case-insensitive. I could use this code to implement the basic idea of
logical names, but that would limit the portability of my application
significantly because I may not be able to install the file system on
every target machine.&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jan 2008 04:48:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746402#M4250</guid>
      <dc:creator>oh_moose</dc:creator>
      <dc:date>2008-01-08T04:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Hook for OPEN(FILE=...,DEFAULTFILE=...)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746403#M4251</link>
      <description>As you have no doubt discovered on your own, Linux is not VMS. Linux has none of the elegant, integrated file system mechanisms that you came to depend on that "just worked". Linux makes you reinvent your own filespec parsing code each time, and there is no standard library or process for doing so. The VMS concept of logical names and their integration into file specifications does not exist in Linux. Windows is somewhat better in this regard, but not even close to what VMS had 30 years ago.&lt;BR /&gt;&lt;BR /&gt;Given that, DEFAULTFILE in ifort is simply a string that is prefixed to what you say in FILE=. If you want a "hook", this is done with a USEROPEN routine - it will at least require you to change the OPEN to specify the USEROPEN keyword and name the routine. Sort of like USEROPEN on VMS, you are passed various items that were specified in the OPEN and you get to do the actual fopen call yourself and return the handle.&lt;BR /&gt;&lt;BR /&gt;I note that the USEROPEN documentation is very much Windows-centric, but it is not documented as Windows-only. I have not yet tried a test case to see what one gets passed on Linux.&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jan 2008 14:21:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746403#M4251</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-01-08T14:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hook for OPEN(FILE=...,DEFAULTFILE=...)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746404#M4252</link>
      <description>I did some experiments and found that the arguments to the USEROPEN routine on Linux are not the same as on Windows. On Linux it is equivalent to the following Fortran routine:&lt;BR /&gt;&lt;BR /&gt;integer(4) function uopn (filename, open_flags, create_mode, unit)&lt;BR /&gt;character(*) filename&lt;BR /&gt;integer open_flags, create_mode, unit&lt;BR /&gt;&lt;BR /&gt;! Routine calls C library routine "open" with filename, open_flags, create_mode)&lt;BR /&gt;uopn = ! file descriptor returned by open()&lt;BR /&gt;end function uopn&lt;BR /&gt;&lt;BR /&gt;The filename has already had paths applied to it. The filename length is passed by value at the end of the argument list. All other arguments are passed by reference.&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jan 2008 16:02:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Hook-for-OPEN-FILE-DEFAULTFILE/m-p/746404#M4252</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-01-08T16:02:39Z</dc:date>
    </item>
  </channel>
</rss>

