Mercurial > hg > octave-lyh
diff src/octave.cc @ 1604:583476712438
[project @ 1995-11-02 10:30:06 by jwe]
author | jwe |
---|---|
date | Thu, 02 Nov 1995 10:32:51 +0000 |
parents | 27f5ac98fc4a |
children | 65572455466f |
line wrap: on
line diff
--- a/src/octave.cc +++ b/src/octave.cc @@ -352,7 +352,7 @@ } void -parse_and_execute (char *s, int print, int verbose) +parse_and_execute (const char *s, int print, int verbose) { begin_unwind_frame ("parse_and_execute_2"); @@ -387,6 +387,28 @@ run_unwind_frame ("parse_and_execute_2"); } +DEFUN ("source", Fsource, Ssource, 10, + "source (FILE)\n\ +\n\ +Parse and execute the contents of FILE. Like executing commands in a\n\ +script file but without requiring the file to be named `FILE.m'.") +{ + Octave_object retval; + + int nargin = args.length (); + + if (nargin == 1) + { + const char *file = args(0).string_value (); + + parse_and_execute (file, 1); + } + else + print_usage ("source"); + + return retval; +} + // Initialize by reading startup files. static void