Mercurial > hg > octave-lyh
changeset 4356:b6ad3db48255
[project @ 2003-02-22 02:57:33 by jwe]
author | jwe |
---|---|
date | Sat, 22 Feb 2003 02:57:33 +0000 |
parents | 6fa0c2306ef6 |
children | d700cfed902a |
files | src/ChangeLog src/octave.cc src/ov.h src/toplev.cc src/toplev.h |
diffstat | 5 files changed, 43 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2003-02-21 John W. Eaton <jwe@bevo.che.wisc.edu> + + * octave.cc (fun_to_call): New static variable. + (octave_main): Pass it to main_loop. + (long_opts): Accept --funcall. + (usage_string, verbose_usage): Add --funcall. + + * toplev.cc (main_loop): New arg, fun_to_call. If non-empty, + evaluate this function before continuing. + 2003-02-21 Paul Kienzle <pkienzle@users.sf.net> * file-io.cc (Fmkstemp): Use OCTAVE_LOCAL_BUFFER instead of using
--- a/src/octave.cc +++ b/src/octave.cc @@ -110,31 +110,37 @@ // Usage message static const char *usage_string = "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--exec-path path]\n\ - [--help] [--info-file file] [--info-program prog] [--interactive]\n\ - [--no-history] [--no-init-file] [--no-line-editing] [--no-site-file]\n\ - [-p path] [--path path] [--silent] [--traditional] [--verbose]\n\ - [--version] [file]"; + [--funcall FUNC] [--help] [--info-file file] [--info-program prog]\n\ + [--interactive] [--no-history] [--no-init-file] [--no-line-editing]\n\ + [--no-site-file] [-p path] [--path path] [--silent] [--traditional]\n\ + [--verbose] [--version] [file]"; // This is here so that it's more likely that the usage message and // the real set of options will agree. Note: the `+' must come first // to prevent getopt from permuting arguments! static const char *short_opts = "+?HVdfhip:qvx"; +// The name of the optional initial function to call at startup. +// (--funcall FUNC) +static std::string fun_to_call; + // Long options. See the comments in getopt.h for the meanings of the // fields in this structure. #define EXEC_PATH_OPTION 1 -#define INFO_FILE_OPTION 2 -#define INFO_PROG_OPTION 3 -#define NO_INIT_FILE_OPTION 4 -#define NO_LINE_EDITING_OPTION 5 -#define NO_SITE_FILE_OPTION 6 -#define TRADITIONAL_OPTION 7 +#define FUNCALL_OPTION 2 +#define INFO_FILE_OPTION 3 +#define INFO_PROG_OPTION 4 +#define NO_INIT_FILE_OPTION 5 +#define NO_LINE_EDITING_OPTION 6 +#define NO_SITE_FILE_OPTION 7 +#define TRADITIONAL_OPTION 8 long_options long_opts[] = { { "debug", prog_args::no_arg, 0, 'd' }, { "braindead", prog_args::no_arg, 0, TRADITIONAL_OPTION }, { "echo-commands", prog_args::no_arg, 0, 'x' }, { "exec-path", prog_args::required_arg, 0, EXEC_PATH_OPTION }, + { "funcall", prog_args::required_arg, 0, FUNCALL_OPTION }, { "help", prog_args::no_arg, 0, 'h' }, { "info-file", prog_args::required_arg, 0, INFO_FILE_OPTION }, { "info-program", prog_args::required_arg, 0, INFO_PROG_OPTION }, @@ -284,6 +290,7 @@ --debug, -d Enter parser debugging mode.\n\ --echo-commands, -x Echo commands as they are executed.\n\ --exec-path PATH Set path for executing subprograms.\n\ + --funcall FUNC Call Octave function FUNC with no arguments.\n\ --help, -h, -? Print short help message and exit.\n\ --info-file FILE Use top-level info file FILE.\n\ --info-program PROGRAM Use PROGRAM for reading info files.\n\ @@ -303,8 +310,10 @@ \n\ Additional information about Octave is available via the WWW at\n\ http://www.octave.org.\n\ -\n\ -Please report bugs to the bug-octave@bevo.che.wisc.edu mailing list.\n"; +\n" +OCTAVE_CONTRIB_STATEMENT "\n\ +\n" +OCTAVE_BUGS_STATEMENT "\n"; exit (0); } @@ -461,6 +470,11 @@ bind_builtin_variable ("EXEC_PATH", args.optarg ()); break; + case FUNCALL_OPTION: + if (args.optarg ()) + fun_to_call = args.optarg (); + break; + case INFO_FILE_OPTION: if (args.optarg ()) bind_builtin_variable ("INFO_FILE", args.optarg ()); @@ -595,7 +609,7 @@ if (! interactive) line_editing = false; - int retval = main_loop (); + int retval = main_loop (fun_to_call); if (retval == 1 && ! error_state) retval = 0;
--- a/src/ov.h +++ b/src/ov.h @@ -175,7 +175,7 @@ #if defined (HAVE_LONG_LONG_INT) octave_value (long long int i); #endif -#if defined (HAVE_UNSIGNEDLONG_LONG_INT) +#if defined (HAVE_UNSIGNED_LONG_LONG_INT) octave_value (unsigned long long int i); #endif