This file is indexed.

/usr/include/polymake/perl/calls.h is in libpolymake-dev-common 3.2r2-3.

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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/* Copyright (c) 1997-2018
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
   http://www.polymake.org

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
--------------------------------------------------------------------------------
*/

#ifndef POLYMAKE_PERL_CALLS_H
#define POLYMAKE_PERL_CALLS_H

namespace pm { namespace perl {

class PropertyValue;
PropertyValue load_data(const std::string& filename);

template <typename T> inline
void save_data(const std::string& filename, const T& data, const std::string& description=std::string());

PropertyValue get_custom(const AnyString& name, const AnyString& key=AnyString());

class FunCall;

class PropertyValue : public Value {
   friend class Object;   friend class ObjectType;
   friend class FunCall;

   friend PropertyValue load_data(const std::string& filename);

   template <typename T> friend
   void save_data(const std::string& filename, const T& data, const std::string& description);

   friend
   PropertyValue get_custom(const AnyString& name, const AnyString& key);

   PropertyValue() {}

   template <typename... TOptions>
   explicit PropertyValue(SV* sv_arg, TOptions... options)
      : Value(sv_arg)
   {
      set_options(options...);
   }

   void set_options() {}

   template <typename... TMoreOptions>
   void set_options(value_flags flag, TMoreOptions... more_options)
   {
      options |= flag;
      set_options(more_options...);
   }

   template <typename... TMoreOptions>
   void set_options(allow_conversion, TMoreOptions... more_options)
   {
      options |= value_allow_conversion;
      set_options(more_options...);
   }

   void operator= (const PropertyValue&) = delete;

   static SV* _load_data(const std::string& filename);
   void _save_data(const std::string&, const std::string&);
public:
   PropertyValue(const PropertyValue& x);
   ~PropertyValue();
};

inline
Value::NoAnchors Value::put_val(const PropertyValue& x, int, int)
{
   set_copy(x);
   return NoAnchors();
}

inline
PropertyValue load_data(const std::string& filename)
{
   return PropertyValue(PropertyValue::_load_data(filename));
}

template <typename T> inline
void save_data(const std::string& filename, const T& data, const std::string& description)
{
   PropertyValue v;
   v << data;
   v._save_data(filename, description);
}

template <typename TContainerRef>
struct Unrolled {
   explicit Unrolled(TContainerRef c)
      : container(c) {}

   TContainerRef container;
};

template <typename TContainer>
inline
Unrolled<TContainer&&> unroll(TContainer&& c)
{
   return Unrolled<TContainer&&>(std::forward<TContainer>(c));
}

class ListResult
   : protected Array {
public:
   ListResult(ListResult&&) = default;
   ListResult& operator= (ListResult&&) = default;

   template <typename Target>
   ListResult& operator>> (Target& x)
   {
      if (!empty()) {
         Value v(shift(), value_allow_undef | value_not_trusted);
         v >> x;
         v.forget();
      }
      return *this;
   }

   template <typename TContainerRef>
   void operator>> (Unrolled<TContainerRef>&& c)
   {
      Value v(sv, value_not_trusted);
      v.retrieve_nomagic(c.container);
      forget();
      sv=nullptr;
   }

   void operator>> (Unrolled<Array&>&& c)
   {
      c.container=static_cast<Array&&>(*this);
   }

protected:
   ListResult(int items, FunCall& fc);

   friend class Object;
   friend class FunCall;

private:
   ListResult(const ListResult&) = delete;
   void operator=(const ListResult&) = delete;
};

class FunCall
   : protected Stack {
   void operator= (const FunCall&) = delete;
   FunCall(const FunCall&) = delete;   
public:
   FunCall(FunCall&&) = default;
   ~FunCall();

   template <typename... TArgs>
   static
   FunCall call_function(const AnyString& name, TArgs&&... args)
   {
      FunCall fc(false, name, count_args(std::forward<TArgs>(args)...));
      fc.push_args(std::forward<TArgs>(args)...);
      return fc;
   }

   template <typename... TArgs>
   static
   FunCall call_method(const AnyString& name, SV* obj_ref, TArgs&&... args)
   {
      FunCall fc(true, name, 1+count_args(std::forward<TArgs>(args)...));
      fc.push(obj_ref);
      fc.push_args(std::forward<TArgs>(args)...);
      return fc;
   }

   // single consumer: call in a scalar context
   template <typename Target,
             typename=typename std::enable_if<Concrete<Target>::value>::type>
   operator Target ()
   {
      return PropertyValue(call_scalar_context(), value_not_trusted);
   }

   operator ListResult ()
   {
      return ListResult(call_list_context(), *this);
   }

   template <typename Target>
   ListResult operator>> (Target&& x)
   {
      return std::move(ListResult(call_list_context(), *this) >> std::forward<Target>(x));
   }

protected:
   FunCall(bool is_method, const AnyString& name, int reserve);

   template <typename... TArgs>
   static
   typename std::enable_if<!mlist_or<is_instance_of<pure_type_t<TArgs>, Unrolled>...>::value, int>::type
   count_args(TArgs&&... args) { return sizeof...(TArgs); }

   template <typename TContainer, typename... MoreArgs>
   static
   int count_args(Unrolled<TContainer>&& c, MoreArgs&&... more_args)
   {
      return c.container.size()+count_args(std::forward<MoreArgs>(more_args)...);
   }

   template <typename FirstArg, typename... MoreArgs>
   static
   typename std::enable_if<!is_instance_of<FirstArg, Unrolled>::value && mlist_or<is_instance_of<pure_type_t<MoreArgs>, Unrolled>...>::value, int>::type
   count_args(FirstArg&& first_arg, MoreArgs&&... more_args)
   {
      return 1+count_args(std::forward<MoreArgs>(more_args)...);
   }

   void push_args() {}

   template <typename FirstArg, typename... MoreArgs>
   void push_args(FirstArg&& first_arg, MoreArgs&&... more_args)
   {
      push_arg(std::forward<FirstArg>(first_arg));
      push_args(std::forward<MoreArgs>(more_args)...);
   }

   template <typename TArg>
   typename std::enable_if<!is_instance_of<pure_type_t<TArg>, Unrolled>::value &&
                           !std::is_same<pure_type_t<TArg>, OptionSet>::value>::type
   push_arg(TArg&& arg)
   {
      Value v(value_allow_non_persistent | value_allow_store_any_ref);
      v.put(std::forward<TArg>(arg), 0);
      push_temp(v);
   }

   template <typename TContainerRef>
   void push_arg(Unrolled<TContainerRef>&& c)
   {
      for (auto it=entire(c.container); !it.at_end(); ++it) {
         Value v(value_allow_non_persistent | value_allow_store_any_ref);
         v.put(*it, 0);
         push_temp(v);
      }
   }

   void push_arg(FunCall&& x);

   void push_arg(const OptionSet& options)
   {
      push(options.get());
   }

   void push_arg(SV* sv)
   {
      push(sv);
   }

   SV* call_scalar_context();
   int call_list_context();

   SV* func;
   const char* method_name;

   friend class ListResult;
};

int get_debug_level();

} }

namespace polymake {

template <typename... Args>
pm::perl::FunCall call_function(const AnyString& name, Args&&... args)
{
   return pm::perl::FunCall::call_function(name, std::forward<Args>(args)...);
}

template <typename... Args>
[[deprecated("CallPolymakeFunction macros are deprecated, please use call_function() instead")]]
pm::perl::FunCall call_function_deprecated(const AnyString& name, Args&&... args)
{
   return pm::perl::FunCall::call_function(name, std::forward<Args>(args)...);
}

namespace perl {
using pm::perl::unroll;
}

}

#endif // POLYMAKE_PERL_CALLS_H

// Local Variables:
// mode:C++
// c-basic-offset:3
// indent-tabs-mode:nil
// End: