Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function order #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions dom/m_dom_dom.F90
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,18 @@ function getnodeName(np, ex)result(c)
end function getnodeName


pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

pure function getNodeValue_len(np, p) result(n)
type(Node), intent(in) :: np
logical, intent(in) :: p
Expand Down Expand Up @@ -4053,18 +4065,6 @@ subroutine updateTextContentLength(np, n)
endif
end subroutine updateTextContentLength

pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

function getTextContent(arg, ex)result(c)
type(DOMException), intent(out), optional :: ex
type(Node), pointer :: arg
Expand Down Expand Up @@ -5847,6 +5847,7 @@ subroutine destroyDocument(arg, ex)

! Switch off all GC - since this is GC!
call setGCstate(arg, .false., ex)

if (arg%nodeType/=DOCUMENT_NODE) then
if (getFoX_checks().or.FoX_INVALID_NODE<200) then
call throw_exception(FoX_INVALID_NODE, "destroyDocument", ex)
Expand Down
3 changes: 2 additions & 1 deletion dom/m_dom_element.m4
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ TOHW_m_dom_get(DOMString, tagName, np%nodeName, (ELEMENT_NODE))
endif
endif

! FIXME what if namespace is undeclared? Throw an error *only* if FoX_errors is on, otherwise its taken care of by namespace fixup on serialization
! FIXME what if namespace is undeclared? Throw an error *only* if FoX_errors is
! on, otherwise its taken care of by namespace fixup on serialization

quickFix = getGCstate(getOwnerDocument(arg)) &
.and. arg%inDocument
Expand Down
24 changes: 12 additions & 12 deletions dom/m_dom_node.m4
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ TOHW_m_dom_contents(`

TOHW_m_dom_get(DOMString, nodeName, np%nodeName)

pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

pure function getNodeValue_len(np, p) result(n)
type(Node), intent(in) :: np
logical, intent(in) :: p
Expand Down Expand Up @@ -1332,18 +1344,6 @@ TOHW_m_dom_treewalk(`
endif
end subroutine updateTextContentLength

pure function getTextContent_len(arg, p) result(n)
type(Node), intent(in) :: arg
logical, intent(in) :: p
integer :: n

if (p) then
n = arg%textContentLength
else
n = 0
endif
end function getTextContent_len

TOHW_function(getTextContent, (arg), c)
type(Node), pointer :: arg
#ifdef RESTRICTED_ASSOCIATED_BUG
Expand Down
6 changes: 3 additions & 3 deletions dom/m_dom_types.m4
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ TOHW_m_dom_contents(`

select case(np%nodeType)
case (ELEMENT_NODE, ATTRIBUTE_NODE, XPATH_NAMESPACE_NODE)
call destroyElementOrAttribute(np,ex)
call destroyElementOrAttribute(np, ex)
case (DOCUMENT_TYPE_NODE)
call destroyDocumentType(np,ex)
call destroyDocumentType(np, ex)
case (ENTITY_NODE, NOTATION_NODE)
call destroyEntityOrNotation(np,ex)
call destroyEntityOrNotation(np, ex)
case (DOCUMENT_NODE)
call destroyDocument(np,ex)
end select
Expand Down
47 changes: 24 additions & 23 deletions fsys/fox_m_fsys_format.F90
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,30 @@ module fox_m_fsys_format
contains

#ifndef DUMMYLIB
! NB: we need checkFmt at the top of the file
! to work around a bug in some Gfortran versions
! see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85138
pure function checkFmt(fmt) result(good)
character(len=*), intent(in) :: fmt
logical :: good

! should be ([rs]\d*)?

if (len(fmt) > 0) then
if (fmt(1:1) == "r" .or. fmt(1:1) == "s") then
if (len(fmt) > 1) then
good = (verify(fmt(2:), digit) == 0)
else
good = .true.
endif
else
good = .false.
endif
else
good = .true.
endif
end function checkFmt

! NB: The len generic module procedure is used in
! many initialisation statments (to set the
! length of the output string needed for the
Expand Down Expand Up @@ -2216,29 +2240,6 @@ pure function str_complex_dp_matrix(ca) result(s)
#endif
end function str_complex_dp_matrix

#ifndef DUMMYLIB
pure function checkFmt(fmt) result(good)
character(len=*), intent(in) :: fmt
logical :: good

! should be ([rs]\d*)?

if (len(fmt) > 0) then
if (fmt(1:1) == "r" .or. fmt(1:1) == "s") then
if (len(fmt) > 1) then
good = (verify(fmt(2:), digit) == 0)
else
good = .true.
endif
else
good = .false.
endif
else
good = .true.
endif
end function checkFmt
#endif

pure function concat_str_int(s1, s2) result(s3)
character(len=*), intent(in) :: s1
integer, intent(in) :: s2
Expand Down