2006-04-05 16:07:32 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/times.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
2005-12-22 11:40:53 -05:00
|
|
|
/* FORTRAN: fd = close(filedes) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int close_(int *filedes)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return(close(*filedes));
|
|
|
|
}
|
|
|
|
/* FORTRAN: fd = open(filnam,mode) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int open_(char filnam[], int *mode)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return(open(filnam,*mode));
|
|
|
|
}
|
|
|
|
/* FORTRAN: fd = creat(filnam,mode) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int creat_(char filnam[],int *mode)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return(creat(filnam,*mode));
|
|
|
|
}
|
|
|
|
/* FORTRAN: nread = read(fd,buf,n) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int read_(int *fd, char buf[], int *n)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return(read(*fd,buf,*n));
|
|
|
|
}
|
|
|
|
/* FORTRAN: nwrt = write(fd,buf,n) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int write_(int *fd, char buf[], int *n)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return(write(*fd,buf,*n));
|
|
|
|
}
|
|
|
|
/* FORTRAN: ns = lseek(fd,offset,origin) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int lseek_(int *fd,int *offset, int *origin)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return(lseek(*fd,*offset,*origin));
|
|
|
|
}
|
|
|
|
/* times(2) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int times_(struct tms *buf)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return (times(buf));
|
|
|
|
}
|
|
|
|
/* ioperm(2) */
|
2006-01-07 15:14:23 -05:00
|
|
|
//ioperm_(from,num,turn_on)
|
|
|
|
//unsigned long *from,*num,*turn_on;
|
|
|
|
//{
|
|
|
|
// return (ioperm(*from,*num,*turn_on));
|
|
|
|
// return (i386_get_ioperm(*from,*num,*turn_on));
|
|
|
|
//}
|
2005-12-22 11:40:53 -05:00
|
|
|
|
|
|
|
/* usleep(3) */
|
2006-04-05 16:07:32 -04:00
|
|
|
int usleep_(unsigned long *microsec)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return (usleep(*microsec));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns random numbers between 0 and 32767 to FORTRAN program */
|
2006-04-05 16:07:32 -04:00
|
|
|
int iran_(int *arg)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return (rand());
|
|
|
|
}
|
2006-04-05 16:07:32 -04:00
|
|
|
int exit_(int *n)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
printf("\n\n");
|
|
|
|
exit(*n);
|
|
|
|
}
|
2006-12-10 19:57:18 -05:00
|
|
|
struct tm *
|
|
|
|
gmtime_r_(const time_t *clock, struct tm *result)
|
|
|
|
{
|
|
|
|
gmtime_r(clock, result);
|
|
|
|
}
|
2006-04-05 16:07:32 -04:00
|
|
|
time_t time_(void)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
|
|
|
return time(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* hrtime() */
|
2006-04-05 16:07:32 -04:00
|
|
|
double hrtime_(void)
|
2005-12-22 11:40:53 -05:00
|
|
|
{
|
2006-04-05 16:07:32 -04:00
|
|
|
struct timeval tv;
|
2007-07-02 12:03:44 -04:00
|
|
|
|
|
|
|
gettimeofday(&tv,NULL);
|
2006-04-05 16:07:32 -04:00
|
|
|
return(tv.tv_sec+1.e-6*tv.tv_usec);
|
2005-12-22 11:40:53 -05:00
|
|
|
}
|