This file is indexed.

/usr/include/polymake/perl/calls.h is in polymake 3.0r1-4.

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
/* Copyright (c) 1997-2015
   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());

SV* get_custom_var(const char* name, size_t ll, const char* key, size_t kl);

template <size_t ll>
PropertyValue get_custom(const char (&name)[ll]);
PropertyValue get_custom(const std::string& name);
template <size_t ll>
PropertyValue get_custom(const char (&name)[ll], const std::string& key);
PropertyValue get_custom(const std::string& name, const std::string& key);

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);

   template <size_t ll> friend
   PropertyValue get_custom(const char (&name)[ll]);
   friend
   PropertyValue get_custom(const std::string& name);
   template <size_t ll> friend
   PropertyValue get_custom(const char (&name)[ll], const std::string& key);
   friend
   PropertyValue get_custom(const std::string& name, const std::string& key);

   PropertyValue() {}
   explicit PropertyValue(SV* sv_arg, value_flags opt_arg=value_flags(0)) :
      Value(sv_arg, opt_arg) {}

   // inhibited
   void operator= (const PropertyValue&);

   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::NoAnchor* Value::put(const PropertyValue& x, const char*, int)
{
   set_copy(x);
   return NULL;
}

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);
}

class ListResult : protected Array {
   friend class FunCall;  friend class Object;
protected:
   ListResult(int items, const FunCall&);
public:
   template <typename Target>
   ListResult& operator>> (Target& x)
   {
      if (size() == 0)
         throw std::runtime_error("no more values in the result list");
      Value v(shift(), value_flags(value_allow_undef | value_not_trusted));
      v >> x;
      v.forget();
      return *this;
   }

   using Array::size;
   using Array::operator[];
   using Array::begin;
   using Array::end;
};

class TempOptionsPendingVal;

class TempOptions : protected HashHolder {
   friend class FunCall;  friend class Object;
protected:
   Value val;
public:
   TempOptions() : val(NULL) {};

   // const return types prevent an odd option list from being consumed by FunCall

   const TempOptionsPendingVal& operator, (const std::string& key);

   template <size_t ll>
   const TempOptionsPendingVal& operator, (const char (&key)[ll]);
};

class TempOptionsPendingVal : public TempOptions {
protected:
   TempOptionsPendingVal();
   ~TempOptionsPendingVal();
public:
   template <typename T>
   TempOptions& operator, (const T& x) const
   {
      val << x;
      return const_cast<TempOptionsPendingVal&>(*this);
   }
};

inline
const TempOptionsPendingVal& TempOptions::operator, (const std::string& key)
{
   val=_access(key.c_str(), key.size(), true);
   return static_cast<const TempOptionsPendingVal&>(*this);
}

template <size_t ll> inline
const TempOptionsPendingVal& TempOptions::operator, (const char (&key)[ll])
{
   val=_access(key, ll-1, true);
   return static_cast<const TempOptionsPendingVal&>(*this);
}

class FunCall : protected Stack {
   friend class Object;  friend class ListResult;
protected:
   mutable SV* func;
   void prepare_function_call(const char* name, size_t nl);

   SV* call() const;
   int list_call() const;
   SV* evaluate_method(SV* obj, const char* name) const;
   int list_evaluate_method(SV* obj, const char* name) const;
   void void_evaluate_method(SV* obj, const char* name) const;
   void push_arg_list(SV* args) const;
private:
   // inhibited
   void operator= (const FunCall&);
public:
   // prepare method call
   FunCall();
   
   explicit FunCall(const std::string& name) : Stack(false,1)
   {
      prepare_function_call(name.c_str(), name.size());
   }

   template <size_t nl>
   explicit FunCall(const char (&name)[nl]) : Stack(false,1)
   {
      prepare_function_call(name, nl-1);
   }

   ~FunCall()
   {
      if (__builtin_expect(func != NULL, 0)) cancel();
   }

   // gathering arguments
   template <typename Arg>
   const FunCall& operator, (const Arg& arg) const
   {
      Value v(value_allow_non_persistent);
      v << arg;
      push(v.get_temp());
      return *this;
   }

   const FunCall& operator, (ArgList& args) const
   {
      push_arg_list(args.get_temp());
      return *this;
   }

   const FunCall& operator, (TempOptions& args) const
   {
      push(args.get_temp());
      return *this;
   }

   PropertyValue evaluate() const
   {
      return PropertyValue(call(), value_flags(value_allow_undef | value_not_trusted));
   }

   ListResult list_evaluate() const
   {
      return ListResult(list_call(), *this);
   }

   void void_evaluate() const;
};


template <size_t ll> inline
PropertyValue get_custom(const char (&name)[ll])
{
   return PropertyValue(get_custom_var(name, ll-1, NULL, 0), value_allow_undef);
}
inline
PropertyValue get_custom(const std::string& name)
{
   return PropertyValue(get_custom_var(name.c_str(), name.size(), NULL, 0), value_allow_undef);
}
template <size_t ll> inline
PropertyValue get_custom(const char (&name)[ll], const std::string& key)
{
   return PropertyValue(get_custom_var(name, ll-1, key.c_str(), key.size()), value_allow_undef);
}
inline
PropertyValue get_custom(const std::string& name, const std::string& key)
{
   return PropertyValue(get_custom_var(name.c_str(), name.size(), key.c_str(), key.size()), value_allow_undef);
}

int get_debug_level();

} }

#endif // POLYMAKE_PERL_CALLS_H

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