*DECK KDRDRV
      INTEGER FUNCTION KDRDRV(HMODUL,NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
*
*-----------------------------------------------------------------------
*
*Purpose:
* code dependent operator driver for DRAGON.
*
*Copyright:
* Copyright (C) 2002 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): A. Hebert
*
*Parameters: input/output
* HMODUL  name of the operator.
* NENTRY  number of LCM objects or files used by the operator.
* HENTRY  name of each LCM object or file.
* IENTRY  type of each LCM object or file:
*         =1 LCM memory object; =2 XSM file; =3 sequential binary file;
*         =4 sequential ascii file.
* JENTRY  access of each LCM object or file:
*         =0 the LCM object or file is created;
*         =1 the LCM object or file is open for modifications;
*         =2 the LCM object or file is open in read-only mode.
* KENTRY  LCM object address or file unit number.
*
*Parameters: output
* KDRDRV  completion flag (=0: operator HMODUL exists; =1: does not
*         exists).
*
*-----------------------------------------------------------------------
*
      USE GANLIB
*----
*  SUBROUTINE ARGUMENTS
*----
      CHARACTER HMODUL*(*),HENTRY(NENTRY)*12
      INTEGER IENTRY(NENTRY),JENTRY(NENTRY)
      TYPE(C_PTR) KENTRY(NENTRY)
*----
*  LOCAL VARIABLES
*----
      REAL TBEG,TEND
      LOGICAL :: DRAMOD
*
      KDRDRV=0
      DRAMOD=.TRUE.
      CALL KDRCPU(TBEG)
      CALL XDRCRE(HMODUL,1)
      IF(HMODUL.EQ.'GEO:') THEN
         CALL GEO(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SYBILT:') THEN
         CALL SYBILT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'EXCELT:') THEN
         CALL EXCELT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'NXT:') THEN
         CALL NXT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'PSP:') THEN
         CALL PSP(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'TLM:') THEN      
         CALL TLM(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'MCCGT:') THEN
         CALL MCCGT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'LIB:') THEN
        CALL LIB(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SHI:') THEN
         CALL SHI(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'MAC:') THEN
         CALL MAC(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'ASM:') THEN
         CALL ASM(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'FLU:') THEN
         CALL FLU(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'EVO:') THEN
         CALL EVO(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'EDI:') THEN
         CALL EDI(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'INFO:') THEN
         CALL INF(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'USS:') THEN
         CALL USS(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'COMPO:') THEN
         CALL COMPO(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SNT:') THEN
         CALL SNT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'M2T:') THEN
         CALL M2T(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'CHAB:') THEN
         CALL CHAB(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'CPO:') THEN
         CALL CPO(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SAP:') THEN
         CALL SAP(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'MC:') THEN
         CALL MCT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'T:') THEN
         CALL TRA(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'DMAC:') THEN
         CALL DMA(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'DREF:') THEN
         CALL DREF(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'EPC:') THEN      
         CALL EPC(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'FMT:') THEN      
         CALL FMT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SPH:') THEN      
         CALL SPH(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'CFC:') THEN      
         CALL CFC(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SENS:') THEN      
         CALL SEN(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'DUO:') THEN      
         CALL DUO(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'S2M:') THEN      
         CALL S2M(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'G2S:') THEN
         CALL G2S(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'G2MC:') THEN
         CALL G2MC(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE IF(HMODUL.EQ.'SALT:') THEN
         CALL SALT(NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ELSE
         DRAMOD=.FALSE.
         KDRDRV=KTRDRV(HMODUL,NENTRY,HENTRY,IENTRY,JENTRY,KENTRY)
      ENDIF
      IF(KDRDRV.EQ.0) CALL XDRCRE(HMODUL,-1)
      IF(DRAMOD)THEN
         CALL KDRCPU(TEND)
         WRITE(6,5000) HMODUL,(TEND-TBEG)
      ENDIF
      RETURN
*
 5000 FORMAT('-->>TIME SPENT IN MODULE ',A12,': ',F10.3)
      END
