Mercurial > hg > octave-nkf
changeset 3329:e84e324db1de
[project @ 1999-11-01 21:58:57 by jwe]
author | jwe |
---|---|
date | Mon, 01 Nov 1999 21:58:57 +0000 |
parents | c447b7fa53e8 |
children | 69136e3883bf |
files | src/ov-dld-fcn.cc src/ov-dld-fcn.h |
diffstat | 2 files changed, 179 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/src/ov-dld-fcn.cc @@ -0,0 +1,81 @@ +/* + +Copyright (C) 1996, 1997 John W. Eaton + +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 2, 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, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if defined (__GNUG__) +#pragma implementation +#endif + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "oct-shlib.h" + +#include <defaults.h> +#include "dynamic-ld.h" +#include "error.h" +#include "oct-obj.h" +#include "ov-dld-fcn.h" +#include "ov.h" + +DEFINE_OCTAVE_ALLOCATOR (octave_dld_function); + +DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_dld_function, + "dynamically-linked function"); + + +octave_dld_function::octave_dld_function + (octave_builtin::fcn ff, const octave_shlib& shl, + const string& nm, const string& ds) + : octave_builtin (ff, nm, ds), sh_lib (shl) +{ + mark_fcn_file_up_to_date (time_parsed ()); + + string file_name = fcn_file_name (); + + system_fcn_file + = (! file_name.empty () + && Vfcn_file_dir.compare (file_name, 0, Vfcn_file_dir.length ()) == 0); +} + +octave_dld_function::~octave_dld_function (void) +{ + octave_dynamic_loader::remove (my_name, sh_lib); +} + +string +octave_dld_function::fcn_file_name (void) const +{ + return sh_lib.file_name (); +} + +octave_time +octave_dld_function::time_parsed (void) const +{ + return sh_lib.time_loaded (); +} + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/
new file mode 100644 --- /dev/null +++ b/src/ov-dld-fcn.h @@ -0,0 +1,98 @@ +/* + +Copyright (C) 1996, 1997 John W. Eaton + +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 2, 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, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_dld_function_h) +#define octave_dld_function_h 1 + +#if defined (__GNUG__) +#pragma interface +#endif + +#include <string> + +#include "oct-shlib.h" + +#include "ov-fcn.h" +#include "ov-builtin.h" +#include "ov-typeinfo.h" + +class octave_shlib; + +class octave_value; +class octave_value_list; + +// Dynamically-linked functions. + +class +octave_dld_function : public octave_builtin +{ +public: + + octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl, + const string& nm = string (), + const string& ds = string ()); + + ~octave_dld_function (void); + + void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } + + string fcn_file_name (void) const; + + octave_time time_parsed (void) const; + + octave_time time_checked (void) const { return t_checked; } + + bool is_system_fcn_file (void) const { return system_fcn_file; } + + bool is_builtin_function (void) const { return false; } + + bool is_dld_function (void) const { return true; } + +private: + + octave_dld_function (void); + + octave_dld_function (const octave_dld_function& m); + + octave_shlib sh_lib; + + // The time the file was last checked to see if it needs to be + // parsed again. + mutable octave_time t_checked; + + // True if this function came from a file that is considered to be a + // system function. This affects whether we check the time stamp + // on the file to see if it has changed. + bool system_fcn_file; + + DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA + + DECLARE_OCTAVE_ALLOCATOR +}; + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/