This file is indexed.

/usr/include/osl/effect_util/effectUtil.tcc is in libosl-dev 0.4.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef _EFFECTUTIL_TCC
#define _EFFECTUTIL_TCC

#include "osl/effect_util/effectUtil.h"
#include "osl/effect_action/storePiece.h"
#include "osl/move_classifier/kingOpenMove.h"
#include "osl/container/pieceVector.h"
#include <boost/static_assert.hpp>

namespace osl
{
  namespace effect_util
  {
    template <osl::Player P, bool InterestEmpty, Direction Dir>
    struct TestEffectOfMove
    {
      template <class State, class Function>
      static void testShort(const State& s, int mask, Square from, 
			    Function& f)
      {
	BOOST_STATIC_ASSERT(! DirectionTraits<Dir>::isLong);
	if (! (mask & DirectionTraits<Dir>::mask))
	  return;

	const Offset offset = DirectionPlayerTraits<Dir,P>::offset();
	const Square target = from+offset;
	const Piece piece = s.pieceAt(target);
	if (piece.isEdge())
	  return;
	if (InterestEmpty || (! piece.isEmpty()))
	  f(target);
      }
      template <class State, class Function>
      static void testLong(const State& s, int mask, Square from, 
			    Function& f)
      {
	BOOST_STATIC_ASSERT(DirectionTraits<Dir>::isLong);
	if (! (mask & DirectionTraits<Dir>::mask))
	  return;

	const Offset offset = DirectionPlayerTraits<Dir,P>::offset();

	Square target = from+offset;
	Piece piece = s.pieceAt(target);
	while (piece.isEmpty())
	{
	  if (InterestEmpty)
	    f(target);		
	  target = target+offset;
	  piece = s.pieceAt(target);
	}
	if (piece.isPiece())
	{
	  f(target);
	}
      }
    };
  } // namespace effect_util
} // namespace osl

template <osl::Player P, class Function, bool InterestEmpty>
void osl::effect_util::EffectUtil::
forEachEffectOfPtypeO(const NumEffectState& state, Square from, Ptype ptype,
		      Function& f)
{
  const int mask = Ptype_Table.getMoveMask(ptype);
  TestEffectOfMove<P,InterestEmpty,UL>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,U>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,UR>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,L>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,R>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,DL>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,D>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,DR>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,UUL>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,UUR>::testShort(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_UL>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_U>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_UR>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_L>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_R>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_DL>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_D>::testLong(state, mask, from, f);
  TestEffectOfMove<P,InterestEmpty,LONG_DR>::testLong(state, mask, from, f);
}

template <class Function, bool InterestEmpty>
void osl::effect_util::EffectUtil::
forEachEffectOfPtypeO(const NumEffectState& state, Square from, PtypeO ptypeo,
		      Function& f)
{
  const Player P = getOwner(ptypeo);
  if (P == BLACK)
    forEachEffectOfPtypeO<BLACK,Function,InterestEmpty>
      (state, from, getPtype(ptypeo), f);
  else
    forEachEffectOfPtypeO<WHITE,Function,InterestEmpty>
      (state, from, getPtype(ptypeo), f);
}

struct osl::effect_util::EffectUtil::SafeCapture
{
public:
  const NumEffectState& state;
  Piece safe_one;
  SafeCapture(const NumEffectState& s) : state(s), safe_one(Piece::EMPTY())
  {
  }
  template <Player P>
  void doAction(Piece effect_piece, Square target)
  {
    if (move_classifier::KingOpenMove<P>::isMember
	(state, effect_piece.ptype(), effect_piece.square(), target))
      return;
    safe_one = effect_piece;
  }
};

template <osl::Player P>
osl::Piece
osl::effect_util::EffectUtil::safeCaptureNotByKing(const NumEffectState& state, Square target,
						   Piece king)
{
  assert(king.owner() == P);
  assert(king.ptype() == KING);
  PieceMask ignore = state.pin(P);
  ignore.set(king.number());
  const Piece piece = state.findAttackNotBy(P, target, ignore);
  if (piece.isPiece())
    return piece;
  SafeCapture safe_captures(state);
  state.template forEachEffectNotBy<P>(target, king, safe_captures);
  
  return safe_captures.safe_one;
}

#endif /* _EFFECTUTIL_TCC */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: