# HG changeset patch # User jwe # Date 760605703 0 # Node ID 82d30a23c979e16061963f1393cee6ee036a3d6d # Parent 3e74ab6e24ba7b0baa3e67911d38922767e3ee02 [project @ 1994-02-07 07:09:33 by jwe] diff --git a/src/builtins.cc b/src/builtins.cc --- a/src/builtins.cc +++ b/src/builtins.cc @@ -424,7 +424,7 @@ "isstr (X): return 1 if X is a string", }, { "keyboard", 2, 1, builtin_keyboard, - "keyboard (\"prompt\"): maybe help in debugging M-files", }, + "keyboard (\"prompt\"): maybe help in debugging function files", }, { "logm", 2, 1, builtin_logm, "logm (x): matrix logarithm", }, @@ -702,8 +702,8 @@ "sqrt (-1)", }, { "ignore_function_time_stamp", "system", ignore_function_time_stamp, - "don't check to see if M-files have changed since they were last\n\ -compiled. Possible values are \"system\" and \"all\"", }, + "don't check to see if function files have changed since they were\n\ +last compiled. Possible values are \"system\" and \"all\"", }, { "implicit_str_to_num_ok", "false", implicit_str_to_num_ok, "allow implicit string to number conversion", }, diff --git a/src/input.cc b/src/input.cc --- a/src/input.cc +++ b/src/input.cc @@ -93,11 +93,11 @@ // Nonzero means get input from current_eval_string. int get_input_from_eval_string = 0; -// Nonzero means we're parsing an M-file. -int reading_m_file = 0; +// Nonzero means we're parsing a function file. +int reading_fcn_file = 0; -// Simple name of M-file we are reading. -char *curr_m_file_name = (char *) NULL; +// Simple name of function file we are reading. +char *curr_fcn_file_name = (char *) NULL; // Nonzero means we're parsing a script file. int reading_script_file = 0; @@ -223,7 +223,7 @@ else { FILE *curr_stream = rl_instream; - if (reading_m_file || reading_script_file) + if (reading_fcn_file || reading_script_file) curr_stream = mf_instream; assert (curr_stream != (FILE *) NULL); @@ -282,7 +282,7 @@ if (instream == (FILE *) NULL && warn) warning ("%s: no such file or directory", name); - if (reading_m_file || reading_script_file) + if (reading_fcn_file || reading_script_file) mf_instream = instream; else rl_instream = instream; diff --git a/src/input.h b/src/input.h --- a/src/input.h +++ b/src/input.h @@ -39,11 +39,11 @@ // Nonzero means get input from current_eval_string. extern int get_input_from_eval_string; -// Nonzero means we're parsing an M-file. -extern int reading_m_file; +// Nonzero means we're parsing a function file. +extern int reading_fcn_file; // Simple name of M-file we are reading. -extern char *curr_m_file_name; +extern char *curr_fcn_file_name; // Nonzero means we're parsing a script file. extern int reading_script_file; diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -691,7 +691,7 @@ // Only ask for input from stdin if we are expecting interactive // input. - if (interactive && ! (reading_m_file || get_input_from_eval_string)) + if (interactive && ! (reading_fcn_file || get_input_from_eval_string)) yyrestart (stdin); } @@ -1020,11 +1020,11 @@ { error ("function keyword invalid within a function body"); - if ((reading_m_file || reading_script_file) - && curr_m_file_name != (char *) NULL) + if ((reading_fcn_file || reading_script_file) + && curr_fcn_file_name != (char *) NULL) error ("defining new function near line %d of file `%s'", input_line_number, - curr_m_file_name); + curr_fcn_file_name); else error ("defining new function near line %d", input_line_number); @@ -1103,7 +1103,7 @@ } /* - * Grab the help text from an M-file. + * Grab the help text from an function file. */ static void grab_help_text (void) @@ -1462,9 +1462,9 @@ } /* - * Print a warning if an M-file that defines a function has anything - * other than comments and whitespace following the END token that - * matches the FUNCTION statement. + * Print a warning if a function file that defines a function has + * anything other than comments and whitespace following the END token + * that matches the FUNCTION statement. */ void check_for_garbage_after_fcn_def (void) @@ -1499,7 +1499,7 @@ else { warning ("ignoring trailing garbage after end of function\n\ - near line %d of file `%s.m'", lineno, curr_m_file_name); + near line %d of file `%s.m'", lineno, curr_fcn_file_name); yyunput ('\n', yytext); return; diff --git a/src/parse.h b/src/parse.h --- a/src/parse.h +++ b/src/parse.h @@ -1,7 +1,7 @@ // parse.h -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -75,7 +75,7 @@ #define HELP_BUF_LENGTH 8192 -// Buffer for help text snagged from M-files. +// Buffer for help text snagged from function files. extern char help_buf [HELP_BUF_LENGTH]; // Nonzero means we're working on a plot command. diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -84,7 +84,7 @@ // The column of the current token. int current_input_column = 1; -// Buffer for help text snagged from M-files. +// Buffer for help text snagged from function files. // Probably shouldn't be a fixed size... char help_buf [HELP_BUF_LENGTH]; @@ -902,28 +902,28 @@ // file does not match the name of the function stated in the file. // Matlab doesn't provide a diagnostic (it ignores the stated name). - if (reading_m_file) + if (reading_fcn_file) { - if (strcmp (curr_m_file_name, id_name) != 0) + if (strcmp (curr_fcn_file_name, id_name) != 0) { warning ("function name `%s' does not agree\ - with M-file name `%s.m'", id_name, curr_m_file_name); + with function file name `%s'", id_name, curr_fcn_file_name); - $1->rename (curr_m_file_name); + $1->rename (curr_fcn_file_name); id_name = $1->name (); } - $4->stash_m_file_name (curr_m_file_name); - $4->stash_m_file_time (time ((time_t *) NULL)); - $4->mark_as_system_m_file (); + $4->stash_fcn_file_name (curr_fcn_file_name); + $4->stash_fcn_file_time (time ((time_t *) NULL)); + $4->mark_as_system_fcn_file (); } else if (! (input_from_tmp_history_file || input_from_startup_file) && reading_script_file - && strcmp (curr_m_file_name, id_name) == 0) + && strcmp (curr_fcn_file_name, id_name) == 0) { warning ("function `%s' defined within\ - script file `%s.m'", id_name, curr_m_file_name); + script file `%s.m'", id_name, curr_fcn_file_name); } top_level_sym_tab->clear (id_name); @@ -951,12 +951,12 @@ if (check_end ($1, token::function_end)) ABORT_PARSE; - if (reading_m_file) + if (reading_fcn_file) check_for_garbage_after_fcn_def (); } | END_OF_INPUT { - if (! (reading_m_file || reading_script_file)) + if (! (reading_fcn_file || reading_script_file)) YYABORT; } ; @@ -1117,9 +1117,9 @@ fprintf (stderr, "\n%s", s); // Maybe print the line number and file name. - if (reading_m_file || reading_script_file) + if (reading_fcn_file || reading_script_file) fprintf (stderr, " near line %d of file %s.m", input_line_number, - curr_m_file_name); + curr_fcn_file_name); if (line != (char *) NULL) { diff --git a/src/pt-base.h b/src/pt-base.h --- a/src/pt-base.h +++ b/src/pt-base.h @@ -129,13 +129,13 @@ virtual void bump_value (tree::expression_type) { assert (0); } - virtual char *m_file_name (void) + virtual char *fcn_file_name (void) { return (char *) NULL; } virtual time_t time_parsed (void) { assert (0); return 0; } - virtual int is_system_m_file (void) const + virtual int is_system_fcn_file (void) const { return 0; } virtual tree_constant eval (int print) = 0; diff --git a/src/t-builtins.cc b/src/t-builtins.cc --- a/src/t-builtins.cc +++ b/src/t-builtins.cc @@ -404,8 +404,8 @@ while (*ptr != (char *) NULL) { int count; - char **names = get_m_file_names (count, *ptr, 0); - output_buf << "\n*** M-files in " + char **names = get_fcn_file_names (count, *ptr, 0); + output_buf << "\n*** function files in " << make_absolute (*ptr, the_current_working_directory) << ":\n\n"; if (names != (char **) NULL && count > 0) @@ -538,7 +538,7 @@ { ostrstream output_buf; - char *m_file_name = (char *) NULL; + char *fcn_file_name = (char *) NULL; symbol_record *sym_rec; help_list *op_help_list = operator_help (); help_list *kw_help_list = keyword_help (); @@ -581,18 +581,18 @@ } } -// Try harder to find M-files that might not be defined yet, or that -// appear to be out of date. Don\'t execute commands from the file if -// it turns out to be a script file. +// Try harder to find function files that might not be defined yet, or +// that appear to be out of date. Don\'t execute commands from the +// file if it turns out to be a script file. - m_file_name = m_file_in_path (*argv); - if (m_file_name != (char *) NULL) + fcn_file_name = fcn_file_in_path (*argv); + if (fcn_file_name != (char *) NULL) { sym_rec = global_sym_tab->lookup (*argv, 1, 0); if (sym_rec != (symbol_record *) NULL) { tree_identifier tmp (sym_rec); - tmp.parse_m_file (0); + tmp.parse_fcn_file (0); char *h = sym_rec->help (); if (h != (char *) NULL && *h != '\0') { @@ -602,7 +602,7 @@ } } } - delete [] m_file_name; + delete [] fcn_file_name; output_buf << "\nhelp: sorry, `" << *argv << "' is not documented\n"; diff --git a/src/tc-extras.cc b/src/tc-extras.cc --- a/src/tc-extras.cc +++ b/src/tc-extras.cc @@ -1243,7 +1243,7 @@ // Important to reset the idea of where input is coming from before // trying to eval the command we just parsed -- it might contain the -// name of an m-file that still needs to be parsed! +// name of an function file that still needs to be parsed! tree *command = global_command; diff --git a/src/tree.h.old b/src/tree.h.old --- a/src/tree.h.old +++ b/src/tree.h.old @@ -1,7 +1,7 @@ // Tree classes. -*- C++ -*- /* -Copyright (C) 1992, 1993 John W. Eaton +Copyright (C) 1992, 1993, 1994 John W. Eaton This file is part of Octave. @@ -193,9 +193,9 @@ void bump_value (tree::expression_type); - int parse_m_file (int exec_script = 1); - int parse_m_file (char *mf, int exec_script = 1); - void parse_m_file (FILE *mfile, char *mf); + int parse_fcn_file (int exec_script = 1); + int parse_fcn_file (char *mf, int exec_script = 1); + void parse_fcn_file (FILE *mfile, char *mf); tree *do_lookup (int& script_file_executed); @@ -235,14 +235,14 @@ tree_function *define_param_list (tree_parameter_list *t); tree_function *define_ret_list (tree_parameter_list *t); - void stash_m_file_name (char * s); - void stash_m_file_time (time_t t); + void stash_fcn_file_name (char * s); + void stash_fcn_file_time (time_t t); - char *m_file_name (void); + char *fcn_file_name (void); time_t time_parsed (void); - void mark_as_system_m_file (void); - int is_system_m_file (void) const; + void mark_as_system_fcn_file (void); + int is_system_fcn_file (void) const; int takes_varargs (void) const; void va_start (void); @@ -273,7 +273,7 @@ char *file_name; char *fcn_name; time_t t_parsed; - int system_m_file; + int system_fcn_file; int varargs_ok; int num_named_args; const tree_constant *args_passed; diff --git a/src/user-prefs.cc b/src/user-prefs.cc --- a/src/user-prefs.cc +++ b/src/user-prefs.cc @@ -237,8 +237,8 @@ } /* - * Should Octave always check to see if M-files have changed since - * they were last compiled? + * Should Octave always check to see if function files have changed + * since they were last compiled? */ int ignore_function_time_stamp (void) diff --git a/src/utils.cc b/src/utils.cc --- a/src/utils.cc +++ b/src/utils.cc @@ -592,13 +592,14 @@ } /* - * See if there is an M-file in the path. If so, return the full path - * to the file. + * See if there is an function file in the path. If so, return the + * full path to the file. */ char * -m_file_in_path (const char *name) +fcn_file_in_path (const char *name) { - return file_in_path (name, ".m"); + char *fcn_file = file_in_path (name, (char *) NULL); + return (fcn_file) ? fcn_file : file_in_path (name, ".m"); } /* @@ -1411,7 +1412,7 @@ } char ** -get_m_file_names (int& num, const char *dir, int no_suffix) +get_fcn_file_names (int& num, const char *dir, int no_suffix) { static int num_max = 256; char **retval = new char * [num_max]; @@ -1461,7 +1462,7 @@ } char ** -get_m_file_names (int& num, int no_suffix) +get_fcn_file_names (int& num, int no_suffix) { static int num_max = 1024; char **retval = new char * [num_max]; @@ -1475,7 +1476,7 @@ while (*ptr != (char *) NULL) { int tmp_num; - char **names = get_m_file_names (tmp_num, *ptr, no_suffix); + char **names = get_fcn_file_names (tmp_num, *ptr, no_suffix); if (i + tmp_num >= num_max - 1) { diff --git a/src/utils.h b/src/utils.h --- a/src/utils.h +++ b/src/utils.h @@ -53,7 +53,7 @@ extern char *get_site_defaults (void); extern char *default_pager (void); extern char *file_in_path (const char *, const char *); -extern char *m_file_in_path (const char *); +extern char *fcn_file_in_path (const char *); extern char *polite_directory_format (const char *); extern int absolute_pathname (const char *); extern int absolute_program (const char *); @@ -79,8 +79,8 @@ extern int keyword_almost_match (const char **std, int *min_len, const char *s, int min_toks_to_match, int max_toks); -extern char **get_m_file_names (int& mfl_len, const char *dir, int no_suffix); -extern char **get_m_file_names (int& mfl_len, int no_suffix); +extern char **get_fcn_file_names (int& mfl_len, const char *dir, int no_suffix); +extern char **get_fcn_file_names (int& mfl_len, int no_suffix); extern int NINT (double x); extern double D_NINT (double x); extern void delete_ppchar (char **); diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -66,8 +66,8 @@ } /* - * Is there a corresponding M-file that is newer than the symbol - * definition? + * Is there a corresponding function file that is newer than the + * symbol definition? */ int symbol_out_of_date (symbol_record *sr) @@ -82,12 +82,12 @@ tree *ans = sr->def (); if (ans != NULL_TREE) { - char *mf = ans->m_file_name (); + char *mf = ans->fcn_file_name (); if (! (mf == (char *) NULL - || (ignore && ans->is_system_m_file ()))) + || (ignore && ans->is_system_fcn_file ()))) { time_t tp = ans->time_parsed (); - char *fname = m_file_in_path (mf); + char *fname = fcn_file_in_path (mf); int status = is_newer (fname, tp); delete [] fname; if (status > 0) @@ -602,7 +602,7 @@ return 2; else { - char *path = m_file_in_path (name); + char *path = fcn_file_in_path (name); if (path != (char *) NULL) { delete [] path; @@ -650,12 +650,12 @@ { sr = global_sym_tab->lookup (fcn_name, 1, 0); tree_identifier tmp (sr); - tmp.parse_m_file (0); + tmp.parse_fcn_file (0); } else if (symbol_out_of_date (sr)) { tree_identifier tmp (sr); - tmp.parse_m_file (0); + tmp.parse_fcn_file (0); } ans = sr->def (); @@ -714,7 +714,7 @@ top = top_level_sym_tab->list (top_len); if (top_level_sym_tab != curr_sym_tab) lcl = curr_sym_tab->list (lcl_len); - mfl = get_m_file_names (mfl_len, 1); + mfl = get_fcn_file_names (mfl_len, 1); int total_len = key_len + glb_len + top_len + lcl_len + mfl_len;