f



Open Watcom Fortran: ETIME, FDATE, FLUSH, GETENV

Hi,

I need to call the following routines in my OW Fortran programs and I
understand that the way to handle it under windows (since it is not
implemented in OW) is to use c wrappers.

The problem is that I am not really a specialist of c wrappers. Has
anyone already implemented these? 

Thanks in advance 

Victor

0
12/16/2005 2:00:39 PM
comp.lang.fortran 11800 articles. 1 followers. Post Follow

3 Replies
473 Views

Similar Articles

[PageSpeed] 40

victor wrote:

>Hi,
>
>I need to call the following routines in my OW Fortran programs and I
>understand that the way to handle it under windows (since it is not
>implemented in OW) is to use c wrappers.
>
>The problem is that I am not really a specialist of c wrappers. Has
>anyone already implemented these? 
>
>Thanks in advance 
>
>Victor
>
>  
>
The online Fortran 77 users guide is a good place to start. Try to look 
for the following  -   gettim, getdat, flushunit, fgetenv 



0
jdoe4201 (18)
12/16/2005 2:31:22 PM
Thank you John.

It is indeed there on page 92.
http://openwatcom.mirrors.pair.com/11.0c/docs/f77userguide.pdf

And it works on my platform (Windows)

0
12/16/2005 3:10:45 PM
victor wrote:

>Thank you John.
>
>It is indeed there on page 92.
>http://openwatcom.mirrors.pair.com/11.0c/docs/f77userguide.pdf
>
>And it works on my platform (Windows)
>
>  
>
It  is not hard to duplicate "etime" using "gettim".  The "fdate" thing 
using "getdat" may be trickier, especially  if you need to get day of 
week.  It might turn out easier to use a function written in C, 
shamelessly plagiarized from the internet.

/*   fdate.c */
#include<time.h>
int fdate(utime)
char utime[24];
{
        int i;
        time_t t;
        t=time (NULL);
        for (i=0; i<24; i++) utime[i]= *(ctime(&t)+i);
        return 1;
}

Called from fortran like this -

c test1.for
*$pragma aux fdate "!_" parm (value)
       character*30 string
       external fdate
       integer fdate
       i=fdate(string)
       print *,string
       pause
       end
    

0
jdoe4201 (18)
12/16/2005 11:31:27 PM
Reply: