This file is indexed.

/usr/include/octave-4.2.2/octave/oct-shlib.h is in liboctave-dev 4.2.2-1ubuntu1.

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
/*

Copyright (C) 1999-2017 John W. Eaton
Copyright (C) 2009 VZLU Prague

This file is part of Octave.

Octave 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 3 of the License, or (at your
option) any later version.

Octave 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.

You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING.  If not, see
<http://www.gnu.org/licenses/>.

*/

#if ! defined (octave_oct_shlib_h)
#define octave_oct_shlib_h 1

#include "octave-config.h"

#include <string>
#include <map>

#include "oct-time.h"
#include "oct-refcount.h"

namespace octave
{
  class
  OCTAVE_API
  dynamic_library
  {
  public: // FIXME: make this class private?

    typedef std::string (*name_mangler) (const std::string&);
    typedef void (*close_hook) (const std::string&);

    class dynlib_rep
    {
    public:

      dynlib_rep (void)
        : count (1), file (), tm_loaded (time_t ()), fcn_names () { }

    protected:

      dynlib_rep (const std::string& f);

    public:

      virtual ~dynlib_rep (void)
      {
        instances.erase (file);
      }

      virtual bool is_open (void) const
      { return false; }

      virtual void *search (const std::string&, name_mangler = 0)
      { return 0; }

      bool is_out_of_date (void) const;

      // This method will be overridden conditionally.
      static dynlib_rep *new_instance (const std::string& f);

      static dynlib_rep *get_instance (const std::string& f, bool fake);

      octave::sys::time time_loaded (void) const
      { return tm_loaded; }

      std::string file_name (void) const
      { return file; }

      size_t num_fcn_names (void) const { return fcn_names.size (); }

      void add_fcn_name (const std::string&);

      bool remove_fcn_name (const std::string&);

      void do_close_hook (close_hook cl_hook);

    public:

      octave_refcount<int> count;

    protected:

      void fake_reload (void);

      std::string file;
      octave::sys::time tm_loaded;

      // Set of hooked function names.
      typedef std::map<std::string, size_t>::iterator fcn_names_iterator;
      typedef std::map<std::string, size_t>::const_iterator fcn_names_const_iterator;

      std::map<std::string, size_t> fcn_names;

      static std::map<std::string, dynlib_rep *> instances;
    };

  private:

    static dynlib_rep nil_rep;

  public:

    dynamic_library (void) : rep (&nil_rep) { rep->count++; }

    dynamic_library (const std::string& f, bool fake = true)
      : rep (dynlib_rep::get_instance (f, fake)) { }

    ~dynamic_library (void)
    {
      if (--rep->count == 0)
        delete rep;
    }

    dynamic_library (const dynamic_library& sl)
      : rep (sl.rep)
    {
      rep->count++;
    }

    dynamic_library& operator = (const dynamic_library& sl)
    {
      if (rep != sl.rep)
        {
          if (--rep->count == 0)
            delete rep;

          rep = sl.rep;
          rep->count++;
        }

      return *this;
    }

    bool operator == (const dynamic_library& sl) const
    { return (rep == sl.rep); }

    operator bool () const { return rep->is_open (); }

    void open (const std::string& f)
    { *this = dynamic_library (f); }

    void close (close_hook cl_hook = 0)
    {
      if (cl_hook)
        rep->do_close_hook (cl_hook);

      *this = dynamic_library ();
    }

    void *search (const std::string& nm, name_mangler mangler = 0) const
    {
      void *f = rep->search (nm, mangler);
      if (f)
        rep->add_fcn_name (nm);

      return f;
    }

    void add (const std::string& name)
    { rep->add_fcn_name (name); }

    bool remove (const std::string& name)
    { return rep->remove_fcn_name (name); }

    size_t number_of_functions_loaded (void) const
    { return rep->num_fcn_names (); }

    bool is_out_of_date (void) const
    { return rep->is_out_of_date (); }

    std::string file_name (void) const
    { return rep->file_name (); }

    octave::sys::time time_loaded (void) const
    { return rep->time_loaded (); }

  private:

    dynlib_rep *rep;
  };
}

#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)

OCTAVE_DEPRECATED ("use 'octave::dynamic_library' instead")
typedef octave::dynamic_library octave_shlib;

#endif

#endif