changeset 15402:4d0ed64a6d19

provide load_workspace and save_workspace functions * load-save.h, load-save.cc (load_workspace, save_workspace): New functions.
author John W. Eaton <jwe@octave.org>
date Mon, 17 Sep 2012 22:38:53 -0400
parents 2b8d9eac2c2e
children 7f423c6111c6
files libinterp/interpfcn/load-save.cc libinterp/interpfcn/load-save.h
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/load-save.cc
+++ b/libinterp/interpfcn/load-save.cc
@@ -1443,6 +1443,16 @@
     }
 }
 
+void
+load_workspace (const std::string& file)
+{
+  octave_value_list args;
+
+  if (! file.empty ())
+    args(0) = file;
+
+  Fload (args);
+}
 
 DEFUN (save, args, ,
   "-*- texinfo -*-\n\
@@ -1745,6 +1755,17 @@
   return retval;
 }
 
+void
+save_workspace (const std::string& file)
+{
+  octave_value_list args;
+
+  if (! file.empty ())
+    args(0) = file;
+
+  Fsave (args);
+}
+
 DEFUN (crash_dumps_octave_core, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {@var{val} =} crash_dumps_octave_core ()\n\
--- a/libinterp/interpfcn/load-save.h
+++ b/libinterp/interpfcn/load-save.h
@@ -87,4 +87,7 @@
 extern void
 write_header (std::ostream& os, load_save_format format);
 
+extern OCTINTERP_API void load_workspace (const std::string& file);
+extern OCTINTERP_API void save_workspace (const std::string& file);
+
 #endif