anchor.diff:        erlang:raise(Class,Reason,StackTrace)
     end.
   
  -postcondition_int(_State,Call,Result) ->
  -  case Call of
  -    {_, _, follow_link, _, _} ->
  -      case validate_call_not_error_result(Call,Result) of
  -	true ->
  -	  case http_result_code(Result) of
  -	    200 ->
  -	      validate_call_result_body(Call,Result);
  -	    Other ->
  -	      io:format
  -		("~n*** Error: postcondition error: for http call~n~s~nhttp responded with result code ~p, expected result code 200~n",
  -		 [format_http_call(Call),Other]),
  -	      false
  -	  end;
  -	_ ->
  -	  io:format("validation failed~n"),
  +postcondition_int(_State,Args,Result) ->
  +  case validate_call_not_error_result(Args,Result) of
  +    true ->
  +      case http_result_code(Result) of
  +	200 ->
  +	  validate_call_result_body(Args,Result);
  +	Other ->
  +	  io:format
  +	    ("~n*** Error: postcondition error: for http call~n~s~nhttp responded with result code ~p, expected result code 200~n",
  +	     [format_http_call(Args),Other]),
   	  false
         end;
       _ ->
  -      true
  -  end.
  -
  -validate_call_not_error_result(Call,Result) ->
  -  case Call of
  -    {_, _, follow_link, _, _} ->
  -      case http_result_type(Result) of
  -	ok ->
  -	  true;
  -	{error,_Error} ->
  -	  io:format
  -	    ("~n*** Error: postcondition error: for http call~n~s~nhttp responded with error ~p~n",
  -	     [format_http_call(Call),http_error(Result)]),
  -	  false
  -      end;
  -    _ -> true
  -  end.
  -
  -validate_call_result_body(Call,Result) ->
  -  case Call of
  -    {_, _, follow_link, _, _} ->
  -      Link = jsg_links:link_def(call_link(Call)),
  -      Schema = jsg_links:link_schema(call_link(Call)),
  -      case jsg_jsonschema:propertyValue(Link,"targetSchema") of
  -	undefined ->
  -	  true;
  -	TargetSchema ->
  -	  RealTargetSchema = jsg_links:get_schema(TargetSchema,Schema),
  -	  case response_has_json_body(Result) of
  -	    false ->
  -	      false;
  -	    true ->
  -	      Body = http_body(Result),
  -	      %%io:format
  -		%%("Checking schema ~p~nagainst~n~s~n",
  -		 %%[RealTargetSchema,
  -		  %%Body]),
  -	      Validator = get_option(validator),
  -	      try Validator:validate(RealTargetSchema,Body)
  -	      catch _Class:Reason ->
  -		  io:format
  -		    ("~n*** Error: postcondition error: for http call~n~s~n"++
  -		       "the JSON value~n~s~n"++
  -		       "did not validate against the schema~n~s~n"++
  -		       "due to error~n~p~n",
  -		     [format_http_call(Call),
  -		      Body,
  -		      mochijson2:encode(RealTargetSchema),
  -		      Reason]),
  -		  io:format
  -		    ("Stacktrace:~n~p~n",
  -		     [erlang:get_stacktrace()]),
  -		  false
  -	      end
  +      io:format("validation failed~n"),
  +      false
  +  end.
  +
  +validate_call_not_error_result(Args,Result) ->
  +  case http_result_type(Result) of
  +    ok ->
  +      true;
  +    {error,_Error} ->
  +      io:format
  +	("~n*** Error: postcondition error: for http call~n~s~nhttp responded with error ~p~n",
  +	 [format_http_call(Args),http_error(Result)]),
  +      false
  +  end.
  +
  +validate_call_result_body(Args,Result) ->
  +  Link = jsg_links:link_def(call_link(Args)),
  +  Schema = jsg_links:link_schema(call_link(Args)),
  +  case jsg_jsonschema:propertyValue(Link,"targetSchema") of
  +    undefined ->
  +      true;
  +    TargetSchema ->
  +      RealTargetSchema = jsg_links:get_schema(TargetSchema,Schema),
  +      case response_has_json_body(Result) of
  +	false ->
  +	  false;
  +	true ->
  +	  Body = http_body(Result),
  +	  Validator = get_option(validator),
  +	  try Validator:validate(RealTargetSchema,Body)
  +	  catch _Class:Reason ->
  +	      io:format
  +		("~n*** Error: postcondition error: for http call~n~s~n"++
  +		   "the JSON value~n~s~n"++
  +		   "did not validate against the schema~n~s~n"++
  +		   "due to error~n~p~n",
  +		 [format_http_call(Args),
  +		  Body,
  +		  mochijson2:encode(RealTargetSchema),
  +		  Reason]),
  +	      io:format
  +		("Stacktrace:~n~p~n",
  +		 [erlang:get_stacktrace()]),
  +	      false
   	  end
  -      end;
  -    _ -> true
  -  end.
  -
  -next_state(State,Result,Call) ->
  -  try
  -    case Call of
  -      {_, _, follow_link, _, _} ->
  -	make_call(next_state,fun next_state_int/3,[State,Result,Call]);
  -      _ ->
  -	next_state_int(State,Result,Call)
  -    end
  +      end
  +  end.
  +
  +link_next(State,Result,Args) ->
  +  try make_call(next_state,fun next_state_int/3,[State,Result,Args])
     catch Class:Reason ->
         io:format
   	("Warning: next_state/3 raises exception ~p~n",
  
positive.code:   true = ets:match_delete(jsg_store,{{reverse_link,'_'},'_'}),
    httpc:reset_cookies().
  
  callouts(_,_) ->
    ?EMPTY.
  
  modify_link(State,Link,Result) ->
    make_call(modify_link,fun modify_link_int/3,[State,Link,Result]).
  
  modify_link_int(_State,_Link,Result) ->
    Result.
  
  link_permitted(State,Link) ->
    make_call(link_permitted,fun link_permitted_int/2,[State,Link]).
  
negative.code:       Result
    end.
  
  format_http_call([_,{URI,RequestType,Body,Params}]) ->
    format_http_call(URI,RequestType,Body,Params).
  
  format_http_call(PreURI,RequestType,Body,Params) ->
    BodyString =
  