Lifted locally-defined functions out of 'pp_print_term' and into a new, internal PP_print_module; small modifications were necessary for some functions, e.g., to add an explicit argument for values which were previously captured from the local scope.