anchor.diff:      io:format("using port driver~n", []),
       {ok, Path} = load_path(Name ++ ".so"),
       Result = case erl_ddll:load_driver(Path, Name) of
  -        ok -> ok;
  -        {error, already_loaded} -> ok;
  -        % {open_error, -10}, otherwise known as "Unknown dlload error",
  -        % could mean any of the following:
  -        % - driver does not exist in the path specified
  -        % - driver can not be read
  -        % - driver does not have all the required symbols
  -        % etc.
  -        {error, ErrorDesc} -> {error, erl_ddll:format_error(ErrorDesc)}
  +        ok ->
  +            ok;
  +        {error, already_loaded} ->
  +            ok;
  +        {error, ErrorDesc} ->
  +            {error, erl_ddll:format_error(ErrorDesc)}
       end,
  -    case Result of
  -        ok ->
  -            case erlang:open_port({spawn, Name}, []) of
  -                P when is_port(P) ->
  -                    {ok, P};
  -                Error ->
  -                    {error, Error}
  -            end;
  -        {error, Reason} ->
  -            {error, Reason}
  +    if
  +        Result =:= ok ->
  +            {ok, erlang:open_port({spawn, Name}, [])};
  +        true ->
  +            Result
       end.
   transform_data(D) ->
       D.
   %% only a port driver can perform asynchronous function calls
   %% (you might be able to put a thread pool in an Erlang port, but why bother?)
  -call_port_async(Process, Command, Msg)
  -    when is_integer(Command), is_list(Msg) ->
  -    gen_server:cast(Process, {call, Command, Msg}).
  +call_port_async(Process, Command, Message)
  +    when is_integer(Command), is_list(Message) ->
  +    gen_server:cast(Process, {call, Command, Message}).
   -else.
   -ifdef(ERL_PORT_NAME).
   local_port_name() ->
  
positive.code:     Name = local_port_name(),
      case load_local_port(Name) of
          {ok, Port} when is_port(Port) ->
              {ok, #state{last_port_name = Name,
                          port = Port}};
          {error, Reason} ->
              {stop, Reason}
      end.
  
  %% handle synchronous function calls on the port/port_driver
  handle_call({call, Command, Msg}, Client,
              #state{port = Port,
                     replies = Replies} = State)
      when is_port(Port), is_list(Msg) ->
      case call_port(Port, Msg) of
          ok ->
              {noreply, State#state{replies = Replies ++ [{Command, Client}]}};
          {error, _} = Error ->
  
negative.code: erroneous_call(Process) ->
      call_port_sync(Process, 32767, [<<32767:16/unsigned-integer-native>>]).
  
  port_exit_to_string(eacces) ->
      "permission denied";
  port_exit_to_string(eagain) ->
      "resource temporarily unavailable";
  port_exit_to_string(ebadf) ->
      "bad file number";
  port_exit_to_string(ebusy) ->
      "file busy";
  port_exit_to_string(edquot) ->
      "disk quota exceeded";
  port_exit_to_string(eexist) ->
      "file already exists";
  port_exit_to_string(efault) ->
      "bad address in system call argument";
  port_exit_to_string(efbig) ->
      "file too large";
  port_exit_to_string(eintr) ->
      "interrupted system call";
  port_exit_to_string(einval) ->
      "invalid argument";
  port_exit_to_string(eio) ->
      "IO error";
  port_exit_to_string(eisdir) ->
      "illegal operation on a directory";
  port_exit_to_string(eloop) ->
      "too many levels of symbolic links";
  port_exit_to_string(emfile) ->
      "too many open files";
  port_exit_to_string(emlink) ->
      "too many links";
  port_exit_to_string(enametoolong) ->
      "file name too long";
  port_exit_to_string(enfile) ->
      "file table overflow";
  port_exit_to_string(enodev) ->
      "no such device";
  port_exit_to_string(enoent) ->
      "no such file or directory";
  port_exit_to_string(enomem) ->
      "not enough memory";
  port_exit_to_string(enospc) ->
      "no space left on device";
  port_exit_to_string(enotblk) ->
      "block device required";
  port_exit_to_string(enotdir) ->
      "not a directory";
  port_exit_to_string(enotsup) ->
      "operation not supported";
  port_exit_to_string(enxio) ->
      "no such device or address";
  port_exit_to_string(eperm) ->
      "not owner";
  port_exit_to_string(epipe) ->
      "broken pipe";
  port_exit_to_string(erofs) ->
      "read-only file system";
  port_exit_to_string(espipe) ->
      "invalid seek";
  port_exit_to_string(esrch) ->
      "no such process";
  port_exit_to_string(estale) ->
      "stale remote file handle";
  port_exit_to_string(exdev) ->
      "cross-domain link";
  port_exit_to_string(Other) when is_atom(Other) ->
      erlang:atom_to_list(Other).
  
  %% exit status messages
  
  exit_status_to_string(  0) -> "no error occurred";
  %% GEPD exit status values (from InternalExitStatus in port.cpp)
  %% exit_status >= GEPD::ExitStatus::errors_min (from port.hpp)
  %% (GEPD::ExitStatus::errors_min == 80)
  exit_status_to_string( 80) -> "erlang exited";
  exit_status_to_string( 81) -> "erlang port read EAGAIN";
  exit_status_to_string( 82) -> "erlang port read EBADF";
  exit_status_to_string( 83) -> "erlang port read EFAULT";
  exit_status_to_string( 84) -> "erlang port read EINTR";
  exit_status_to_string( 85) -> "erlang port read EINVAL";
  exit_status_to_string( 86) -> "erlang port read EIO";
  exit_status_to_string( 87) -> "erlang port read EISDIR";
  exit_status_to_string( 88) -> "erlang port read null";
  exit_status_to_string( 89) -> "erlang port read overflow";
  exit_status_to_string( 90) -> "erlang port read unknown";
  exit_status_to_string( 91) -> "erlang port write EAGAIN";
  exit_status_to_string( 92) -> "erlang port write EBADF";
  exit_status_to_string( 93) -> "erlang port write EFAULT";
  exit_status_to_string( 94) -> "erlang port write EFBIG";
  exit_status_to_string( 95) -> "erlang port write EINTR";
  exit_status_to_string( 96) -> "erlang port write EINVAL";
  exit_status_to_string( 97) -> "erlang port write EIO";
  exit_status_to_string( 98) -> "erlang port write ENOSPC";
  exit_status_to_string( 99) -> "erlang port write EPIPE";
  exit_status_to_string(100) -> "erlang port write null";
  exit_status_to_string(101) -> "erlang port write overflow";
  exit_status_to_string(102) -> "erlang port write unknown";
  exit_status_to_string(103) -> "erlang port ei_encode_error";
  exit_status_to_string(104) -> "erlang port poll EBADF";
  exit_status_to_string(105) -> "erlang port poll EFAULT";
  exit_status_to_string(106) -> "erlang port poll EINTR";
  exit_status_to_string(107) -> "erlang port poll EINVAL";
  exit_status_to_string(108) -> "erlang port poll ENOMEM";
  exit_status_to_string(109) -> "erlang port poll ERR";
  exit_status_to_string(110) -> "erlang port poll HUP";
  exit_status_to_string(111) -> "erlang port poll NVAL";
  exit_status_to_string(112) -> "erlang port poll unknown";
  exit_status_to_string(113) -> "erlang port pipe EFAULT";
  exit_status_to_string(114) -> "erlang port pipe EINVAL";
  exit_status_to_string(115) -> "erlang port pipe EMFILE";
  exit_status_to_string(116) -> "erlang port pipe ENFILE";
  exit_status_to_string(117) -> "erlang port pipe unknown";
  exit_status_to_string(118) -> "erlang port dup EBADF";
  exit_status_to_string(119) -> "erlang port dup EBUSY";
  exit_status_to_string(120) -> "erlang port dup EINTR";
  exit_status_to_string(121) -> "erlang port dup EINVAL";
  exit_status_to_string(122) -> "erlang port dup EMFILE";
  exit_status_to_string(123) -> "erlang port dup unknown";
  exit_status_to_string(124) -> "erlang port close EBADF";
  exit_status_to_string(125) -> "erlang port close EINTR";
  exit_status_to_string(126) -> "erlang port close EIO";
  exit_status_to_string(127) -> "erlang port close unknown";
  exit_status_to_string(Status) when is_integer(Status) ->
      if
          Status > 128 ->
              %% exit status values due to signals
              signal_to_string(Status - 128);
          true ->
              erlang:integer_to_list(Status)
      end.
  
  % Only signal integers that are consistent among all platforms use a
  % specific string.
  signal_to_string( 1) -> "SIGHUP";
  signal_to_string( 2) -> "SIGINT";
  signal_to_string( 3) -> "SIGQUIT";
  signal_to_string( 4) -> "SIGILL";
  signal_to_string( 5) -> "SIGTRAP";
  signal_to_string( 6) -> "SIGABRT";
  signal_to_string( 8) -> "SIGFPE";
  signal_to_string( 9) -> "SIGKILL";
  signal_to_string(11) -> "SIGSEGV";
  signal_to_string(13) -> "SIGPIPE";
  signal_to_string(14) -> "SIGALRM";
  signal_to_string(15) -> "SIGTERM";
  signal_to_string(Signal) when is_integer(Signal), Signal > 0 ->
      "SIG#" ++ erlang:integer_to_list(Signal).
  
  