/
m_wxml_overloads.m4
187 lines (173 loc) · 5.24 KB
/
m_wxml_overloads.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
dnl
include(`foreach.m4')dnl
dnl
include(`datatypes.m4')dnl
dnl
dnl Note that, irritatingly, we have to exclude the possibility of
dnl a scalar character subroutine in order to not overlap with the
dnl basic one to which we are calling through.
dnl
define(`TOHWM4_subroutinename', `dnl
ifelse(`$2$3', `ScalarCh', `', `dnl
module procedure $1$2$3')`'dnl
')`'dnl
dnl
dnl First arg is name of quantity (Character, Attribute, PseudoAttribute)
dnl Second arg is whether this is scalar, array, or matrix.
dnl Third arg is type of property(character/logical etc.)
dnl
define(`TOHWM4_CharacterSub',`dnl
ifelse(`$2$3', `ScalarCh', `', `dnl
subroutine $1$2$3 &
(xf, chars`'dnl
ifelse(substr($3,0,4),`Real',`, fmt', substr($3,0,5), `Cmplx', `, fmt', `$2$3', `ScalarCh', `', `$3', `Ch', `, delimiter'))
type(xmlf_t), intent(inout) :: xf
TOHWM4_declarationtype(`$3'), intent(in) dnl
ifelse(`$2', `Array', `, dimension(:)', `$2', `Matrix',`, dimension(:,:)') dnl
:: chars
dnl
ifelse(substr($3,0,4), `Real', `dnl
character(len=*), intent(in), optional :: fmt
', substr($3,0,5), `Cmplx', `dnl
character(len=*), intent(in), optional :: fmt
', `$2$3', `ScalarCh', `', `$3', `Ch', `dnl
character(len=1), intent(in), optional :: delimiter
')dnl
#ifndef DUMMYLIB
ifelse(substr($3,0,4), `Real', `dnl
if (present(fmt)) then
call xml_Add$1(xf=xf, chars=str(chars, fmt)`'dnl
ifelse(`$2', `Array', `, ws_significant=.false.')`'dnl
ifelse(`$2', `Matrix', `, ws_significant=.false.'))
else
', substr($3,0,5), `Cmplx', `dnl
if (present(fmt)) then
call xml_Add$1(xf=xf, chars=str(chars, fmt)`'dnl
ifelse(`$2', `Array', `, ws_significant=.false.')`'dnl
ifelse(`$2', `Matrix', `, ws_significant=.false.'))
else
')dnl
call xml_Add$1(xf=xf, chars=str(chars`'dnl
ifelse(`$2$3', `ScalarCh', `', `$3', `Ch', `, delimiter'))`'dnl
ifelse(`$2', `Array', `, ws_significant=.false.')`'dnl
ifelse(`$2', `Matrix', `, ws_significant=.false.')`'dnl
)
dnl
ifelse(substr($3,0,4), `Real', `dnl
endif
', substr($3,0,5), `Cmplx', `dnl
endif
')`'dnl
#endif
end subroutine $1$2$3
')
')dnl
dnl
dnl
define(`TOHWM4_AttributeSub',`dnl
ifelse(`$2$3', `ScalarCh', `', `dnl
subroutine $1$2$3 &
(xf, name, value`'dnl
ifelse(substr($3,0,4),`Real',`, fmt', substr($3,0,5), `Cmplx', `, fmt', `$2$3', `ScalarCh', `', `$3', `Ch', `, delimiter'))
type(xmlf_t), intent(inout) :: xf
character(len=*), intent(in) :: name
TOHWM4_declarationtype(`$3'), intent(in) dnl
ifelse(`$2', `Array', `, dimension(:)', `$2', `Matrix',`, dimension(:,:)') dnl
:: value
dnl
ifelse(substr($3,0,4), `Real', `dnl
character(len=*), intent(in), optional :: fmt
', substr($3,0,5), `Cmplx',`dnl
character(len=*), intent(in), optional :: fmt
', `$2$3', `ScalarCh', `', `$3', `Ch', `dnl
character(len=1), intent(in), optional :: delimiter
')
dnl
#ifndef DUMMYLIB
ifelse(substr($3,0,4),`Real',`dnl
if (present(fmt)) then
call xml_Add$1(xf=xf, name=name, value=str(value, fmt)`'dnl
ifelse(`$2', `Array', `, ws_significant=.false.')`'dnl
ifelse(`$2', `Matrix', `, ws_significant=.false.'))
else
', substr($3,0,5), `Cmplx', `dnl
if (present(fmt)) then
call xml_Add$1(xf=xf, name=name, value=str(value, fmt)`'dnl
ifelse(`$2', `Array', `, ws_significant=.false.')`'dnl
ifelse(`$2', `Matrix', `, ws_significant=.false.'))
else
')dnl
call xml_Add$1(xf=xf, name=name, value=str(value`'dnl
ifelse(`$2$3', `ScalarCh', `', `$3', `Ch', `, delimiter'))`'dnl
ifelse(`$2', `Array', `, ws_significant=.false.')`'dnl
ifelse(`$2', `Matrix', `, ws_significant=.false.'))
dnl
ifelse(substr($3,0,4), `Real', `dnl
endif
', substr($3,0,5), `Cmplx', `dnl
endif
')`'dnl
dnl
#endif
end subroutine $1$2$3
')dnl
')dnl
dnl
dnl
dnl
! This file is AUTOGENERATED!!!!
! Do not edit this file; edit m_wxml_overloads.m4 and regenerate.
!
!
module m_wxml_overloads
#ifndef DUMMYLIB
use fox_m_fsys_format, only: str
#endif
use fox_m_fsys_realtypes, only: sp, dp
use m_wxml_core, only: xmlf_t
use m_wxml_core, only: xml_AddCharacters
use m_wxml_core, only: xml_AddAttribute
use m_wxml_core, only: xml_AddPseudoAttribute
implicit none
private
interface xml_AddCharacters
m4_foreach(`type', `(Scalar, Array, Matrix)', `dnl
m4_foreach(`x', TOHWM4_types, `dnl
TOHWM4_subroutinename(`Characters', type, x)
')dnl
')dnl
end interface
interface xml_AddAttribute
m4_foreach(`type', `(Scalar, Array, Matrix)', `dnl
m4_foreach(`x', TOHWM4_types, `dnl
TOHWM4_subroutinename(`Attribute', type, x)
')dnl
')dnl
end interface
interface xml_AddPseudoAttribute
m4_foreach(`type', `(Scalar, Array, Matrix)', `dnl
m4_foreach(`x', TOHWM4_types, `dnl
TOHWM4_subroutinename(`PseudoAttribute', type, x)
')dnl
')dnl
end interface
public :: xml_AddCharacters
public :: xml_AddAttribute
public :: xml_AddPseudoAttribute
contains
m4_foreach(`ArrayType', `(Scalar, Array, Matrix)', `dnl
m4_foreach(`x', TOHWM4_types, `dnl
TOHWM4_CharacterSub(`Characters', ArrayType, x)
')dnl
')dnl
m4_foreach(`ArrayType', `(Scalar, Array, Matrix)', `dnl
m4_foreach(`x', TOHWM4_types, `dnl
TOHWM4_AttributeSub(`Attribute', ArrayType, x)
')dnl
')dnl
m4_foreach(`ArrayType', `(Scalar, Array, Matrix)', `dnl
m4_foreach(`x', TOHWM4_types, `dnl
TOHWM4_AttributeSub(`PseudoAttribute', ArrayType, x)
')dnl
')dnl
end module m_wxml_overloads