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 | INTERFACE xios(get_current_context) |
---|
20 | MODULE PROCEDURE xios(get_current_context_hdl), xios(get_current_context_id) |
---|
21 | END INTERFACE xios(get_current_context) |
---|
22 | |
---|
23 | CONTAINS ! Fonctions disponibles pour les utilisateurs. |
---|
24 | |
---|
25 | SUBROUTINE xios(get_context_handle)(idt,ret) |
---|
26 | IMPLICIT NONE |
---|
27 | CHARACTER(len = *) , INTENT(IN) :: idt |
---|
28 | TYPE(txios(context)), INTENT(OUT):: ret |
---|
29 | |
---|
30 | CALL cxios_context_handle_create(ret%daddr, idt, len(idt)) |
---|
31 | END SUBROUTINE xios(get_context_handle) |
---|
32 | |
---|
33 | SUBROUTINE xios(get_current_context_hdl)(context) |
---|
34 | IMPLICIT NONE |
---|
35 | |
---|
36 | TYPE(txios(context)), INTENT(OUT) :: context |
---|
37 | |
---|
38 | CALL cxios_context_get_current(context%daddr) |
---|
39 | |
---|
40 | END SUBROUTINE xios(get_current_context_hdl) |
---|
41 | |
---|
42 | SUBROUTINE xios(get_current_context_id)(idt) |
---|
43 | IMPLICIT NONE |
---|
44 | CHARACTER(len = *) , INTENT(OUT) :: idt |
---|
45 | TYPE(txios(context)) :: context |
---|
46 | |
---|
47 | CALL cxios_context_get_current(context%daddr) |
---|
48 | CALL cxios_context_get_id(context%daddr, idt, len(idt)) |
---|
49 | |
---|
50 | END SUBROUTINE xios(get_current_context_id) |
---|
51 | |
---|
52 | SUBROUTINE xios(set_current_context_hdl)(context, withswap) |
---|
53 | IMPLICIT NONE |
---|
54 | |
---|
55 | TYPE(txios(context)) , INTENT(IN) :: context |
---|
56 | LOGICAL , OPTIONAL, INTENT(IN) :: withswap |
---|
57 | LOGICAL (kind = 1) :: wswap |
---|
58 | |
---|
59 | IF (PRESENT(withswap)) THEN |
---|
60 | wswap = withswap |
---|
61 | ELSE |
---|
62 | wswap = .FALSE. |
---|
63 | END IF |
---|
64 | CALL cxios_context_set_current(context%daddr, wswap) |
---|
65 | |
---|
66 | END SUBROUTINE xios(set_current_context_hdl) |
---|
67 | |
---|
68 | SUBROUTINE xios(set_current_context_id)(idt) |
---|
69 | IMPLICIT NONE |
---|
70 | |
---|
71 | CHARACTER(len = *) , INTENT(IN) :: idt |
---|
72 | LOGICAL :: withswap |
---|
73 | TYPE(xios_context):: ret |
---|
74 | |
---|
75 | CALL xios(get_context_handle)(idt,ret) |
---|
76 | CALL xios(set_current_context_hdl)(ret, withswap) |
---|
77 | END SUBROUTINE xios(set_current_context_id) |
---|
78 | |
---|
79 | LOGICAL FUNCTION xios(is_valid_context)(idt) |
---|
80 | IMPLICIT NONE |
---|
81 | CHARACTER(len = *) , INTENT(IN) :: idt |
---|
82 | LOGICAL (kind = 1) :: val |
---|
83 | |
---|
84 | CALL cxios_context_valid_id(val, idt, len(idt)); |
---|
85 | xios(is_valid_context) = val |
---|
86 | |
---|
87 | END FUNCTION xios(is_valid_context) |
---|
88 | |
---|
89 | |
---|
90 | END MODULE ICONTEXT |
---|