49 public::
operator(.onthesamefile.)
75 interface operator(.onthesamefile.)
92 character,
public,
parameter::
gt_plus =
"+" 128 character(len = STRING):: result
129 character(len = *),
intent(in):: file
130 character(len = *),
intent(in):: var
143 character(len = STRING):: result
144 character(len = *),
intent(in):: file
145 character(len = *),
intent(in):: var
146 character(len = *),
intent(in):: attr
147 character(len = *),
intent(in):: iorange(:)
155 if (var /=
"") result = trim(result) // var
157 result = trim(result) //
gt_colon // attr
159 do i = 1,
size(iorange)
160 if (iorange(i) /=
"")
then 161 if (iorange(i)(1:1) ==
gt_comma)
then 162 result = trim(result) // trim(iorange(i))
164 result = trim(result) //
gt_comma // trim(iorange(i))
176 character(len = STRING):: result
177 character(len = *),
intent(in):: file
178 character(len = *),
intent(in):: var
179 character(len = *),
intent(in):: attr
180 character(len = *),
intent(in):: iorange
182 if (trim(file) /=
"")
then 187 if (trim(var) /=
"") result = trim(result) // var
188 if (trim(attr) /=
"")
then 189 result = trim(result) //
gt_colon // attr
191 if (trim(iorange) /=
"")
then 193 result = trim(result) // iorange
195 result = trim(result) //
gt_comma // iorange
206 character(len = *),
intent(in):: fullname
207 character(len = *),
intent(out):: iorange
208 character(len = *),
intent(out):: remainder
209 character(STRING):: file, var, attr
210 call urlsplit(fullname, file=file, var=var, attr=attr, iorange=iorange)
211 remainder =
url_merge_cccc(file=file, var=var, attr=attr, iorange=
"")
226 character(len = *),
intent(in):: fullname
227 character(len = *),
intent(in):: dimvar
228 character(len = STRING):: result
229 character(STRING):: file, var, attr, iorange
230 character(STRING),
pointer :: ioranges_slice(:) => null()
231 integer :: i, eqpos, atmark
236 if (atmark == 0) atmark = index(fullname,
gt_atmark)
237 if (atmark /= 0)
then 238 call urlsplit(fullname, file=file, var=var, attr=attr, iorange=iorange)
243 do i = 1,
size(ioranges_slice)
244 eqpos = index(ioranges_slice(i),
gt_equal)
245 if (ioranges_slice(i)(1:eqpos-1) == trim(dimvar))
then 246 result = trim(ioranges_slice(i)(eqpos+1:))
250 deallocate(ioranges_slice)
253 subroutine url_split_c(fullname, file, var, attr, iorange)
260 character(len = *),
intent(in):: fullname
261 character(len = *),
intent(out),
optional:: file, var, attr, iorange
262 character(len = STRING):: varpart
263 integer:: atmark, colon, comma
264 character(len = *),
parameter:: VARNAME_SET &
265 =
"0123456789eEdD+-=^,.:_" &
266 //
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" &
267 //
"abcdefghijklmnopqrstuvwxyz" 274 if (atmark == 0)
then 275 atmark = index(fullname,
gt_atmark, back=.true.)
276 if (atmark /= 0)
then 277 if (verify(trim(fullname(atmark+1: )), varname_set) /= 0)
then 282 if (atmark == 0)
then 284 if (
present(file)) file = fullname
285 if (
present(var)) var =
'' 286 if (
present(attr)) attr =
'' 287 if (
present(iorange)) iorange =
'' 290 varpart = fullname(atmark+1: )
292 if (
present(file)) file = fullname(1: atmark - 1)
297 if (
present(var)) var = varpart(1: comma - 1)
298 if (
present(attr)) attr =
'' 299 if (
present(iorange)) iorange = varpart(comma + 1: )
302 if (
present(iorange)) iorange =
'' 306 if (
present(var)) var = varpart
307 if (
present(attr)) attr =
'' 311 if (
present(var)) var = varpart(1: colon - 1)
312 if (
present(attr)) attr = varpart(colon + 1: )
391 character(len = *),
intent(in) :: url_a
392 character(len = *),
intent(in) :: url_b
393 character(len = STRING) :: filepart_a
394 character(len = STRING) :: filepart_b
395 call urlsplit(url_a, file=filepart_a)
396 call urlsplit(url_b, file=filepart_b)
397 result = (filepart_a == filepart_b)
414 character(len = *),
intent(in):: relative
415 character(len = *),
intent(in):: base
416 character(len = STRING):: result
417 integer,
parameter:: FILE = 1, var = 2, attr = 3, ior = 4
418 character(len = STRING):: rel(file:ior), bas(file:ior)
419 character(3),
parameter:: PATHDELIM =
"/:" // achar(94)
420 integer:: idir_r, idir_b
422 call beginsub(
'urlresolve',
'rel=<%c> base=<%c>', c1=relative, c2=base)
423 call urlsplit(trim(relative), file=rel(file), var=rel(var), &
424 & attr=rel(attr), iorange=rel(ior))
425 call dbgmessage(
'rel -> file=<%c> var=<%c> attr=<%c>', &
426 & c1=trim(rel(file)), c2=trim(rel(var)), &
427 & c3=(trim(rel(attr)) //
'> ior=<' // trim(rel(ior))))
428 call urlsplit(base, file=bas(file), var=bas(var), &
429 & attr=bas(attr), iorange=bas(ior))
430 call dbgmessage(
'base -> file=<%s> var=<%s> attr=<%s> ior=<%s>', &
431 & c1=trim(bas(file)), c2=trim(bas(var)), &
432 & c3=(trim(bas(attr)) //
'> ior=<' // trim(bas(ior))))
434 if (rel(file) ==
"")
then 435 rel(file) = bas(file)
436 if (rel(var) ==
"") &
437 & rel(var) = bas(var)
438 result =
urlmerge(file=rel(file), var=rel(var), &
439 & attr=rel(attr), iorange=rel(ior))
440 call endsub(
'urlresolve',
'1 result=%c', c1=trim(result))
444 if (
strhead(rel(file),
"file:") &
445 & .OR.
strhead(rel(file),
"http:") &
446 & .OR.
strhead(rel(file),
"ftp:") &
447 & .OR.
strhead(rel(file),
"news:") &
448 & .OR.
strhead(rel(file),
"www") &
449 & .OR.
strhead(rel(file),
"/") &
450 & .OR.
strhead(rel(file), achar(94)) &
451 & .OR. rel(file)(2:2) ==
":" &
454 call endsub(
'urlresolve',
'2 result=%c', c1=trim(result))
458 idir_b = scan(bas(file), pathdelim, back=.true.)
459 if (idir_b == 0)
then 463 call endsub(
'urlresolve',
'3 result=%c', c1=trim(result))
467 idir_r = scan(rel(file), pathdelim, back=.true.)
468 if (idir_r == 0)
then 472 result = base(1: idir_b) // relative(idir_r: )
473 call endsub(
'urlresolve',
'4 result=%c', c1=trim(result))
character, parameter, public gt_comma
logical function urlonthesamefile(url_a, url_b)
character, parameter, public gt_equal
character, parameter, public gt_plus
character(len=string) function url_resolve_c(relative, base)
character(len=string) function url_merge_cc(file, var)
character(len=string) function url_merge_cccc(file, var, attr, iorange)
character, parameter, public gt_atmark
character(len=string) function url_merge_cccca(file, var, attr, iorange)
subroutine url_split_c(fullname, file, var, attr, iorange)
subroutine, public url_chop_iorange(fullname, iorange, remainder)
subroutine, public dbgmessage(fmt, i, r, d, L, n, c1, c2, c3, ca)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
character, parameter, public gt_circumflex
character, parameter, public gt_colon
character, parameter, public gt_question
character(len=string) function url_search_iorange(fullname, dimvar)
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ