Commit aabaf03c authored by Kim, Jungwon's avatar Kim, Jungwon

rallback c_ptr

parent 56c95fb4
......@@ -24,7 +24,7 @@ MODULE PAPYRUS
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: ARGC
TYPE(C_PTR), VALUE, INTENT(IN) :: ARGV
TYPE(C_PTR), VALUE, INTENT(IN) :: REPOSITORY
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: REPOSITORY
END FUNCTION PAPYRUSKV_INIT_CBIND
INTEGER(C_INT) FUNCTION PAPYRUSKV_FINALIZE_CBIND() &
......@@ -35,7 +35,7 @@ MODULE PAPYRUS
INTEGER(C_INT) FUNCTION PAPYRUSKV_OPEN_CBIND(NAME, FLAGS, OPT, DB) &
BIND(C, NAME='papyruskv_open')
USE, INTRINSIC :: ISO_C_BINDING
TYPE(C_PTR), VALUE, INTENT(IN) :: NAME
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: NAME
INTEGER(C_INT), VALUE, INTENT(IN) :: FLAGS
TYPE(C_PTR), VALUE, INTENT(IN) :: OPT
INTEGER(C_INT), INTENT(OUT) :: DB
......@@ -51,9 +51,9 @@ MODULE PAPYRUS
BIND(C, NAME='papyruskv_put')
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: DB
TYPE(C_PTR), VALUE, INTENT(IN) :: KEY
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: KEY
INTEGER(C_SIZE_T), VALUE, INTENT(IN) :: KEYLEN
TYPE(C_PTR), VALUE, INTENT(IN) :: VAL
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: VAL
INTEGER(C_SIZE_T), VALUE, INTENT(IN) :: VALLEN
END FUNCTION PAPYRUSKV_PUT_CBIND
......@@ -61,7 +61,7 @@ MODULE PAPYRUS
BIND(C, NAME='papyruskv_get')
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: DB
TYPE(C_PTR), VALUE, INTENT(IN) :: KEY
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: KEY
INTEGER(C_SIZE_T), VALUE, INTENT(IN) :: KEYLEN
TYPE(C_PTR), INTENT(OUT) :: VAL
INTEGER(C_SIZE_T), INTENT(OUT) :: VALLEN
......@@ -71,7 +71,7 @@ MODULE PAPYRUS
BIND(C, NAME='papyruskv_delete')
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: DB
TYPE(C_PTR), VALUE, INTENT(IN) :: KEY
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: KEY
INTEGER(C_SIZE_T), VALUE, INTENT(IN) :: KEYLEN
END FUNCTION PAPYRUSKV_DELETE_CBIND
......@@ -99,7 +99,7 @@ MODULE PAPYRUS
BIND(C, NAME='papyruskv_signal_notify')
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: SIGNUM
TYPE(C_PTR), VALUE, INTENT(IN) :: RANKS
INTEGER(C_INT), DIMENSION(*), INTENT(IN) :: RANKS
INTEGER(C_INT), VALUE, INTENT(IN) :: COUNT
END FUNCTION PAPYRUSKV_SIGNAL_NOTIFY_CBIND
......@@ -107,7 +107,7 @@ MODULE PAPYRUS
BIND(C, NAME='papyruskv_signal_wait')
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: SIGNUM
TYPE(C_PTR), VALUE, INTENT(IN) :: RANKS
INTEGER(C_INT), DIMENSION(*), INTENT(IN) :: RANKS
INTEGER(C_INT), VALUE, INTENT(IN) :: COUNT
END FUNCTION PAPYRUSKV_SIGNAL_WAIT_CBIND
......@@ -136,15 +136,15 @@ MODULE PAPYRUS
BIND(C, NAME='papyruskv_checkpoint')
USE, INTRINSIC :: ISO_C_BINDING
INTEGER(C_INT), VALUE, INTENT(IN) :: DB
TYPE(C_PTR), VALUE, INTENT(IN) :: PATH
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: PATH
INTEGER(C_INT), INTENT(OUT) :: EVENT
END FUNCTION PAPYRUSKV_CHECKPOINT_CBIND
INTEGER(C_INT) FUNCTION PAPYRUSKV_RESTART_CBIND(PATH, NAME, FLAGS, OPT, DB, EVENT) &
BIND(C, NAME='papyruskv_restart')
USE, INTRINSIC :: ISO_C_BINDING
TYPE(C_PTR), VALUE, INTENT(IN) :: PATH
TYPE(C_PTR), VALUE, INTENT(IN) :: NAME
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: PATH
CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: NAME
INTEGER(C_INT), VALUE, INTENT(IN) :: FLAGS
TYPE(C_PTR), VALUE, INTENT(IN) :: OPT
INTEGER(C_INT), INTENT(OUT) :: DB
......@@ -165,9 +165,7 @@ MODULE PAPYRUS
SUBROUTINE PAPYRUSKV_INIT(REPOSITORY, IERROR)
CHARACTER, DIMENSION(*), INTENT(IN) :: REPOSITORY
INTEGER, INTENT(OUT) :: IERROR
TYPE(C_PTR) :: REPOSITORY_CPTR
REPOSITORY_CPTR = C_LOC(REPOSITORY)
IERROR = PAPYRUSKV_INIT_CBIND(0, C_NULL_PTR, REPOSITORY_CPTR)
IERROR = PAPYRUSKV_INIT_CBIND(0, C_NULL_PTR, REPOSITORY)
END SUBROUTINE PAPYRUSKV_INIT
SUBROUTINE PAPYRUSKV_FINALIZE(IERROR)
......@@ -180,9 +178,7 @@ MODULE PAPYRUS
INTEGER, INTENT(IN) :: FLAGS
INTEGER, INTENT(OUT) :: DB
INTEGER, INTENT(OUT) :: IERROR
TYPE(C_PTR) :: NAME_C_PTR
NAME_C_PTR = C_LOC(NAME)
IERROR = PAPYRUSKV_OPEN_CBIND(NAME_C_PTR, FLAGS, C_NULL_PTR, DB)
IERROR = PAPYRUSKV_OPEN_CBIND(NAME, FLAGS, C_NULL_PTR, DB)
END SUBROUTINE PAPYRUSKV_OPEN
SUBROUTINE PAPYRUSKV_CLOSE(DB, IERROR)
......@@ -198,7 +194,7 @@ MODULE PAPYRUS
CHARACTER, DIMENSION(*), INTENT(IN) :: VAL
INTEGER(KIND=8), INTENT(IN) :: VALLEN
INTEGER, INTENT(OUT) :: IERROR
IERROR = PAPYRUSKV_PUT_CBIND(DB, C_LOC(KEY), KEYLEN, C_LOC(VAL), VALLEN)
IERROR = PAPYRUSKV_PUT_CBIND(DB, KEY, KEYLEN, VAL, VALLEN)
END SUBROUTINE PAPYRUSKV_PUT
SUBROUTINE PAPYRUSKV_GET(DB, KEY, KEYLEN, VAL, VALLEN, IERROR)
......@@ -217,7 +213,7 @@ MODULE PAPYRUS
VAL_CPTR = C_NULL_PTR
VAL_NULL_PTR = .TRUE.
END IF
IERROR = PAPYRUSKV_GET_CBIND(DB, C_LOC(KEY), KEYLEN, VAL_CPTR, VALLEN)
IERROR = PAPYRUSKV_GET_CBIND(DB, KEY, KEYLEN, VAL_CPTR, VALLEN)
IF (VAL_NULL_PTR) THEN
CALL C_F_POINTER(VAL_CPTR, VAL, [VALLEN])
END IF
......@@ -228,14 +224,15 @@ MODULE PAPYRUS
CHARACTER, DIMENSION(*), INTENT(IN) :: KEY
INTEGER(KIND=8), INTENT(IN) :: KEYLEN
INTEGER, INTENT(OUT) :: IERROR
IERROR = PAPYRUSKV_DELETE_CBIND(DB, C_LOC(KEY), KEYLEN)
IERROR = PAPYRUSKV_DELETE_CBIND(DB, KEY, KEYLEN)
END SUBROUTINE PAPYRUSKV_DELETE
SUBROUTINE PAPYRUSKV_FREE(VAL, IERROR)
CHARACTER, POINTER, INTENT(INOUT) :: VAL(:)
INTEGER, INTENT(OUT) :: IERROR
TYPE(C_PTR) :: VAL_CPTR
IERROR = PAPYRUSKV_FREE_CBIND(C_LOC(VAL))
VAL_CPTR = C_LOC(VAL)
IERROR = PAPYRUSKV_FREE_CBIND(VAL_CPTR)
NULLIFY(VAL)
END SUBROUTINE PAPYRUSKV_FREE
......@@ -258,7 +255,7 @@ MODULE PAPYRUS
INTEGER, DIMENSION(*), INTENT(IN) :: RANKS
INTEGER, INTENT(IN) :: COUNT
INTEGER, INTENT(OUT) :: IERROR
IERROR = PAPYRUSKV_SIGNAL_NOTIFY_CBIND(SIGNUM, C_LOC(RANKS), COUNT)
IERROR = PAPYRUSKV_SIGNAL_NOTIFY_CBIND(SIGNUM, RANKS, COUNT)
END SUBROUTINE PAPYRUSKV_SIGNAL_NOTIFY
SUBROUTINE PAPYRUSKV_SIGNAL_WAIT(SIGNUM, RANKS, COUNT, IERROR)
......@@ -266,7 +263,7 @@ MODULE PAPYRUS
INTEGER, DIMENSION(*), INTENT(IN) :: RANKS
INTEGER, INTENT(IN) :: COUNT
INTEGER, INTENT(OUT) :: IERROR
IERROR = PAPYRUSKV_SIGNAL_WAIT_CBIND(SIGNUM, C_LOC(RANKS), COUNT)
IERROR = PAPYRUSKV_SIGNAL_WAIT_CBIND(SIGNUM, RANKS, COUNT)
END SUBROUTINE PAPYRUSKV_SIGNAL_WAIT
SUBROUTINE PAPYRUSKV_CONSISTENCY(DB, CONSISTENCY, IERROR)
......@@ -295,7 +292,7 @@ MODULE PAPYRUS
CHARACTER, DIMENSION(*), INTENT(IN) :: PATH
INTEGER, INTENT(OUT) :: EVENT
INTEGER, INTENT(OUT) :: IERROR
IERROR = PAPYRUSKV_CHECKPOINT_CBIND(DB, C_LOC(PATH), EVENT)
IERROR = PAPYRUSKV_CHECKPOINT_CBIND(DB, PATH, EVENT)
END SUBROUTINE PAPYRUSKV_CHECKPOINT
SUBROUTINE PAPYRUSKV_RESTART(PATH, NAME, FLAGS, DB, EVENT, IERROR)
......@@ -305,7 +302,7 @@ MODULE PAPYRUS
INTEGER, INTENT(OUT) :: DB
INTEGER, INTENT(OUT) :: EVENT
INTEGER, INTENT(OUT) :: IERROR
IERROR = PAPYRUSKV_RESTART_CBIND(C_LOC(PATH), C_LOC(NAME), FLAGS, C_NULL_PTR, DB, EVENT)
IERROR = PAPYRUSKV_RESTART_CBIND(PATH, NAME, FLAGS, C_NULL_PTR, DB, EVENT)
END SUBROUTINE PAPYRUSKV_RESTART
SUBROUTINE PAPYRUSKV_WAIT(DB, EVENT, IERROR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment