1 | #include "xios_fortran_prefix.hpp" |
---|
2 | |
---|
3 | MODULE ICONTEXT |
---|
4 | USE, INTRINSIC :: ISO_C_BINDING |
---|
5 | USE CONTEXT_INTERFACE |
---|
6 | USE IDATE |
---|
7 | USE IDURATION |
---|
8 | ! USE icontext_attr |
---|
9 | |
---|
10 | |
---|
11 | TYPE txios(context) |
---|
12 | INTEGER(kind = C_INTPTR_T) :: daddr |
---|
13 | END TYPE txios(context) |
---|
14 | |
---|
15 | INTERFACE xios(set_current_context) |
---|
16 | MODULE PROCEDURE xios(set_current_context_hdl), xios(set_current_context_id) |
---|
17 | END INTERFACE xios(set_current_context) |
---|
18 | |
---|
19 | CONTAINS ! Fonctions disponibles pour les utilisateurs. |
---|
20 | |
---|
21 | SUBROUTINE xios(get_context_handle)(idt,ret) |
---|
22 | IMPLICIT NONE |
---|
23 | CHARACTER(len = *) , INTENT(IN) :: idt |
---|
24 | TYPE(txios(context)), INTENT(OUT):: ret |
---|
25 | |
---|
26 | CALL cxios_context_handle_create(ret%daddr, idt, len(idt)) |
---|
27 | END SUBROUTINE xios(get_context_handle) |
---|
28 | |
---|
29 | SUBROUTINE xios(get_current_context)(context) |
---|
30 | IMPLICIT NONE |
---|
31 | |
---|
32 | TYPE(txios(context)), INTENT(IN) :: context |
---|
33 | |
---|
34 | CALL cxios_context_get_current(context%daddr) |
---|
35 | |
---|
36 | END SUBROUTINE xios(get_current_context) |
---|
37 | |
---|
38 | SUBROUTINE xios(set_current_context_hdl)(context, withswap) |
---|
39 | IMPLICIT NONE |
---|
40 | |
---|
41 | TYPE(txios(context)) , INTENT(IN) :: context |
---|
42 | LOGICAL , OPTIONAL, INTENT(IN) :: withswap |
---|
43 | LOGICAL (kind = 1) :: wswap |
---|
44 | |
---|
45 | IF (PRESENT(withswap)) THEN |
---|
46 | wswap = withswap |
---|
47 | ELSE |
---|
48 | wswap = .FALSE. |
---|
49 | END IF |
---|
50 | CALL cxios_context_set_current(context%daddr, wswap) |
---|
51 | |
---|
52 | END SUBROUTINE xios(set_current_context_hdl) |
---|
53 | |
---|
54 | SUBROUTINE xios(set_current_context_id)(idt) |
---|
55 | IMPLICIT NONE |
---|
56 | |
---|
57 | CHARACTER(len = *) , INTENT(IN) :: idt |
---|
58 | LOGICAL :: withswap |
---|
59 | TYPE(xios_context):: ret |
---|
60 | |
---|
61 | CALL xios(get_context_handle)(idt,ret) |
---|
62 | CALL xios(set_current_context_hdl)(ret, withswap) |
---|
63 | END SUBROUTINE xios(set_current_context_id) |
---|
64 | |
---|
65 | LOGICAL FUNCTION xios(is_valid_context)(idt) |
---|
66 | IMPLICIT NONE |
---|
67 | CHARACTER(len = *) , INTENT(IN) :: idt |
---|
68 | LOGICAL (kind = 1) :: val |
---|
69 | |
---|
70 | CALL cxios_context_valid_id(val, idt, len(idt)); |
---|
71 | xios(is_valid_context) = val |
---|
72 | |
---|
73 | END FUNCTION xios(is_valid_context) |
---|
74 | |
---|
75 | |
---|
76 | END MODULE ICONTEXT |
---|