anchor.diff:  end;
   
   
  +{ TContext }
  +
  +function TContext.Get(Key: string): Variant;
  +begin
  +  Result := FUserData[Key];
  +end;
  +
  +procedure TContext.Put(Key: string; const Value: Variant);
  +begin
  +  FUserData[Key] := Value;
  +end;
  +
  +constructor TContext.Create(AUserData: IMap);
  +begin
  +  FUserData := TCaseInsensitiveHashMap.Create(16, 0.75, False);
  +  if AUserData <> nil then FUserData.PutAll(AUserData);
  +end;
  +
  +{ TFilterList }
  +
  +constructor TFilterList.Create();
  +begin
  +  inherited Create;
  +  FFilters := THashedList.Create();
  +end;
  +
  +function TFilterList.Get(Index: Integer): IFilter;
  +var
  +  F: Variant;
  +begin
  +  Result := nil;
  +  F := FFilters[Index];
  +  if (not VarIsNull(F)) and (not VarIsEmpty(F)) then
  +    VarToIntf(F, IFilter, Result);
  +end;
  +
  +procedure TFilterList.Put(Index: Integer; const Value: IFilter);
  +begin
  +  FFilters[Index] := Value;
  +end;
  +
  +function TFilterList.GetCount: Integer;
  +begin
  +  Result := FFilters.Count;
  +end;
  +
  +function TFilterList.Add(const Filter: IFilter): TFilterList;
  +begin
  +  FFilters.Add(Filter);
  +  Result := Self;
  +end;
  +
  +function TFilterList.Remove(const Filter: IFilter): TFilterList;
  +begin
  +  FFilters.Remove(Filter);
  +  Result := Self;
  +end;
  +
  +function TFilterList.InputFilter(const Data: TBytes; const Context: TContext
  +  ): TBytes;
  +var
  +  I: Integer;
  +  AFilter: IFilter;
  +begin
  +  Result := Data;
  +  for I := FFilters.Count - 1 downto 0 do begin
  +    VarToIntf(FFilters[I], IFilter, AFilter);
  +    Result := AFilter.InputFilter(Result, Context);
  +  end;
  +end;
  +
  +function TFilterList.OutputFilter(const Data: TBytes; const Context: TContext
  +  ): TBytes;
  +var
  +  I: Integer;
  +  AFilter: IFilter;
  +begin
  +  Result := Data;
  +  for I := 0 to FFilters.Count - 1 do begin
  +    VarToIntf(FFilters[I], IFilter, AFilter);
  +    Result := AFilter.OutputFilter(Result, Context);
  +  end;
  +end;
  +
  +{$IFDEF SUPPORTS_ANONYMOUS_METHOD}
  +{ THandlerManager }
  +
  +procedure THandlerManager.AddAfterFilterHandler(const Handler: TFilterHandler);
  +var
  +  Next: TNextFilterHandler;
  +  I: Integer;
  +begin
  +  FAfterFilterHandlers.Add(Handler);
  +  Next := FDefaultAfterFilterHandler;
  +  for I := FAfterFilterHandlers.Count - 1 downto 0 do
  +    Next := GetNextFilterHandler(Next, FAfterFilterHandlers[I]);
  +  FAfterFilterHandler := Next;
  +end;
  +
  +procedure THandlerManager.AddBeforeFilterHandler(const Handler: TFilterHandler);
  +var
  +  Next: TNextFilterHandler;
  +  I: Integer;
  +begin
  +  FBeforeFilterHandlers.Add(Handler);
  +  Next := FDefaultBeforeFilterHandler;
  +  for I := FBeforeFilterHandlers.Count - 1 downto 0 do
  +    Next := GetNextFilterHandler(Next, FBeforeFilterHandlers[I]);
  +  FBeforeFilterHandler := Next;
  +end;
  +
  +procedure THandlerManager.AddInvokeHandler(const Handler: TInvokeHandler);
  +var
  +  Next: TNextInvokeHandler;
  +  I: Integer;
  +begin
  +  FInvokeHandlers.Add(Handler);
  +  Next := FDefaultInvokeHandler;
  +  for I := FInvokeHandlers.Count - 1 downto 0 do
  +    Next := GetNextInvokeHandler(Next, FInvokeHandlers[I]);
  +  FInvokeHandler := Next;
  +end;
  +
  +constructor THandlerManager.Create;
  +begin
  +  inherited Create;
  +  FInvokeHandlers := TList<TInvokeHandler>.Create();
  +  FBeforeFilterHandlers := TList<TFilterHandler>.Create();
  +  FAfterFilterHandlers := TList<TFilterHandler>.Create();
  +end;
  +
  +destructor THandlerManager.Destroy;
  +begin
  +  FreeAndNil(FInvokeHandlers);
  +  FreeAndNil(FBeforeFilterHandlers);
  +  FreeAndNil(FAfterFilterHandlers);
  +  inherited Destroy;
  +end;
  +
  +function THandlerManager.GetNextFilterHandler(const Next: TNextFilterHandler;
  +  const Handler: TFilterHandler): TNextFilterHandler;
  +begin
  +  Result := function(const Request: TBytes; const Context: TContext): TBytes
  +  begin
  +    Result := Handler(Request, Context, Next)
  +  end;
  +end;
  +
  +function THandlerManager.GetNextInvokeHandler(const Next: TNextInvokeHandler;
  +  const Handler: TInvokeHandler): TNextInvokeHandler;
  +begin
  +  Result := function(const Name: String;
  +                    var Args: TVariants;
  +                    const Context: TContext): Variant
  +  begin
  +    Result := Handler(Name, Args, Context, Next)
  +  end;
  +end;
  +{$ENDIF}
  +
   initialization
     HproseClassMap := TCaseInsensitiveHashedMap.Create(False, True);
     HproseInterfaceMap := TCaseInsensitiveHashedMap.Create(False, True);
  
positive.code: 
  {$IFNDEF DELPHIXE3_UP}
  function BytesOf(const Val: Pointer; const Len: integer): TBytes; overload;
  {$ENDIF}
  
  implementation
  
negative.code:  *                                                        *
   * hprose common unit for delphi.                         *
   *                                                        *
   * LastModified: Nov 7, 2016                              *
   * Author: Ma Bingyao <andot@hprose.com>                  *
   *                                                        *
  \**********************************************************/
  