C     *************************************************************** 
C     cast venova interface s Delphi
C     *************************************************************** 
C     6.9.2001 opravena chyba v RECALC_D
      SUBROUTINE SPHCAR_D [stdcall, dll export, alias:'D_SphCar'] 
     *(R,TETA,PHI,X,Y,Z,J)
      REAL      R [reference],TETA [reference],PHI [reference],
     1          X [reference],   Y [reference],  Z [reference]
	INTEGER*4 J [reference]
	 call sphcar(R,TETA,PHI,X,Y,Z,J)
	 return
      end
      
	SUBROUTINE GEOGSM_D [stdcall, dll export, alias:'D_GeoGsm']
     *(XGEO,YGEO,ZGEO,XGSM,YGSM,ZGSM,J)
	REAL*4 XGEO [reference],YGEO [reference],ZGEO [reference],
     1       XGSM [reference],YGSM [reference],ZGSM [reference]
	INTEGER*4 J [reference]
	 call GEOGSM(XGEO,YGEO,ZGEO,XGSM,YGSM,ZGSM,J)
      return
      end

      SUBROUTINE SMGSM_D [stdcall, dll export, alias:'D_SmGsm']
     *(XSM,YSM,ZSM,XGSM,YGSM,ZGSM,J)
      REAL*4  XSM [reference], YSM [reference], ZSM [reference],
     1       XGSM [reference],YGSM [reference],ZGSM [reference]
      INTEGER*4 J [reference]
	 call smgsm(XSM,YSM,ZSM,XGSM,YGSM,ZGSM,J)
      return
      end

      SUBROUTINE MAGSM_D [stdcall, dll export, alias:'D_MagSm']
     *(XMAG,YMAG,ZMAG,XSM,YSM,ZSM,J)
      REAL*4 XMAG [reference],YMAG [reference],ZMAG [reference],
     1        XSM [reference], YSM [reference], ZSM [reference]
      INTEGER*4 J [reference]
	 call magsm(XMAG,YMAG,ZMAG,XSM,YSM,ZSM,J)
      return
      end

      SUBROUTINE GSMGSE_D [stdcall, dll export, alias:'D_GsmGse']
     *(XGSM,YGSM,ZGSM,XGSE,YGSE,ZGSE,J)
	REAL*4 XGSM [reference],YGSM [reference],ZGSM [reference],
     1       XGSE [reference],YGSE [reference],ZGSE [reference]
	INTEGER*4 J [reference]
	 call GSMGSE(XGSM,YGSM,ZGSM,XGSE,YGSE,ZGSE,J)
      return
      end

      SUBROUTINE GEIGEO_D [stdcall, dll export, alias:'D_GeiGeo']
     *(XGEI,YGEI,ZGEI,XGEO,YGEO,ZGEO,J)
	REAL*4 XGEI [reference],YGEI [reference],ZGEI [reference],
     1       XGEO [reference],YGEO [reference],ZGEO [reference]
	INTEGER*4 J [reference]
	 call geigeo(XGEI,YGEI,ZGEI,XGEO,YGEO,ZGEO,J)
      return
      end

      SUBROUTINE GEOMAG_D [stdcall, dll export, alias:'D_GeoMag']
     *(XGEO,YGEO,ZGEO,XMAG,YMAG,ZMAG,J)
      REAL*4 XGEO [reference],YGEO [reference],ZGEO [reference],
     1       XMAG [reference],YMAG [reference],ZMAG [reference]
      INTEGER*4 J [reference]
	 call geomag(XGEO,YGEO,ZGEO,XMAG,YMAG,ZMAG,J)
      return
      end

      SUBROUTINE RECALC_D [stdcall, dll export, alias:'D_ReCalc']
     *(IYR,IDAY,IHOUR,IMIN,ISEC)
      INTEGER*4 IYR [reference],IDAY [reference],IHOUR [reference],
     1          IMIN [reference],ISEC [reference]
	 call recalc(IYR,IDAY,IHOUR,IMIN,ISEC)
      return
      end

      SUBROUTINE BSPCAR_D [stdcall, dll export, alias:'D_BSpCar']
     *(TETA,PHI,BR,BTET,BPHI,BX,BY,BZ)
      REAL*4 TETA [reference], PHI [reference],BR [reference],
     1       BTET [reference],BPHI [reference],
     2         BX [reference],  BY [reference],BZ [reference]
	 call bspcar(TETA,PHI,BR,BTET,BPHI,BX,BY,BZ)
      return
      end

      SUBROUTINE BCARSP_D [stdcall, dll export, alias:'D_BCarSp'] 
     *(X,Y,Z,BX,BY,BZ,BR,BTET,BPHI)
      REAL*4  X [reference], Y [reference], Z [reference],
     1       BX [reference],BY [reference],BZ [reference],
     2       BTET [reference],BPHI [reference]

	 call bcarsp(X,Y,Z,BX,BY,BZ,BR,BTET,BPHI)
      return
      end
            
      SUBROUTINE SUN_D [stdcall, dll export, alias:'D_Sun'] 
     *(IYR,IDAY,IHOUR,MIN,ISEC,GST,SLONG,SRASN,SDEC)
      REAL*4    GST [reference],SLONG [reference],SRASN [reference],
     1         SDEC [reference]
      INTEGER*4 IYR [reference],IDAY [reference],IHOUR [reference],
     1          MIN [reference],ISEC [reference]
	 call sun(IYR,IDAY,IHOUR,IMIN,ISEC,GST,SLONG,SRASN,SDEC)
      return
      end

      SUBROUTINE DIP_D [stdcall, dll export, alias:'D_Dip']
     * (X,Y,Z,BX,BY,BZ)
      REAL*4 X  [reference],Y  [reference], Z [reference],
     1	   BX [reference],BY [reference],BZ [reference]
	 call DIP(X,Y,Z,BX,BY,BZ)
      return
      end

      SUBROUTINE IGRF_GEO_D [stdcall, dll export, alias:'D_Igrf_geo']
     *(R,T,F,BR,BT,BF)

      REAL*4     R [REFERENCE], T [REFERENCE], F [REFERENCE],
     *          BR [REFERENCE],BT [REFERENCE],BF [REFERENCE] 
	 call IGRF_GEO(R,T,F,BR,BT,BF)
      return
      end

      SUBROUTINE IGRF_GSM_D [stdcall, dll export, alias:'D_Igrf_gsm'] 
     *(XGSM,YGSM,ZGSM,HXGSM,HYGSM,HZGSM)
      REAL*4  XGSM [REFERENCE], YGSM [REFERENCE], ZGSM [REFERENCE],
     *       HXGSM [REFERENCE],HYGSM [REFERENCE],HZGSM [REFERENCE] 
	
	 call IGRF_GSM(XGSM,YGSM,ZGSM,HXGSM,HYGSM,HZGSM)
      return
      end


      SUBROUTINE T96_MGNP_D [stdcall, dll export, alias:'D_T96_mgnp']
     *(XN_PD,VEL,XGSM,YGSM,ZGSM,XMGNP,YMGNP,ZMGNP,DIST,ID)
      REAL*4 XN_PD [REFERENCE],VEL [REFERENCE],
     1       XGSM [REFERENCE], YGSM [REFERENCE], ZGSM [REFERENCE],
     2       XMGNP [REFERENCE],YMGNP [REFERENCE],ZMGNP [REFERENCE],
     3       DIST  [REFERENCE]
      INTEGER*4 ID [REFERENCE] 
      
	 call T96_MGNP (XN_PD,VEL,XGSM,YGSM,ZGSM,
     *XMGNP,YMGNP,ZMGNP,DIST,ID)
      return
      end

      SUBROUTINE SHUETAL_MGNP_I [stdcall, dll export,
     *alias:'D_Shuetal_mgnp']
     1(XN_PD,VEL,BZIMF,XGSM,YGSM,ZGSM,XMGNP,YMGNP,ZMGNP,DIST,ID) 
      REAL*4 XN_PD [REFERENCE],VEL [REFERENCE],BZIMF [REFERENCE],
     1       XGSM [REFERENCE], YGSM [REFERENCE], ZGSM [REFERENCE],
     2       XMGNP [REFERENCE],YMGNP [REFERENCE],ZMGNP [REFERENCE],
     3       DIST  [REFERENCE]
      INTEGER*4 ID [REFERENCE] 
      
       call SHUETAL_MGNP (XN_PD,VEL,BZIMF,XGSM,YGSM,ZGSM,
     *XMGNP,YMGNP,ZMGNP,DIST,ID)
      return
      end


      SUBROUTINE T89C_D [stdcall, dll export, alias:'D_t89c']
     *(IOPT,PARMOD,PS,X,Y,Z,BX,BY,BZ)
      INTEGER*4 IOPT [REFERENCE]
      REAL*4      PS [reference],
     1             X [reference], Y [reference], Z [reference],
     2            BX [reference],BY [reference],BZ [reference],
     3        PARMOD [reference] (10)
	 call T89C(IOPT,PARMOD,PS,X,Y,Z,BX,BY,BZ)
      return
      end

      SUBROUTINE T96_01_D [stdcall, dll export, alias:'D_t96_01']
     *(IOPT,PARMOD,PS,X,Y,Z,BX,BY,BZ)
      INTEGER*4 IOPT [REFERENCE]
      REAL*4      PS [reference],
     1             X [reference], Y [reference], Z [reference],
     2            BX [reference],BY [reference],BZ [reference],
     3        PARMOD [reference] (10)
	 call T96_01(IOPT,PARMOD,PS,X,Y,Z,BX,BY,BZ)
      return
      end

      SUBROUTINE T01_01_D [stdcall, dll export, alias:'D_t01_01']
     *(IOPT,PARMOD,PS,X,Y,Z,BX,BY,BZ)
      INTEGER*4 IOPT [REFERENCE]
      REAL*4      PS [reference],
     1             X [reference], Y [reference], Z [reference],
     2            BX [reference],BY [reference],BZ [reference],
     3        PARMOD [reference] (10)
	 call T01_01(IOPT,PARMOD,PS,X,Y,Z,BX,BY,BZ)
      return
      end

      SUBROUTINE LOCATE_D [stdcall, dll export, alias:'D_Locate']
     *(XN_PD,VEL,XGSM,YGSM,ZGSM,XMGNP,YMGNP,ZMGNP,DIST,ID)
      REAL*4 XMGNP [reference],YMGNP [reference], ZMGNP [reference],
     1        XGSM [reference], YGSM [reference],  ZGSM [reference],
     2       XN_PD [reference],  VEL [reference],  DIST [reference]
      INTEGER*4 ID [reference]
       call Locate(XN_PD,VEL,XGSM,YGSM,ZGSM,XMGNP,YMGNP,ZMGNP,DIST,ID)
      return
      end

      SUBROUTINE CROSSING_D [stdcall, dll export, alias: 'D_Crossing']
     *(XGSM,YGSM,ZGSM,PDYN)
      REAL*4  PDYN [reference],
     1        XGSM [reference], YGSM [reference],  ZGSM [reference]
	 call CROSSING(XGSM,YGSM,ZGSM,PDYN)
	return
      end

 	SUBROUTINE GSMMAG_D [stdcall, dll export, alias:'D_GSMMag']
     *(xgsm,ygsm,zgsm,r,alat,aMLT,j)
      REAL*4     R [reference],ALAT [reference],AMLT [reference],
     1        XGSM [reference],YGSM [reference],ZGSM [reference]
      INTEGER*4  J [reference]
       call GSMMAG(xgsm,ygsm,zgsm,r,alat,aMLT,j)
	return
      end

      SUBROUTINE STEP_D[stdcall, dll export, alias:'D_Step']
     *(X,Y,Z,DS,ERRIN,IOPT,PARMOD,IEXNAME,INNAME)
      INTEGER*4 INNAME [reference], IOPT [reference],IEXNAME [reference]
      REAL*4    X [reference],    Y [reference],      Z [reference],
     1         DS [reference],ERRIN [reference], PARMOD [reference] (10)   

	if (IEXNAME.EQ.89 .AND. INNAME.EQ.0) 
     * CALL STEP(X,Y,Z,DS,ERRIN,IOPT,PARMOD,T89C,DIP)
	if (IEXNAME.EQ.89 .AND. INNAME.EQ.1) 
     * CALL STEP(X,Y,Z,DS,ERRIN,IOPT,PARMOD,T89C,IGRF_GSM)
	
	if (IEXNAME.EQ.96 .AND. INNAME.EQ.0)  
     * CALL STEP(X,Y,Z,DS,ERRIN,IOPT,PARMOD,T96_01,DIP)
	if (IEXNAME.EQ.96 .AND. INNAME.EQ.1)  
     * CALL STEP(X,Y,Z,DS,ERRIN,IOPT,PARMOD,T96_01,IGRF_GSM)
      
	if (IEXNAME.EQ.1 .AND. INNAME.EQ.0)  
     * CALL STEP(X,Y,Z,DS,ERRIN,IOPT,PARMOD,T01_01,DIP)
	if (IEXNAME.EQ.1 .AND. INNAME.EQ.1)  
     * CALL STEP(X,Y,Z,DS,ERRIN,IOPT,PARMOD,T01_01,IGRF_GSM)
      
      return
	end


      SUBROUTINE RHAND_D[stdcall, dll export, alias:'D_RHand']
     *(X,Y,Z,R1,R2,R3,IOPT,PARMOD,IEXNAME,INNAME)
      INTEGER*4 INNAME [reference],IOPT [reference],IEXNAME [reference]
      REAL*4    X [reference],   Y [reference],      Z [reference],
     1         R1 [reference],  R2 [reference],     R3 [reference],
     2     PARMOD [reference] (10)   
	
	if (IEXNAME.EQ.89 .AND. INNAME.EQ.0) 
     * CALL RHAND(X,Y,Z,R1,R2,R3,IOPT,PARMOD,T89C,DIP)
	if (IEXNAME.EQ.89 .AND. INNAME.EQ.1) 
     * CALL RHAND(X,Y,Z,R1,R2,R3,IOPT,PARMOD,T89C,IGRF_GSM)
	
	if (IEXNAME.EQ.96 .AND. INNAME.EQ.0)  
     * CALL RHAND(X,Y,Z,R1,R2,R3,IOPT,PARMOD,T96_01,DIP)
	if (IEXNAME.EQ.96 .AND. INNAME.EQ.1)  
     * CALL RHAND(X,Y,Z,R1,R2,R3,IOPT,PARMOD,T96_01,IGRF_GSM)
	
	if (IEXNAME.EQ.1 .AND. INNAME.EQ.0)  
     * CALL RHAND(X,Y,Z,R1,R2,R3,IOPT,PARMOD,T01_01,DIP)
	if (IEXNAME.EQ.1 .AND. INNAME.EQ.1)  
     * CALL RHAND(X,Y,Z,R1,R2,R3,IOPT,PARMOD,T01_01,IGRF_GSM)

      return
	end

      SUBROUTINE TRACE_D[stdcall, dll export, alias:'D_Trace']
     * (XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,IEXNAME,INNAME,
     * XF,YF,ZF,XX,YY,ZZ,L)
      INTEGER*4 IOPT [reference],IEXNAME [reference],
     1             L [reference], INNAME [reference]
      REAL*4    XI [reference],  YI [reference],     ZI [reference],
     1         DIR [reference],RLIM [reference],     R0 [reference],
     2      PARMOD [reference] (10),  
     3          XF [reference],  YF [reference],     ZF [reference],
     3          XX [reference](*),YY [reference](*), ZZ [reference](*)

	if (IEXNAME.EQ.89 .AND. INNAME.EQ.0) 
     * CALL TRACE(XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,T89C,DIP,
     *            XF,YF,ZF,XX,YY,ZZ,L)
	if (IEXNAME.EQ.89 .AND. INNAME.EQ.1) 
     * CALL TRACE(XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,T89C,IGRF_GSM,
     *            XF,YF,ZF,XX,YY,ZZ,L)
	
	if (IEXNAME.EQ.96 .AND. INNAME.EQ.0) 
     * CALL TRACE(XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,T96_01,DIP,
     *            XF,YF,ZF,XX,YY,ZZ,L)
	if (IEXNAME.EQ.96 .AND. INNAME.EQ.1) 
     * CALL TRACE(XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,T96_01,IGRF_GSM,
     *XF,YF,ZF,XX,YY,ZZ,L)

	if (IEXNAME.EQ.1 .AND. INNAME.EQ.0) 
     * CALL TRACE(XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,T01_01,DIP,
     *            XF,YF,ZF,XX,YY,ZZ,L)
	if (IEXNAME.EQ.1 .AND. INNAME.EQ.1) 
     * CALL TRACE(XI,YI,ZI,DIR,RLIM,R0,IOPT,PARMOD,T01_01,IGRF_GSM,
     *XF,YF,ZF,XX,YY,ZZ,L)

      return
      end

	SUBROUTINE GEOCGM01_D[stdcall, dll export, alias:'D_GeoCgm01']
     *(ICOR,IYEAR,HI,DAT,PLA,PLO)
      REAL*4     DAT [reference](11,4),
     1           PLA [reference](4),PLO [reference](4), HI [reference]
      INTEGER*4 ICOR [reference], IYEAR [reference]
       call GEOCGM01(ICOR,IYEAR,HI,DAT,PLA,PLO)
      return
      end

	SUBROUTINE MLTUT_D [stdcall, dll export, alias:'D_MltUt']
     *(SLA,SLO,CLA,PLA,PLO,UT)
      REAL*4 SLA [reference], SLO [reference], CLA [reference],
     1       PLA [reference], PLO [reference],  UT [reference]
	 call MLTUT(SLA,SLO,CLA,PLA,PLO,UT)
	return
	end

      real function OVL_ANG_D [stdcall, dll export, alias:'D_Ovl_Ang']
     *(SLA,SLO,CLA,CLO,RR)
      REAL*4 SLA [reference], SLO [reference], CLA [reference],
     1       CLO [reference], RR  [reference]
       OVL_ANG_D = OVL_ANG(SLA,SLO,CLA,CLO,RR)
	return
	end
	
	real function CGMGLA_D [stdcall, dll export, alias:'D_CgmGLa'] 
     *(CLAT)
      REAL*4 CLAT [reference]
       CGMGLA_D = CGMGLA(CLat)
	return
	end

      real function CGMGLO_D [stdcall, dll export, alias:'D_CgmGLo']
     * (CLON)
      REAL*4 CLON [reference]
       CGMGLO_D = CGMGLO(CLON)
	return
	end
	
	
      real function AZM_ANG_D [stdcall, dll export, alias:'D_Azm_Ang']
     *(SLA,SLO,CLA,PLA,PLO)
      REAL*4 SLA [reference], SLO [reference], CLA [reference],
     1       PLA [reference], PLO [reference]
       AZM_ANG_D = AZM_ANG(SLA,SLO,CLA,PLA,PLO)
	return
	end

      SUBROUTINE MFC_D [stdcall, dll export, alias:'D_MFc']
     *(SLA,SLO,R,H,D,Z)
      REAL*4 SLA [reference], SLO [reference], R [reference],
     1         H [reference],  D  [reference], Z [reference]
	 call MFC(SLA,SLO,R,H,D,Z)
	return
	end

      SUBROUTINE FTPRNT_D [stdcall, dll export, alias:'D_FtPrnt']
     *(RH,SLA,SLO,CLA,CLO,ACLA,ACLO,SLAF,SLOF,RF)
      REAL*4 SLA [reference], SLO [reference], CLA [reference],
     1        RH [reference], CLO [reference],ACLA [reference],
     2        RF [reference],ACLO [reference],SLAF [reference],
     3      SLOF [reference]
	 call FTPRNT(RH,SLA,SLO,CLA,CLO,ACLA,ACLO,SLAF,SLOF,RF)
	return
	end

      SUBROUTINE GEOLOW_D [stdcall, dll export, alias:'D_GeoLow']
     *(SLAR,SLOR,RH,CLAR,CLOR,RBM,SLAC,SLOC)
      REAL*4 SLAR [reference], SLOR [reference], CLAR [reference],
     1         RH [reference], CLOR [reference],
     2        RBM [reference], SLOC [reference], SLAC [reference]
	 call GEOLOW(SLAR,SLOR,RH,CLAR,CLOR,RBM,SLAC,SLOC)
	return
	end

      SUBROUTINE CORGEO_D [stdcall, dll export, alias:'D_CorGeo']
     *(SLA,SLO,RH,DLA,DLO,CLA,CLO,PMI)
      REAL*4 SLA [reference], SLO [reference],  RH [reference],
     1       CLA [reference], CLO [reference], PMI [reference],
     2       DLA [reference], DLO [reference]   
	 call CORGEO(SLA,SLO,RH,DLA,DLO,CLA,CLO,PMI)
	return
	end

      SUBROUTINE GEOCOR_D [stdcall, dll export, alias:'D_GeoCor']
     *(SLA,SLO,RH,DLA,DLO,CLA,CLO,PMI)
      REAL*4 SLA [reference], SLO [reference],  RH [reference],
     1       CLA [reference], CLO [reference], PMI [reference],
     2       DLA [reference], DLO [reference]   
	 call GEOCOR(SLA,SLO,RH,DLA,DLO,CLA,CLO,PMI)
	return
	end

      SUBROUTINE SHAG_D [stdcall, dll export, alias:'D_Shag']
     *(X,Y,Z,DS)
      REAL*4 X [reference], Y [reference], Z [reference],
     1      DS [reference]
	 call SHAG(X,Y,Z,DS)
	return
	end

      SUBROUTINE RIGHT_D [stdcall, dll export, alias:'D_Right']
     *(X,Y,Z,R1,R2,R3)
      REAL*4 X [reference],  Y [reference],  Z [reference],
     1      R1 [reference], R2 [reference], R3 [reference]
	 call RIGHT(X,Y,Z,R1,R2,R3)
	return
	end

      real function TILT_D [stdcall, dll export, alias:'D_Tilt_Ang']
     *(IYR,IDAY,IHOUR,IMIN,ISEC)
	INTEGER*4 IYR [reference],IDAY [reference],IHOUR [reference],
     1          IMIN [reference],ISEC [reference]
	COMMON /GEOPACK1/ A(15),PSI1,AA(10),DS31,K1,IY1,BB(8)
       call recalc(IYR,IDAY,IHOUR,IMIN,ISEC)
       TILT_D = PSI1  
	return
	end

      Subroutine GETCOM_D [stdcall, dll export, alias:'D_GetCom']
     *(psi,ds3,k,iy)
      integer k [reference], iy [reference]
      real psi [reference], ds3 [reference]
      COMMON /GEOPACK1/ A(15),PSI1,AA(10),DS31,K1,IY1,BB(8)
      psi = psi1
      ds3 = ds31
      k = k1
      iy = iy1
      return 
      end

      Subroutine SETCOM_D [stdcall, dll export, alias:'D_SetCom']
     *(psi,ds3,k,iy)
      integer k [reference], iy [reference]
      real psi [reference], ds3 [reference]
      COMMON /GEOPACK1/ A(15),PSI1,AA(10),DS31,K1,IY1,BB(8)
      psi1 = psi
      ds31 = ds3
      k1 = k
      iy1 = iy
      return 
      end
c