process this part through all the workflows.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(part), | intent(in) | :: | p |
function process(p) result(accepted) !! process this part through all the workflows. type(part),intent(in) :: p logical :: accepted integer :: i, irule i = workflow_name_to_index('in') ! start at the first workflow irule = 1 ! first rule do associate( r => workflows(i)%rules(irule) ) ! check if we are done if (r%accept) then; accepted = .true.; return; end if if (r%reject) then; accepted = .false.;return; end if if (r%operator>0) then ! process the operator select case (r%operator) case(1) ! < if (p%xmas(r%operator_arg) < r%operator_val) then ! check if done if (r%goto=='A') then; accepted = .true.; return; end if if (r%goto=='R') then; accepted = .false.; return; end if ! go to next workflow: i = workflow_name_to_index(r%goto) !write(*,*) 'goto '//r%goto irule = 1 ! start at first rule of new workflow else irule = irule + 1 ! next rule end if case(2) ! > if (p%xmas(r%operator_arg) > r%operator_val) then ! check if done if (r%goto=='A') then; accepted = .true.; return; end if if (r%goto=='R') then; accepted = .false.; return; end if ! go to next workflow: i = workflow_name_to_index(r%goto) irule = 1 ! start at first rule of new workflow else irule = irule + 1 ! next rule end if end select else ! goto another workflow i = workflow_name_to_index(r%goto) irule = 1 ! start at first rule of new workflow end if end associate end do end function process