Mercurial > octave
annotate liboctave/util/oct-shlib.h @ 17822:ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
* libgui/src/dialog.h, libgui/src/find-files-dialog.h,
libgui/src/find-files-model.h, libgui/src/m-editor/file-editor-tab.h,
libgui/src/m-editor/octave-qscintilla.h, libgui/src/main-window.h,
libgui/src/octave-dock-widget.h, libgui/src/workspace-model.h,
libgui/src/workspace-view.h, libinterp/corefcn/Cell.h,
libinterp/corefcn/gl-render.h, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.in.h, libinterp/corefcn/oct-errno.h,
libinterp/corefcn/oct-fstrm.h, libinterp/corefcn/oct-handle.h,
libinterp/corefcn/oct-hdf5.h, libinterp/corefcn/oct-hist.h,
libinterp/corefcn/oct-iostrm.h, libinterp/corefcn/oct-lvalue.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-procbuf.h,
libinterp/corefcn/oct-stdstrm.h, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/oct-strstrm.h, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pt-jit.h, libinterp/octave-value/ov-base-diag.h,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.h,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.h,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.h,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.h,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.h, libinterp/octave-value/ov-cs-list.h,
libinterp/octave-value/ov-cx-diag.h, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.h, libinterp/octave-value/ov-dld-fcn.h,
libinterp/octave-value/ov-fcn-handle.h, libinterp/octave-value/ov-fcn-inline.h,
libinterp/octave-value/ov-fcn.h, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int-traits.h,
libinterp/octave-value/ov-int16.h, libinterp/octave-value/ov-int32.h,
libinterp/octave-value/ov-int64.h, libinterp/octave-value/ov-int8.h,
libinterp/octave-value/ov-java.h, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.h, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.h,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.h,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.h,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.h,
libinterp/octave-value/ov-typeinfo.h, libinterp/octave-value/ov-uint16.h,
libinterp/octave-value/ov-uint32.h, libinterp/octave-value/ov-uint64.h,
libinterp/octave-value/ov-uint8.h, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.h, libinterp/parse-tree/pt-all.h,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-array-list.h,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.h,
libinterp/parse-tree/pt-bp.h, libinterp/parse-tree/pt-cbinop.h,
libinterp/parse-tree/pt-cell.h, libinterp/parse-tree/pt-check.h,
libinterp/parse-tree/pt-cmd.h, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.h, libinterp/parse-tree/pt-decl.h,
libinterp/parse-tree/pt-eval.h, libinterp/parse-tree/pt-except.h,
libinterp/parse-tree/pt-exp.h, libinterp/parse-tree/pt-fcn-handle.h,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.h,
libinterp/parse-tree/pt-jump.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.h, libinterp/parse-tree/pt-misc.h,
libinterp/parse-tree/pt-pr-code.h, libinterp/parse-tree/pt-select.h,
libinterp/parse-tree/pt-stmt.h, libinterp/parse-tree/pt-unop.h,
libinterp/parse-tree/pt-walk.h, libinterp/parse-tree/pt.h,
liboctave/array/CColVector.h, liboctave/array/CDiagMatrix.h,
liboctave/array/CMatrix.h, liboctave/array/CNDArray.h,
liboctave/array/CRowVector.h, liboctave/array/boolMatrix.h,
liboctave/array/chMatrix.h, liboctave/array/chNDArray.h,
liboctave/array/dColVector.h, liboctave/array/dDiagMatrix.h,
liboctave/array/dMatrix.h, liboctave/array/dNDArray.h,
liboctave/array/dRowVector.h, liboctave/array/fCColVector.h,
liboctave/array/fCDiagMatrix.h, liboctave/array/fCMatrix.h,
liboctave/array/fCNDArray.h, liboctave/array/fCRowVector.h,
liboctave/array/fColVector.h, liboctave/array/fDiagMatrix.h,
liboctave/array/fMatrix.h, liboctave/array/fNDArray.h,
liboctave/array/fRowVector.h, liboctave/cruft/misc/lo-error.h,
liboctave/numeric/CmplxAEPBAL.h, liboctave/numeric/CmplxCHOL.h,
liboctave/numeric/CmplxGEPBAL.h, liboctave/numeric/CmplxHESS.h,
liboctave/numeric/CmplxLU.h, liboctave/numeric/CmplxQR.h,
liboctave/numeric/CmplxQRP.h, liboctave/numeric/CmplxSCHUR.h,
liboctave/numeric/CmplxSVD.h, liboctave/numeric/Quad.h,
liboctave/numeric/SparseCmplxCHOL.h, liboctave/numeric/SparseCmplxLU.h,
liboctave/numeric/SparseCmplxQR.h, liboctave/numeric/SparseQR.h,
liboctave/numeric/SparsedbleCHOL.h, liboctave/numeric/SparsedbleLU.h,
liboctave/numeric/bsxfun.h, liboctave/numeric/dbleAEPBAL.h,
liboctave/numeric/dbleCHOL.h, liboctave/numeric/dbleGEPBAL.h,
liboctave/numeric/dbleHESS.h, liboctave/numeric/dbleLU.h,
liboctave/numeric/dbleQR.h, liboctave/numeric/dbleQRP.h,
liboctave/numeric/dbleSCHUR.h, liboctave/numeric/dbleSVD.h,
liboctave/numeric/fCmplxAEPBAL.h, liboctave/numeric/fCmplxCHOL.h,
liboctave/numeric/fCmplxGEPBAL.h, liboctave/numeric/fCmplxHESS.h,
liboctave/numeric/fCmplxLU.h, liboctave/numeric/fCmplxQR.h,
liboctave/numeric/fCmplxQRP.h, liboctave/numeric/fCmplxSCHUR.h,
liboctave/numeric/fCmplxSVD.h, liboctave/numeric/fEIG.h,
liboctave/numeric/floatAEPBAL.h, liboctave/numeric/floatCHOL.h,
liboctave/numeric/floatGEPBAL.h, liboctave/numeric/floatHESS.h,
liboctave/numeric/floatLU.h, liboctave/numeric/floatQR.h,
liboctave/numeric/floatQRP.h, liboctave/numeric/floatSCHUR.h,
liboctave/numeric/floatSVD.h, liboctave/numeric/lo-mappers.h,
liboctave/numeric/lo-specfun.h, liboctave/numeric/oct-convn.h,
liboctave/numeric/oct-norm.h, liboctave/numeric/oct-rand.h,
liboctave/operators/Sparse-diag-op-defs.h,
liboctave/operators/Sparse-op-defs.h,
liboctave/operators/Sparse-perm-op-defs.h, liboctave/system/lo-sysdep.h,
liboctave/system/oct-env.h, liboctave/system/oct-group.h,
liboctave/system/oct-openmp.h, liboctave/system/oct-passwd.h,
liboctave/system/oct-syscalls.h, liboctave/system/oct-time.h,
liboctave/system/oct-uname.h, liboctave/util/lo-array-gripes.h,
liboctave/util/lo-cutils.h, liboctave/util/lo-ieee.h,
liboctave/util/lo-macros.h, liboctave/util/lo-math.h,
liboctave/util/lo-regexp.h, liboctave/util/lo-traits.h,
liboctave/util/lo-utils.h, liboctave/util/oct-base64.h,
liboctave/util/oct-binmap.h, liboctave/util/oct-glob.h,
liboctave/util/oct-inttypes.h, liboctave/util/oct-locbuf.h,
liboctave/util/oct-mem.h, liboctave/util/oct-mutex.h,
liboctave/util/oct-refcount.h, liboctave/util/oct-rl-edit.h,
liboctave/util/oct-rl-hist.h, liboctave/util/oct-shlib.h,
liboctave/util/oct-sort.h, liboctave/util/oct-sparse.h:
Use common #define syntax "octave_filename_h" in h_files.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 31 Oct 2013 22:19:07 -0700 |
parents | 49a5a4be04a1 |
children | 4197fc428c7d |
rev | line source |
---|---|
3326 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
3 Copyright (C) 1999-2013 John W. Eaton |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
4 Copyright (C) 2009 VZLU Prague |
3326 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3326 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3326 | 21 |
22 */ | |
23 | |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
24 #if !defined (octave_oct_shlib_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
25 #define octave_oct_shlib_h 1 |
3326 | 26 |
27 #include <string> | |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
28 #include <map> |
3326 | 29 |
4848 | 30 #include "oct-time.h" |
12125
a21a3875ca83
implement a common class for reference counts
Jaroslav Hajek <highegg@gmail.com>
parents:
11586
diff
changeset
|
31 #include "oct-refcount.h" |
3326 | 32 |
33 class | |
6108 | 34 OCTAVE_API |
3326 | 35 octave_shlib |
36 { | |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
37 public: // FIXME: make this class private? |
3326 | 38 |
3504 | 39 typedef std::string (*name_mangler) (const std::string&); |
40 typedef void (*close_hook) (const std::string&); | |
3326 | 41 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
42 class shlib_rep |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
43 { |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
44 public: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
45 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
46 shlib_rep (void) |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
47 : count (1), file (), tm_loaded (time_t ()), fcn_names () { } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
48 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
49 protected: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
50 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
51 shlib_rep (const std::string& f); |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
52 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
53 public: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
54 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
55 virtual ~shlib_rep (void) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 instances.erase (file); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 } |
3326 | 59 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
60 virtual bool is_open (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 { return false; } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
62 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
63 virtual void *search (const std::string&, name_mangler = 0) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 { return 0; } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
65 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
66 bool is_out_of_date (void) const; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
67 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
68 // This method will be overriden conditionally. |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
69 static shlib_rep *new_instance (const std::string& f); |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
70 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
71 static shlib_rep *get_instance (const std::string& f, bool fake); |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
72 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
73 octave_time time_loaded (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 { return tm_loaded; } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
75 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
76 std::string file_name (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 { return file; } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
78 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
79 size_t num_fcn_names (void) const { return fcn_names.size (); } |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
80 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
81 void add_fcn_name (const std::string&); |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
82 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
83 bool remove_fcn_name (const std::string&); |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
84 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
85 void do_close_hook (close_hook cl_hook); |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
86 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
87 public: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
88 |
12125
a21a3875ca83
implement a common class for reference counts
Jaroslav Hajek <highegg@gmail.com>
parents:
11586
diff
changeset
|
89 octave_refcount<int> count; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
90 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
91 protected: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
92 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
93 void fake_reload (void); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
94 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
95 std::string file; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
96 octave_time tm_loaded; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
97 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
98 // Set of hooked function names. |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
99 typedef std::map<std::string, size_t>::iterator fcn_names_iterator; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
100 typedef std::map<std::string, size_t>::const_iterator fcn_names_const_iterator; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
101 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
102 std::map<std::string, size_t> fcn_names; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
103 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
104 static std::map<std::string, shlib_rep *> instances; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
105 }; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
106 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
107 private: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
108 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
109 static shlib_rep nil_rep; |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
110 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
111 public: |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
112 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
113 octave_shlib (void) : rep (&nil_rep) { rep->count++; } |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
114 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
115 octave_shlib (const std::string& f, bool fake = true) |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
116 : rep (shlib_rep::get_instance (f, fake)) { } |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
117 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
118 ~octave_shlib (void) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
119 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 if (--rep->count == 0) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
121 delete rep; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 } |
3326 | 123 |
124 octave_shlib (const octave_shlib& sl) | |
11501
331fcc41ca23
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
125 : rep (sl.rep) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 rep->count++; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 } |
3326 | 129 |
130 octave_shlib& operator = (const octave_shlib& sl) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
132 if (rep != sl.rep) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 if (--rep->count == 0) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 delete rep; |
3326 | 136 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 rep = sl.rep; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
138 rep->count++; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 } |
3326 | 140 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
141 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
142 } |
3326 | 143 |
144 bool operator == (const octave_shlib& sl) const | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
145 { return (rep == sl.rep); } |
3326 | 146 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
147 operator bool () const { return rep->is_open (); } |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
148 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
149 void open (const std::string& f) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
150 { *this = octave_shlib (f); } |
3326 | 151 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
152 void close (close_hook cl_hook = 0) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
153 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
154 if (cl_hook) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
155 rep->do_close_hook (cl_hook); |
7749
14e05160b99f
reference counting for functions loaded from shared libraries
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
156 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
157 *this = octave_shlib (); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
158 } |
3326 | 159 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
160 void *search (const std::string& nm, name_mangler mangler = 0) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
161 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
162 void *f = rep->search (nm, mangler); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
163 if (f) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
164 rep->add_fcn_name (nm); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
165 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
166 return f; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 } |
3326 | 168 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
169 void add (const std::string& name) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 { rep->add_fcn_name (name); } |
3326 | 171 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
172 bool remove (const std::string& name) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
173 { return rep->remove_fcn_name (name); } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
174 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
175 size_t number_of_functions_loaded (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
176 { return rep->num_fcn_names (); } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
177 |
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
178 bool is_out_of_date (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
179 { return rep->is_out_of_date (); } |
3326 | 180 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
181 std::string file_name (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 { return rep->file_name (); } |
3326 | 183 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
184 octave_time time_loaded (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 { return rep->time_loaded (); } |
3326 | 186 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
187 private: |
3326 | 188 |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
189 shlib_rep *rep; |
3326 | 190 }; |
191 | |
192 #endif |