Fix a variety of bugs in vpi_handle_by_name.
Fix a variety of bugs in vpi_handle_by_name.

This function was apparently not well tested, because any use of
acc_handle_object() triggered a use of vpi_handle_by_name that was
buggy.

The implementation was awkwardly written, to parts of it were redone.

themperek/iverilog,themperek/iverilog,CastMi/iverilog,CastMi/iverilog,themperek/iverilog,CastMi/iverilog