Fortran for 3B1 needed

Thad P Floryan thad at cup.portal.com
Tue Jan 15 07:23:08 AEST 1991


jeffrey at sci.ccny.cuny.edu (Jeffrey L Bromberger)
in <1991Jan14.160257.6838 at sci.ccny.cuny.edu> writes:

Re:f2c	The package comes with it's own libraries.  Really, the only thing you
	need is to put the libs in the appropriate place.  It holds the
	routines called main, f_init, and f_exit (the routines needed to make
	f77 happy in a C universe).  There are also a few other routines, I
	forget exactly which ones at this point.  But it works.

Re:SVS	If only the Fortran that does exist (SVS Fortran) would link with C,
	but it doesn't (without assembly wrappers) :-(

Oh?  Then kindly explain why the following works just fine using SVS Fortran:

	thadlabs ksh 24989/24990> cat foo.for
		INTEGER PART1, PART2, PART3
		PART1 = -1
		PART2 = 31
	C
		PART3 = IAND(PART1,PART2)
		WRITE(*,100) PART1,PART2,PART3
	100	FORMAT(I13,' .AND. ',I13,' = ',I13/)
	C
		PART3 = IOR(PART1,PART2)
		WRITE(*,200) PART1,PART2,PART3
	200	FORMAT(I13,' .OR. ',I13,' = ',I13/)
	C
		PART3 = IXOR(PART1,PART2)
		WRITE(*,300) PART1,PART2,PART3
	300	FORMAT(I13,' .XOR. ',I13,' = ',I13/)
		END
	thadlabs ksh 24989/24990> cat bitsub.c
	int IAND(arg1, arg2)
		int	*arg1, *arg2;
	{
		return(*arg1 & *arg2);
	}

	int IOR(arg1, arg2)
		int	*arg1, *arg2;
	{
		return(*arg1 | *arg2);
	}

	int IXOR(arg1, arg2)
		int	*arg1, *arg2;
	{
		return(*arg1 ^ *arg2);
	}
	thadlabs ksh 24989/24990> cat doit.sh
	fortran foo.for bitsub.o -o foo
	thadlabs ksh 24989/24990> ./foo
	           -1 .AND.            31 =            31

	           -1 .OR.            31 =            -1

	           -1 .XOR.            31 =           -32

	thadlabs ksh 24989/24990> 

Thad Floryan [ thad at cup.portal.com ]



More information about the Comp.sys.att mailing list