# HG changeset patch # User John W. Eaton # Date 1645154351 18000 # Node ID e00154c0a71b246995d180d20a3409304d4d65d4 # Parent 311a8fb8b1274477eaf72a861d5198cc9c520038 move auto_shlib class to separate source file * auto-shlib.h, auto-shlib.cc: New files with class definition extracted from defun-int.h. * libinterp/corefcn/module.mk: Update. diff -r 311a8fb8b127 -r e00154c0a71b libinterp/corefcn/auto-shlib.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libinterp/corefcn/auto-shlib.cc Thu Feb 17 22:19:11 2022 -0500 @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// 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 +// . +// +//////////////////////////////////////////////////////////////////////// + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include "octave-config.h" + +#include "auto-shlib.h" +#include "defun-int.h" + +OCTAVE_NAMESPACE_BEGIN + +auto_shlib::auto_shlib (void) + : dynamic_library (get_current_shlib ()) +{ } + +OCTAVE_NAMESPACE_END diff -r 311a8fb8b127 -r e00154c0a71b libinterp/corefcn/auto-shlib.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libinterp/corefcn/auto-shlib.h Thu Feb 17 22:19:11 2022 -0500 @@ -0,0 +1,57 @@ +//////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 The Octave Project Developers +// +// See the file COPYRIGHT.md in the top-level directory of this +// distribution or . +// +// 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 +// . +// +//////////////////////////////////////////////////////////////////////// + +#if ! defined (octave_auto_shlib_h) +#define octave_auto_shlib_h 1 + +#include "octave-config.h" + +#include "oct-shlib.h" + +OCTAVE_NAMESPACE_BEGIN + +// This is a convenience class that calls the +// octave::get_dynamic_library function automatically at construction +// time. When deriving new classes, you can either use it as a field or +// as a parent (with multiple inheritance). + +class +OCTINTERP_API +auto_shlib : public dynamic_library +{ +public: + + auto_shlib (void); + + ~auto_shlib (void) = default; + + auto_shlib (const auto_shlib&) = default; + + auto_shlib& operator = (const auto_shlib&) = default; +}; + +OCTAVE_NAMESPACE_END + +#endif diff -r 311a8fb8b127 -r e00154c0a71b libinterp/corefcn/defun-int.h --- a/libinterp/corefcn/defun-int.h Thu Feb 17 19:22:50 2022 -0500 +++ b/libinterp/corefcn/defun-int.h Thu Feb 17 22:19:11 2022 -0500 @@ -64,22 +64,6 @@ // Gets the shlib of the currently executing DLD function, if any. extern OCTINTERP_API dynamic_library get_current_shlib (void); -// FIXME: this class doesn't seem to be used in Octave. Is it -// really needed? - -// This is a convenience class that calls the above function automatically at -// construction time. When deriving new classes, you can either use it as a -// field or as a parent (with multiple inheritance). - -class auto_shlib : public dynamic_library -{ -public: - - auto_shlib (void) : dynamic_library (get_current_shlib ()) { } - - auto_shlib (const dynamic_library& shl) : dynamic_library (shl) { } -}; - OCTAVE_NAMESPACE_END // Some of these functions are widely used, so maybe we should avoid diff -r 311a8fb8b127 -r e00154c0a71b libinterp/corefcn/module.mk --- a/libinterp/corefcn/module.mk Thu Feb 17 19:22:50 2022 -0500 +++ b/libinterp/corefcn/module.mk Thu Feb 17 22:19:11 2022 -0500 @@ -17,6 +17,7 @@ DIRSTAMP_FILES += %reldir%/$(octave_dirstamp) COREFCN_INC = \ + %reldir%/auto-shlib.h \ %reldir%/base-text-renderer.h \ %reldir%/Cell.h \ %reldir%/c-file-ptr-stream.h \ @@ -125,6 +126,7 @@ %reldir%/__pchip_deriv__.cc \ %reldir%/__qp__.cc \ %reldir%/amd.cc \ + %reldir%/auto-shlib.cc \ %reldir%/balance.cc \ %reldir%/base-text-renderer.cc \ %reldir%/besselj.cc \