For Programmers: Free Programming Magazines  


Home > Archive > Fortran > December 2004 > Fortran to Java or C









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Fortran to Java or C
Per Jørgen Vigdal

2004-12-16, 4:06 pm

Hi



Could any one please help me to understand what is happening in the attached
fortran code.

I am to implement this in Java and do not understand the fortran syntaks.

The code are supposed to do some sort off transliteration of a 8 byte data
type.







!
SUBROUTINE CONTSN(TSNW,SCODW)
!
INCLUDE 'COM_LIBRARY_SRC:CONTSN.INC'

INTEGER*2 TSNW(4) !
INTEGER*2 SCODW(4)!

!local
INTEGER*2 I,J,K,R3W
INTEGER*2 R1W
INTEGER*4 R1L/0/
BYTE R1B(2),TMPB
EQUIVALENCE (R1W,R1L)
EQUIVALENCE (R1W,R1B)
DATA PADL/0,0,0,0/

DO I = 1, 4
PADL(I) = 0
ENDDO
DO I = 1, 4
PADW(1,I) = TSNW(I) ! working copy of input
ENDDO
R3W = 0 ! initial bias
DO I = 1, 4
DO J = 1, 4
DO K = 1, 4 ! get hex digit in R1L
R1L = R1L*2
PADL(TABW(R3W,K)) = ISHFT(PADL(TABW(R3W,K)), 1)
! PADL(TABW(R3W,K)) = PADL(TABW(R3W,K))*2
IF (PADW(2,TABW(R3W,K))) R1L = R1L + 1
ENDDO
R3W = (R3W+R1L) .AND. 15 ! update bias
ENDDO
SCODW(5-I) = R1W ! store 4 hex digits
R1L = 0
ENDDO
RETURN
END


David Frank

2004-12-16, 4:06 pm


"Per Jørgen Vigdal" <per.jorgen.vigdal@ergo.no> wrote in message
news:1103205572.463596@makrell.interpost.no...

>
> The code are supposed to do some sort off transliteration of a 8 byte
> data
> type.
>



Without the include file its difficult to understand what happens to the
8bytes of data.
But your code can be rewritten in easier to understand Fortran-9x if you
provide
sample input/output cases..


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com