program fort_test use uap_fortran implicit none type (uap_node_struct) f_root, f_root2 type (c_dummy_struct) c_root ! call uap_allocate_node(f_root, 3, 2, "root") f_root%attributes(0) = uap_attribute_struct("a1", "v1") f_root%attributes(1) = uap_attribute_struct("a2", "v2") f_root%attributes(2) = uap_attribute_struct("a3", "v3") call uap_allocate_node(f_root%children(0), 0, 1, "c1") call uap_allocate_node(f_root%children(1), 1, 0, "c2") call uap_allocate_node (f_root%children(0)%children(0), 0, 0, "c11") f_root%children(1)%attributes(0) = uap_attribute_struct("a21", "v21") ! call fortran_convert (f_root, c_root) ! C++ routine call uap_node_tree_to_f (c_root, f_root2) call uap_node_compare (f_root, f_root2) !------------------------------------------------------------------ contains recursive subroutine uap_node_compare (node1, node2) implicit none type (uap_node_struct) node1, node2 integer i ! ! attributes if (node1%name /= node2%name) then print *, "ERROR: NODE NAMES DO NOT MATCH: " print *, " ", '"', trim(node1%name), '"' print *, " ", '"', trim(node2%name), '"' endif if (size(node1%attributes) /= size(node2%attributes)) then print *, "ERROR: ATTRIBUTE SIZE DOES NOT MATCH:", & size(node1%attributes), size(node2%attributes) endif do i = lbound(node1%attributes, 1) , ubound(node1%attributes, 1) if (node1%attributes(i)%name /= node2%attributes(i)%name) then print *, "ERROR: ATTRIBUTE NAME DOES NOT MATCH:", i print *, " ", '"', trim(node1%attributes(i)%name), '"' print *, " ", '"', trim(node2%attributes(i)%name), '"' endif if (node1%attributes(i)%value /= node2%attributes(i)%value) then print *, "ERROR: ATTRIBUTE VALUE DOES NOT MATCH:", i print *, " ", '"', trim(node1%attributes(i)%value), '"' print *, " ", '"', trim(node2%attributes(i)%value), '"' endif enddo ! children if (size(node1%children) /= size(node2%children)) then print *, "ERROR: CHILD SIZE DOES NOT MATCH:", & size(node1%children), size(node2%children) endif do i = lbound(node1%children, 1), ubound(node1%children, 1) call uap_node_compare (node1%children(i), node2%children(i)) enddo end subroutine end program